1919typedef struct r2r_state_t {
2020 R2RRunConfig run_config ;
2121 bool verbose ;
22+ bool quiet ;
2223 R2RTestDatabase * db ;
2324 PJ * test_results ;
2425
@@ -358,6 +359,7 @@ int main(int argc, char **argv) {
358359 goto beach ;
359360 case 'q' :
360361 quiet = true;
362+ r_log_set_quiet (true);
361363 break ;
362364 case 'v' :
363365 if (quiet ) {
@@ -508,6 +510,7 @@ int main(int argc, char **argv) {
508510 state .run_config .json_test_file = json_test_file ? json_test_file : JSON_TEST_FILE_DEFAULT ;
509511 state .run_config .timeout_ms = (timeout_sec > UT64_MAX / 1000 ) ? UT64_MAX : timeout_sec * 1000 ;
510512 state .verbose = verbose ;
513+ state .quiet = quiet ;
511514 state .db = r2r_test_database_new ();
512515 if (!state .db ) {
513516 return -1 ;
@@ -610,7 +613,9 @@ int main(int argc, char **argv) {
610613
611614 R_FREE (cwd );
612615 uint32_t loaded_tests = r_pvector_length (& state .db -> tests );
613- printf ("Loaded %u tests.\n" , loaded_tests );
616+ if (!state .quiet ) {
617+ printf ("Loaded %u tests.\n" , loaded_tests );
618+ }
614619 if (nothing ) {
615620 goto coast ;
616621 }
@@ -692,8 +697,6 @@ int main(int argc, char **argv) {
692697
693698 r_th_lock_leave (state .lock );
694699
695- printf ("\n" );
696-
697700 void * * it ;
698701 r_pvector_foreach (& workers , it ) {
699702 RThread * th = * it ;
@@ -702,14 +705,17 @@ int main(int argc, char **argv) {
702705 }
703706 r_pvector_clear (& workers );
704707
705- ut64 seconds = (r_time_now_mono () - time_start ) / 1000000 ;
706- printf ("Finished in" );
707- if (seconds > 60 ) {
708- ut64 minutes = seconds / 60 ;
709- printf (" %" PFMT64d " minutes and" , seconds / 60 );
710- seconds -= (minutes * 60 );
708+ if (!state .quiet ) {
709+ printf ("\n" );
710+ ut64 seconds = (r_time_now_mono () - time_start ) / 1000000 ;
711+ printf ("Finished in" );
712+ if (seconds > 60 ) {
713+ ut64 minutes = seconds / 60 ;
714+ printf (" %" PFMT64d " minutes and" , seconds / 60 );
715+ seconds -= (minutes * 60 );
716+ }
717+ printf (" %" PFMT64d " seconds.\n" , seconds % 60 );
711718 }
712- printf (" %" PFMT64d " seconds.\n" , seconds % 60 );
713719
714720 if (output_file ) {
715721 pj_end (state .test_results );
@@ -1044,7 +1050,12 @@ static void print_new_results(R2RState *state, ut64 prev_completed) {
10441050 if (state -> test_results && !result -> run_skipped ) {
10451051 test_result_to_json (state -> test_results , result );
10461052 }
1047- if (!state -> verbose && (result -> result == R2R_TEST_RESULT_OK || result -> result == R2R_TEST_RESULT_FIXED || result -> result == R2R_TEST_RESULT_BROKEN )) {
1053+ /* In quiet mode only print failing tests; otherwise follow verbose flag rules */
1054+ if (state -> quiet ) {
1055+ if (result -> result != R2R_TEST_RESULT_FAILED ) {
1056+ continue ;
1057+ }
1058+ } else if (!state -> verbose && (result -> result == R2R_TEST_RESULT_OK || result -> result == R2R_TEST_RESULT_FIXED || result -> result == R2R_TEST_RESULT_BROKEN )) {
10481059 continue ;
10491060 }
10501061 char * name = r2r_test_name (result -> test );
@@ -1087,9 +1098,13 @@ static void print_state(R2RState *state, ut64 prev_completed) {
10871098#if R2__WINDOWS__
10881099 setvbuf (stdout , NULL , _IOFBF , 8192 );
10891100#endif
1101+ /* Always print new failing results; in quiet mode skip summary/status line */
10901102 print_new_results (state , prev_completed );
1103+ if (state -> quiet ) {
1104+ return ;
1105+ }
10911106
1092- // [x/x] OK 42 BR 0 ...
1107+ /* [x/x] OK 42 BR 0 ... */
10931108 printf (R_CONS_CLEAR_LINE );
10941109 ut64 a = (ut64 )r_pvector_length (& state -> results );
10951110 ut64 b = (ut64 )r_pvector_length (& state -> db -> tests );
@@ -1107,7 +1122,11 @@ static void print_state(R2RState *state, ut64 prev_completed) {
11071122}
11081123
11091124static void print_log (R2RState * state , ut64 prev_completed , ut64 prev_paths_completed ) {
1125+ /* Always print new failing results; in quiet mode skip per-path summaries */
11101126 print_new_results (state , prev_completed );
1127+ if (state -> quiet ) {
1128+ return ;
1129+ }
11111130 ut64 paths_completed = r_pvector_length (& state -> completed_paths );
11121131 int a = r_pvector_length (& state -> queue );
11131132 for (; prev_paths_completed < paths_completed ; prev_paths_completed ++ ) {
0 commit comments