From abf52845e929fab3c54c4d3514bc9c37e6650f37 Mon Sep 17 00:00:00 2001 From: Yaroslav Stefinko Date: Tue, 15 Sep 2020 14:07:36 +0300 Subject: [PATCH] Fix bug in script,catch crashes too (#1056) Add verification of exitcode is not-zero after gtest run of functional test. Relates-To: OLPEDGE-2297 Signed-off-by: Yaroslav Stefinko --- scripts/linux/fv/gitlab_test_fv.sh | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/scripts/linux/fv/gitlab_test_fv.sh b/scripts/linux/fv/gitlab_test_fv.sh index 79f4b73c1..179c1ac20 100755 --- a/scripts/linux/fv/gitlab_test_fv.sh +++ b/scripts/linux/fv/gitlab_test_fv.sh @@ -46,7 +46,7 @@ ulimit -c unlimited # Stop after 2nd retry. source ${FV_HOME}/olp-cpp-sdk-functional-test.variables set +e -for RETRY_COUNT in 1 2 +for RETRY_COUNT in 1 2 3 do echo "This is (${RETRY_COUNT}) time run ..." @@ -55,15 +55,20 @@ do if [[ $? -eq 1 ]]; then # Functional test failed with exit code 1 means some tests failed + # But we handle flacky test and repeat up to 3 times TEST_FAILURE=1 sleep 10 + elif [[ $? -gt 1 ]]; then + # Functional test crashed + result=$? + set -e + exit $result else # Return to success TEST_FAILURE=0 break fi done -set -e # End of retry part. This part can be removed any time later or after all online tests are stable. # Run functional tests with Mock Server @@ -88,19 +93,18 @@ ${FV_HOME}/gitlab-olp-cpp-sdk-dataservice-write-test.sh || TEST_FAILURE=1 # Lines below are added for pretty data sum-up and finalize results of this script is case of FAILURE -set +x # to avoid dirty output at the end on logs -if [[ ${TEST_FAILURE} == 1 ]]; then - export REPORT_COUNT=$(ls ${REPO_HOME}/reports | wc -l) - if [[ ${REPORT_COUNT} -ne ${EXPECTED_REPORT_COUNT} || ${REPORT_COUNT} == 0 ]]; then - echo "##################################################################################################" - echo "CRASH ERROR. One of test groups contains crash. Report was not generated for that group ! " - echo "##################################################################################################" - fi +# set +x to avoid dirty output at the end on logs +set +x +export REPORT_COUNT=$(ls ${REPO_HOME}/reports | wc -l) +if [[ ${REPORT_COUNT} -ne ${EXPECTED_REPORT_COUNT} || ${REPORT_COUNT} == 0 ]]; then + echo "##################################################################################################" + echo "CRASH ERROR. One of test groups contains crash. Report was not generated for that group ! " + echo "##################################################################################################" + TEST_FAILURE=1 else echo "OK. Full list of test reports was generated. " fi - for failreport in $(ls ${REPO_HOME}/reports/*.xml) do echo "Parsing ${failreport} ..."