From 19e7b4798e2a91d30f697c71b9cd365bf8a6ba7a Mon Sep 17 00:00:00 2001 From: Aurelien Bouteiller Date: Wed, 23 Apr 2025 10:21:35 -0400 Subject: [PATCH] Show and log what the functional test driver is running (#70) Show and log what the functional test driver is running * Log errors in the log file * list all failed tests at the end * pretty colors :x * Print stderr when the test has failed --------- Signed-off-by: Aurelien Bouteiller [ROCm/rocshmem commit: 67bc5b9e5a0aa782a2a45d46aaba2ceba2b581e7] --- .../scripts/functional_tests/driver.sh | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/projects/rocshmem/scripts/functional_tests/driver.sh b/projects/rocshmem/scripts/functional_tests/driver.sh index 80d249ef14..21a34aa890 100755 --- a/projects/rocshmem/scripts/functional_tests/driver.sh +++ b/projects/rocshmem/scripts/functional_tests/driver.sh @@ -23,6 +23,13 @@ ############################################################################### #!/bin/bash +if true || tty -s; then + PRETTY_FAILED="\033[1;31mFAILED\033[0m" + PRETTY_PASSED="\033[1;32mPASSED\033[0m" +else + PRETTY_FAILED="FAILED" + PRETTY_PASSED="PASSED" +fi # This names/values should match the TestType enum in rocSHMEM/tests/functional_tests/tester.hpp declare -A TEST_NUMBERS=( @@ -146,17 +153,20 @@ ExecTest() { TEST_LOG_NAME+=_"$MAX_MSG_SIZE"B fi - CMD+=" > $LOG_DIR/$TEST_LOG_NAME.log" + CMD+=" >> $LOG_DIR/$TEST_LOG_NAME.log 2>&1" # Run Test echo $TEST_LOG_NAME + echo "# $CMD" >"$LOG_DIR/$TEST_LOG_NAME.log" eval $CMD # Validate Test if [ $? -ne 0 ] then - echo "Failed $TEST_CONFIG" >&2 + echo -e "$PRETTY_FAILED: $TEST_LOG_NAME" >&2 + cat "$LOG_DIR/$TEST_LOG_NAME.log" DRIVER_RETURN_STATUS=1 + FAILED_LIST="$FAILED_LIST $TEST_LOG_NAME" fi unset ROCSHMEM_MAX_NUM_CONTEXTS @@ -488,4 +498,10 @@ case $TEST in ;; esac -exit $(($DRIVER_RETURN_STATUS || $?)) +EXIT_STATUS=$(($DRIVER_RETURN_STATUS || $?)) +if [ $EXIT_STATUS -eq 0 ]; then + echo -e "TESTS PASSED" +else + echo -e "TESTS FAILED: $FAILED_LIST" +fi +exit $EXIT_STATUS