maint: Update HACKING
[automake.git] / t / parallel-tests-fd-redirect.sh
blob386b7aada09f6d086293980a7e96d7a686f38807
1 #! /bin/sh
2 # Copyright (C) 2011-2017 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 # parallel-tests support: redirection of file descriptors with
18 # AM_TESTS_FD_REDIRECT, even when using tests without suffix.
19 # The sister 'parallel-tests-fd-redirect-exeext.sh' do a similar
20 # check for tests that are binary executables.
21 # See also the more generic test 'check-fd-redirect.sh'.
23 . test-init.sh
25 cat >> configure.ac << 'END'
26 AC_OUTPUT
27 END
29 cat > Makefile.am << 'END'
30 AM_TESTS_FD_REDIRECT = 9>&1
31 TEST_EXTENSIONS = .test .sh
32 TESTS = foo.sh bar
33 END
35 $ACLOCAL
36 $AUTOCONF
37 $AUTOMAKE -a
39 cat > foo.sh <<'END'
40 #!/bin/sh
41 echo " foofoofoo" >&9
42 END
43 chmod a+x foo.sh
45 cat > bar <<'END'
46 #!/bin/sh
47 echo " barbarbar" >&9
48 END
50 chmod a+x foo.sh bar
52 ./configure
54 # Sanity checks.
55 st=0
56 grep '^bar\.log:.*bar' Makefile || st=1
57 grep '^foo\.log:' Makefile && st=1
58 test $st -eq 0 || fatal_ "doesn't cover expected code paths"
60 run_make -O -e IGNORE check
61 cat foo.log
62 cat bar.log
63 test $am_make_rc -eq 0
64 grep "^ foofoofoo$" stdout
65 grep "^ barbarbar$" stdout
66 $EGREP '(foofoofoo|barbarbar)' *.log && exit 1