diff options
author | Chen Gong <gong.chen@linux.intel.com> | 2009-12-25 11:01:07 +0800 |
---|---|---|
committer | Andi Kleen <ak@linux.intel.com> | 2010-01-12 13:04:23 +0100 |
commit | 8a01959454db5dfd22d88ee1bd3d6e5023d2a8da (patch) | |
tree | 09104772f97a600bc32d507f98ceaae1ac157c70 | |
parent | b8b789d8b073ddd1d66b95b48f9092ab8037025e (diff) | |
download | mce-test-8a01959454db5dfd22d88ee1bd3d6e5023d2a8da.tar.gz |
Better precondition checking in the test suite
1. auto-load einj module before apei test begins and update APEI_IF
definition to a proper place
2. fix typos in the check_debugfs
3. enhance the module check before stress test
Signed-off-by: Chen Gong <gong.chen@linux.intel.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
-rw-r--r-- | lib/apei-inject.sh | 11 | ||||
-rw-r--r-- | lib/mce.sh | 4 | ||||
-rwxr-xr-x | stress/hwpoison.sh | 16 |
3 files changed, 24 insertions, 7 deletions
diff --git a/lib/apei-inject.sh b/lib/apei-inject.sh index 99549b9..a1ed34c 100644 --- a/lib/apei-inject.sh +++ b/lib/apei-inject.sh @@ -14,7 +14,6 @@ if [ -n "$this_case" ]; then fi mcelog_result=$RDIR/$this_case/mcelog klog=$RDIR/$this_case/klog -APEI_IF=`mount | grep debugfs | cut -d ' ' -f3`/apei/einj apei_mce_reformat() { @@ -85,6 +84,16 @@ apei_inject_enumerate() apei_inject_trigger() { check_debugfs + #APEI_IF should be defined after debugfs is mounted + APEI_IF=`mount | grep debugfs | cut -d ' ' -f3`/apei/einj + + #if einj is a module, it is ensured to have been loaded + modinfo einj > /dev/null 2>&1 + if [ $? -eq 0 ]; then + [ -d $APEI_IF ] || modprobe einj + [ $? -eq 0 ] || die "module einj isn't supported ?" + fi + mcelog &> /dev/null TYPE=`awk '/^TYPE/{print $2}' $SDIR/data/$bcase` echo $TYPE > $APEI_IF/error_type @@ -300,9 +300,9 @@ get_tolerant() check_debugfs() { - mount|grep /sys/kernel/debugfs > /dev/null 2>&1 + mount|grep /sys/kernel/debug > /dev/null 2>&1 [ ! $? -eq 0 ] && mount -t debugfs none /sys/kernel/debug - mount|grep /sys/kernel/debugfs > /dev/null 2>&1 + mount|grep /sys/kernel/debug > /dev/null 2>&1 [ ! $? -eq 0 ] && die "Kernel without debugfs support ?" } diff --git a/stress/hwpoison.sh b/stress/hwpoison.sh index cf15fe0..4263d08 100755 --- a/stress/hwpoison.sh +++ b/stress/hwpoison.sh @@ -228,12 +228,20 @@ check_env() dbp "Found the tool: $g_pagetool" fi if [ $g_pfninj -eq 1 ]; then - [ -d $g_debugfs/hwpoison/ ] || modprobe hwpoison_inject - [ $? -eq 0 ] || die "module hwpoison_inject isn't supported ?" + #if hwpoison_inject is a module, it is ensured to have been loaded + modinfo hwpoison_inject > /dev/null 2>&1 + if [ $? -eq 0 ]; then + [ -d $g_debugfs/hwpoison/ ] || modprobe hwpoison_inject + [ $? -eq 0 ] || die "module hwpoison_inject isn't supported ?" + fi fi if [ $g_apei -eq 1 ]; then - [ -d $g_debugfs/apei/ ] || modprobe einj - [ $? -eq 0 ] || die "module apei_inj isn't supported ?" + #if einj is a module, it is ensured to have been loaded + modinfo einj > /dev/null 2>&1 + if [ $? -eq 0 ]; then + [ -d $g_debugfs/apei/einj ] || modprobe einj + [ $? -eq 0 ] || die "module apei_inj isn't supported ?" + fi fi [ -d $g_ltproot -a -f $g_ltppan ] || invalid "no ltp-pan on the machine: $g_ltppan" if [ $g_runltp -eq 1 ]; then |