1cc04a46fSHiraku Toyooka#!/bin/sh
263307d01SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only
3cc04a46fSHiraku Toyooka
4cc04a46fSHiraku Toyooka# pstore_tests - Check pstore's behavior before crash/reboot
5cc04a46fSHiraku Toyooka#
6cc04a46fSHiraku Toyooka# Copyright (C) Hitachi Ltd., 2015
7cc04a46fSHiraku Toyooka#  Written by Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com>
8cc04a46fSHiraku Toyooka#
9cc04a46fSHiraku Toyooka
10cc04a46fSHiraku Toyooka. ./common_tests
11cc04a46fSHiraku Toyooka
12cc04a46fSHiraku Toyookaprlog -n "Checking pstore console is registered ... "
13*d195c390SKees Cookdmesg | grep -Eq "console \[(pstore|${backend})"
14cc04a46fSHiraku Toyookashow_result $?
15cc04a46fSHiraku Toyooka
16cc04a46fSHiraku Toyookaprlog -n "Checking /dev/pmsg0 exists ... "
17cc04a46fSHiraku Toyookatest -e /dev/pmsg0
18cc04a46fSHiraku Toyookashow_result $?
19cc04a46fSHiraku Toyooka
20cc04a46fSHiraku Toyookaprlog -n "Writing unique string to /dev/pmsg0 ... "
21cc04a46fSHiraku Toyookaif [ -e "/dev/pmsg0" ]; then
22cc04a46fSHiraku Toyooka    echo "${TEST_STRING_PATTERN}""$UUID" > /dev/pmsg0
23cc04a46fSHiraku Toyooka    show_result $?
24cc04a46fSHiraku Toyooka    echo "$UUID" > $TOP_DIR/uuid
25cc04a46fSHiraku Toyookaelse
26cc04a46fSHiraku Toyooka    prlog "FAIL"
27cc04a46fSHiraku Toyooka    rc=1
28cc04a46fSHiraku Toyookafi
29cc04a46fSHiraku Toyooka
30cc04a46fSHiraku Toyookaexit $rc
31