Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / distcheck-pr10470.test
1 #! /bin/sh
2 # Copyright (C) 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 # Ensure "make distcheck" does not experience racy failures on
18 # systems (like MinGW/MSYS) that cannot remove a directory "in use"
19 # by a process (e.g., that is its "current working directory").
20 # See automake bug#10470.
21
22 parallel_tests=no
23 . ./defs || Exit 1
24
25 set -e
26
27 mkdir foo.d
28 sh -c "cd foo.d && sleep '4'" &
29 # Without this sleep, the "rm -rf foo.d" below would reliably beat
30 # the "cd foo.d" in the subshell above, and the test would be always
31 # skipped, even on MinGW/MSYS.
32 sleep '1'
33 rm -rf foo.d && skip_ 'system is able to remove "in use" directories'
34
35 echo AC_OUTPUT >> configure.in
36
37 cat > Makefile.am <<END
38 TESTS = foo.test
39 EXTRA_DIST= foo.test
40 END
41
42 cat > foo.test <<END
43 #!/bin/sh
44 sleep '4' &
45 exit 0
46 END
47 chmod a+x foo.test
48
49 $ACLOCAL
50 $AUTOCONF
51 $AUTOMAKE
52 ./configure
53
54 # We can build the distribution.
55 $MAKE distcheck >output 2>&1 || { cat output; Exit 1; }
56 cat output
57 # Sanity check: verify that our code has hit a problem removing
58 # the distdir, but has recovered from it.
59 grep "rm:.*$destdir" output || fatal_ "expected code path not covered"
60
61 :