summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2021-04-01 19:24:31 +0200
committerJo-Philipp Wich <jo@mein.io>2021-04-24 23:44:04 +0200
commit93ededbe93ff1e5949387996b69892c9220a94e8 (patch)
treeb350c7c0dee70e2477cdc4ff3edd987fb32d0c37 /tests
parent0e4a3872ab466e715c84a379a53dfce9f4f9aebc (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-xtests/custom/run_tests.sh12
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]_}"