Skip all tests that need internet connection unless they have it.
authorbluhm <bluhm@openbsd.org>
Tue, 18 Apr 2023 19:41:50 +0000 (19:41 +0000)
committerbluhm <bluhm@openbsd.org>
Tue, 18 Apr 2023 19:41:50 +0000 (19:41 +0000)
Run reachability ping only once.  Fix clean files and always run
make obj.  Do not suppress messages from redirectchain test.

regress/usr.sbin/rpki-client/Makefile.inc
regress/usr.sbin/rpki-client/libressl/Makefile

index 2c487ab..0e402ce 100644 (file)
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.30 2023/03/12 11:55:34 job Exp $
+# $OpenBSD: Makefile.inc,v 1.31 2023/04/18 19:41:50 bluhm Exp $
 
 .PATH:         ${.CURDIR}/../../../../usr.sbin/rpki-client
 
@@ -22,6 +22,8 @@ CFLAGS+=      -I${.CURDIR}/.. -I${.CURDIR}/../../../../usr.sbin/rpki-client
 LDADD+=                -lcrypto -lutil
 DPADD+=                ${LIBCRYPTO} ${LIBUTIL}
 
+CLEANFILES+=   *.out *.err *.txt
+
 SRCS_test-ip +=                test-ip.c ip.c io.c encoding.c print.c x509.c \
                        log.c validate.c as.c cert.c cms.c crl.c mft.c
 run-regress-test-ip: test-ip
@@ -90,7 +92,7 @@ run-regress-test-rrdp: test-rrdp
        ./test-rrdp -S 8fe05c2e-047d-49e7-8398-cd4250a572b1 -N 50500 \
        -n < ${.CURDIR}/../rrdp/notification.xml 2>&1 | tee rrdp-r2.out
        cmp ${.CURDIR}/../rrdp/rrdp-r2.out rrdp-r2.out
-       
+
        ./test-rrdp -S 9b3f7e31-4979-4f8c-9818-73e4dadc3e6b -N 13755 \
        -H 75416a54d1bb47f4f4dec7696bd33f77aa3a4a09a295b7f1a027841af0b50c1b \
        -d < ${.CURDIR}/../rrdp/delta.xml 2>&1 | tee rrdp-r3.out
index 2eb0168..89ef279 100644 (file)
@@ -1,19 +1,19 @@
-# $OpenBSD: Makefile,v 1.8 2023/01/04 14:27:00 claudio Exp $
+# $OpenBSD: Makefile,v 1.9 2023/04/18 19:41:50 bluhm Exp $
 
-PROGS += test-http
+PROGS +=       test-http
 
-SRCS_test-http=   test-http.c http.c io.c encoding.c
-LDADD_test-http+= -ltls -lssl -lcrypto -lutil
-DPADD_test-http+= ${LIBTLS} ${LIBSSL} ${LIBCRYPTO} ${LIBUTIL}
+SRCS_test-http =       test-http.c http.c io.c encoding.c
+LDADD_test-http =      -ltls -lssl -lcrypto -lutil
+DPADD_test-http =      ${LIBTLS} ${LIBSSL} ${LIBCRYPTO} ${LIBUTIL}
 
 SERVER =       jigsaw.w3.org
-REACHABLE =
-.if make(run-regress-test-http)
-REACHABLE !=   ! ping -n -c 1 -w 1 ${SERVER} >/dev/null || echo yes
+.if ! (make(clean) || make(cleandir) || make(obj))
+REACHABLE !?=  ! ping -n -c 1 -w 1 ${SERVER} >/dev/null || echo yes
+.MAKEFLAGS :=  REACHABLE=${REACHABLE}
 .endif
 
 run-regress-test-http: test-http
-.if ${REACHABLE:L} == "yes"
+.if "${REACHABLE:L}" == "yes"
        ./test-http https://${SERVER}/HTTP/TE/foo.txt foo.txt
        ./test-http https://${SERVER}/HTTP/ChunkedScript chunk.out
        ./test-http https://${SERVER}/HTTP/300/307.html redir.out
@@ -25,7 +25,15 @@ run-regress-test-http: test-http
 
 REGRESS_TARGETS+=              run-regress-test-http-redirectchain
 run-regress-test-http-redirectchain: test-http
-       ./test-http 'https://demo.cyotek.com/features/redirectchaintest.php?index=1' redirloop.out 2>&1 | grep -q 'Too many redirections requested'
+.if "${REACHABLE:L}" == "yes"
+       ./test-http \
+           'https://demo.cyotek.com/features/redirectchaintest.php?index=1' \
+           redirloop.out 2>&1 | tee redirloop.err
+       grep -q 'Too many redirections requested' redirloop.err
+.else
+       # server ${SERVER} not reachable
+       @echo SKIPPED
+.endif
 
 .PATH: ${.CURDIR}/..