>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<
>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<
->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<
\ No newline at end of file
-#!/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
#
->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<
\ No newline at end of file
-#!/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
#
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<
\ No newline at end of file
>STDERR>Before vfork().
-<STDERR<>STDERR>After vfork().
+After vfork().
<STDERR<
$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"
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"