diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-04-01 19:24:31 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-04-24 23:44:04 +0200 |
commit | 93ededbe93ff1e5949387996b69892c9220a94e8 (patch) | |
tree | b350c7c0dee70e2477cdc4ff3edd987fb32d0c37 /tests | |
parent | 0e4a3872ab466e715c84a379a53dfce9f4f9aebc (diff) |
tests: allow executing run_tests.sh from any directory
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/custom/run_tests.sh | 12 |
1 files changed, 9 insertions, 3 deletions
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]_}" |