aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShaoyong Wang <shaoyongx.wang@intel.com>2013-02-07 09:56:46 -0500
committerChen, Gong <gong.chen@linux.intel.com>2015-01-21 21:24:00 -0500
commitddf1ee787c9c36e543de648e5eb49e33d8de6607 (patch)
tree60147aeee01f8a82df724cf8778cef97d1f1b2f8
parenta0901e469f8361d9f04b2d240733f7157d50226f (diff)
downloadmce-test-ddf1ee787c9c36e543de648e5eb49e33d8de6607.tar.gz
Update apei-inj test case
Fix incomplete dmesg information which is used for result analysis. Put related dmesg/mcelog log under path/to/apei-inj/log/. Signed-off-by: Shaoyong Wang <shaoyongx.wang@intel.com> Signed-off-by: Chen Gong <gong.chen@linux.intel.com>
-rwxr-xr-xcases/function/apei-inj/apei-inject.sh61
-rwxr-xr-xcases/function/apei-inj/runtest.sh4
2 files changed, 43 insertions, 22 deletions
diff --git a/cases/function/apei-inj/apei-inject.sh b/cases/function/apei-inj/apei-inject.sh
index 5385937..7a29391 100755
--- a/cases/function/apei-inj/apei-inject.sh
+++ b/cases/function/apei-inj/apei-inject.sh
@@ -10,6 +10,8 @@ setup_path
APEI_IF=""
GHES_REC="Hardware error from APEI Generic Hardware Error Source"
+LOG_DIR=$ROOT/cases/function/apei-inj/log
+LOG=$LOG_DIR/$(date +%Y-%m-%d.%H.%M.%S)-`uname -r`.log
check_err_type()
{
@@ -32,39 +34,56 @@ check_result()
local sleep=5
local time=0
+ echo -e "<<< OS/kernel version is as follows >>>\n" >> $LOG
+ uname -a >> $LOG
+ cat /etc/issue >> $LOG
+ echo -e "\n<<< dmesg information is as follows >>>\n" >> $LOG
+ dmesg -c &>> $LOG
+ echo -e "\n<<< mcelog information as follows >>>\n" >> $LOG
+ mcelog &>> $LOG
while [ $time -lt $timeout ]
do
- dmesg -c | grep -q "$GHES_REC"
- [ $? -eq 0 ] && return 0
+ grep -q "$GHES_REC" $LOG
+ if [ $? -eq 0 ]
+ then
+ echo -e "\nGHES record is OK\n" |tee -a $LOG
+ echo 0 >> $TMP_DIR/error.$$
+ return
+ fi
time=`expr $time + $sleep`
done
-
+ echo -e "\nGHES record is not expected\n" |tee -a $LOG
+ echo 1 > $TMP_DIR/error.$$
return 1
}
main()
{
+ echo 0 > $TMP_DIR/error.$$
+ mkdir -p $LOG_DIR
+ dmesg -c > /dev/null
#inject error type
local type=$1
check_debugfs
- #APEI_IF should be defined after debugfs is mounted
- APEI_IF=`cat /proc/mounts | grep debugfs | cut -d ' ' -f2 | head -1`/apei/einj
-
#if einj is a module, it is ensured to have been loaded
- modinfo einj > /dev/null 2>&1
+ modinfo einj &> /dev/null
if [ $? -eq 0 ]; then
- [ -d $APEI_IF ] || modprobe einj param_extension=1
+ modprobe einj param_extension=1
[ $? -eq 0 ] ||
- die "module einj isn't supported or EINJ Table doesn't exist?"
+ die "module einj isn't supported or EINJ Table doesn't exist?"
fi
+ #APEI_IF should be defined after debugfs is mounted
+ APEI_IF=`cat /proc/mounts | grep debugfs | cut -d ' ' -f2 | head -1`/apei/einj
+ [ -d $APEI_IF ] ||
+ die "einj isn't supported in the kernel or EINJ Table doesn't exist."
check_err_type $type
[ $? -ne 0 ] && return 1
mcelog &> /dev/null
echo $type > $APEI_IF/error_type
- killall simple_process > /dev/null 2>&1
+ killall simple_process &> /dev/null
simple_process > /dev/null &
page-types -p `pidof simple_process` -LN -b ano > $TMP_DIR/pagelist.$$
@@ -76,29 +95,29 @@ main()
echo 0xfffffffffffff000 > $APEI_IF/param2
fi
- dmesg -c > /dev/null
- echo "1" > $APEI_IF/error_inject 2>/dev/null
+ echo "1" > $APEI_IF/error_inject
[ $? -ne 0 ] &&
{
cat <<-EOF
- Error injection fails, it maybe happens on some
- bogus BIOS. For example, some iomem region can't
- be acquired when requesting some resources. Please
- contact BIOS engineer to get further information.
+ Error injection fails. It maybe happens on some bogus BIOS. For example,
+ some iomem region can't be acquired when requesting some resources.
+ For detail information please refer to the following file:
+ $LOG
EOF
- }
+ } && echo 1 > $TMP_DIR/error.$$
sleep 1
check_result
+ grep -q "1" $TMP_DIR/error.$$
if [ $? -eq 0 ]
then
- echo " PASSED: GHES record is ok"
- exit 0
- else
- echo " FAILED: GHES record is not expected"
+ echo -e "\nTest FAILED\n"
exit 1
+ else
+ echo -e "\nTest PASSED\n"
+ exit 0
fi
}
diff --git a/cases/function/apei-inj/runtest.sh b/cases/function/apei-inj/runtest.sh
index bcb28b0..b9d5533 100755
--- a/cases/function/apei-inj/runtest.sh
+++ b/cases/function/apei-inj/runtest.sh
@@ -16,9 +16,11 @@ are possible to cause system hang/crash, only Memory Correctable Error is
injected to test the availiability of APEI/EINJ.
***************************************************************************
-
EOF
+TMP="../../../work"
+export TMP_DIR=${TMP_DIR:-$TMP}
+
echo 0 > $TMP_DIR/error.$$
pushd `dirname $0` > /dev/null