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)
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 # Sanity check for the automake testsuite.
18 # Check that tests using './defs' create a proper temporary directory,
19 # and run in it. Also check that we can prevent the pre-population
20 # and the creation of such directory if we want.
27 AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
28 keep_testdirs=; unset keep_testdirs
30 # This needs to be consistent with what $AM_TEST_RUNNER_SHELL
31 # deems to be the current working directory.
32 cwd=$($AM_TEST_RUNNER_SHELL -c 'pwd') \
33 || fatal_ "can't get current working directory"
38 rm -rf _self.dir || framework_failure_ "cleaning up _self.dir"
39 command_ok_ "$1 [$2]" $AM_TEST_RUNNER_SHELL -c "
42 # Don't fail if 'ls -l' fails; avoids possible racy spurious failures.
43 pwd; ls -l || : # For debugging.
48 do_check 'testdir has the expected path' \
49 'unset am_create_testdir' \
50 'case $(pwd) in '"$cwd"'/t/_self.dir);; *) exit 1;; esac'
52 do_check 'fully pre-populated testdir' \
53 'unset am_create_testdir' \
54 'test -f install-sh || exit 1
55 test -f configure.ac || exit 1
56 case $(pwd) in '"$cwd"'/t/_self.dir) : ;; *) exit 1;; esac'
58 do_check 'testdir has the expected path' \
59 'am_create_testdir=empty' \
60 'case $(pwd) in '"$cwd"'/t/_self.dir) : ;; *) exit 1;; esac'
62 do_check 'do not pre-populate testdir' \
63 'am_create_testdir=empty' \
64 'ls -a | grep -v "^\\.\\{1,2\\}$" | grep . && exit 1; :'
66 do_check 'do not create nor chdir in testdir' \
67 'am_create_testdir=no' \
68 'test ! -e t/_self.dir || exit 1
69 grep "self-check-dir\.tap" Makefile || exit 1
70 case $(pwd) in '"$cwd"') : ;; *) exit 1;; esac'