summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-03-15 00:30:06 +0100
committerJo-Philipp Wich <jo@mein.io>2022-03-15 23:15:12 +0100
commit0d05cb5eb07d19275370e3daa5da22dfc08786b1 (patch)
tree7bee6baa47272f27eb627b2478cd4d8a39ae0f44 /tests
parent271e5207386da2fbbf3d777beb34595b9ba21d83 (diff)
tests: run_tests.sh: use greadlink if available
This ensures that GNU readlink is preferred over OS X own readlink when executing test cases. This is required due to lacking `-f` flag support on OS X. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/custom/run_tests.sh14
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/custom/run_tests.sh b/tests/custom/run_tests.sh
index c2839df..8063747 100755
--- a/tests/custom/run_tests.sh
+++ b/tests/custom/run_tests.sh
@@ -1,7 +1,13 @@
#!/usr/bin/env bash
+if greadlink -f . &>/dev/null; then
+ readlink=greadlink
+else
+ readlink=readlink
+fi
+
testdir=$(dirname "$0")
-topdir=$(readlink -f "$testdir/../..")
+topdir=$($readlink -f "$testdir/../..")
line='........................................'
ucode_bin=${UCODE_BIN:-"$topdir/ucode"}
@@ -44,7 +50,7 @@ extract_sections() {
tag="file"
outfile="${line#-- File }"
outfile="$(echo "${outfile% --}" | xargs)"
- outfile="$dir/files$(readlink -m "/${outfile:-file}")"
+ outfile="$dir/files$($readlink -m "/${outfile:-file}")"
mkdir -p "$(dirname "$outfile")"
printf "" > "$outfile"
;;
@@ -200,14 +206,14 @@ n_fails=0
select_tests="$@"
use_test() {
- local input="$(readlink -f "$1")"
+ local input="$($readlink -f "$1")"
local test
[ -f "$input" ] || return 1
[ -n "$select_tests" ] || return 0
for test in "$select_tests"; do
- test="$(readlink -f "$test")"
+ test="$($readlink -f "$test")"
[ "$test" != "$input" ] || return 0
done