aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen Gong <gong.chen@linux.intel.com>2012-08-08 02:14:11 +0800
committerChen Gong <gong.chen@linux.intel.com>2012-08-21 23:20:41 -0400
commit770e3763f97a5dc4738c50190e6491cefd271a4c (patch)
treed061e6e2dc429ce62e100fbfb0b50b53f8a904f8
parentbb9b320730ca82a8acc5bdb5a61d0f9b40b89b70 (diff)
downloadmce-test-770e3763f97a5dc4738c50190e6491cefd271a4c.tar.gz
update the check method for debugfs
On some platforms old methods can't find debugfs correctly, so a new way via /proc/mounts is used to find debugfs path. Signed-off-by: Chen Gong <gong.chen@linux.intel.com>
-rwxr-xr-xcases/function/apei-inj/apei-inject.sh2
-rwxr-xr-xcases/function/hwpoison/random_offline2
-rwxr-xr-xcases/function/pfa/run_pfa.sh13
-rwxr-xr-xlib/mce.sh6
4 files changed, 8 insertions, 15 deletions
diff --git a/cases/function/apei-inj/apei-inject.sh b/cases/function/apei-inj/apei-inject.sh
index ffa5cf0..5385937 100755
--- a/cases/function/apei-inj/apei-inject.sh
+++ b/cases/function/apei-inj/apei-inject.sh
@@ -49,7 +49,7 @@ main()
check_debugfs
#APEI_IF should be defined after debugfs is mounted
- APEI_IF=`mount | grep debugfs | cut -d ' ' -f3 | head -1`/apei/einj
+ 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
diff --git a/cases/function/hwpoison/random_offline b/cases/function/hwpoison/random_offline
index ecd0b3e..5528dfe 100755
--- a/cases/function/hwpoison/random_offline
+++ b/cases/function/hwpoison/random_offline
@@ -46,7 +46,7 @@ done
[ "$(whoami)" != root ] && fail "Not root"
check_debugfs
-DEBUG=`mount | grep debugfs | cut -d ' ' -f3 | head -1`
+DEBUG=`cat /proc/mounts | grep debugfs | cut -d ' ' -f2 | head -1`
#if hwpoison_inject is a module, it is ensured to have been loaded
modinfo hwpoison_inject > /dev/null 2>&1
if [ $? -eq 0 ]; then
diff --git a/cases/function/pfa/run_pfa.sh b/cases/function/pfa/run_pfa.sh
index 116931e..0366dee 100755
--- a/cases/function/pfa/run_pfa.sh
+++ b/cases/function/pfa/run_pfa.sh
@@ -1,5 +1,7 @@
#!/bin/sh
+. ../../../lib/mce.sh
+
INJ_TYPE=0x00000008
APEI_IF=""
PFA_BIN=""
@@ -10,15 +12,6 @@ invalid()
exit 1
}
-check_debugfs()
-{
- mount|grep -q debugfs
- [ $? -eq 0 ] && return
- mount -t debugfs none /sys/kernel/debug
- mount|grep -q /sys/kernel/debug
- [ $? -ne 0 ] && invalid "Kernel without debugfs support ?"
-}
-
apei_inj()
{
echo $INJ_TYPE > $APEI_IF/error_type
@@ -47,7 +40,7 @@ main()
PFA_BIN=$1
check_debugfs
- APEI_IF=`mount | grep debugfs | cut -d ' ' -f3 | head -1`/apei/einj
+ APEI_IF=`cat /proc/mounts | grep debugfs | cut -d ' ' -f2 | head -1`/apei/einj
#if einj is not builtin, just insmod it
if [ ! -d $APEI_IF ]; then
diff --git a/lib/mce.sh b/lib/mce.sh
index 464f369..0000ccb 100755
--- a/lib/mce.sh
+++ b/lib/mce.sh
@@ -300,17 +300,17 @@ get_tolerant()
check_debugfs()
{
- mount | grep -q /sys/kernel/debug
+ cat /proc/mounts | grep -q debug
[ $? -eq 0 ] && return
mount -t debugfs none /sys/kernel/debug
- mount | grep -q /sys/kernel/debug
+ cat /proc/mounts | grep -q /sys/kernel/debug
[ $? -ne 0 ] && die "Kernel without debugfs support ?"
}
# should be called after check_debugfs
check_mce()
{
- DEBUGFS=`mount | grep debugfs | cut -d ' ' -f3 | head -1`
+ DEBUGFS=`cat /proc/mounts | grep debugfs | cut -d ' ' -f2 | head -1`
[ ! -d ${DEBUGFS}/mce ] && die "Kernel without CONFIG_X86_MCE_INJECT ?"
}