From 9fcf4cd8e5a0e3688fc2deefd36e65b927b45917 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 24 Sep 2023 22:35:27 +0200 Subject: [PATCH] run-gnu-test.sh: show if we can't find the file Otherwise, the error can be cryptic Co-authored-by: Daniel Hofstetter --- util/run-gnu-test.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/util/run-gnu-test.sh b/util/run-gnu-test.sh index 55ba8cefc..fde066ae1 100755 --- a/util/run-gnu-test.sh +++ b/util/run-gnu-test.sh @@ -33,7 +33,17 @@ if test $# -ge 1; then # if set, run only the tests passed SPECIFIC_TESTS="" for t in "$@"; do - SPECIFIC_TESTS="$SPECIFIC_TESTS $t" + + # Construct the full path + full_path="$path_GNU/$t" + + # Check if the file exists with .sh, .pl extension or without any extension in the $path_GNU directory + if [ -f "$full_path" ] || [ -f "$full_path.sh" ] || [ -f "$full_path.pl" ]; then + SPECIFIC_TESTS="$SPECIFIC_TESTS $t" + else + echo "Error: Test file $full_path, $full_path.sh, or $full_path.pl does not exist!" + exit 1 + fi done # trim it SPECIFIC_TESTS=$(echo $SPECIFIC_TESTS | xargs)