Skip to content

Commit 248ae6f

Browse files
Wolfram Sangshuahkh
authored andcommitted
selftests: timers: clocksource-switch: add 'runtime' command line parameter
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>
1 parent 19b6823 commit 248ae6f

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

tools/testing/selftests/timers/clocksource-switch.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,22 @@ int main(int argc, char **argv)
124124
char orig_clk[512];
125125
int count, i, status, opt;
126126
int do_sanity_check = 1;
127+
int runtime = 60;
127128
pid_t pid;
128129

129130
/* Process arguments */
130-
while ((opt = getopt(argc, argv, "s")) != -1) {
131+
while ((opt = getopt(argc, argv, "st:")) != -1) {
131132
switch (opt) {
132133
case 's':
133134
do_sanity_check = 0;
134135
break;
136+
case 't':
137+
runtime = atoi(optarg);
138+
break;
135139
default:
136-
printf("Usage: %s [-s]\n", argv[0]);
140+
printf("Usage: %s [-s] [-t <secs>]\n", argv[0]);
137141
printf(" -s: skip sanity checks\n");
142+
printf(" -t: Number of seconds to run\n");
138143
exit(-1);
139144
}
140145
}
@@ -167,7 +172,7 @@ int main(int argc, char **argv)
167172
printf("Running Asynchronous Switching Tests...\n");
168173
pid = fork();
169174
if (!pid)
170-
return run_tests(60);
175+
return run_tests(runtime);
171176

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

0 commit comments

Comments
 (0)