Merge branch 'master' into test-protocols
[platform/upstream/automake.git] / tests / plain-functions.sh
1 # -*- shell-script -*-
2 #
3 # Copyright (C) 2011 Free Software Foundation, Inc.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 # Helper functions used by "plain" tests of the Automake testsuite
19 # (i.e., tests that don't use any test protocol).
20
21 # Print warnings (e.g., about skipped and failed tests) to this file
22 # number.  Override by putting, say:
23 #   stderr_fileno_=9; export stderr_fileno_; exec 9>&2;
24 # in the definition of AM_TESTS_ENVIRONMENT.
25 # This is useful when using automake's parallel tests mode, to print the
26 # reason for skip/failure to console, rather than to the *.log files.
27 : ${stderr_fileno_=2}
28
29 # Copied from Gnulib's `tests/init.sh'.
30 warn_ () { echo "$@" 1>&$stderr_fileno_; }
31 fail_ () { warn_ "$me: failed test: $@"; Exit 1; }
32 skip_ () { warn_ "$me: skipped test: $@"; Exit 77; }
33 fatal_ () { warn_ "$me: hard error: $@"; Exit 99; }
34 framework_failure_ () { warn_ "$me: set-up failure: $@"; Exit 99; }
35
36 # For compatibility with TAP functions.
37 skip_all_ () { skip "$@"; }
38
39 :