@@ -675,7 +675,7 @@ static int z_ztest_run_test_suite_ptr(struct ztest_suite_node *suite)
675675 int fail = 0 ;
676676 int tc_result = TC_PASS ;
677677
678- if (test_status != ZTEST_STATUS_OK ) {
678+ if (test_status < 0 ) {
679679 return test_status ;
680680 }
681681
@@ -766,7 +766,7 @@ static int z_ztest_run_test_suite_ptr(struct ztest_suite_node *suite)
766766 }
767767#endif
768768
769- if (test_status == ZTEST_STATUS_OK && fail != 0 && FAIL_FAST ) {
769+ if (test_status == ZTEST_STATUS_OK && fail != 0 ) {
770770 test_status = ZTEST_STATUS_HAS_FAILURE ;
771771 }
772772 }
@@ -882,28 +882,15 @@ static void __ztest_show_suite_summary_verbose(struct ztest_suite_node *suite)
882882 tc_result = TC_SKIP ;
883883 } else if (test -> stats -> pass_count == test -> stats -> run_count ) {
884884 tc_result = TC_PASS ;
885- } else if (test -> stats -> pass_count == 0 ) {
886- tc_result = TC_FAIL ;
887885 } else {
888- tc_result = TC_FLAKY ;
886+ tc_result = TC_FAIL ;
889887 }
890888
891- if (tc_result == TC_FLAKY ) {
892- TC_SUMMARY_PRINT (" - %s - [%s.%s] - (Failed %d of %d attempts)"
893- " - duration = %u.%03u seconds\n" ,
894- TC_RESULT_TO_STR (tc_result ),
895- test -> test_suite_name , test -> name ,
896- test -> stats -> run_count - test -> stats -> pass_count ,
897- test -> stats -> run_count ,
898- test -> stats -> duration_worst_ms / 1000 ,
899- test -> stats -> duration_worst_ms % 1000 );
900- } else {
901- TC_SUMMARY_PRINT (" - %s - [%s.%s] duration = %u.%03u seconds\n" ,
902- TC_RESULT_TO_STR (tc_result ),
903- test -> test_suite_name , test -> name ,
904- test -> stats -> duration_worst_ms / 1000 ,
905- test -> stats -> duration_worst_ms % 1000 );
906- }
889+ TC_SUMMARY_PRINT (" - %s - [%s.%s] duration = %u.%03u seconds\n" ,
890+ TC_RESULT_TO_STR (tc_result ),
891+ test -> test_suite_name , test -> name ,
892+ test -> stats -> duration_worst_ms / 1000 ,
893+ test -> stats -> duration_worst_ms % 1000 );
907894
908895 if (flush_frequency % 3 == 0 ) {
909896 /** Reduce the flush frequencey a bit to speed up the output */
@@ -943,6 +930,7 @@ static int __ztest_run_test_suite(struct ztest_suite_node *ptr, const void *stat
943930
944931 for (int i = 0 ; i < NUM_ITER_PER_SUITE ; i ++ ) {
945932 if (ztest_api .should_suite_run (state , ptr )) {
933+ __ztest_init_unit_test_result_for_suite (ptr );
946934 int fail = z_ztest_run_test_suite_ptr (ptr );
947935
948936 count ++ ;
@@ -970,9 +958,6 @@ int z_impl_ztest_run_test_suites(const void *state)
970958 memset (suites_to_run , 0 , ZTEST_SUITE_COUNT * sizeof (struct ztest_suite_node * ));
971959 z_ztest_shuffle ((void * * )suites_to_run , (intptr_t )_ztest_suite_node_list_start ,
972960 ZTEST_SUITE_COUNT , sizeof (struct ztest_suite_node ));
973- for (size_t i = 0 ; i < ZTEST_SUITE_COUNT ; ++ i ) {
974- __ztest_init_unit_test_result_for_suite (suites_to_run [i ]);
975- }
976961 for (size_t i = 0 ; i < ZTEST_SUITE_COUNT ; ++ i ) {
977962 count += __ztest_run_test_suite (suites_to_run [i ], state );
978963 /* Stop running tests if we have a critical error or if we have a failure and
@@ -986,7 +971,6 @@ int z_impl_ztest_run_test_suites(const void *state)
986971#else
987972 for (struct ztest_suite_node * ptr = _ztest_suite_node_list_start ;
988973 ptr < _ztest_suite_node_list_end ; ++ ptr ) {
989- __ztest_init_unit_test_result_for_suite (ptr );
990974 count += __ztest_run_test_suite (ptr , state );
991975 /* Stop running tests if we have a critical error or if we have a failure and
992976 * FAIL_FAST was set
0 commit comments