From ae3118b96af59bedbf6d600d5c1bf58a6462f2a4 Mon Sep 17 00:00:00 2001 From: Radoslaw Wicik Date: Tue, 1 Jun 2021 14:09:15 +0200 Subject: [PATCH] [EGD-6875] Fix UT check script Fix error causing bad tests where passing unnoticed. --- Jenkinsfile | 2 ++ enabled_unittests | 1 - tools/run_unittests.sh | 18 +++++++++++++++--- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8ad8c3eb8e8bf6a2d66e90705f9dd0a1804a50a7..8e9e50977e5c6355bfd50a4b2ee8f6cf0b33d750 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -148,7 +148,9 @@ export JOBS=${JOBS:-6} echo "JOBS=${JOBS}" pushd "${WORKSPACE}" ./tools/run_unittests.sh enabled_unittests +set +e ./tools/check_unittests.sh +set -e pushd build-linux-Debug ./googletest-gui popd diff --git a/enabled_unittests b/enabled_unittests index 37593c93fbbca76db21385997f7045c3c70ba13f..c73b24f2fef9e697b130622b00b2884da5d64d76 100644 --- a/enabled_unittests +++ b/enabled_unittests @@ -248,7 +248,6 @@ TESTS_LIST["catch2-service-db"]=" Settings Messages; Quotes; Factory Settings; - Factory Settings Init; " #--------- TESTS_LIST["catch2-service-db-settings"]=" diff --git a/tools/run_unittests.sh b/tools/run_unittests.sh index 35df51f6ba8be33ed45c1744e95a3017bf117000..2629ef4f5bc373d609373fbd34cb73d0ee9379fd 100755 --- a/tools/run_unittests.sh +++ b/tools/run_unittests.sh @@ -1,4 +1,4 @@ -#!/bin/bash -e +#!/bin/bash # Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. # For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md @@ -27,6 +27,8 @@ if [[ $# -ne 1 ]]; then exit 1 fi +source ${root_dir}/config/common_scripsts_lib + TESTS_FILE=$1 if [[ ! -r ${TESTS_FILE} ]]; then @@ -50,8 +52,18 @@ do do CUR_TEST=$( trim ${TESTS[$I]}) if [[ -n "${CUR_TEST}" ]]; then - echo ${TEST_BINARY} \"${CUR_TEST}\" - ./${TEST_BINARY} "${CUR_TEST}" | tee ${run_logs} + echo -en "${TEST_BINARY} \"${CUR_TEST}\":" + ./${TEST_BINARY} "${CUR_TEST}" --use-colour=yes > ${run_logs} + RESULT=$? + + if [[ ${RESULT} -eq 0 ]]; then + echo -e "${OK}" + else + echo -e "${ERROR}" + cat ${run_logs} + exit 1 + fi + CHK_IF_RUN=`cat ${run_logs} | grep "No tests ran" || true` echo "---$CHK_IF_RUN---" if [[ -n "${CHK_IF_RUN}" ]]; then