]> ruderich.org/simon Gitweb - coloredstderr/coloredstderr.git/blobdiff - tests/lib.sh
tests: Also run tests in subshell with LD_PRELOAD set.
[coloredstderr/coloredstderr.git] / tests / lib.sh
index 88bcbbe62a5614c6ee5c38f1880a125f5cdd2d6c..53a2ea444602a09399fd1b5b595e5ce90a03ae28 100644 (file)
@@ -74,7 +74,7 @@ run_test() {
             export COLORED_STDERR_FORCE_WRITE
         fi
 
-        "$testcase" > output 2>&1
+        "$@" "$testcase" > output 2>&1
     )
 
     diff -u "$expected" output \
@@ -84,8 +84,18 @@ run_test() {
 }
 
 test_script() {
-    run_test "$srcdir/$1" "$srcdir/$1.expected"
+    testcase="$1"
+    shift
+    run_test "$srcdir/$testcase" "$srcdir/$testcase.expected" "$@"
+}
+test_script_subshell() {
+    test_script "$1" bash -c 'bash $1' ''
 }
 test_program() {
-    run_test "$builddir/$1" "$srcdir/$1.expected"
+    testcase="$1"
+    shift
+    run_test "$builddir/$testcase" "$srcdir/$testcase.expected" "$@"
+}
+test_program_subshell() {
+    test_program "$1" sh -c '$1' ''
 }