aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen Gong <gong.chen@linux.intel.com>2012-09-12 04:37:31 -0400
committerChen, Gong <gong.chen@linux.intel.com>2015-01-21 21:24:00 -0500
commit0dc287787bdb56bf792046255ca1bcc7a49b1425 (patch)
tree12e2a1f071bdf6450ff9c0f8709bea75fafa40dd
parent07e7fcbf6e248a6f859fe6265ed30dc2830b2b62 (diff)
downloadmce-test-0dc287787bdb56bf792046255ca1bcc7a49b1425.tar.gz
Clear existed ERST record before the test
If ERST table is full, the test can't begin. To avoid this potential issue, if existing ERST record, erase one record to relase the storage space and let the test go on. Because the ERST test maybe damges the data in the ERST table, please restore the valid data in the ERST to the other safe place. Signed-off-by: Chen Gong <gong.chen@linux.intel.com>
-rwxr-xr-xcases/function/erst-inject/runtest.sh18
1 files changed, 15 insertions, 3 deletions
diff --git a/cases/function/erst-inject/runtest.sh b/cases/function/erst-inject/runtest.sh
index c8922b7..540536c 100755
--- a/cases/function/erst-inject/runtest.sh
+++ b/cases/function/erst-inject/runtest.sh
@@ -50,13 +50,16 @@ Pay attention:
This test is basic APEI/ERST functional test. In this test case, it will
test ERST functionality of READ/WRITE/ERASE. Any error in the test
-procedure will be consider as failure and reported.
+procedure will be considered as failure and reported.
+
+Because the ERST test maybe damges the data in the ERST table, please
+restore the valid data in the ERST to the other safe place.
+
***************************************************************************
EOF
-ID=0xdeadbeaf
ERST=./erst-inject
LOG=$TMP_DIR/erst.log.$$
MODSTATUS=0
@@ -65,7 +68,7 @@ err()
{
echo
echo ERROR: "$*"
- echo ERROR: "Please check dmesg for further information"
+ echo ERROR: "Please check dmesg or log for further information"
echo -e "\n\nTEST FAILS"
exit 1
}
@@ -85,6 +88,15 @@ fi
which $ERST &> /dev/null
[ $? -eq 0 ] || err "Please compile the test case first"
+# If ERST table is full, the test can't proceed. To ensure below
+# test can go on, if existing records, remove one first.
+COUNT=`$ERST -n|cut -d' ' -f5`
+if [ $COUNT -ne 0 ]; then
+ ID=`$ERST -p|grep "rcd id"|head -1|cut -d' ' -f3`
+ $ERST -c $ID 1>/dev/null
+fi
+
+ID=0xdeadbeaf
echo -n "Write one error record into ERST... "
$ERST -i $ID 1>/dev/null
if [ ! $? -eq 0 ]; then