mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-06 22:55:11 +00:00
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>
This commit is contained in:
parent
3c1f619eea
commit
b274e75c20
8 changed files with 30 additions and 23 deletions
|
@ -394,9 +394,11 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%s: Test requeue functionality\n", basename(argv[0]));
|
ksft_print_header();
|
||||||
printf("\tArguments: broadcast=%d locked=%d owner=%d timeout=%ldns\n",
|
ksft_print_msg("%s: Test requeue functionality\n", basename(argv[0]));
|
||||||
broadcast, locked, owner, timeout_ns);
|
ksft_print_msg(
|
||||||
|
"\tArguments: broadcast=%d locked=%d owner=%d timeout=%ldns\n",
|
||||||
|
broadcast, locked, owner, timeout_ns);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FIXME: unit_test is obsolete now that we parse options and the
|
* FIXME: unit_test is obsolete now that we parse options and the
|
||||||
|
|
|
@ -78,7 +78,8 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%s: Detect mismatched requeue_pi operations\n",
|
ksft_print_header();
|
||||||
|
ksft_print_msg("%s: Detect mismatched requeue_pi operations\n",
|
||||||
basename(argv[0]));
|
basename(argv[0]));
|
||||||
|
|
||||||
if (pthread_create(&child, NULL, blocking_child, NULL)) {
|
if (pthread_create(&child, NULL, blocking_child, NULL)) {
|
||||||
|
|
|
@ -143,9 +143,10 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%s: Test signal handling during requeue_pi\n",
|
ksft_print_header();
|
||||||
|
ksft_print_msg("%s: Test signal handling during requeue_pi\n",
|
||||||
basename(argv[0]));
|
basename(argv[0]));
|
||||||
printf("\tArguments: <none>\n");
|
ksft_print_msg("\tArguments: <none>\n");
|
||||||
|
|
||||||
sa.sa_handler = handle_signal;
|
sa.sa_handler = handle_signal;
|
||||||
sigemptyset(&sa.sa_mask);
|
sigemptyset(&sa.sa_mask);
|
||||||
|
|
|
@ -97,8 +97,10 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%s: Test the futex value of private file mappings in FUTEX_WAIT\n",
|
ksft_print_header();
|
||||||
basename(argv[0]));
|
ksft_print_msg(
|
||||||
|
"%s: Test the futex value of private file mappings in FUTEX_WAIT\n",
|
||||||
|
basename(argv[0]));
|
||||||
|
|
||||||
ret = pthread_create(&thr, NULL, thr_futex_wait, NULL);
|
ret = pthread_create(&thr, NULL, thr_futex_wait, NULL);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
|
|
@ -68,9 +68,10 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%s: Block on a futex and wait for timeout\n",
|
ksft_print_header();
|
||||||
|
ksft_print_msg("%s: Block on a futex and wait for timeout\n",
|
||||||
basename(argv[0]));
|
basename(argv[0]));
|
||||||
printf("\tArguments: timeout=%ldns\n", timeout_ns);
|
ksft_print_msg("\tArguments: timeout=%ldns\n", timeout_ns);
|
||||||
|
|
||||||
/* initialize timeout */
|
/* initialize timeout */
|
||||||
to.tv_sec = 0;
|
to.tv_sec = 0;
|
||||||
|
|
|
@ -99,7 +99,8 @@ int main(int argc, char **argv)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%s: Test the uninitialized futex value in FUTEX_WAIT\n",
|
ksft_print_header();
|
||||||
|
ksft_print_msg("%s: Test the uninitialized futex value in FUTEX_WAIT\n",
|
||||||
basename(argv[0]));
|
basename(argv[0]));
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,8 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%s: Test the unexpected futex value in FUTEX_WAIT\n",
|
ksft_print_header();
|
||||||
|
ksft_print_msg("%s: Test the unexpected futex value in FUTEX_WAIT\n",
|
||||||
basename(argv[0]));
|
basename(argv[0]));
|
||||||
|
|
||||||
info("Calling futex_wait on f1: %u @ %p with val=%u\n", f1, &f1, f1+1);
|
info("Calling futex_wait on f1: %u @ %p with val=%u\n", f1, &f1, f1+1);
|
||||||
|
|
|
@ -109,22 +109,20 @@ void log_verbosity(int level)
|
||||||
*/
|
*/
|
||||||
void print_result(const char *test_name, int ret)
|
void print_result(const char *test_name, int ret)
|
||||||
{
|
{
|
||||||
const char *result = "Unknown return code";
|
|
||||||
|
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case RET_PASS:
|
case RET_PASS:
|
||||||
ksft_inc_pass_cnt();
|
ksft_test_result_pass("%s\n", test_name);
|
||||||
result = PASS;
|
ksft_print_cnts();
|
||||||
break;
|
return;
|
||||||
case RET_ERROR:
|
case RET_ERROR:
|
||||||
result = ERROR;
|
ksft_test_result_error("%s\n", test_name);
|
||||||
break;
|
ksft_print_cnts();
|
||||||
|
return;
|
||||||
case RET_FAIL:
|
case RET_FAIL:
|
||||||
ksft_inc_fail_cnt();
|
ksft_test_result_fail("%s\n", test_name);
|
||||||
result = FAIL;
|
ksft_print_cnts();
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
printf("selftests: %s [%s]\n", test_name, result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* log level macros */
|
/* log level macros */
|
||||||
|
|
Loading…
Add table
Reference in a new issue