81 lines · plain
1#!/bin/sh2# SPDX-License-Identifier: GPL-2.0-only3 4# pstore_post_reboot_tests - Check pstore's behavior after crash/reboot5#6# Copyright (C) Hitachi Ltd., 20157# Written by Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>8#9 10# Kselftest framework requirement - SKIP code is 4.11ksft_skip=412 13. ./common_tests14 15if [ -e $REBOOT_FLAG ]; then16 rm $REBOOT_FLAG17else18 prlog "pstore_crash_test has not been executed yet. we skip further tests."19 exit $ksft_skip20fi21 22prlog -n "Mounting pstore filesystem ... "23mount_info=`grep pstore /proc/mounts`24if [ $? -eq 0 ]; then25 mount_point=`echo ${mount_info} | cut -d' ' -f2 | head -n1`26 prlog "ok"27else28 mount none /sys/fs/pstore -t pstore29 if [ $? -eq 0 ]; then30 mount_point=`grep pstore /proc/mounts | cut -d' ' -f2 | head -n1`31 prlog "ok"32 else33 prlog "FAIL"34 exit 135 fi36fi37 38cd ${mount_point}39 40prlog -n "Checking dmesg files exist in pstore filesystem ... "41check_files_exist dmesg42 43prlog -n "Checking console files exist in pstore filesystem ... "44check_files_exist console45 46prlog -n "Checking pmsg files exist in pstore filesystem ... "47check_files_exist pmsg48 49prlog -n "Checking dmesg files contain oops end marker"50grep_end_trace() {51 grep -q "\---\[ end trace" $152}53files=`ls dmesg-${backend}-*`54operate_files $? "$files" grep_end_trace55 56prlog -n "Checking console file contains oops end marker ... "57grep -q "\---\[ end trace" console-${backend}-058show_result $?59 60prlog -n "Checking pmsg file properly keeps the content written before crash ... "61prev_uuid=`cat $TOP_DIR/prev_uuid`62if [ $? -eq 0 ]; then63 nr_matched=`grep -c "$TEST_STRING_PATTERN" pmsg-${backend}-0`64 if [ $nr_matched -eq 1 ]; then65 grep -q "$TEST_STRING_PATTERN"$prev_uuid pmsg-${backend}-066 show_result $?67 else68 prlog "FAIL"69 rc=170 fi71else72 prlog "FAIL"73 rc=174fi75 76prlog -n "Removing all files in pstore filesystem "77files=`ls *-${backend}-*`78operate_files $? "$files" rm79 80exit $rc81