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# Basic TAP test protocol support: 18# - dependencies between test scripts 19 20. test-init.sh 21 22cat > Makefile.am << 'END' 23# The tests are *deliberately* listed in inversed order here. 24TESTS = c.test b.test a.test 25b.log: a.log 26c.log: b.log 27END 28 29. tap-setup.sh 30 31cat > a.test << 'END' 32#!/bin/sh 33echo 1..2 34echo ok 1 35# Creative quoting below to please maintainer-check. 36sleep '3' 37echo ok 2 38: > a.run 39END 40 41cat > b.test << 'END' 42#!/bin/sh 43echo 1..2 44if test -f a.run; then 45 echo ok 1 46else 47 echo not ok 1 48fi 49# Creative quoting below to please maintainer-check. 50sleep '3' 51echo ok 2 52: > b.run 53END 54 55cat > c.test << 'END' 56#!/bin/sh 57echo 1..1 58test -f b.run || { echo 'Bail out!'; exit 1; } 59echo ok 1 60rm -f a.run b.run 61END 62 63chmod a+x *.test 64 65run_make -O check 66count_test_results total=5 pass=5 fail=0 xpass=0 xfail=0 skip=0 error=0 67 68cat > exp << 'END' 69PASS: a.test 1 70PASS: a.test 2 71PASS: b.test 1 72PASS: b.test 2 73PASS: c.test 1 74END 75 76grep ': [abc]\.test' stdout > got 77 78cat exp 79cat got 80diff exp got 81 82# TODO: it would be nice to also redo the checks forcing parallel make... 83 84: 85