0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 ksft_skip=4
0012
0013 . ./common_tests
0014
0015 if [ -e $REBOOT_FLAG ]; then
0016 rm $REBOOT_FLAG
0017 else
0018 prlog "pstore_crash_test has not been executed yet. we skip further tests."
0019 exit $ksft_skip
0020 fi
0021
0022 prlog -n "Mounting pstore filesystem ... "
0023 mount_info=`grep pstore /proc/mounts`
0024 if [ $? -eq 0 ]; then
0025 mount_point=`echo ${mount_info} | cut -d' ' -f2 | head -n1`
0026 prlog "ok"
0027 else
0028 mount none /sys/fs/pstore -t pstore
0029 if [ $? -eq 0 ]; then
0030 mount_point=`grep pstore /proc/mounts | cut -d' ' -f2 | head -n1`
0031 prlog "ok"
0032 else
0033 prlog "FAIL"
0034 exit 1
0035 fi
0036 fi
0037
0038 cd ${mount_point}
0039
0040 prlog -n "Checking dmesg files exist in pstore filesystem ... "
0041 check_files_exist dmesg
0042
0043 prlog -n "Checking console files exist in pstore filesystem ... "
0044 check_files_exist console
0045
0046 prlog -n "Checking pmsg files exist in pstore filesystem ... "
0047 check_files_exist pmsg
0048
0049 prlog -n "Checking dmesg files contain oops end marker"
0050 grep_end_trace() {
0051 grep -q "\---\[ end trace" $1
0052 }
0053 files=`ls dmesg-${backend}-*`
0054 operate_files $? "$files" grep_end_trace
0055
0056 prlog -n "Checking console file contains oops end marker ... "
0057 grep -q "\---\[ end trace" console-${backend}-0
0058 show_result $?
0059
0060 prlog -n "Checking pmsg file properly keeps the content written before crash ... "
0061 prev_uuid=`cat $TOP_DIR/prev_uuid`
0062 if [ $? -eq 0 ]; then
0063 nr_matched=`grep -c "$TEST_STRING_PATTERN" pmsg-${backend}-0`
0064 if [ $nr_matched -eq 1 ]; then
0065 grep -q "$TEST_STRING_PATTERN"$prev_uuid pmsg-${backend}-0
0066 show_result $?
0067 else
0068 prlog "FAIL"
0069 rc=1
0070 fi
0071 else
0072 prlog "FAIL"
0073 rc=1
0074 fi
0075
0076 prlog -n "Removing all files in pstore filesystem "
0077 files=`ls *-${backend}-*`
0078 operate_files $? "$files" rm
0079
0080 exit $rc