From 93ededbe93ff1e5949387996b69892c9220a94e8 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 1 Apr 2021 19:24:31 +0200 Subject: tests: allow executing run_tests.sh from any directory Signed-off-by: Jo-Philipp Wich --- tests/custom/run_tests.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/custom/run_tests.sh b/tests/custom/run_tests.sh index 2364914..b20404a 100755 --- a/tests/custom/run_tests.sh +++ b/tests/custom/run_tests.sh @@ -1,7 +1,10 @@ #!/usr/bin/env bash +testdir=$(dirname "$0") +topdir=$(readlink -f "$testdir/../..") + line='........................................' -ucode_bin=${UCODE_BIN:-./ucode} +ucode_bin=${UCODE_BIN:-"$topdir/ucode"} extract_sections() { local file=$1 @@ -48,7 +51,10 @@ run_testcase() { local code=$6 local fail=0 - $ucode_bin -e '{ "REQUIRE_SEARCH_PATH": [ "./lib/*.so" ] }' -i - <"$in" >"$dir/res.out" 2>"$dir/res.err" + ( + cd "$topdir" + $ucode_bin -e '{ "REQUIRE_SEARCH_PATH": [ "'"$topdir"'/*.so" ] }' -i - <"$in" >"$dir/res.out" 2>"$dir/res.err" + ) touch "$dir/empty" printf "%d\n" $? > "$dir/res.code" @@ -163,7 +169,7 @@ use_test() { return 1 } -for catdir in [0-9][0-9]_*; do +for catdir in "$testdir/"[0-9][0-9]_*; do [ -d "$catdir" ] || continue printf "\n##\n## Running %s tests\n##\n\n" "${catdir##*/[0-9][0-9]_}" -- cgit v1.2.3