Merge branch 'maint'
[platform/upstream/automake.git] / t / self-check-explicit-skips.sh
1 #! /bin/sh
2 # Copyright (C) 2011-2012 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
17 # Sanity check for the automake testsuite.
18 # Check creation/removal of temporary test working directory by './defs'.
19
20 am_create_testdir=empty
21 . ./defs || Exit 1
22
23 test x"$sh_errexit_works" = x"yes" || skip_ "no working shell exit trap"
24
25 # We still need a little hack to make ./defs work outside automake's
26 # tree 'tests' subdirectory.  Not a big deal.
27 sed "s|^am_top_builddir=.*|am_top_builddir='`pwd`'|" \
28   "$am_top_builddir"/defs-static > defs-static
29 diff "$am_top_builddir"/defs-static defs-static \
30   && fatal_ "failed to edit defs-static"
31 cp "$am_top_builddir"/defs .
32
33 set +e
34
35 unset am_explicit_skips stderr_fileno_
36 AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
37
38 $SHELL -c '. ./defs; (exit 77); exit 77' dummy.test
39 test $? -eq 77 || Exit 1
40
41 am_explicit_skips=no $SHELL -c '. ./defs; sh -c "exit 77"' dummy.test
42 test $? -eq 77 || Exit 1
43
44 am_explicit_skips=yes $SHELL -c '. ./defs; (exit 77); exit 77' dummy.test
45 test $? -eq 78 || Exit 1
46
47 am_explicit_skips=y $SHELL -c '. ./defs; sh -c "exit 77"' dummy.test
48 test $? -eq 78 || Exit 1
49
50 am_explicit_skips=yes $SHELL -c '. ./defs; Exit 77' dummy.test
51 test $? -eq 77 || Exit 1
52
53 am_explicit_skips=y $SHELL -c '. ./defs; skip_ "foo"' dummy.test
54 test $? -eq 77 || Exit 1
55
56 :