From c83f5de38e7d6fdf21b7ce063db4ec8526643391 Mon Sep 17 00:00:00 2001 From: "raviteja.karumuri" Date: Thu, 23 May 2024 15:22:13 +0100 Subject: [PATCH] Fixing 'oransc-nonrtric-verify-bash' not exiting with error, If error occurs Issue-ID: NONRTRIC-1004 Change-Id: I3755bc1469bc94c6e9d5298638f79768a00029a0 Signed-off-by: Raviteja Karumuri --- test/auto-test/Suite-Verify-jobs.sh | 4 +++- test/auto-test/verify-jobs-nonrtric.sh | 3 +++ test/common/testsuite_common.sh | 14 ++++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/test/auto-test/Suite-Verify-jobs.sh b/test/auto-test/Suite-Verify-jobs.sh index d53af8fb..ef97938d 100644 --- a/test/auto-test/Suite-Verify-jobs.sh +++ b/test/auto-test/Suite-Verify-jobs.sh @@ -31,4 +31,6 @@ suite_setup ########################################## -suite_complete \ No newline at end of file +suite_complete + +exit diff --git a/test/auto-test/verify-jobs-nonrtric.sh b/test/auto-test/verify-jobs-nonrtric.sh index 7bee3fa5..625eff41 100644 --- a/test/auto-test/verify-jobs-nonrtric.sh +++ b/test/auto-test/verify-jobs-nonrtric.sh @@ -51,6 +51,7 @@ fi cd "$TEST_DIRECTORY" sudo chmod 775 "$TEST_SCRIPT" "$TEST_SCRIPT" remote-remove docker release --env-file ../common/test_env-oran-h-release.sh +exit_val=$? # Remove docker-compose after tests are done if command -v docker-compose &> /dev/null; then @@ -62,3 +63,5 @@ if command -v jq &> /dev/null; then echo "Removing jq..." sudo apt-get remove -y jq fi + +exit $exit_val diff --git a/test/common/testsuite_common.sh b/test/common/testsuite_common.sh index 4117cdb3..57285103 100644 --- a/test/common/testsuite_common.sh +++ b/test/common/testsuite_common.sh @@ -94,8 +94,8 @@ suite_complete() { total=$((TCSUITE_PASS_CTR+TCSUITE_FAIL_CTR)) if [ $TCSUITE_CTR -eq 0 ]; then - echo -e "\033[1mNo test cases seem to have executed. Check the script....\033[0m" - elif [ $total != $TCSUITE_CTR ]; then + echo -e "\033[1mNo test cases seem to have executed. Check the script....\033[0m" + elif [ $total != $TCSUITE_CTR ]; then echo -e "\033[1mTotal number of test cases does not match the sum of passed and failed test cases. Check the script....\033[0m" fi echo "Number of test cases : " $TCSUITE_CTR @@ -108,7 +108,13 @@ suite_complete() { echo "FAIL test cases" cat .tmp_tcsuite_fail echo "" + if [ $TCSUITE_FAIL_CTR -ne 0 ]; then + echo "################################### Test suite completed with Tests FAIL ##############################" + echo "#################################################################################################" + else + echo "################################### Test suite completed ##############################" + echo "#################################################################################################" + fi - echo "################################### Test suite completed ##############################" - echo "#################################################################################################" + exit $TCSUITE_FAIL_CTR } \ No newline at end of file -- 2.16.6