diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-12-29 06:27:13 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-12-29 06:27:13 +0100 |
commit | 903b77c631673eeec9e9114e9524171cdf9a2646 (patch) | |
tree | 030064e334b9adc8328b9410bc2ffb2f52548a68 /tools/testing/selftests/watchdog/watchdog-test.c | |
parent | Merge tag 'char-misc-4.21-rc1' of git://git.kernel.org/pub/scm/linux/kernel/g... (diff) | |
parent | selftests: Fix test errors related to lib.mk khdr target (diff) | |
download | linux-903b77c631673eeec9e9114e9524171cdf9a2646.tar.xz linux-903b77c631673eeec9e9114e9524171cdf9a2646.zip |
Merge tag 'linux-kselftest-4.21-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull Kselftest updates from Shuah Khan:
- fixes and improvements to the framework, and individual tests
- a new media test for IR encoders from Sean Young
- a new watchdog test option to find time left on a timer
* tag 'linux-kselftest-4.21-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
selftests: Fix test errors related to lib.mk khdr target
fix dma-buf/udmabuf selftest
selftests: watchdog: fix spelling mistake "experies" -> "expires"
selftests: watchdog: Add gettimeleft command line arg
selftests: do not macro-expand failed assertion expressions
selftests/ftrace: Fix invalid SPDX identifiers
selftests: gpio: Find libmount with pkg-config if available
selftests: firmware: add CONFIG_FW_LOADER_USER_HELPER_FALLBACK to config
selftests: firmware: remove use of non-standard diff -Z option
media: rc: self test for IR encoders and decoders
Diffstat (limited to 'tools/testing/selftests/watchdog/watchdog-test.c')
-rw-r--r-- | tools/testing/selftests/watchdog/watchdog-test.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/testing/selftests/watchdog/watchdog-test.c b/tools/testing/selftests/watchdog/watchdog-test.c index c6bd9a68306b..c2333c78cf04 100644 --- a/tools/testing/selftests/watchdog/watchdog-test.c +++ b/tools/testing/selftests/watchdog/watchdog-test.c @@ -19,7 +19,7 @@ int fd; const char v = 'V'; -static const char sopts[] = "bdehp:t:Tn:N"; +static const char sopts[] = "bdehp:t:Tn:NL"; static const struct option lopts[] = { {"bootstatus", no_argument, NULL, 'b'}, {"disable", no_argument, NULL, 'd'}, @@ -30,6 +30,7 @@ static const struct option lopts[] = { {"gettimeout", no_argument, NULL, 'T'}, {"pretimeout", required_argument, NULL, 'n'}, {"getpretimeout", no_argument, NULL, 'N'}, + {"gettimeleft", no_argument, NULL, 'L'}, {NULL, no_argument, NULL, 0x0} }; @@ -77,6 +78,7 @@ static void usage(char *progname) printf(" -T, --gettimeout Get the timeout\n"); printf(" -n, --pretimeout=T Set the pretimeout to T seconds\n"); printf(" -N, --getpretimeout Get the pretimeout\n"); + printf(" -L, --gettimeleft Get the time left until timer expires\n"); printf("\n"); printf("Parameters are parsed left-to-right in real-time.\n"); printf("Example: %s -d -t 10 -p 5 -e\n", progname); @@ -180,6 +182,15 @@ int main(int argc, char *argv[]) else printf("WDIOC_GETPRETIMEOUT error '%s'\n", strerror(errno)); break; + case 'L': + oneshot = 1; + ret = ioctl(fd, WDIOC_GETTIMELEFT, &flags); + if (!ret) + printf("WDIOC_GETTIMELEFT returns %u seconds.\n", flags); + else + printf("WDIOC_GETTIMELEFT error '%s'\n", strerror(errno)); + break; + default: usage(argv[0]); goto end; |