test-driver (nss-pam-ldapd-0.9.11) | : | test-driver (nss-pam-ldapd-0.9.12) | ||
---|---|---|---|---|
#! /bin/sh | #! /bin/sh | |||
# test-driver - basic testsuite driver script. | # test-driver - basic testsuite driver script. | |||
scriptversion=2018-03-07.03; # UTC | scriptversion=2018-03-07.03; # UTC | |||
# Copyright (C) 2011-2018 Free Software Foundation, Inc. | # Copyright (C) 2011-2021 Free Software Foundation, Inc. | |||
# | # | |||
# This program is free software; you can redistribute it and/or modify | # This program is free software; you can redistribute it and/or modify | |||
# it under the terms of the GNU General Public License as published by | # it under the terms of the GNU General Public License as published by | |||
# the Free Software Foundation; either version 2, or (at your option) | # the Free Software Foundation; either version 2, or (at your option) | |||
# any later version. | # any later version. | |||
# | # | |||
# This program is distributed in the hope that it will be useful, | # This program is distributed in the hope that it will be useful, | |||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
# GNU General Public License for more details. | # GNU General Public License for more details. | |||
skipping to change at line 45 | skipping to change at line 45 | |||
{ | { | |||
echo "$0: $*" >&2 | echo "$0: $*" >&2 | |||
print_usage >&2 | print_usage >&2 | |||
exit 2 | exit 2 | |||
} | } | |||
print_usage () | print_usage () | |||
{ | { | |||
cat <<END | cat <<END | |||
Usage: | Usage: | |||
test-driver --test-name=NAME --log-file=PATH --trs-file=PATH | test-driver --test-name NAME --log-file PATH --trs-file PATH | |||
[--expect-failure={yes|no}] [--color-tests={yes|no}] | [--expect-failure {yes|no}] [--color-tests {yes|no}] | |||
[--enable-hard-errors={yes|no}] [--] | [--enable-hard-errors {yes|no}] [--] | |||
TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS] | TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS] | |||
The '--test-name', '--log-file' and '--trs-file' options are mandatory. | The '--test-name', '--log-file' and '--trs-file' options are mandatory. | |||
See the GNU Automake documentation for information. | ||||
END | END | |||
} | } | |||
test_name= # Used for reporting. | test_name= # Used for reporting. | |||
log_file= # Where to save the output of the test script. | log_file= # Where to save the output of the test script. | |||
trs_file= # Where to save the metadata of the test run. | trs_file= # Where to save the metadata of the test run. | |||
expect_failure=no | expect_failure=no | |||
color_tests=no | color_tests=no | |||
enable_hard_errors=yes | enable_hard_errors=yes | |||
while test $# -gt 0; do | while test $# -gt 0; do | |||
skipping to change at line 106 | skipping to change at line 108 | |||
else | else | |||
red= grn= lgn= blu= mgn= std= | red= grn= lgn= blu= mgn= std= | |||
fi | fi | |||
do_exit='rm -f $log_file $trs_file; (exit $st); exit $st' | do_exit='rm -f $log_file $trs_file; (exit $st); exit $st' | |||
trap "st=129; $do_exit" 1 | trap "st=129; $do_exit" 1 | |||
trap "st=130; $do_exit" 2 | trap "st=130; $do_exit" 2 | |||
trap "st=141; $do_exit" 13 | trap "st=141; $do_exit" 13 | |||
trap "st=143; $do_exit" 15 | trap "st=143; $do_exit" 15 | |||
# Test script is run here. | # Test script is run here. We create the file first, then append to it, | |||
"$@" >$log_file 2>&1 | # to ameliorate tests themselves also writing to the log file. Our tests | |||
# don't, but others can (automake bug#35762). | ||||
: >"$log_file" | ||||
"$@" >>"$log_file" 2>&1 | ||||
estatus=$? | estatus=$? | |||
if test $enable_hard_errors = no && test $estatus -eq 99; then | if test $enable_hard_errors = no && test $estatus -eq 99; then | |||
tweaked_estatus=1 | tweaked_estatus=1 | |||
else | else | |||
tweaked_estatus=$estatus | tweaked_estatus=$estatus | |||
fi | fi | |||
case $tweaked_estatus:$expect_failure in | case $tweaked_estatus:$expect_failure in | |||
0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; | 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; | |||
skipping to change at line 129 | skipping to change at line 134 | |||
77:*) col=$blu res=SKIP recheck=no gcopy=yes;; | 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; | |||
99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; | 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; | |||
*:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; | *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; | |||
*:*) col=$red res=FAIL recheck=yes gcopy=yes;; | *:*) col=$red res=FAIL recheck=yes gcopy=yes;; | |||
esac | esac | |||
# Report the test outcome and exit status in the logs, so that one can | # Report the test outcome and exit status in the logs, so that one can | |||
# know whether the test passed or failed simply by looking at the '.log' | # know whether the test passed or failed simply by looking at the '.log' | |||
# file, without the need of also peaking into the corresponding '.trs' | # file, without the need of also peaking into the corresponding '.trs' | |||
# file (automake bug#11814). | # file (automake bug#11814). | |||
echo "$res $test_name (exit status: $estatus)" >>$log_file | echo "$res $test_name (exit status: $estatus)" >>"$log_file" | |||
# Report outcome to console. | # Report outcome to console. | |||
echo "${col}${res}${std}: $test_name" | echo "${col}${res}${std}: $test_name" | |||
# Register the test result, and other relevant metadata. | # Register the test result, and other relevant metadata. | |||
echo ":test-result: $res" > $trs_file | echo ":test-result: $res" > $trs_file | |||
echo ":global-test-result: $res" >> $trs_file | echo ":global-test-result: $res" >> $trs_file | |||
echo ":recheck: $recheck" >> $trs_file | echo ":recheck: $recheck" >> $trs_file | |||
echo ":copy-in-global-log: $gcopy" >> $trs_file | echo ":copy-in-global-log: $gcopy" >> $trs_file | |||
End of changes. 6 change blocks. | ||||
7 lines changed or deleted | 12 lines changed or added |