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