aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests
diff options
context:
space:
mode:
authorEugeniu Rosca <erosca@de.adit-jv.com>2017-07-01 14:57:29 +0200
committerShuah Khan <shuahkh@osg.samsung.com>2017-07-24 12:37:01 -0600
commitf8f92c072e6f1e694c13d432bdbdbcbf138c31ad (patch)
tree1ace4779880da25dc389e7acf429a8bc050c3f74 /tools/testing/selftests
parentselftests: watchdog: point out ioctl() failures (diff)
downloadlinux-dev-f8f92c072e6f1e694c13d432bdbdbcbf138c31ad.tar.xz
linux-dev-f8f92c072e6f1e694c13d432bdbdbcbf138c31ad.zip
selftests: watchdog: avoid keepalive flood
Calling `watchdog-test [options] -p 0` results in flooding the kernel with WDIOC_KEEPALIVE. Fix this by enforcing 1 second as minimal/default keepalive/ping rate. Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Diffstat (limited to 'tools/testing/selftests')
-rw-r--r--tools/testing/selftests/watchdog/watchdog-test.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/testing/selftests/watchdog/watchdog-test.c b/tools/testing/selftests/watchdog/watchdog-test.c
index 41f40c3c4d95..9b34b319fc91 100644
--- a/tools/testing/selftests/watchdog/watchdog-test.c
+++ b/tools/testing/selftests/watchdog/watchdog-test.c
@@ -14,6 +14,8 @@
#include <linux/types.h>
#include <linux/watchdog.h>
+#define DEFAULT_PING_RATE 1
+
int fd;
const char v = 'V';
static const char sopts[] = "dehp:t:";
@@ -64,7 +66,7 @@ static void usage(char *progname)
printf(" -d, --disable Turn off the watchdog timer\n");
printf(" -e, --enable Turn on the watchdog timer\n");
printf(" -h, --help Print the help message\n");
- printf(" -p, --pingrate=P Set ping rate to P seconds\n");
+ printf(" -p, --pingrate=P Set ping rate to P seconds (default %d)\n", DEFAULT_PING_RATE);
printf(" -t, --timeout=T Set timeout to T seconds\n");
printf("\n");
printf("Parameters are parsed left-to-right in real-time.\n");
@@ -74,7 +76,7 @@ static void usage(char *progname)
int main(int argc, char *argv[])
{
int flags;
- unsigned int ping_rate = 1;
+ unsigned int ping_rate = DEFAULT_PING_RATE;
int ret;
int c;
@@ -107,6 +109,8 @@ int main(int argc, char *argv[])
break;
case 'p':
ping_rate = strtoul(optarg, NULL, 0);
+ if (!ping_rate)
+ ping_rate = DEFAULT_PING_RATE;
printf("Watchdog ping rate set to %u seconds.\n", ping_rate);
break;
case 't':