From c773f4a84c455fd92ee9a69a163d10dce9eb289f Mon Sep 17 00:00:00 2001 From: Theo Buehler Date: Mon, 3 May 2021 18:21:01 +0000 Subject: Add scaffold to run the ruby/openssl regression tests This test depends on the ruby/ruby-openssl-tests port that bundles the sources and tests of the Ruby OpenSSL gem below /usr/local. The Makefile compiles the openssl.so shared object below obj/ that provides Ruby bindings for the OpenSSL API. Once this is built, the regression tests are run. There are currently 4 failing tests, all related to the new verifier. At least one libssl bug is hidden behind a pend. All this will hopefully be fixed during this release cycle. This adds a decent amount of test coverage without being overly expensive. This way, regressions should be spotted during development so jeremy will no longer have to chase and work around them. Joint work with jeremy, positive feedback from bcook and jsing. --- regress/lib/libssl/openssl-ruby/Makefile | 72 ++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 regress/lib/libssl/openssl-ruby/Makefile diff --git a/regress/lib/libssl/openssl-ruby/Makefile b/regress/lib/libssl/openssl-ruby/Makefile new file mode 100644 index 00000000000..7a897157d16 --- /dev/null +++ b/regress/lib/libssl/openssl-ruby/Makefile @@ -0,0 +1,72 @@ +# $OpenBSD: Makefile,v 1.1 2021/05/03 18:21:00 tb Exp $ + +OPENSSL_RUBY_TESTS = /usr/local/share/openssl-ruby-tests +RUBY_BINREV = 27 +RUBY = ruby${RUBY_BINREV} + +# We work in a subdirectory of obj/ since extconf.rb generates a Makefile whose +# name can't be customized in $PWD. An obj/Makefile in turn confuses either make +# or bsd.*.mk. This hurts when things are in an unexpected state after a signal. +BUILDDIR = build + +.if !exists(${OPENSSL_RUBY_TESTS}) +regress: + @echo package openssl-ruby-tests is required for this regress + @echo SKIPPED +.else + +REGRESS_TARGETS += openssl-ruby-test +REGRESS_EXPECTED_FAILURES += openssl-ruby-test + +openssl-ruby-test: retest + +_BUILDDIR_COOKIE = .builddir +_BUILD_COOKIE = .build +_TEST_COOKIE = .test + +${_BUILDDIR_COOKIE}: + mkdir -p ${BUILDDIR} + touch $@ + +${_BUILD_COOKIE}: ${_BUILDDIR_COOKIE} + cd ${BUILDDIR} && \ + ${RUBY} ${OPENSSL_RUBY_TESTS}/ext/openssl/extconf.rb && \ + make; + touch $@ + +OPENSSL_RUBY_TESTSRC = ${OPENSSL_RUBY_TESTS}/test/openssl/test_*.rb +${_TEST_COOKIE}: ${_BUILD_COOKIE} ${_BUILDDIR_COOKIE} + cd ${BUILDDIR} && \ + ${RUBY} -I. -I${OPENSSL_RUBY_TESTS}/test/openssl \ + -I${OPENSSL_RUBY_TESTS}/lib \ + -e 'Dir["${OPENSSL_RUBY_TESTSRC}"].each{|f| require f}' \ + -- --no-use-color --no-show-detail-immediately + touch $@ + +build: ${_BUILD_COOKIE} +test: ${_TEST_COOKIE} + +_MAKE = cd ${.CURDIR} && exec ${.MAKE} + +rebuild: + rm -f ${_BUILD_COOKIE} + ${_MAKE} build + +retest: + rm -f ${_TEST_COOKIE} + ${_MAKE} test + +CLEANFILES += ${_BUILD_COOKIE} ${_TEST_COOKIE} ${_BUILDDIR_COOKIE} + +. if make(clean) || make(cleandir) +. if exists(${BUILDDIR}) +.BEGIN: + rm -r ${BUILDDIR} +. endif +. endif + +.PHONY: build rebuild test retest + +.endif + +.include -- cgit v1.2.3