summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/watchdog
diff options
context:
space:
mode:
authorShuah Khan <skhan@linuxfoundation.org>2022-10-22 00:51:16 +0300
committerShuah Khan <skhan@linuxfoundation.org>2022-10-26 06:27:42 +0300
commitec7b4511185bba95fc702c33a388582c8842d454 (patch)
tree9d356d20b3d2a73e687c819b199a21c6add32221 /tools/testing/selftests/watchdog
parent8856f710ed00d974ce20e9894ba2a5e02fe90542 (diff)
downloadlinux-ec7b4511185bba95fc702c33a388582c8842d454.tar.xz
selftests/watchdog: add test for WDIOC_GETTEMP
Add test for WDIOC_GETTEMP and this ioctl might not be supported by some devices and if it is this test will print the following message: Inappropriate ioctl for device Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/watchdog')
-rw-r--r--tools/testing/selftests/watchdog/watchdog-test.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/testing/selftests/watchdog/watchdog-test.c b/tools/testing/selftests/watchdog/watchdog-test.c
index a4547dd53b4e..fb3ca67785c2 100644
--- a/tools/testing/selftests/watchdog/watchdog-test.c
+++ b/tools/testing/selftests/watchdog/watchdog-test.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Watchdog Driver Test Program
-* - Tests all ioctls except WDIOC_GETTEMP
+* - Tests all ioctls
* - Tests Magic Close - CONFIG_WATCHDOG_NOWAYOUT
* - Could be tested against softdog driver on systems that
* don't have watchdog hardware.
@@ -177,6 +177,7 @@ int main(int argc, char *argv[])
int oneshot = 0;
char *file = "/dev/watchdog";
struct watchdog_info info;
+ int temperature;
setbuf(stdout, NULL);
@@ -255,6 +256,12 @@ int main(int argc, char *argv[])
print_status(flags);
else
printf("WDIOC_GETSTATUS error '%s'\n", strerror(errno));
+ ret = ioctl(fd, WDIOC_GETTEMP, &temperature);
+ if (ret)
+ printf("WDIOC_GETTEMP: '%s'\n", strerror(errno));
+ else
+ printf("Temeprature: %d\n", temperature);
+
break;
case 't':
flags = strtoul(optarg, NULL, 0);