Skip to content

Commit

Permalink
Fix bug in script,catch crashes too (#1056)
Browse files Browse the repository at this point in the history
Add verification of exitcode is not-zero after gtest run
of functional test.

Relates-To: OLPEDGE-2297

Signed-off-by: Yaroslav Stefinko <[email protected]>
  • Loading branch information
ystefinko authored Sep 15, 2020
1 parent 482d553 commit abf5284
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions scripts/linux/fv/gitlab_test_fv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..."

Expand All @@ -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
Expand All @@ -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} ..."
Expand Down

0 comments on commit abf5284

Please sign in to comment.