Skip to content

Commit

Permalink
selftests: timers: clocksource-switch: add 'runtime' command line par…
Browse files Browse the repository at this point in the history
…ameter

So the user can decide how long the test should run.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: John Stultz <jstultz@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
  • Loading branch information
Wolfram Sang authored and Shuah Khan committed Jul 14, 2022
1 parent 19b6823 commit 248ae6f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tools/testing/selftests/timers/clocksource-switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,22 @@ int main(int argc, char **argv)
char orig_clk[512];
int count, i, status, opt;
int do_sanity_check = 1;
int runtime = 60;
pid_t pid;

/* Process arguments */
while ((opt = getopt(argc, argv, "s")) != -1) {
while ((opt = getopt(argc, argv, "st:")) != -1) {
switch (opt) {
case 's':
do_sanity_check = 0;
break;
case 't':
runtime = atoi(optarg);
break;
default:
printf("Usage: %s [-s]\n", argv[0]);
printf("Usage: %s [-s] [-t <secs>]\n", argv[0]);
printf(" -s: skip sanity checks\n");
printf(" -t: Number of seconds to run\n");
exit(-1);
}
}
Expand Down Expand Up @@ -167,7 +172,7 @@ int main(int argc, char **argv)
printf("Running Asynchronous Switching Tests...\n");
pid = fork();
if (!pid)
return run_tests(60);
return run_tests(runtime);

while (pid != waitpid(pid, &status, WNOHANG))
for (i = 0; i < count; i++)
Expand Down

0 comments on commit 248ae6f

Please sign in to comment.