X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=tests%2Flib.sh;h=08309c7401af00ffd5572d7d3a386a92019e890b;hb=b926752fac0fc420ae8e8d78c26f1815d35e89ed;hp=3427b5608fc36cdf7dca0824fbca4b4f97979f73;hpb=d5b84811d2f4bded83211984c839a096872608af;p=coloredstderr%2Fcoloredstderr.git diff --git a/tests/lib.sh b/tests/lib.sh index 3427b56..08309c7 100644 --- a/tests/lib.sh +++ b/tests/lib.sh @@ -40,7 +40,10 @@ fi LC_ALL=C unset LANGUAGE -# Set default COLORED_STDERR_FDS value. +# Clear user defined variables. +unset COLORED_STDERR_FDS +unset COLORED_STDERR_FORCE_WRITE +# Set default COLORED_STDERR_PRIVATE_FDS value. fds=2, @@ -78,9 +81,9 @@ run_test() { ( # Standard setup. LD_PRELOAD="$library" - COLORED_STDERR_FDS="$fds" + COLORED_STDERR_PRIVATE_FDS="$fds" export LD_PRELOAD - export COLORED_STDERR_FDS + export COLORED_STDERR_PRIVATE_FDS # Change pre/post strings for simpler testing. COLORED_STDERR_PRE='>STDERR>' @@ -96,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>//g' < "$output" > "$output.tmp" + mv "$output.tmp" "$output" + diff -u "$expected" "$output" \ || die 'failed!' rm "$output" @@ -115,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"