comparison tests/test-perror.sh @ 40221:8c1a17df67e0

tests: Prepare for using valgrind. tests/*.sh: Invoke all test programs through ${CHECKER}. tests/*/*.sh: Likewise.
author Bruno Haible <bruno@clisp.org>
date Sun, 10 Mar 2019 11:32:11 +0100
parents 7a6575389402
children
comparison
equal deleted inserted replaced
40220:2796695e9216 40221:8c1a17df67e0
3 . "$srcdir/init.sh"; path_prepend_ . 3 . "$srcdir/init.sh"; path_prepend_ .
4 4
5 # Test NULL prefix. Result should not contain a number, except in lines that 5 # Test NULL prefix. Result should not contain a number, except in lines that
6 # start with 'EDC' (IBM z/OS libc produces an error identifier before the 6 # start with 'EDC' (IBM z/OS libc produces an error identifier before the
7 # error message). 7 # error message).
8 test-perror 2>&1 >/dev/null | LC_ALL=C tr -d '\r' > t-perror.tmp 8 ${CHECKER} test-perror 2>&1 >/dev/null | LC_ALL=C tr -d '\r' > t-perror.tmp
9 grep -v '^EDC' t-perror.tmp | grep '[0-9]' > /dev/null \ 9 grep -v '^EDC' t-perror.tmp | grep '[0-9]' > /dev/null \
10 && fail_ "result should not contain a number" 10 && fail_ "result should not contain a number"
11 11
12 # Test empty prefix. Result should be the same. 12 # Test empty prefix. Result should be the same.
13 test-perror '' 2>&1 >/dev/null | LC_ALL=C tr -d '\r' > t-perror1.tmp 13 ${CHECKER} test-perror '' 2>&1 >/dev/null | LC_ALL=C tr -d '\r' > t-perror1.tmp
14 diff t-perror.tmp t-perror1.tmp \ 14 diff t-perror.tmp t-perror1.tmp \
15 || fail_ "empty prefix should behave like NULL argument" 15 || fail_ "empty prefix should behave like NULL argument"
16 16
17 # Test non-empty prefix. 17 # Test non-empty prefix.
18 test-perror foo 2>&1 >/dev/null | LC_ALL=C tr -d '\r' > t-perror3.tmp 18 ${CHECKER} test-perror foo 2>&1 >/dev/null | LC_ALL=C tr -d '\r' > t-perror3.tmp
19 sed -e 's/^/foo: /' < t-perror.tmp > t-perror2.tmp 19 sed -e 's/^/foo: /' < t-perror.tmp > t-perror2.tmp
20 diff t-perror2.tmp t-perror3.tmp || fail_ "prefix applied incorrectly" 20 diff t-perror2.tmp t-perror3.tmp || fail_ "prefix applied incorrectly"
21 21
22 # Test exit status. 22 # Test exit status.
23 test-perror >out 2>/dev/null || fail_ "unexpected exit status" 23 ${CHECKER} test-perror >out 2>/dev/null || fail_ "unexpected exit status"
24 test -s out && fail_ "unexpected output" 24 test -s out && fail_ "unexpected output"
25 25
26 Exit 0 26 Exit 0