mirror of
https://github.com/opnsense/src.git
synced 2026-04-28 17:49:22 -04:00
Add support for TODO tests. These are tests that are supposed to fail,
because of a make bug that should be fixed.
This commit is contained in:
parent
277afaff66
commit
6772dd14cb
2 changed files with 43 additions and 23 deletions
|
|
@ -164,6 +164,10 @@ This also lists special filenames.
|
|||
To skip a test (for whatever reason) this should be set
|
||||
to a string explaining the reason for skipping the test.
|
||||
|
||||
TEST_<number>_TODO
|
||||
For a test that should fail this is a short string describing
|
||||
what the problem in make(1) is that should be fixed.
|
||||
|
||||
run_test()
|
||||
Function to run a test. This function gets a single argument
|
||||
which is the number of the test to executed. The default
|
||||
|
|
|
|||
|
|
@ -35,8 +35,7 @@ ensure_run()
|
|||
FAIL=
|
||||
N=1
|
||||
while [ ${N} -le ${TEST_N} ] ; do
|
||||
eval skip=\${TEST_${N}_SKIP}
|
||||
if [ -z "${skip}" ] ; then
|
||||
if ! skip_test ${N} ; then
|
||||
if [ ! -f ${OUTPUT_DIR}/status.${N} -o \
|
||||
! -f ${OUTPUT_DIR}/stdout.${N} -o \
|
||||
! -f ${OUTPUT_DIR}/stderr.${N} ] ; then
|
||||
|
|
@ -72,6 +71,19 @@ print_usage()
|
|||
echo " help - show this information"
|
||||
}
|
||||
|
||||
#
|
||||
# Return 0 if we should skip the test. 1 otherwise
|
||||
#
|
||||
skip_test()
|
||||
{
|
||||
eval skip=\${TEST_${1}_SKIP}
|
||||
if [ -z "${skip}" ] ; then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Common function for setup and reset.
|
||||
#
|
||||
|
|
@ -238,8 +250,7 @@ eval_run()
|
|||
|
||||
N=1
|
||||
while [ ${N} -le ${TEST_N} ] ; do
|
||||
eval skip=\${TEST_${N}_SKIP}
|
||||
if [ -z "${skip}" ] ; then
|
||||
if ! skip_test ${N} ; then
|
||||
( cd ${WORK_DIR} ;
|
||||
exec 1>${OUTPUT_DIR}/stdout.${N} 2>${OUTPUT_DIR}/stderr.${N}
|
||||
run_test ${N}
|
||||
|
|
@ -274,8 +285,7 @@ eval_show()
|
|||
|
||||
N=1
|
||||
while [ ${N} -le ${TEST_N} ] ; do
|
||||
eval skip=\${TEST_${N}_SKIP}
|
||||
if [ -z "${skip}" ] ; then
|
||||
if ! skip_test ${N} ; then
|
||||
echo "=== Test ${N} Status =================="
|
||||
cat ${OUTPUT_DIR}/status.${N}
|
||||
echo ".......... Stdout .................."
|
||||
|
|
@ -302,20 +312,28 @@ eval_compare()
|
|||
echo "1..${TEST_N}"
|
||||
N=1
|
||||
while [ ${N} -le ${TEST_N} ] ; do
|
||||
eval skip=\${TEST_${N}_SKIP}
|
||||
if [ -z "${skip}" ] ; then
|
||||
FAIL=
|
||||
do_compare stdout ${N} || FAIL="${FAIL}stdout "
|
||||
do_compare stderr ${N} || FAIL="${FAIL}stderr "
|
||||
do_compare status ${N} || FAIL="${FAIL}status "
|
||||
if [ ! -z "$FAIL" ]; then
|
||||
echo "not ok ${N} ${SUBDIR}/${N} # reason: ${FAIL}"
|
||||
else
|
||||
echo "ok ${N} ${SUBDIR}/${N}"
|
||||
fi
|
||||
else
|
||||
echo "ok ${N} ${SUBDIR}/${N} # skip: ${skip}"
|
||||
fail=
|
||||
todo=
|
||||
if ! skip_test ${N} ; then
|
||||
do_compare stdout ${N} || fail="${fail}stdout "
|
||||
do_compare stderr ${N} || fail="${fail}stderr "
|
||||
do_compare status ${N} || fail="${fail}status "
|
||||
eval todo=\${TEST_${N}_TODO}
|
||||
fi
|
||||
if [ ! -z "$fail" ]; then
|
||||
echo -n "not "
|
||||
fi
|
||||
echo -n "ok ${N} ${SUBDIR}/${N}"
|
||||
if [ ! -z "$fail" -o ! -z "$todo" ]; then
|
||||
echo -n " # "
|
||||
fi
|
||||
if [ ! -z "$todo" ] ; then
|
||||
echo -n "TODO $todo; "
|
||||
fi
|
||||
if [ ! -z "$fail" ] ; then
|
||||
echo "reason: ${fail}"
|
||||
fi
|
||||
echo
|
||||
N=$((N + 1))
|
||||
done
|
||||
}
|
||||
|
|
@ -354,8 +372,7 @@ eval_diff()
|
|||
|
||||
N=1
|
||||
while [ ${N} -le ${TEST_N} ] ; do
|
||||
eval skip=\${TEST_${N}_SKIP}
|
||||
if [ -z "${skip}" ] ; then
|
||||
if ! skip_test ${N} ; then
|
||||
FAIL=
|
||||
do_diff stdout ${N}
|
||||
do_diff stderr ${N}
|
||||
|
|
@ -400,8 +417,7 @@ eval_update()
|
|||
FAIL=
|
||||
N=1
|
||||
while [ ${N} -le ${TEST_N} ] ; do
|
||||
eval skip=\${TEST_${N}_SKIP}
|
||||
if [ -z "${skip}" ] ; then
|
||||
if ! skip_test ${N} ; then
|
||||
cp ${OUTPUT_DIR}/stdout.${N} expected.stdout.${N}
|
||||
cp ${OUTPUT_DIR}/stderr.${N} expected.stderr.${N}
|
||||
cp ${OUTPUT_DIR}/status.${N} expected.status.${N}
|
||||
|
|
|
|||
Loading…
Reference in a new issue