Debian Codegraph @

tools/testing/selftests/pstore/pstore_crash_test

raw
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0-only
3
4 # pstore_crash_test - Pstore test shell script which causes crash and reboot
5 #
6 # Copyright (C) Hitachi Ltd., 2015
7 # Written by Hiraku Toyooka <[email protected]>
8 #
9
10 # exit if pstore backend is not registered
11 . ./common_tests
12
13 prlog "Causing kernel crash ..."
14
15 # enable all functions triggered by sysrq
16 echo 1 > /proc/sys/kernel/sysrq
17 # setting to reboot in 3 seconds after panic
18 echo 3 > /proc/sys/kernel/panic
19
20 # save uuid file by different name because next test execution will replace it.
21 mv $TOP_DIR/uuid $TOP_DIR/prev_uuid
22
23 # create a file as reboot flag
24 touch $REBOOT_FLAG
25 sync
26
27 # cause crash
28 # Note: If you use kdump and want to see kmesg-* files after reboot, you should
29 # specify 'crash_kexec_post_notifiers' in 1st kernel's cmdline.
30 echo c > /proc/sysrq-trigger