diff mbox series

run-posix-option-group-test.sh: Log and exit if one attempts to run tests without compiling

Message ID 20220607220853.50868-1-sturlapati@vmware.com
State Superseded
Headers show
Series run-posix-option-group-test.sh: Log and exit if one attempts to run tests without compiling | expand

Commit Message

shatur.linux@gmail.com June 7, 2022, 10:08 p.m. UTC
From: Sharan Turlapati <sturlapati@vmware.com>

Currently, run-posix-option-group-test.sh erroneously
logs "***Tests Completed***" when no test has actually run if the script is invoked
to run without actually compiling the tests.

Check if the .run-test files actually exist before attempting to run them.
If not found, log a message indicating the problem and suggest to check if
the tests were compiled. Exit the script without attempting to run other
tests.

Signed-off-by: Sharan Turlapati <sturlapati@vmware.com>
---
 .../bin/run-posix-option-group-test.sh              | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/testcases/open_posix_testsuite/bin/run-posix-option-group-test.sh b/testcases/open_posix_testsuite/bin/run-posix-option-group-test.sh
index 0d4c9bd80..56773f0f0 100755
--- a/testcases/open_posix_testsuite/bin/run-posix-option-group-test.sh
+++ b/testcases/open_posix_testsuite/bin/run-posix-option-group-test.sh
@@ -22,9 +22,16 @@  EOF
 
 run_option_group_tests()
 {
-	for test_script in $(find $1 -name '*.run-test' | sort); do
-		(cd "$(dirname "$test_script")" && ./$(basename "$test_script"))
-	done
+	list_of_tests=`find $1 -name '*.run-test' | sort`
+	if [[ -n $list_of_tests ]]
+	then
+		for test_script in $list_of_tests; do
+			(cd "$(dirname "$test_script")" && ./$(basename "$test_script"))
+		done
+	else
+		echo ".run-test files not found under $1. Were the tests compiled?"
+		exit 1
+	fi
 }
 
 case $1 in