1#! /bin/sh
2# Copyright (C) 2012-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# The parallel-tests 'recheck' target must depend on the 'all' target.
18# See automake bug#11252.
19
20required='cc native'
21. test-init.sh
22
23cat >> configure.ac << 'END'
24AC_PROG_CC
25AC_OUTPUT
26END
27
28cat > Makefile.am << 'END'
29all-local:
30	test ! -f status || echo okokok > status
31bin_PROGRAMS = foo
32TESTS = a.test b.test c.test
33END
34
35cat > foo.c << 'END'
36#include <stdio.h>
37int main (void)
38{
39  printf ("failure :-(" "\n");
40  return 1;
41}
42END
43
44cat > a.test << 'END'
45#!/bin/sh
46exit 0
47END
48
49cat > b.test << 'END'
50#!/bin/sh
51grep okokok status
52END
53
54cat > c.test << 'END'
55#!/bin/sh
56./foo
57END
58
59chmod a+x *.test
60
61$ACLOCAL
62$AUTOCONF
63$AUTOMAKE -a
64./configure
65
66run_make -O -e FAIL check
67count_test_results total=3 pass=1 fail=2 skip=0 xfail=0 xpass=0 error=0
68test ! -e status
69
70$sleep
71: > status
72cat > foo.c << 'END'
73#include <stdio.h>
74int main (void)
75{
76  printf ("success :-)" "\n");
77  return 0;
78}
79END
80
81run_make -O recheck
82count_test_results total=2 pass=2 fail=0 skip=0 xfail=0 xpass=0 error=0
83grep '^PASS: b\.test$' stdout
84grep '^PASS: c\.test$' stdout
85
86run_make -O recheck
87count_test_results total=0 pass=0 fail=0 skip=0 xfail=0 xpass=0 error=0
88
89:
90