From 374b11a3140bcbd9a211f52ad19195f87c79d0bc Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Wed, 5 Jun 2013 01:06:10 +0200 Subject: [PATCH] tests: Also run tests in subshell with LD_PRELOAD set. --- tests/lib.sh | 16 +++++++++++++--- tests/run.sh | 5 +++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/lib.sh b/tests/lib.sh index 88bcbbe..53a2ea4 100644 --- a/tests/lib.sh +++ b/tests/lib.sh @@ -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' '' } diff --git a/tests/run.sh b/tests/run.sh index 1dc800f..56ea950 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -34,3 +34,8 @@ test_script example-simple.sh test_script example-redirects.sh test_program example test_program example_vfork + +test_script_subshell example-simple.sh +test_script_subshell example-redirects.sh +test_program_subshell example +test_program_subshell example_vfork -- 2.45.2