tests: Don't require bash.

Instead merge continuous regions of colored output. This way different
shell implementations shouldn't make a difference.
This commit is contained in:
Simon Ruderich
2013-07-01 03:12:24 +02:00
parent 2c55827f6f
commit b926752fac
9 changed files with 25 additions and 26 deletions

View File

@@ -1,9 +1,9 @@
>STDERR>write to stderr: 1
<STDERR<write to stdout
>STDERR>error!: Cannot allocate memory
<STDERR<>STDERR>write to stderr 2<STDERR<write to stdout 2>STDERR>
write to stderr 2<STDERR<write to stdout 2>STDERR>
<STDERR<
>STDERR>more on stderr
<STDERR<>STDERR>stderr ...
stderr ...
<STDERR<more on stdout
>STDERR>x<STDERR<

View File

@@ -7,5 +7,5 @@
>STDERR>example_err: error: message
<STDERR<exit code: 1
>STDERR>example_err: warning: message: Cannot allocate memory
<STDERR<>STDERR>example_err: warning: message
example_err: warning: message
<STDERR<

View File

@@ -1,10 +1,10 @@
>STDERR>./example_error:<STDERR<>STDERR> <STDERR<>STDERR><message><STDERR<>STDERR>
<STDERR<>STDERR>./example_error:<STDERR<>STDERR>file:42:<STDERR<>STDERR> <STDERR<>STDERR><message><STDERR<>STDERR>
<STDERR<>STDERR>./example_error:<STDERR<>STDERR> <STDERR<>STDERR><message><STDERR<>STDERR>: Cannot allocate memory<STDERR<>STDERR>
<STDERR<>STDERR>./example_error:<STDERR<>STDERR>file:42:<STDERR<>STDERR> <STDERR<>STDERR><message><STDERR<>STDERR>: Cannot allocate memory<STDERR<>STDERR>
<STDERR<>STDERR>./example_error:<STDERR<>STDERR>file:42:<STDERR<>STDERR> <STDERR<>STDERR><message><STDERR<>STDERR>: Cannot allocate memory<STDERR<>STDERR>
<STDERR<>STDERR>PROG<STDERR<>STDERR><message><STDERR<>STDERR>
<STDERR<>STDERR>PROG<STDERR<>STDERR>file:42:<STDERR<>STDERR> <STDERR<>STDERR><message><STDERR<>STDERR>
<STDERR<>STDERR>PROG<STDERR<>STDERR><message><STDERR<>STDERR>: Cannot allocate memory<STDERR<>STDERR>
<STDERR<>STDERR>PROG<STDERR<>STDERR>file:42:<STDERR<>STDERR> <STDERR<>STDERR><message><STDERR<>STDERR>: Cannot allocate memory<STDERR<>STDERR>
>STDERR>./example_error: <message>
./example_error:file:42: <message>
./example_error: <message>: Cannot allocate memory
./example_error:file:42: <message>: Cannot allocate memory
./example_error:file:42: <message>: Cannot allocate memory
PROG<message>
PROGfile:42: <message>
PROG<message>: Cannot allocate memory
PROGfile:42: <message>: Cannot allocate memory
<STDERR<

View File

@@ -1,7 +1,4 @@
#!/bin/bash
# Use bash to get consistent test results, /bin/sh can point to multiple
# shells with different behaviour.
#!/bin/sh
# Copyright (C) 2013 Simon Ruderich
#

View File

@@ -1,8 +1,8 @@
>STDERR>write<STDERR<>STDERR> <STDERR<>STDERR>to<STDERR<>STDERR> <STDERR<>STDERR>stderr<STDERR<>STDERR> <STDERR<>STDERR>1<STDERR<>STDERR>
>STDERR>write to stderr 1
<STDERR<write to stdout 1
>STDERR>write<STDERR<>STDERR> <STDERR<>STDERR>to<STDERR<>STDERR> <STDERR<>STDERR>stdout<STDERR<>STDERR> <STDERR<>STDERR>which<STDERR<>STDERR> <STDERR<>STDERR>gets<STDERR<>STDERR> <STDERR<>STDERR>redirected<STDERR<>STDERR> <STDERR<>STDERR>to<STDERR<>STDERR> <STDERR<>STDERR>stderr<STDERR<>STDERR>
>STDERR>write to stdout which gets redirected to stderr
<STDERR<write to stdout 2
write to stderr which gets redirected to stdout
write to stdout 3
>STDERR>another<STDERR<>STDERR> <STDERR<>STDERR>redirect<STDERR<>STDERR> <STDERR<>STDERR>to<STDERR<>STDERR> <STDERR<>STDERR>stderr<STDERR<>STDERR>
>STDERR>another redirect to stderr
<STDERR<

View File

@@ -1,7 +1,4 @@
#!/bin/bash
# Use bash to get consistent test results, /bin/sh can point to multiple
# shells with different behaviour.
#!/bin/sh
# Copyright (C) 2013 Simon Ruderich
#

View File

@@ -1,3 +1,3 @@
write to stdout
>STDERR>write<STDERR<>STDERR> <STDERR<>STDERR>to<STDERR<>STDERR> <STDERR<>STDERR>stderr<STDERR<>STDERR>
>STDERR>write to stderr
<STDERR<write to stdout without newline>STDERR>write to stderr without newline<STDERR<

View File

@@ -1,3 +1,3 @@
>STDERR>Before vfork().
<STDERR<>STDERR>After vfork().
After vfork().
<STDERR<

View File

@@ -99,6 +99,11 @@ run_test() {
$valgrind_cmd "$@" "$testcase" > "$output" 2>&1
)
# Merge continuous regions of colored output. The exact calls don't matter
# as long as the output is colored.
sed 's/<STDERR<>STDERR>//g' < "$output" > "$output.tmp"
mv "$output.tmp" "$output"
diff -u "$expected" "$output" \
|| die 'failed!'
rm "$output"
@@ -118,7 +123,7 @@ test_script() {
run_test "$srcdir/$testcase" "$srcdir/$expected.expected" "$@"
}
test_script_subshell() {
test_script "$1" "$2" bash -c 'bash $1' ''
test_script "$1" "$2" sh -c 'sh $1' ''
}
test_program() {
testcase="$1"