From: dtucker Date: Mon, 4 Jul 2022 09:10:31 +0000 (+0000) Subject: Add TEST_REGRESS_CACHE_DIR which, if set, is used to cache regress test X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=977e9b4031ec2d67549d1e8750ed8ba1f26d0dda;p=openbsd Add TEST_REGRESS_CACHE_DIR which, if set, is used to cache regress test names that have succeeded and skip those on a re-run. --- diff --git a/regress/usr.bin/ssh/test-exec.sh b/regress/usr.bin/ssh/test-exec.sh index 892a1b5c1d6..d2fefe37372 100644 --- a/regress/usr.bin/ssh/test-exec.sh +++ b/regress/usr.bin/ssh/test-exec.sh @@ -1,4 +1,4 @@ -# $OpenBSD: test-exec.sh,v 1.89 2022/01/06 22:14:25 dtucker Exp $ +# $OpenBSD: test-exec.sh,v 1.90 2022/07/04 09:10:31 dtucker Exp $ # Placed in the Public Domain. #SUDO=sudo @@ -134,6 +134,30 @@ if [ "x$TEST_REGRESS_LOGFILE" = "x" ]; then TEST_REGRESS_LOGFILE=$OBJ/regress.log fi +# If set, keep track of successful tests and skip them them if we've +# previously completed that test. +if [ "x$TEST_REGRESS_CACHE_DIR" != "x" ]; then + if [ ! -d "$TEST_REGRESS_CACHE_DIR" ]; then + mkdir -p "$TEST_REGRESS_CACHE_DIR" + fi + TEST="`basename $SCRIPT .sh`" + CACHE="${TEST_REGRESS_CACHE_DIR}/${TEST}.cache" + for i in ${SSH} ${SSHD} ${SSHAGENT} ${SSHADD} ${SSHKEYGEN} ${SCP} \ + ${SFTP} ${SFTPSERVER} ${SSHKEYSCAN}; do + case $i in + /*) bin="$i" ;; + *) bin="`which $i`" ;; + esac + if [ "$bin" -nt "$CACHE" ]; then + rm -f "$CACHE" + fi + done + if [ -f "$CACHE" ]; then + echo ok cached $CACHE + exit 0 + fi +fi + # truncate logfiles >$TEST_SSH_LOGFILE >$TEST_SSHD_LOGFILE @@ -524,6 +548,9 @@ start_sshd () cleanup if [ $RESULT -eq 0 ]; then verbose ok $tid + if [ "x$CACHE" != "x" ]; then + touch "$CACHE" + fi else echo failed $tid fi