mirror of
https://github.com/torvalds/linux.git
synced 2024-11-25 05:32:00 +00:00
selftests: timers: Convert nsleep-lat test to generate KTAP output
Currently the nsleep-lat test does not produce KTAP output but rather a custom format. This means that we only get a pass/fail for the suite, not for each individual test that the suite does. Convert to using the standard kselftest output functions which result in KTAP output being generated. Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
parent
071af0c9e5
commit
0a6fa8f03e
@ -118,7 +118,7 @@ int nanosleep_lat_test(int clockid, long long ns)
|
||||
clock_gettime(clockid, &end);
|
||||
|
||||
if (((timespec_sub(start, end)/count)-ns) > UNRESONABLE_LATENCY) {
|
||||
printf("Large rel latency: %lld ns :", (timespec_sub(start, end)/count)-ns);
|
||||
ksft_print_msg("Large rel latency: %lld ns :", (timespec_sub(start, end)/count)-ns);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -132,20 +132,23 @@ int nanosleep_lat_test(int clockid, long long ns)
|
||||
}
|
||||
|
||||
if (latency/count > UNRESONABLE_LATENCY) {
|
||||
printf("Large abs latency: %lld ns :", latency/count);
|
||||
ksft_print_msg("Large abs latency: %lld ns :", latency/count);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#define SKIPPED_CLOCK_COUNT 3
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
long long length;
|
||||
int clockid, ret;
|
||||
|
||||
ksft_print_header();
|
||||
ksft_set_plan(NR_CLOCKIDS - CLOCK_REALTIME - SKIPPED_CLOCK_COUNT);
|
||||
|
||||
for (clockid = CLOCK_REALTIME; clockid < NR_CLOCKIDS; clockid++) {
|
||||
|
||||
/* Skip cputime clockids since nanosleep won't increment cputime */
|
||||
@ -154,9 +157,6 @@ int main(int argc, char **argv)
|
||||
clockid == CLOCK_HWSPECIFIC)
|
||||
continue;
|
||||
|
||||
printf("nsleep latency %-26s ", clockstring(clockid));
|
||||
fflush(stdout);
|
||||
|
||||
length = 10;
|
||||
while (length <= (NSEC_PER_SEC * 10)) {
|
||||
ret = nanosleep_lat_test(clockid, length);
|
||||
@ -167,14 +167,12 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (ret == UNSUPPORTED) {
|
||||
printf("[UNSUPPORTED]\n");
|
||||
continue;
|
||||
ksft_test_result_skip("%s\n", clockstring(clockid));
|
||||
} else {
|
||||
ksft_test_result(ret >= 0, "%s\n",
|
||||
clockstring(clockid));
|
||||
}
|
||||
if (ret < 0) {
|
||||
printf("[FAILED]\n");
|
||||
return ksft_exit_fail();
|
||||
}
|
||||
printf("[OK]\n");
|
||||
}
|
||||
return ksft_exit_pass();
|
||||
|
||||
ksft_finished();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user