Commit 248ae6f4 authored by Wolfram Sang's avatar Wolfram Sang Committed by Shuah Khan

selftests: timers: clocksource-switch: add 'runtime' command line parameter

So the user can decide how long the test should run.
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: default avatarJohn Stultz <jstultz@google.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent 19b6823a
...@@ -124,17 +124,22 @@ int main(int argc, char **argv) ...@@ -124,17 +124,22 @@ int main(int argc, char **argv)
char orig_clk[512]; char orig_clk[512];
int count, i, status, opt; int count, i, status, opt;
int do_sanity_check = 1; int do_sanity_check = 1;
int runtime = 60;
pid_t pid; pid_t pid;
/* Process arguments */ /* Process arguments */
while ((opt = getopt(argc, argv, "s")) != -1) { while ((opt = getopt(argc, argv, "st:")) != -1) {
switch (opt) { switch (opt) {
case 's': case 's':
do_sanity_check = 0; do_sanity_check = 0;
break; break;
case 't':
runtime = atoi(optarg);
break;
default: default:
printf("Usage: %s [-s]\n", argv[0]); printf("Usage: %s [-s] [-t <secs>]\n", argv[0]);
printf(" -s: skip sanity checks\n"); printf(" -s: skip sanity checks\n");
printf(" -t: Number of seconds to run\n");
exit(-1); exit(-1);
} }
} }
...@@ -167,7 +172,7 @@ int main(int argc, char **argv) ...@@ -167,7 +172,7 @@ int main(int argc, char **argv)
printf("Running Asynchronous Switching Tests...\n"); printf("Running Asynchronous Switching Tests...\n");
pid = fork(); pid = fork();
if (!pid) if (!pid)
return run_tests(60); return run_tests(runtime);
while (pid != waitpid(pid, &status, WNOHANG)) while (pid != waitpid(pid, &status, WNOHANG))
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment