summaryrefslogtreecommitdiffstats
path: root/tests/test-self-check
blob: c0e1d0de03e21e470d36af2fcc0b0061a85fe3eb (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
42
43
44
45
46
47
48
49
50
51
52
53
54
# -*- sh -*-
# See LICENSE file for copyright and license details.

set -e

stderr_printf () {
	printf "$@" >&2
}
test "$(stderr_printf 'hello\n')" = ''
test "$(stderr stderr_printf 'hello\n' 2>&1)" = 'hello'

failing_function () { false; true; } # use of { } rather than ( ) is important
( ! failing_function )

(! (false > $a) )

getname OS 0
(! getname OS)
getnum OS LINUX
(! getnum OS 0)

getnamelist OS | grep LINUX
getnamelist ARCH | grep AMD64_X32

getnumlist OS | grep '^0$'
getnumlist ARCH | grep 10

getnumlist OS ${CPP} | grep '^0$'
test -n "${CPP}"

test "$(getname OS 0)" = LINUX
test "$(getnum OS LINUX)" = 0

test "$(lookupnum "$(getlist OS)" LINUX)" = 0
test "$(lookupname "$(getlist OS)" 0)" = LINUX

printf 'a\n' > $a
printf 'b\n' > $b
(! diff -u $a $b)

printf 'a\n' > $a
printf 'a\n' > $b
diff -u $a $b

true & wait $!
( false & ! wait $! )
await

for os in ${SUPPORTED_OSES}; do
	issupported $os
	for arch in $(env | sed -n 's/^SUPPORTED_'"$os"'_ARCHES=//p' | xargs printf '%s\n'); do
		issupported $os $arch
	done
done