summaryrefslogtreecommitdiff
diff options
authorJonathan Cave <jonathan.cave@canonical.com>2019-08-20 17:28:02 +0100
committerJonathan Cave <jonathan.cave@canonical.com>2019-08-21 11:04:44 +0100
commit4a95aaaff9caa4651580d39a4ef5df02bde1218d (patch)
treea27b2f12b43d7b8f15bf4aaeb2dfacff0a4ce4ac
parent9f0c4e4b92645bb2c43068807309f9a73744fff6 (diff)
watchdog: import from p-p-snappy
-rw-r--r--units/watchdog/jobs.pxu67
-rw-r--r--units/watchdog/test-plan.pxu27
2 files changed, 94 insertions, 0 deletions
diff --git a/units/watchdog/jobs.pxu b/units/watchdog/jobs.pxu
new file mode 100644
index 00000000..f42a4f53
--- /dev/null
+++ b/units/watchdog/jobs.pxu
@@ -0,0 +1,67 @@
+id: watchdog/systemd-config
+_summary: Check if the hardware watchdog is properly configured
+template-engine: jinja2
+command:
+ inbuilt=$(systemctl show -p RuntimeWatchdogUSec | awk -F= '{print $2}')
+ external=$(systemctl is-active watchdog.service)
+ {%- if __on_ubuntucore__ %}
+ if [ "$inbuilt" == "0" ]; then
+ echo "systemd watchdog should be enabled but reset timeout: $inbuilt"
+ exit 1
+ fi
+ if [ "$external" == "active" ]; then
+ echo "found unexpected active watchdog.service unit"
+ exit 1
+ fi
+ echo "systemd watchdog enabled, reset timeout: $inbuilt"
+ echo "watchdog.service is not active"
+ {%- else %}
+ if [ "$inbuilt" != "0" ]; then
+ echo "systemd watchdog should not be enabled but reset timeout: $inbuilt"
+ exit 1
+ fi
+ if [ "$external" != "active" ]; then
+ echo "watchdog.service unit does not report as active"
+ exit 1
+ fi
+ echo "systemd watchdog disabled"
+ echo "watchdog.service active"
+ {% endif -%}
+category_id: power
+flags: simple
+
+id: watchdog/trigger-system-reset
+depends: watchdog/systemd-config
+_summary: Test that the watchdog module can trigger a system reset
+_purpose:
+ The watchdog module should be capable of issuing a hard reset of the SUT.
+_steps:
+ 1. Commence the test to trigger a SysRq.
+ 2. Once the watchdog timeout has expired (10s) the SUT should reset itself.
+ 3. The board will reboot and the user should resume the test session.
+_verification:
+ Did the board reset itself?
+command:
+ echo 1 > /proc/sys/kernel/sysrq
+ echo 0 > /proc/sys/kernel/panic
+ echo c > /proc/sysrq-trigger
+flags: noreturn preserve-locale
+user: root
+plugin: user-interact-verify
+category_id: power
+estimated_duration: 60
+
+id: watchdog/trigger-system-reset-auto
+depends: watchdog/systemd-config
+_summary: Test that the watchdog module can trigger a system reset
+command:
+ sync
+ sleep 5
+ echo 1 > /proc/sys/kernel/sysrq
+ echo 0 > /proc/sys/kernel/panic
+ echo c > /proc/sysrq-trigger
+flags: preserve-locale noreturn autorestart
+user: root
+plugin: shell
+category_id: power
+estimated_duration: 60
diff --git a/units/watchdog/test-plan.pxu b/units/watchdog/test-plan.pxu
new file mode 100644
index 00000000..407a2734
--- /dev/null
+++ b/units/watchdog/test-plan.pxu
@@ -0,0 +1,27 @@
+id: watchdog-full
+unit: test plan
+_name: Watchdog tests
+_description:
+ QA test plan that includes watchdog tests
+estimated_duration: 1m
+include:
+nested_part:
+ watchdog-manual
+
+id: watchdog-manual
+unit: test plan
+_name: Manual watchdog tests
+_description: Manual watchdog tests for Snappy Ubuntu Core devices
+include:
+ watchdog/systemd-config
+ watchdog/trigger-system-reset
+
+id: watchdog-automated
+unit: test plan
+_name: Automated watchdog tests
+_description:
+ QA test plan that includes automated watchdog tests
+estimated_duration: 1s
+include:
+ watchdog/systemd-config
+ watchdog/trigger-system-reset-auto