mirror of
https://github.com/torvalds/linux.git
synced 2026-11-27 00:43:12 +00:00
The pstore_tests script includes test cases which check pstore's
behavior before crash (and reboot).
The test cases are currently following.
- Check pstore backend is registered
- Check pstore console is registered
- Check /dev/pmsg0 exists
- Write unique string to /dev/pmsg0
The unique string written to /dev/pmsg includes UUID. The UUID is also
left in 'uuid' file in order to enable us to check if the pmsg keeps the
string correctly after reboot.
Example usage is following.
# cd /path/to/selftests
# make run_tests -C pstore (or just .pstore/pstore_tests)
make: Entering directory '/path/to/selftests/pstore'
=== Pstore unit tests (pstore_tests) ===
UUID=b49b02cf-b0c2-4309-be43-b08c3971e37f
Checking pstore backend is registered ... ok
backend=ramoops
cmdline=console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait mem=768M ramoops.mem_address=0x30000000 ramoops.mem_size=0x10000
Checking pstore console is registered ... ok
Checking /dev/pmsg0 exists ... ok
Writing unique string to /dev/pmsg0 ... ok
selftests: pstore_tests [PASS]
make: Leaving directory '/path/to/selftests/pstore'
We can also see test logs later.
# cat pstore/logs/20151001-072718_b49b02cf-b0c2-4309-be43-b08c3971e37f/pstore_tests.log
Thu Oct 1 07:27:18 UTC 2015
=== Pstore unit tests (pstore_tests) ===
UUID=b49b02cf-b0c2-4309-be43-b08c3971e37f
Checking pstore backend is registered ... ok
backend=ramoops
cmdline=console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait mem=768M ramoops.mem_address=0x30000000 ramoops.mem_size=0x10000
Checking pstore console is registered ... ok
Checking /dev/pmsg0 exists ... ok
Writing unique string to /dev/pmsg0 ... ok
Signed-off-by: Hiraku Toyooka <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: Tony Luck <[email protected]>
Cc: Anton Vorontsov <[email protected]>
Cc: Colin Cross <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: Mark Salyzyn <[email protected]>
Cc: Seiji Aguchi <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Shuah Khan <[email protected]>
31 lines
647 B
Bash
Executable File
31 lines
647 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# pstore_tests - Check pstore's behavior before crash/reboot
|
|
#
|
|
# Copyright (C) Hitachi Ltd., 2015
|
|
# Written by Hiraku Toyooka <[email protected]>
|
|
#
|
|
# Released under the terms of the GPL v2.
|
|
|
|
. ./common_tests
|
|
|
|
prlog -n "Checking pstore console is registered ... "
|
|
dmesg | grep -q "console \[pstore"
|
|
show_result $?
|
|
|
|
prlog -n "Checking /dev/pmsg0 exists ... "
|
|
test -e /dev/pmsg0
|
|
show_result $?
|
|
|
|
prlog -n "Writing unique string to /dev/pmsg0 ... "
|
|
if [ -e "/dev/pmsg0" ]; then
|
|
echo "${TEST_STRING_PATTERN}""$UUID" > /dev/pmsg0
|
|
show_result $?
|
|
echo "$UUID" > $TOP_DIR/uuid
|
|
else
|
|
prlog "FAIL"
|
|
rc=1
|
|
fi
|
|
|
|
exit $rc
|