Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: futex: convert test to use ksft TAP13 framework

Convert test to use ksft TAP13 framework to print user friendly
test output which is consistent across kselftest suite.

Acked-by: Darren Hart (VMware) <dvhart@infradead.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>

+30 -23
+5 -3
tools/testing/selftests/futex/functional/futex_requeue_pi.c
··· 394 394 } 395 395 } 396 396 397 - printf("%s: Test requeue functionality\n", basename(argv[0])); 398 - printf("\tArguments: broadcast=%d locked=%d owner=%d timeout=%ldns\n", 399 - broadcast, locked, owner, timeout_ns); 397 + ksft_print_header(); 398 + ksft_print_msg("%s: Test requeue functionality\n", basename(argv[0])); 399 + ksft_print_msg( 400 + "\tArguments: broadcast=%d locked=%d owner=%d timeout=%ldns\n", 401 + broadcast, locked, owner, timeout_ns); 400 402 401 403 /* 402 404 * FIXME: unit_test is obsolete now that we parse options and the
+2 -1
tools/testing/selftests/futex/functional/futex_requeue_pi_mismatched_ops.c
··· 78 78 } 79 79 } 80 80 81 - printf("%s: Detect mismatched requeue_pi operations\n", 81 + ksft_print_header(); 82 + ksft_print_msg("%s: Detect mismatched requeue_pi operations\n", 82 83 basename(argv[0])); 83 84 84 85 if (pthread_create(&child, NULL, blocking_child, NULL)) {
+3 -2
tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c
··· 143 143 } 144 144 } 145 145 146 - printf("%s: Test signal handling during requeue_pi\n", 146 + ksft_print_header(); 147 + ksft_print_msg("%s: Test signal handling during requeue_pi\n", 147 148 basename(argv[0])); 148 - printf("\tArguments: <none>\n"); 149 + ksft_print_msg("\tArguments: <none>\n"); 149 150 150 151 sa.sa_handler = handle_signal; 151 152 sigemptyset(&sa.sa_mask);
+4 -2
tools/testing/selftests/futex/functional/futex_wait_private_mapped_file.c
··· 97 97 } 98 98 } 99 99 100 - printf("%s: Test the futex value of private file mappings in FUTEX_WAIT\n", 101 - basename(argv[0])); 100 + ksft_print_header(); 101 + ksft_print_msg( 102 + "%s: Test the futex value of private file mappings in FUTEX_WAIT\n", 103 + basename(argv[0])); 102 104 103 105 ret = pthread_create(&thr, NULL, thr_futex_wait, NULL); 104 106 if (ret < 0) {
+3 -2
tools/testing/selftests/futex/functional/futex_wait_timeout.c
··· 68 68 } 69 69 } 70 70 71 - printf("%s: Block on a futex and wait for timeout\n", 71 + ksft_print_header(); 72 + ksft_print_msg("%s: Block on a futex and wait for timeout\n", 72 73 basename(argv[0])); 73 - printf("\tArguments: timeout=%ldns\n", timeout_ns); 74 + ksft_print_msg("\tArguments: timeout=%ldns\n", timeout_ns); 74 75 75 76 /* initialize timeout */ 76 77 to.tv_sec = 0;
+2 -1
tools/testing/selftests/futex/functional/futex_wait_uninitialized_heap.c
··· 99 99 exit(1); 100 100 } 101 101 102 - printf("%s: Test the uninitialized futex value in FUTEX_WAIT\n", 102 + ksft_print_header(); 103 + ksft_print_msg("%s: Test the uninitialized futex value in FUTEX_WAIT\n", 103 104 basename(argv[0])); 104 105 105 106
+2 -1
tools/testing/selftests/futex/functional/futex_wait_wouldblock.c
··· 64 64 } 65 65 } 66 66 67 - printf("%s: Test the unexpected futex value in FUTEX_WAIT\n", 67 + ksft_print_header(); 68 + ksft_print_msg("%s: Test the unexpected futex value in FUTEX_WAIT\n", 68 69 basename(argv[0])); 69 70 70 71 info("Calling futex_wait on f1: %u @ %p with val=%u\n", f1, &f1, f1+1);
+9 -11
tools/testing/selftests/futex/include/logging.h
··· 109 109 */ 110 110 void print_result(const char *test_name, int ret) 111 111 { 112 - const char *result = "Unknown return code"; 113 - 114 112 switch (ret) { 115 113 case RET_PASS: 116 - ksft_inc_pass_cnt(); 117 - result = PASS; 118 - break; 114 + ksft_test_result_pass("%s\n", test_name); 115 + ksft_print_cnts(); 116 + return; 119 117 case RET_ERROR: 120 - result = ERROR; 121 - break; 118 + ksft_test_result_error("%s\n", test_name); 119 + ksft_print_cnts(); 120 + return; 122 121 case RET_FAIL: 123 - ksft_inc_fail_cnt(); 124 - result = FAIL; 125 - break; 122 + ksft_test_result_fail("%s\n", test_name); 123 + ksft_print_cnts(); 124 + return; 126 125 } 127 - printf("selftests: %s [%s]\n", test_name, result); 128 126 } 129 127 130 128 /* log level macros */