doc: typos in test file.
[automake.git] / t / distcheck-pr10470.sh
blob82c8e53355b0605e408a98b8480a5006152c2171
1 #! /bin/sh
2 # Copyright (C) 2012-2024 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 <https://www.gnu.org/licenses/>.
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.
22 . test-init.sh
24 mkdir foo.d
25 sh -c "cd foo.d && sleep '4'" &
26 # Without this sleep, the "rm -rf foo.d" below would reliably beat
27 # the "cd foo.d" in the subshell above, and the test would be always
28 # skipped, even on MinGW/MSYS.
29 sleep '1'
30 rm -rf foo.d && skip_ 'system is able to remove "in use" directories'
32 echo AC_OUTPUT >> configure.ac
34 cat > Makefile.am <<END
35 TESTS = foo.test
36 EXTRA_DIST= foo.test
37 END
39 cat > foo.test <<END
40 #!/bin/sh
41 sleep '4' &
42 exit 0
43 END
44 chmod a+x foo.test
46 $ACLOCAL
47 $AUTOCONF
48 $AUTOMAKE -a
49 ./configure
51 # We can build the distribution.
52 run_make -M distcheck
53 # Sanity check: verify that our code has hit a problem removing
54 # the distdir, but has recovered from it.
55 $EGREP "(^| )(rm|find):.*$distdir" output || fatal_ "expected code path not covered"