From 5406775a50f7afb6df1c6c0820557d1a025973cc Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 6 Dec 2019 23:00:53 +0000 Subject: [PATCH] test-common: Framework for compatibility tests Now normal tests must start with a letter. Ones starting with C require OLD_SECNET_DIR. (Right now that must be both source and build dir because it's tedious to have to distinguish them and pass both.) Update comprehensive-test to (i) notice if the user forgot to set this (ii) make it into an absolute path. Note that comprehensive-test therefore has a different default to `make check': If OLD_SECNET_DIR is not set, `make check' will do none of those tests, but comprehensive-test will complain (and wants "" to disable those tests). We do not need to print this variable in our debugging output about how we are running secnet (or how the user who specifies _DIVERT_=i should run it). Signed-off-by: Ian Jackson --- comprehensive-test | 13 +++++++++++++ stest/common.tcl | 2 +- test-common.sd.mk | 6 +++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/comprehensive-test b/comprehensive-test index d8cf07d..cf01c7b 100755 --- a/comprehensive-test +++ b/comprehensive-test @@ -15,6 +15,19 @@ for arg in "$@"; do esac done +case "${OLD_SECNET_DIR:?must be set, perhaps to the empty string}" in + ''|/*) + ;; + ../*) + OLD_SECNET_DIR="${PWD%/*}/${OLD_SECNET_DIR#../}" + echo >&2 "x OLD_SECNET_DIR=$OLD_SECNET_DIR" + ;; + *) + echo >&2 "relative non-.. OLD_SECNET_DIR $OLD_SECNET_DIR !"; + exit 1 + ;; +esac + x () { echo >&2 "x $*"; "$@"; } srcdir=$(pwd) diff --git a/stest/common.tcl b/stest/common.tcl index cbf8fc1..89045a5 100644 --- a/stest/common.tcl +++ b/stest/common.tcl @@ -159,7 +159,7 @@ proc spawn-secnet {location site} { foreach k [array names env] { switch -glob $k { SECNET_STEST_DIVERT_* - - SECNET_TEST_BUILDDIR { } + SECNET_TEST_BUILDDIR - OLD_SECNET_DIR { } *SECNET* - *PRELOAD* { puts -nonewline " $k=$env($k)" } } diff --git a/test-common.sd.mk b/test-common.sd.mk index 904536d..0b7f4df 100644 --- a/test-common.sd.mk +++ b/test-common.sd.mk @@ -1,7 +1,11 @@ include common.make -&TESTSCRIPTS ?= $(wildcard &^/t-*[0-9a-z]) +&TESTSCRIPTS ?= $(wildcard &^/t-[a-z]*[0-9a-z]) +ifneq ($(OLD_SECNET_DIR),) +&TESTSCRIPTS += $(wildcard &^/t-C*[0-9a-z]) +endif + &TESTNAMES := $(patsubst t-%,%,$(notdir $(&TESTSCRIPTS))) &DEPS += $(src)/test-common.tcl -- 2.30.2