@@ -401,7 +401,7 @@ void recv_buf(int fd, void *buf, size_t len, int flags, ssize_t expected_ret)
401
401
*/
402
402
void send_byte (int fd , int expected_ret , int flags )
403
403
{
404
- const uint8_t byte = 'A' ;
404
+ static const uint8_t byte = 'A' ;
405
405
406
406
send_buf (fd , & byte , sizeof (byte ), flags , expected_ret );
407
407
}
@@ -420,7 +420,7 @@ void recv_byte(int fd, int expected_ret, int flags)
420
420
recv_buf (fd , & byte , sizeof (byte ), flags , expected_ret );
421
421
422
422
if (byte != 'A' ) {
423
- fprintf (stderr , "unexpected byte read %c \n" , byte );
423
+ fprintf (stderr , "unexpected byte read 0x%02x \n" , byte );
424
424
exit (EXIT_FAILURE );
425
425
}
426
426
}
@@ -486,8 +486,7 @@ void list_tests(const struct test_case *test_cases)
486
486
exit (EXIT_FAILURE );
487
487
}
488
488
489
- void skip_test (struct test_case * test_cases , size_t test_cases_len ,
490
- const char * test_id_str )
489
+ static unsigned long parse_test_id (const char * test_id_str , size_t test_cases_len )
491
490
{
492
491
unsigned long test_id ;
493
492
char * endptr = NULL ;
@@ -505,9 +504,35 @@ void skip_test(struct test_case *test_cases, size_t test_cases_len,
505
504
exit (EXIT_FAILURE );
506
505
}
507
506
507
+ return test_id ;
508
+ }
509
+
510
+ void skip_test (struct test_case * test_cases , size_t test_cases_len ,
511
+ const char * test_id_str )
512
+ {
513
+ unsigned long test_id = parse_test_id (test_id_str , test_cases_len );
508
514
test_cases [test_id ].skip = true;
509
515
}
510
516
517
+ void pick_test (struct test_case * test_cases , size_t test_cases_len ,
518
+ const char * test_id_str )
519
+ {
520
+ static bool skip_all = true;
521
+ unsigned long test_id ;
522
+
523
+ if (skip_all ) {
524
+ unsigned long i ;
525
+
526
+ for (i = 0 ; i < test_cases_len ; ++ i )
527
+ test_cases [i ].skip = true;
528
+
529
+ skip_all = false;
530
+ }
531
+
532
+ test_id = parse_test_id (test_id_str , test_cases_len );
533
+ test_cases [test_id ].skip = false;
534
+ }
535
+
511
536
unsigned long hash_djb2 (const void * data , size_t len )
512
537
{
513
538
unsigned long hash = 5381 ;
0 commit comments