Chris@69: #! /bin/sh
Chris@69: # test-driver - basic testsuite driver script.
Chris@69:
Chris@69: scriptversion=2016-01-11.22; # UTC
Chris@69:
Chris@69: # Copyright (C) 2011-2017 Free Software Foundation, Inc.
Chris@69: #
Chris@69: # This program is free software; you can redistribute it and/or modify
Chris@69: # it under the terms of the GNU General Public License as published by
Chris@69: # the Free Software Foundation; either version 2, or (at your option)
Chris@69: # any later version.
Chris@69: #
Chris@69: # This program is distributed in the hope that it will be useful,
Chris@69: # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@69: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@69: # GNU General Public License for more details.
Chris@69: #
Chris@69: # You should have received a copy of the GNU General Public License
Chris@69: # along with this program. If not, see .
Chris@69:
Chris@69: # As a special exception to the GNU General Public License, if you
Chris@69: # distribute this file as part of a program that contains a
Chris@69: # configuration script generated by Autoconf, you may include it under
Chris@69: # the same distribution terms that you use for the rest of that program.
Chris@69:
Chris@69: # This file is maintained in Automake, please report
Chris@69: # bugs to or send patches to
Chris@69: # .
Chris@69:
Chris@69: # Make unconditional expansion of undefined variables an error. This
Chris@69: # helps a lot in preventing typo-related bugs.
Chris@69: set -u
Chris@69:
Chris@69: usage_error ()
Chris@69: {
Chris@69: echo "$0: $*" >&2
Chris@69: print_usage >&2
Chris@69: exit 2
Chris@69: }
Chris@69:
Chris@69: print_usage ()
Chris@69: {
Chris@69: cat <$log_file 2>&1
Chris@69: estatus=$?
Chris@69:
Chris@69: if test $enable_hard_errors = no && test $estatus -eq 99; then
Chris@69: tweaked_estatus=1
Chris@69: else
Chris@69: tweaked_estatus=$estatus
Chris@69: fi
Chris@69:
Chris@69: case $tweaked_estatus:$expect_failure in
Chris@69: 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
Chris@69: 0:*) col=$grn res=PASS recheck=no gcopy=no;;
Chris@69: 77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
Chris@69: 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
Chris@69: *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
Chris@69: *:*) col=$red res=FAIL recheck=yes gcopy=yes;;
Chris@69: esac
Chris@69:
Chris@69: # Report the test outcome and exit status in the logs, so that one can
Chris@69: # know whether the test passed or failed simply by looking at the '.log'
Chris@69: # file, without the need of also peaking into the corresponding '.trs'
Chris@69: # file (automake bug#11814).
Chris@69: echo "$res $test_name (exit status: $estatus)" >>$log_file
Chris@69:
Chris@69: # Report outcome to console.
Chris@69: echo "${col}${res}${std}: $test_name"
Chris@69:
Chris@69: # Register the test result, and other relevant metadata.
Chris@69: echo ":test-result: $res" > $trs_file
Chris@69: echo ":global-test-result: $res" >> $trs_file
Chris@69: echo ":recheck: $recheck" >> $trs_file
Chris@69: echo ":copy-in-global-log: $gcopy" >> $trs_file
Chris@69:
Chris@69: # Local Variables:
Chris@69: # mode: shell-script
Chris@69: # sh-indentation: 2
Chris@69: # eval: (add-hook 'write-file-hooks 'time-stamp)
Chris@69: # time-stamp-start: "scriptversion="
Chris@69: # time-stamp-format: "%:y-%02m-%02d.%02H"
Chris@69: # time-stamp-time-zone: "UTC0"
Chris@69: # time-stamp-end: "; # UTC"
Chris@69: # End: