Re: [PATCH] selftests: watchdog: Add optional file argument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Eugeniu,

On Thu, Aug 29, 2019 at 04:38:14PM +0200, Eugeniu Rosca wrote:
> Hi George,
> 
> On Thu, Aug 29, 2019 at 12:39:25AM -0400, George G. Davis wrote:
> > Some systems have multiple watchdog devices where the first device
> > registered is assigned to the /dev/watchdog device file.
> 
> Confirmed on R-Car H3-Salvator-X:
> 
> root@rcar-gen3:~# ls -al /dev/watchdog*
> crw-------    1 root     root       10, 130 Aug 21 09:38 /dev/watchdog
> crw-------    1 root     root      247,   0 Aug 21 09:38 /dev/watchdog0

What you see there is the typical case where there is only one watchdog in
the system, /dev/watchdog0, which is registered as the default watchdog
via /dev/watchdog. If you have another watchdog enabled, e.g. softdog, you
will see:

root@h3ulcb:~# ls -l /dev/watchdog*
crw-------    1 root     root       10, 130 Mar 28 20:37 /dev/watchdog
crw-------    1 root     root      247,   0 Mar 28 20:37 /dev/watchdog0
crw-------    1 root     root      247,   1 Mar 28 20:37 /dev/watchdog1

In the above case, `watchdog0` is aliased to `watchdog` but you may prefer
to test the non-default `watchdog1` instead (rather than changing your
kernel config if one or more are built-in, preventing testing of the
non-default watchdog).

> [..]
> 
> > -	fd = open("/dev/watchdog", O_WRONLY);
> > +	while ((c = getopt_long(argc, argv, sopts, lopts, NULL)) != -1) {
> > +		if (c == 'f')
> > +			file = optarg;
> > +	}
> > +
> > +	fd = open(file, O_WRONLY);
> 
> Would it be possible to improve below not so helpful and slightly
> misleading printout:
> 
> $ ./watchdog-test -d -t 10 -p 5 -e -f /dev/watch
> Watchdog device not enabled.

Oops, right, thanks for that report.

I'll add the following in the next update:

diff --git a/tools/testing/selftests/watchdog/watchdog-test.c b/tools/testing/selftests/watchdog/watchdog-test.c
index ebeb684552b9..9f17cae61007 100644
--- a/tools/testing/selftests/watchdog/watchdog-test.c
+++ b/tools/testing/selftests/watchdog/watchdog-test.c
@@ -107,7 +107,7 @@ int main(int argc, char *argv[])
 
 	if (fd == -1) {
 		if (errno == ENOENT)
-			printf("Watchdog device not enabled.\n");
+			printf("Watchdog device (%s) not found.\n", file);
 		else if (errno == EACCES)
 			printf("Run watchdog as root.\n");
 		else


Thanks!

-- 
Regards,
George



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux