File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -79,6 +79,11 @@ checkresult::
7979 At the moment, the use of _sudo_ can be flagged, and tests requiring sudo can be skipped when using `runtests -u`.
8080 To flag such requirements, add a line with `Restrictions: sudo` to this file.
8181
82+ musthave::
83+ This file can contain a list of prerequisites from config.h (one per line). If it's not met, the test will be skipped.
84+ e.g. if your test depends on config.h having `#define HAVE_TK_H 1` and `#define HAVE_LIBMODBUS3 yes`, add a line with
85+ `TK_H` and a line with `LIBMODBUS3` to this file.
86+
8287== Some testing approaches
8388
8489There are various ways to structure a test, depending on what one wants to test.
Original file line number Diff line number Diff line change @@ -126,6 +126,18 @@ run_tests () {
126126
127127 while read testname; do
128128 testdir=$( dirname $testname )
129+ # check if there's a "musthave" file with prerequisites from config.h
130+ if [ -e $testdir /musthave ] ; then
131+ # one prerequisite per line
132+ while IFS= read -r prereq ; do
133+ if ! grep --quiet --regexp " ^#define HAVE_$prereq .*" " $TOPDIR /src/config.h" ; then
134+ echo " Skipping test for missing prerequisite \" $prereq \" : $testdir " 1>&2
135+ SKIP=$(( $SKIP + 1 ))
136+ continue 3
137+ fi
138+ done < $testdir /musthave
139+ fi
140+ # skip test if there's a "skip" file
129141 if [ -e $testdir /skip ]; then
130142 if ! [ -x $testdir /skip ] || ! $testdir /skip; then
131143 echo " Skipping disabled test: $testdir " 1>&2
You can’t perform that action at this time.
0 commit comments