On 8/30/19 6:53 AM, George G. Davis wrote:
Some systems have multiple watchdog devices where the first device
registered is assigned to the /dev/watchdog device file. In order
to test other watchdog devices, add an optional file argument for
selecting non-default watchdog devices for testing.

Tested-by: Eugeniu Rosca <[email protected]>
Signed-off-by: George G. Davis <[email protected]>
---
v1:
- https://lkml.org/lkml/2019/8/29/16
v2:
- Update printf for ENOENT case based on report from Eugeniu Rosca
---
  tools/testing/selftests/watchdog/watchdog-test.c | 19 ++++++++++++++++---
  1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/watchdog/watchdog-test.c 
b/tools/testing/selftests/watchdog/watchdog-test.c
index c2333c78cf04..9f17cae61007 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:NL";
+static const char sopts[] = "bdehp:t:Tn:NLf:";
  static const struct option lopts[] = {
        {"bootstatus",          no_argument, NULL, 'b'},
        {"disable",             no_argument, NULL, 'd'},
@@ -31,6 +31,7 @@ static const struct option lopts[] = {
        {"pretimeout",    required_argument, NULL, 'n'},
        {"getpretimeout",       no_argument, NULL, 'N'},
        {"gettimeleft",               no_argument, NULL, 'L'},
+       {"file",          required_argument, NULL, 'f'},
        {NULL,                  no_argument, NULL, 0x0}
  };
@@ -69,6 +70,7 @@ static void term(int sig)
  static void usage(char *progname)
  {
        printf("Usage: %s [options]\n", progname);
+       printf(" -f, --file          Open watchdog device file (default is 
/dev/watchdog)\n");

Can you split this line into two printf's. Checkpatch doesn't like
it.

printf(" -f, --file          Open watchdog device file\n");
A second one below for default.

On a separate note, I wish this usage block uses \t instead of spacing
things out.

thanks,
-- Shuah


Reply via email to