summaryrefslogtreecommitdiff
path: root/regress/lib/libssl/openssl-ruby/Makefile
blob: bf29045bcd97e97b6ccaa743f24d287c814a7adc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#	$OpenBSD: Makefile,v 1.12 2024/06/15 08:39:47 tb Exp $

OPENSSL_RUBY_TESTS =	/usr/local/share/openssl-ruby-tests
.if exists(/usr/local/bin/ruby32)
RUBY_BINREV =		32
.else
RUBY_BINREV =		33
.endif
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

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} && \
	    env SKIP_EXPECTED_FAILURES=true ${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

.for _t in test_client_ca
REGRESS_TARGETS += ${_t}
REGRESS_EXPECTED_FAILURES += ${_t}
${_t}: ${_BUILD_COOKIE}
	cd ${BUILDDIR} && \
	    ${RUBY} -I. -I${OPENSSL_RUBY_TESTS}/test/openssl \
		-I${OPENSSL_RUBY_TESTS}/lib \
		${OPENSSL_RUBY_TESTS}/test/openssl/test_ssl.rb \
		-n ${_t}
.endfor

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 <bsd.regress.mk>