Skip to content

Commit 19b6823

Browse files
Wolfram Sangshuahkh
authored andcommitted
selftests: timers: clocksource-switch: add command line switch to skip sanity check
The sanity check takes a while. If you do repeated checks when debugging, this is time consuming. Add a parameter to skip it. 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 5be1fd9 commit 19b6823

1 file changed

Lines changed: 28 additions & 12 deletions

File tree

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

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,26 @@ int run_tests(int secs)
119119

120120
char clocksource_list[10][30];
121121

122-
int main(int argv, char **argc)
122+
int main(int argc, char **argv)
123123
{
124124
char orig_clk[512];
125-
int count, i, status;
125+
int count, i, status, opt;
126+
int do_sanity_check = 1;
126127
pid_t pid;
127128

129+
/* Process arguments */
130+
while ((opt = getopt(argc, argv, "s")) != -1) {
131+
switch (opt) {
132+
case 's':
133+
do_sanity_check = 0;
134+
break;
135+
default:
136+
printf("Usage: %s [-s]\n", argv[0]);
137+
printf(" -s: skip sanity checks\n");
138+
exit(-1);
139+
}
140+
}
141+
128142
get_cur_clocksource(orig_clk, 512);
129143

130144
count = get_clocksources(clocksource_list);
@@ -135,19 +149,21 @@ int main(int argv, char **argc)
135149
}
136150

137151
/* Check everything is sane before we start switching asynchronously */
138-
for (i = 0; i < count; i++) {
139-
printf("Validating clocksource %s\n", clocksource_list[i]);
140-
if (change_clocksource(clocksource_list[i])) {
141-
status = -1;
142-
goto out;
143-
}
144-
if (run_tests(5)) {
145-
status = -1;
146-
goto out;
152+
if (do_sanity_check) {
153+
for (i = 0; i < count; i++) {
154+
printf("Validating clocksource %s\n",
155+
clocksource_list[i]);
156+
if (change_clocksource(clocksource_list[i])) {
157+
status = -1;
158+
goto out;
159+
}
160+
if (run_tests(5)) {
161+
status = -1;
162+
goto out;
163+
}
147164
}
148165
}
149166

150-
151167
printf("Running Asynchronous Switching Tests...\n");
152168
pid = fork();
153169
if (!pid)

0 commit comments

Comments
 (0)