From 68367b9577fdf1578b66008e5e1cb37070098b1b Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Fri, 28 Apr 2023 20:23:05 -0500 Subject: [PATCH] Bugfix: Incorrect return code in tests causes false failures in CI. Recent changes of the code change the "failure" variable from being an empty string for no error to being the explicit digit of "0". The change is incomplete and this caused the false failure by incorrectly returning "1" when instead "0" should be returned. The Gitlab CI detected this but the Github CI failed to. --- build/scripts/test.sh | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/build/scripts/test.sh b/build/scripts/test.sh index f99c46f..47381e4 100644 --- a/build/scripts/test.sh +++ b/build/scripts/test.sh @@ -63,7 +63,7 @@ test_main() { local test_thread_individual="thread_individual" local context= - local failure= + local failure=0 local operation= local operation_failure= local verbosity=normal @@ -308,18 +308,18 @@ test_main() { fi if [[ ${verbosity} != "quiet" ]] ; then - if [[ ${failure} != "" || ${verbosity} != "error" ]] ; then + if [[ ${failure} -eq 1 || ${verbosity} != "error" ]] ; then test_print_last fi fi test_cleanup - if [[ ${failure} == "" ]] ; then - return 0 + if [[ ${failure} -eq 1 ]] ; then + return 1 fi - return 1 + return 0 } test_handle_colors() { @@ -498,11 +498,11 @@ test_operate_build_individual() { cd ${path_original} done - if [[ ${failure} == "" ]] ; then - return 0 + if [[ ${failure} -eq 1 ]] ; then + return 1 fi - return 1 + return 0 } test_operate_build_project() { @@ -683,11 +683,11 @@ test_operate_build_tools() { cd ${path_original} - if [[ ${failure} == "" ]] ; then - return 0 + if [[ ${failure} -eq 1 ]] ; then + return 1 fi - return 1 + return 0 } test_operate_ci_prebuild() { @@ -715,11 +715,11 @@ test_operate_ci_prebuild() { cd ${path_original} - if [[ ${failure} == "" ]] ; then - return 0 + if [[ ${failure} -eq 1 ]] ; then + return 1 fi - return 1 + return 0 } test_operate_ci_pretest() { @@ -747,11 +747,11 @@ test_operate_ci_pretest() { cd ${path_original} - if [[ ${failure} == "" ]] ; then - return 0 + if [[ ${failure} -eq 1 ]] ; then + return 1 fi - return 1 + return 0 } test_operate_ci_pretest_cmocka() { @@ -1030,7 +1030,7 @@ test_operate_tests() { let failure=1 fi - if [[ ${failure} == "" ]] ; then + if [[ ${failure} -eq 0 ]] ; then if [[ ! -f ${path_test_package_individual}${project}-${version}/data/build/testfile ]] ; then if [[ $(echo ${projects_no_tests} | grep -o "\<${project}\>") == "" ]] ; then if [[ ${verbosity} == "verbose" || ${verbosity} == "debug" ]] ; then @@ -1048,7 +1048,7 @@ test_operate_tests() { fi fi - if [[ ${failure} == "" ]] ; then + if [[ ${failure} -eq 0 ]] ; then if [[ ${verbosity} == "debug" ]] ; then test_print_first_or_always @@ -1070,7 +1070,7 @@ test_operate_tests() { fi fi - if [[ ${failure} == "" ]] ; then + if [[ ${failure} -eq 0 ]] ; then if [[ ${verbosity} == "debug" ]] ; then test_print_first_or_always @@ -1102,16 +1102,16 @@ test_operate_tests() { cd ${path_original} - if [[ ${failure} != "" ]] ; then + if [[ ${failure} -eq 1 ]] ; then break; fi done - if [[ ${failure} == "" ]] ; then - return 0 + if [[ ${failure} -eq 1 ]] ; then + return 1 fi - return 1 + return 0 } test_print_first() { -- 1.8.3.1