summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2021-06-27 11:48:41 +0200
committerJakob Unterwurzacher2021-06-27 11:48:41 +0200
commitdb81614cd660372c836e8c5b1cf975d0df5dbbd0 (patch)
treeae5c4c021d7a2c5fd0a28253e894030bf203f3d2
parent2a9d70d48f4cc715a6864849cdec91ab08b6fd03 (diff)
canonical-benchmarks.bash: handle relative paths
Passing a relative path was broken because we cd'ed away first.
-rwxr-xr-xtests/canonical-benchmarks.bash10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/canonical-benchmarks.bash b/tests/canonical-benchmarks.bash
index 71563ab..7b37601 100755
--- a/tests/canonical-benchmarks.bash
+++ b/tests/canonical-benchmarks.bash
@@ -6,20 +6,24 @@
#
# This is called by the top-level script "benchmark.bash".
-cd "$(dirname "$0")"
+
MYNAME=$(basename "$0")
-MD5="$PWD/stress_tests/linux-3.0.md5sums"
if [ $# -ne 1 ]; then
echo "usage: $MYNAME TESTDIR"
exit 1
fi
+# Resolve possible relative TESTDIR path before cd'ing away
+TESTDIR=$(realpath "$1")
+
# Download /tmp/linux-3.0.tar.gz
+cd "$(dirname "$0")"
+MD5="$PWD/stress_tests/linux-3.0.md5sums"
./dl-linux-tarball.bash
# cd to TESTDIR
-cd "$1"
+cd "$TESTDIR"
# Execute command, discard all stdout output, print elapsed time
# (to stderr, unfortunately).