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>2012-09-18 03:54:57 -0400
commit62dc0d3385c9a8c425e2ee42f2d9be87389abc98 (patch)
tree12e2a1f071bdf6450ff9c0f8709bea75fafa40dd
parentde41ef52c05a965e69c696a947cabb6012bb10e0 (diff)
downloadmce-test-62dc0d3385c9a8c425e2ee42f2d9be87389abc98.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