1
1
#include "config.h"
2
2
3
+ #include <getopt.h>
3
4
#include <stdio.h>
4
-
5
- #ifdef HAVE_UNISTD_H
6
- # include <unistd.h>
7
- #endif
8
-
9
- #ifdef HAVE_GETOPT_H
10
- # include <getopt.h>
11
- #endif
5
+ #include <stdlib.h>
6
+ #include <unistd.h>
12
7
13
8
#include <mpi.h>
14
9
@@ -50,7 +45,7 @@ int tst_atomic = 0;
50
45
tst_report_types tst_report = TST_REPORT_RUN ;
51
46
tst_mode_types tst_mode = TST_MODE_RELAXED ;
52
47
/*
53
- * Declaration of output_relevant data
48
+ * Declaration of output relevant data
54
49
* Do not remove or change the following without modifying tst_output.h!
55
50
*/
56
51
tst_output_stream tst_output ;
@@ -198,8 +193,6 @@ int main (int argc, char * argv[])
198
193
{
199
194
char hostname [256 ];
200
195
int delay ;
201
- /* XXX INC stdlib.h CN Needs stdlib.h so we should check in configure script
202
- */
203
196
delay = atoi (start_delay_str );
204
197
if (delay < 0 ) {
205
198
printf ("Warning: Delay time should be greater than zero! Using no delay now.\n" );
@@ -344,8 +337,7 @@ int main (int argc, char * argv[])
344
337
num_tests = 0 ;
345
338
346
339
str = strtok (optarg , "," );
347
- while (str )
348
- {
340
+ while (str ) {
349
341
/*
350
342
* In case we find the magic word all, we reset the list as above.
351
343
* In case we find a '^', deselect the test (test-class)
@@ -358,26 +350,25 @@ int main (int argc, char * argv[])
358
350
tst_test_array [i ] = i ;
359
351
num_tests ++ ;
360
352
}
361
- }
362
- else if ('^' == str [0 ])
363
- {
353
+ }
354
+ else if ('^' == str [0 ]) {
364
355
char tmp_str [TST_DESCRIPTION_LEN + 1 ];
365
356
366
357
INTERNAL_CHECK (if (strlen (str ) > TST_DESCRIPTION_LEN ) ERROR (EINVAL , "Name of test too long for negation" ));
367
358
368
359
strncpy (tmp_str , & (str [1 ]), TST_DESCRIPTION_LEN );
369
360
tst_test_deselect (tmp_str , tst_test_array , tst_test_array_max , & num_tests );
370
- }
371
- else if ('0' <= str [0 ] && '9' >= str [0 ])
372
- {
361
+ }
362
+ else if ('0' <= str [0 ] && '9' >= str [0 ]) {
373
363
int tmp_test = atoi (str );
374
364
if (0 > tmp_test || tst_test_array_max <= tmp_test )
375
365
ERROR (EINVAL , "Specified test number out of range" );
376
366
377
367
tst_test_array [num_tests ++ ] = tmp_test ;
378
- }
379
- else
368
+ }
369
+ else {
380
370
tst_test_select (str , tst_test_array , tst_test_array_max , & num_tests );
371
+ }
381
372
str = strtok (NULL , "," );
382
373
}
383
374
tst_array_compress (tst_test_array , tst_test_array_max , & num_tests );
@@ -476,7 +467,7 @@ int main (int argc, char * argv[])
476
467
int tmp_test_type = atoi (str );
477
468
if (0 > tmp_test_type || tst_type_array_max <= tmp_test_type )
478
469
ERROR (EINVAL , "Specified type number out of range" );
479
-
470
+
480
471
tst_type_array [num_types ++ ] = tmp_test_type ;
481
472
}
482
473
else
@@ -641,8 +632,9 @@ int main (int argc, char * argv[])
641
632
MPI_Barrier (MPI_COMM_WORLD );
642
633
}
643
634
644
- if (tst_global_rank == 0 )
635
+ if (tst_global_rank == 0 ) {
645
636
tst_test_print_failed ();
637
+ }
646
638
647
639
/*
648
640
* XXX Disable for Thread Checker test, as we free twice???
@@ -658,7 +650,7 @@ int main (int argc, char * argv[])
658
650
*/
659
651
660
652
time_stop = MPI_Wtime ();
661
- tst_output_printf (DEBUG_LOG , TST_REPORT_FULL , "(Rank:%d) Overall time taken:%f \n" ,
653
+ tst_output_printf (DEBUG_LOG , TST_REPORT_FULL , "(Rank:%d) Overall time taken:%lf \n" ,
662
654
tst_global_rank , time_stop - time_start );
663
655
tst_output_printf (DEBUG_LOG , TST_REPORT_FULL , "(Rank:%d) Going to MPI_Finalize\n" ,
664
656
tst_global_rank );
0 commit comments