2 # SPDX-License-Identifier: GPL-2.0-only
4 # pstore_post_reboot_tests - Check pstore's behavior after crash/reboot
6 # Copyright (C) Hitachi Ltd., 2015
7 # Written by Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>
10 # Kselftest framework requirement - SKIP code is 4.
15 if [ -e $REBOOT_FLAG ]; then
18 prlog
"pstore_crash_test has not been executed yet. we skip further tests."
22 prlog
-n "Mounting pstore filesystem ... "
23 mount_info
=`grep pstore /proc/mounts`
25 mount_point
=`echo ${mount_info} | cut -d' ' -f2 | head -n1`
28 mount none
/sys
/fs
/pstore
-t pstore
30 mount_point
=`grep pstore /proc/mounts | cut -d' ' -f2 | head -n1`
40 prlog
-n "Checking dmesg files exist in pstore filesystem ... "
41 check_files_exist dmesg
43 prlog
-n "Checking console files exist in pstore filesystem ... "
44 check_files_exist console
46 prlog
-n "Checking pmsg files exist in pstore filesystem ... "
47 check_files_exist pmsg
49 prlog
-n "Checking dmesg files contain oops end marker"
51 grep -q "\---\[ end trace" $1
53 files
=`ls dmesg-${backend}-*`
54 operate_files $?
"$files" grep_end_trace
56 prlog
-n "Checking console file contains oops end marker ... "
57 grep -q "\---\[ end trace" console-
${backend}-0
60 prlog
-n "Checking pmsg file properly keeps the content written before crash ... "
61 prev_uuid
=`cat $TOP_DIR/prev_uuid`
63 nr_matched
=`grep -c "$TEST_STRING_PATTERN" pmsg-${backend}-0`
64 if [ $nr_matched -eq 1 ]; then
65 grep -q "$TEST_STRING_PATTERN"$prev_uuid pmsg-
${backend}-0
76 prlog
-n "Removing all files in pstore filesystem "
77 files
=`ls *-${backend}-*`
78 operate_files $?
"$files" rm