kselftests: timers: leap-a-day: Change default arguments to help test runs

Change default arguments for leap-a-day to always set the time
each iteration (rather then waiting for midnight UTC), and to
only run 10 interations (rather then infinite).

If one wants to wait for midnight UTC, they can use the new -w
flag, and we add a note to the argument help that -i -1 will
run infinitely.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Miroslav Lichvar <mlichvar@redhat.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Stephen Boyd <stephen.boyd@linaro.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: linux-kselftest@vger.kernel.org
Signed-off-by: John Stultz <john.stultz@linaro.org>
Cc: stable <stable@vger.kernel.org> [4.13+]
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
This commit is contained in:
John Stultz 2017-08-18 16:23:32 -07:00 committed by Shuah Khan
parent b841065043
commit 98b74e1f31

View File

@ -179,18 +179,18 @@ int main(int argc, char **argv)
struct sigevent se; struct sigevent se;
struct sigaction act; struct sigaction act;
int signum = SIGRTMAX; int signum = SIGRTMAX;
int settime = 0; int settime = 1;
int tai_time = 0; int tai_time = 0;
int insert = 1; int insert = 1;
int iterations = -1; int iterations = 10;
int opt; int opt;
/* Process arguments */ /* Process arguments */
while ((opt = getopt(argc, argv, "sti:")) != -1) { while ((opt = getopt(argc, argv, "sti:")) != -1) {
switch (opt) { switch (opt) {
case 's': case 'w':
printf("Setting time to speed up testing\n"); printf("Only setting leap-flag, not changing time. It could take up to a day for leap to trigger.\n");
settime = 1; settime = 0;
break; break;
case 'i': case 'i':
iterations = atoi(optarg); iterations = atoi(optarg);
@ -199,9 +199,10 @@ int main(int argc, char **argv)
tai_time = 1; tai_time = 1;
break; break;
default: default:
printf("Usage: %s [-s] [-i <iterations>]\n", argv[0]); printf("Usage: %s [-w] [-i <iterations>]\n", argv[0]);
printf(" -s: Set time to right before leap second each iteration\n"); printf(" -w: Set flag and wait for leap second each iteration");
printf(" -i: Number of iterations\n"); printf(" (default sets time to right before leapsecond)\n");
printf(" -i: Number of iterations (-1 = infinite, default is 10)\n");
printf(" -t: Print TAI time\n"); printf(" -t: Print TAI time\n");
exit(-1); exit(-1);
} }