summaryrefslogtreecommitdiffstats
path: root/tests/preamble
blob: 527a098790b48f026dbd2119933fb97783080bb0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# -*- sh -*-
# See LICENSE file for copyright and license details.

if test $# = 0; then
	if "$0" fail for me; then
		printf 'Testing is broken!\n' >&2
		exit 2
	fi
	set +e
	"$0" $$
	r=$?
	rm -f -- .?-$$.tmp
	exit $r
fi


set -e
test $# = 1
pid=$1
a=.a-$pid.tmp
b=.b-$pid.tmp
PATH="$(dirname -- "$0")/testutil:$PATH"
export PATH


if ! env | grep '^SUPPORTED_OSES=' >/dev/null; then
	printf '%s\n' \
		"The test's environment has not been set up;" \
		'you should run the test via `make check`'
	exit 1
fi

. tests/load-functions

alias t='$t'

if ! (. tests/test-self-check) >/dev/null 2>/dev/null; then
	printf '%s\n' \
		"The test's self-check failed"
	exit 1
fi