Hello,
Attached patch which allows to run kdump tests on non RH and SUSE machines.
I have did also some code cleanups. Please review an let me know if your
opinion about it. I would like this patch be submitted to LTP.
--
Best regards,
Maxim Uvarov
--- ltp/testcases/kdump/distro.orig 2007-04-10 07:08:10.000000000 +0000
+++ ltp/testcases/kdump/distro 2007-05-21 20:26:50.000000000 +0000
@@ -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
--- ltp/testcases/kdump/setup.orig 2007-05-04 15:40:09.000000000 +0000
+++ ltp/testcases/kdump/setup 2007-05-21 20:25:44.000000000 +0000
@@ -8,14 +8,11 @@
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='[EMAIL PROTECTED]'
-PPC_CRASHKERNEL='[EMAIL PROTECTED]'
+CRASHKERNEL='[EMAIL PROTECTED]'
USE_CRASH="n"
SCSI="n"
IDE="n"
@@ -24,20 +21,15 @@
LINUX_2_6_16=2616
# Determine architecture we're running on
-#arch=$(uname -i)
-arch="i386"
-
-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"
@@ -53,18 +45,8 @@
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"
@@ -123,7 +105,7 @@
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
@@ -134,29 +116,31 @@
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
@@ -193,11 +177,11 @@
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
@@ -211,7 +195,7 @@
# Tools
echo "CRASHER_MOD=\$TEST_BASE_DIR/tools/crasher_mod/crasher.ko" >> $CONFIG_FILE
-if [ $DISTRO_SUSE -eq 1 ]; then
+if [ $DISTRO == "SUSE" ]; then
echo "TTUTILS_BIN=\$TEST_BASE_DIR/tools/dtt_tools/ttutils" >> $CONFIG_FILE
echo "MEMDRAIN_BIN=\$TEST_BASE_DIR/tools/dtt_tools/helper/memdrain" >> $CONFIG_FILE
echo "SETUID_BIN=\$TEST_BASE_DIR/tools/dtt_tools/helper/setuid" >> $CONFIG_FILE
@@ -219,7 +203,7 @@
echo "BRK_BIN=\$TEST_BASE_DIR/tools/dtt_tools/helper/brk" >> $CONFIG_FILE
fi
-if [ $DISTRO_RH -eq 1 ]; then
+if [ $DISTRO == "RH" ]; then
echo "LKDTM=\$TEST_BASE_DIR/tools/lkdtm_mod/lkdtm.ko" >> $CONFIG_FILE
fi
@@ -241,7 +225,7 @@
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
#
@@ -260,18 +244,24 @@
# 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 [ -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 -eq 1 ]; then
-chkconfig crond on
-service crond restart
+ 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
--- ltp/testcases/kdump/master.orig 2007-04-10 07:08:10.000000000 +0000
+++ ltp/testcases/kdump/master 2007-05-21 19:43:16.000000000 +0000
@@ -38,7 +38,7 @@
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 @@
fi
fi
fi
- if [ $DISTRO_SUSE -eq 1 ]; then
+ if [ $DISTRO == "RH" ]; then
#
# Verify results of previous test
#
@@ -103,12 +103,12 @@
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
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list