Skip to content

Commit

Permalink
selftests/watchdog: add test for WDIOC_GETTEMP
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
shuahkh committed Oct 26, 2022
1 parent 8856f71 commit ec7b451
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tools/testing/selftests/watchdog/watchdog-test.c
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ec7b451

Please sign in to comment.