tests: never source test-defs.sh directly, source test-lib.sh instead
[automake.git] / t / get-sysconf.sh
blob60f62cdfff78872006ba798fd59515e8e21b5e04
1 #! /bin/sh
2 # Copyright (C) 2011-2012 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Dummy test case, aimed at reporting useful system information in the
18 # final 'test-suite.log'. This way, if a user experiences a failure in
19 # the Automake test suite and then only sends us the 'test-suite.log',
20 # we won't have to ask him for more information to start analyzing the
21 # failure (that had happened too many times in the past!).
23 . ./defs || exit 1
25 st=0
26 if test -d "$am_top_srcdir"/.git; then
27 # We are running from a git checkout.
28 (cd "$am_top_srcdir" && git log -1) || st=1
29 elif test -f "$am_top_srcdir"/ChangeLog; then
30 # We are probably running from a distribution tarball.
31 awk '
32 BEGIN { first = 1 }
33 (first == 1) { print; first = 0; next; }
34 /^[^\t]/ { exit(0); }
35 { print }
36 ' "$am_top_srcdir"/ChangeLog || st=1
37 else
38 # Some non-common but possibly valid setup (see for example the Homebrew
39 # problem reported in automake bug#10866); so just give an harmless
40 # warning instead of failing.
41 warn_ "no .git directory nor ChangeLog file found, some info won't" \
42 "be available"
44 $PERL -V || st=1
45 # It's OK for the user not to have the TAP::Parser module; this can
46 # happen with older perl installation, or on MinGW/MSYS.
47 $PERL -e 'use TAP::Parser; print $TAP::Parser::VERSION, "\n"' || :
49 cat "$am_top_builddir/config.log" || st=1
50 cat "$am_top_builddir/t/wrap/aclocal-$APIVERSION" || st=1
51 cat "$am_top_builddir/t/wrap/automake-$APIVERSION" || st=1
53 if test $st -eq 0; then
54 # This test SKIPs, so that all the information it has gathered and
55 # printed will get unconditionally copied into the 'test-suite.log'
56 # file.
57 exit 77
60 # Some unexpected error occurred; this must be reported as an hard
61 # error by the testsuite driver.
62 exit 99