Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: "George G. Davis" <george_davis@mentor.com>
To: Eugeniu Rosca <erosca@de.adit-jv.com>
Cc: Shuah Khan <shuah@kernel.org>,
	Jerry Hoemann <jerry.hoemann@hpe.com>,
	Colin Ian King <colin.king@canonical.com>,
	"open list:KERNEL SELFTEST FRAMEWORK" 
	<linux-kselftest@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	Eugeniu Rosca <roscaeugeniu@gmail.com>
Subject: Re: [PATCH] selftests: watchdog: Add optional file argument
Date: Thu, 29 Aug 2019 11:38:43 -0400	[thread overview]
Message-ID: <20190829153842.GC4028@mam-gdavis-lt> (raw)
In-Reply-To: <20190829143814.GA3424@vmlxhi-102.adit-jv.com>

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

      parent reply	other threads:[~2019-08-29 15:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-29  4:39 [PATCH] selftests: watchdog: Add optional file argument George G. Davis
2019-08-29 14:38 ` Eugeniu Rosca
2019-08-29 15:28   ` Eugeniu Rosca
2019-08-29 15:38   ` George G. Davis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190829153842.GC4028@mam-gdavis-lt \
    --to=george_davis@mentor.com \
    --cc=colin.king@canonical.com \
    --cc=erosca@de.adit-jv.com \
    --cc=jerry.hoemann@hpe.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=roscaeugeniu@gmail.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox