1#! /bin/sh
2# Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>.
16
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'.
22
23. test-init.sh
24
25cat >> configure.ac << 'END'
26AC_OUTPUT
27END
28
29cat > Makefile.am << 'END'
30AM_TESTS_FD_REDIRECT = 9>&1
31TEST_EXTENSIONS = .test .sh
32TESTS = foo.sh bar
33END
34
35$ACLOCAL
36$AUTOCONF
37$AUTOMAKE -a
38
39cat > foo.sh <<'END'
40#!/bin/sh
41echo " foofoofoo" >&9
42END
43chmod a+x foo.sh
44
45cat > bar <<'END'
46#!/bin/sh
47echo " barbarbar" >&9
48END
49
50chmod a+x foo.sh bar
51
52./configure
53
54# Sanity checks.
55st=0
56grep '^bar\.log:.*bar' Makefile || st=1
57grep '^foo\.log:' Makefile && st=1
58test $st -eq 0 || fatal_ "doesn't cover expected code paths"
59
60run_make -O -e IGNORE check
61cat foo.log
62cat bar.log
63test $am_make_rc -eq 0
64grep "^ foofoofoo$" stdout
65grep "^ barbarbar$" stdout
66$EGREP '(foofoofoo|barbarbar)' *.log && exit 1
67
68:
69