aboutsummaryrefslogtreecommitdiff
path: root/testcases/kdump
diff options
context:
space:
mode:
authorsubrata_modak <subrata_modak>2007-05-23 11:25:57 +0000
committersubrata_modak <subrata_modak>2007-05-23 11:25:57 +0000
commita22aa85d4d44bd888cc1b7bb12280886c18d98d0 (patch)
treed010452cc4ef69ede61ce9e824994c5d2f282373 /testcases/kdump
parent7135ba037238e600d5b8a2a935adb712f83a699e (diff)
<muvarov@gmail.com> modified to run kdump tests on non RH and SUSE machines
Diffstat (limited to 'testcases/kdump')
-rw-r--r--testcases/kdump/distro18
-rw-r--r--testcases/kdump/master8
-rw-r--r--testcases/kdump/setup103
3 files changed, 67 insertions, 62 deletions
diff --git a/testcases/kdump/distro b/testcases/kdump/distro
index c2140f967..7dba4895b 100644
--- a/testcases/kdump/distro
+++ b/testcases/kdump/distro
@@ -6,14 +6,28 @@
#
rm -f tools
+DISTRO="Unsupported"
+
# Determine the distribution we are running on
if [ -f /etc/redhat-release ]; then
ln -fs ./rhtools ./tools
+ DISTRO="RH"
else if [ -f /etc/SuSE-release ]; then
ln -fs ./susetools ./tools
+ DISTRO="SUSE"
else
- echo "Unsupported distribution ... exiting"
- exit
+ read -p "Unsupported distribution. To countinue choose type RH(1) SUSE(2): " DISTRO
+ if [ $DISTRO -eq 1 ]; then
+ ln -fs ./rhtools ./tools
+ DISTRO="RH"
+ elif [ $DISTRO -eq 2 ]; then
+ ln -fs ./susetools ./tools
+ DISTRO="SUSE"
+ else
+ echo "Distribution have not beed chosen. Quit."
+ exit
+ fi
fi
fi
+echo $DISTRO
diff --git a/testcases/kdump/master b/testcases/kdump/master
index f3e6d2e76..0947f6307 100644
--- a/testcases/kdump/master
+++ b/testcases/kdump/master
@@ -38,7 +38,7 @@ run_test()
LAST_TEST=${#TESTS[*]}-1
if [ $PREV_TEST -gt -1 ] ; then
- if [ $DISTRO_RH -eq 1 ]; then
+ if [ $DISTRO == "RH" ]; then
#
# Verify results of previous test
#
@@ -71,7 +71,7 @@ run_test()
fi
fi
fi
- if [ $DISTRO_SUSE -eq 1 ]; then
+ if [ $DISTRO == "RH" ]; then
#
# Verify results of previous test
#
@@ -103,12 +103,12 @@ run_test()
RESULTS_DIR=${RESULTS_DIR}/`hostname`.`date +%F-%T`
mkdir -p $RESULTS_DIR
echo "`date +%F-%T`: Starting test run" >> ${RESULTS_DIR}/status
- if [ $DISTRO_SUSE -eq 1 ]; then
+ if [ $DISTRO == "RH" ]; then
cp /proc/config.gz ${RESULTS_DIR}
fi
echo "creating sysinfo"
$SYSINFO_SCR > ${RESULTS_DIR}/system.info
- if [ $DISTRO_RH -eq 1 ]; then
+ if [ $DISTRO == "RH" ]; then
echo "emptying /var/crash/"
rm -rf /var/crash/*
fi
diff --git a/testcases/kdump/setup b/testcases/kdump/setup
index 6185a8ae7..e1eda90a9 100644
--- a/testcases/kdump/setup
+++ b/testcases/kdump/setup
@@ -8,14 +8,11 @@ SYSCONFIG_FILE=/etc/sysconfig/kdump
declare -i ERRORS=0
declare -i NUM_ITERATIONS=1
declare -i CRASH_FOUND=0
-declare -i DISTRO_SUSE=0
-declare -i DISTRO_RH=0
# ARCH = 1 means it's ia32/x86_64 arch
# ARCH = 2 means it's ppc64 arch
declare -i ARCH
-X86_CRASHKERNEL='crashkernel=128M@16M'
-PPC_CRASHKERNEL='crashkernel=128M@32M'
+CRASHKERNEL='crashkernel=[0-9]\+M@[0-9]\+M'
USE_CRASH="n"
SCSI="n"
IDE="n"
@@ -24,18 +21,16 @@ VMLINUX_DEBUG=""
LINUX_2_6_16=2616
# Determine architecture we're running on
-arch=$(uname -i)
-if [ $arch = "i386" ]
+arch= `uname -m`
+if [ `echo $arch |grep -e "i[3-6]86"` ]
then
CRASHKERNEL=$X86_CRASHKERNEL
ARCH=1
-else if [ $arch = "x86_64" ]
+else if [ $arch == "x86_64" ]
then
- CRASHKERNEL=$X86_CRASHKERNEL
ARCH=1
-else if [ $arch = "ppc64" ]
+else if [ $arch == "ppc64" ]
then
- CRASHKERNEL=$PPC_CRASHKERNEL
ARCH=2
else
echo "Unsupported architecture... exiting"
@@ -51,18 +46,8 @@ if [ $KERNEL_VERSION -lt $LINUX_2_6_16 ]; then
fi
# Determine the distribution we are running on
-if [ -f /etc/redhat-release ]; then
- DISTRO_RH=1
-else if [ -f /etc/SuSE-release ]; then
- DISTRO_SUSE=1
-else
- echo "Unsupported distribution ... exiting"
- exit
-fi
-fi
-
-echo "DISTRO_RH=${DISTRO_RH}" > $CONFIG_FILE
-echo "DISTRO_SUSE=${DISTRO_SUSE}" >> $CONFIG_FILE
+DISTRO=`./distro`
+echo "DISTRO=$DISTRO" > $CONFIG_FILE
echo "Using the crash command and the kernel debug info during results"
echo "verfication is optional. If you choose to do so, they must be"
@@ -121,7 +106,7 @@ fi
echo "Checking other prerequisites..."
# Check for kexec-tools
-if [ -f /sbin/kexec -a -f /etc/sysconfig/kdump ]; then
+if [ -f /sbin/kexec ]; then
echo "Found kexec-tools..."
echo " "
else
@@ -132,29 +117,31 @@ else
fi
# Check for kdump kernel
-REQ_FOUND=$(rpm -qa | grep kernel-kdump 2>/dev/null)
-if [ $REQ_FOUND ]; then
- echo "Found kernel-kdump..."
- echo " "
-else
+if [ $DISTRO == "SUSE" ] || [ $DISTRO == "RH" ]; then
+ REQ_FOUND=$(rpm -qa | grep kernel-kdump 2>/dev/null)
+ if [ $REQ_FOUND ]; then
+ echo "Found kernel-kdump..."
+ echo " "
+ else
# Currently PPC64 arch on RHEL5 doesnot support relocatable kernel.
# Hence a seperate rpm for kdump kernel is shipped.
# For SuSE all arch do not have relocatable support hence require
# kdump rpm to be shipped.
-
- if [ $DISTRO_RH -eq 1 ] && [ $ARCH -eq 1 ]; then
- echo "Found kernel-kdump..."
- else
- echo "kernel-kdump NOT FOUND..."
- echo "Please install kernel-kdump rpm and run the setup"
- let "ERRORS++"
+ if [ $DISTRO == "RH" ] && [ $ARCH -eq 1 ]; then
+ echo "Found kernel-kdump..."
+ else
+ echo "kernel-kdump NOT FOUND..."
+ echo "Please install kernel-kdump rpm and run the setup"
+ let "ERRORS++"
+ fi
+ echo " "
fi
- echo " "
fi
# Make sure kernel was booted with proper crashkernel values
-STR=$(cat /proc/cmdline | grep -c $CRASHKERNEL 2>/dev/null)
-if [ $STR -gt 0 ]; then
+cat /proc/cmdline | grep -e $CRASHKERNEL >/dev/null
+RET=$?
+if [ $RET -eq 0 ]; then
echo "Kernel has reserved memory for kdump kernel..."
echo " "
else
@@ -191,11 +178,10 @@ echo "CRASH_CMDS=\$TEST_BASE_DIR/crash_cmds" >> $CONFIG_FILE
echo "VMLINUX_DEBUG=$VMLINUX_DEBUG" >> $CONFIG_FILE
# Where to put vmcore
-if [ $DISTRO_RH -eq 1 ]; then
+if [ $DISTRO == "RH" ]; then
echo "VMCORE=/var/crash" >> $CONFIG_FILE
fi
-
-if [ $DISTRO_SUSE -eq 1 ]; then
+if [ $DISTRO == "SUSE" ]; then
echo "VMCORE=\$TEST_BASE_DIR/vmcore" >> $CONFIG_FILE
fi
@@ -229,7 +215,7 @@ echo "MAILTO=root" >> $CRONTAB_FILE
echo "@reboot cd $TEST_BASE_DIR; ./master run" >> $CRONTAB_FILE
crontab $CRONTAB_FILE
-if [ $DISTRO_SUSE -eq 1 ]; then
+if [ $DISTRO == "SUSE" ]; then
#
# Editing /etc/sysconfig/kdump
#
@@ -248,18 +234,23 @@ fi
# Make sure the kdump service is on and
# the kdump kernel is loaded
-echo "Activating kdump service..."
-chkconfig kdump on
-echo "Making sure kdump kernel can be loaded..."
-service kdump restart
-
-#echo "Activating cron..."
-if [ $DISTRO_SUSE -eq 1 ]; then
-chkconfig cron on
-service cron start
-fi
-
-if [ $DISTRO_RH -eq 1 ]; then
-chkconfig crond on
-service crond restart
+if [ -f /bin/rpm ]; then
+ echo "Activating kdump service..."
+ chkconfig kdump on
+ echo "Making sure kdump kernel can be loaded..."
+ service kdump restart
+
+ echo "Activating cron..."
+ if [ $DISTRO == "SUSE" ]; then
+ chkconfig cron on
+ service cron start
+ fi
+ if [ $DISTRO == "RH" ]; then
+ chkconfig crond on
+ service crond restart
+ fi
+else
+ echo "There is no rpm on your machine."
+ echo "Please make sure that kdump and cron are enabled by
+ default."
fi