lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241025013933.6516-3-lizhijian@fujitsu.com>
Date: Fri, 25 Oct 2024 09:39:33 +0800
From: Li Zhijian <lizhijian@...itsu.com>
To: linux-kselftest@...r.kernel.org
Cc: shuah@...nel.org,
	linux-kernel@...r.kernel.org,
	Li Zhijian <lizhijian@...itsu.com>
Subject: [PATCH for-next 3/3] selftests/watchdog: Add run_watchdog-test.sh to run watchdog tests

We are ready to run the watchdog tests and check its exit code.
An example output is like below:
  linux/tools/testing/selftests/watchdog# make run_tests
  TAP version 13
  1..1
  # timeout set to 45
  # selftests: watchdog: run_watchdog-test.sh
  # ./run_watchdog-test.sh: Feed dog
  # Watchdog Ticking Away!
  # ..
  # ./run_watchdog-test.sh: Show watchdog_info
  # watchdog_info:
  #  identity:            iTCO_wdt
  #  firmware_version:    2
  # Support/Status: Set timeout (in seconds)
  # Support/Status: Supports magic close char
  # Support/Status: Keep alive ping reply
  #
  # ./run_watchdog-test.sh Turn off the watchdog timer
  # Watchdog card disabled.
  # Watchdog Ticking Away!
  # ..
  # ./run_watchdog-test.sh: Turn off the watchdog timer
  # Watchdog card enabled.
  # Watchdog Ticking Away!
  # ..
  # ./run_watchdog-test.sh: Set timeout to T seconds
  # Watchdog card disabled.
  # Watchdog timeout set to 10 seconds.
  # Watchdog card enabled.
  # Watchdog Ticking Away!
  # ..
  # ./run_watchdog-test.sh: Get the timeout
  # WDIOC_GETTIMEOUT returns 10 seconds.
  #
  # ./run_watchdog-test.sh: Get the pretimeout to T seconds
  # Watchdog card disabled.
  # WDIOC_GETPRETIMEOUT returns 0 seconds.
  # Watchdog card enabled.
  #
  # ./run_watchdog-test.sh Get the time left until timer expires
  # WDIOC_GETTIMELEFT returns 9 seconds.
  #
  # Get status & supported features
  # Support/Status: Keep alive ping reply
  # WDIOC_GETTEMP: 'Inappropriate ioctl for device'
  not ok 1 selftests: watchdog: run_watchdog-test.sh # exit=1

Signed-off-by: Li Zhijian <lizhijian@...itsu.com>
---
 tools/testing/selftests/watchdog/Makefile     |  3 +-
 .../selftests/watchdog/run_watchdog-test.sh   | 41 +++++++++++++++++++
 2 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100755 tools/testing/selftests/watchdog/run_watchdog-test.sh

diff --git a/tools/testing/selftests/watchdog/Makefile b/tools/testing/selftests/watchdog/Makefile
index 6b5598b55252..4d1cb1d292a1 100644
--- a/tools/testing/selftests/watchdog/Makefile
+++ b/tools/testing/selftests/watchdog/Makefile
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
-TEST_GEN_PROGS := watchdog-test
+TEST_GEN_FILES := watchdog-test
+TEST_PROGS := run_watchdog-test.sh
 
 include ../lib.mk
diff --git a/tools/testing/selftests/watchdog/run_watchdog-test.sh b/tools/testing/selftests/watchdog/run_watchdog-test.sh
new file mode 100755
index 000000000000..0ea4b7770f1d
--- /dev/null
+++ b/tools/testing/selftests/watchdog/run_watchdog-test.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+echo "$0: Feed dog"
+./watchdog-test -c 2 || exit
+
+echo
+echo "$0: Show watchdog_info"
+./watchdog-test -i -c 2 || exit
+
+echo
+echo "$0 Turn off the watchdog timer"
+./watchdog-test -d -c 2 || exit
+
+echo
+echo "$0: Turn on the watchdog timer"
+./watchdog-test -e -c 2 || exit
+
+echo
+echo "$0: Set timeout to T seconds"
+./watchdog-test -d -t 10 -c 2 -e || exit
+
+echo
+echo "$0: Get the timeout"
+./watchdog-test -T -c 2 || exit
+
+echo
+echo "$0: Get the pretimeout to T seconds"
+./watchdog-test -d -N -c 2 -e || exit
+
+echo
+echo "$0 Get the time left until timer expires"
+./watchdog-test -L -c 2 || exit
+
+echo
+echo "Get status & supported features"
+./watchdog-test -s || exit
+
+echo
+echo "$0: Set the pretimeout to T seconds"
+./watchdog-test -n 3 -c 2 || exit
-- 
2.44.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ