From ec654d4682fd67f3329c45d6e5082cb78e1aae28 Mon Sep 17 00:00:00 2001 From: Paul Wise Date: Wed, 31 Mar 2021 15:32:45 +0800 Subject: [PATCH] Be more flexible about the path to sharness Some folks might want to run a different version. Check all the common installation paths and support using a custom path to sharness. --- test/test-lib.sh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/test/test-lib.sh b/test/test-lib.sh index b14e32c..dda172f 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -1,6 +1,24 @@ #!/bin/sh -. ./sharness.sh +if [ -z "$SHARNESS" ] ; then + for d in \ + "." \ + "$HOME/share/sharness" \ + "/usr/local/share/sharness" \ + "/usr/share/sharness" + do + f="$d/sharness.sh" + if [ -f "$f" ] ; then + SHARNESS="$f" + fi + done +fi +if [ -z "$SHARNESS" ] || [ ! -f "$SHARNESS" ] ; then + echo "sharness.sh not found" >&2 + exit 1 +fi + +. "$SHARNESS" test_set_prereq PYTHON