Author: gnichols
Date: 2011-04-14 15:26:58 +0000 (Thu, 14 Apr 2011)
New Revision: 867
Modified:
trunk/tests/reboot/reboot.py
Log:
635973 - reboot test should set vmcore size before testing kdump
Modified: trunk/tests/reboot/reboot.py
===================================================================
--- trunk/tests/reboot/reboot.py 2011-04-14 15:26:43 UTC (rev 866)
+++ trunk/tests/reboot/reboot.py 2011-04-14 15:26:58 UTC (rev 867)
@@ -36,20 +36,28 @@
self.continuation = Continuation(self.environment)
self.rebootTimeLimit = self.environment.getRebootTimelimit()
self.priority = 1001 # run last
+ self.coreCollector = "makedumpfile -d31"
+ self.kdumpConfigPath = "/etc/kdump.conf"
def getRequiredRPMs(self):
- rpms = ["kernel-debug", "kernel-debuginfo"]
+ rpms = ["kernel-debug", "kernel-debuginfo",
"kexec-tools"]
return rpms
def tags(self):
return [TestTag.noninteractive, TestTag.certification]
- def verifyKDump(self):
+ def configureKDump(self):
# if kdump is set up, use it
print "Checking kdump configuration"
verified = True
+ # log kexec-tools installation
+ try:
+ kexecRPM = Command("rpm -q kexec-tools").getString()
+ print "kexec-tools installed: " + kexecRPM
+ except:
+ pass
- # these checks aren't required, leaving them for diagnostic purposes
+ # check crashkernel on kernel command line
kernelBootParams = Command("cat /proc/cmdline")
kdump = None
try:
@@ -60,6 +68,7 @@
print "Warning: \"crashkernel\" is not set in boot
parameters"
verified = False
+ # check kernel panic timeout, and set to 1sec if necessary
try:
procPanicTimeout = "/proc/sys/kernel/panic"
getPanic = Command("cat " + procPanicTimeout)
@@ -76,7 +85,32 @@
print "Warning: could not set " + procPanicTimeout
print e
verified = False
+
+ # configure kdump to use makedumpfile -d 31
+ try:
+ configFile = ConfigFile(self.kdumpConfigPath)
+ coreCollector = configFile.getParameter("core_collector")
+ except IOError, exception:
+ print "Error: %s" % exception
+ return False
+ if not coreCollector:
+ print "Adding core_collector = %s to /etc/kdump.conf" %
self.coreCollector
+ configFile.addParameter("core_collector", self.coreCollector)
+ print "restarting kdump with new configuration..."
+ try:
+ Command("service kdump stop").echo()
+ Command("service kdump start").echo()
+ except V7CommandException, exception:
+ print "Error: kdump restart failed"
+ print exception
+ exception.command.printErrors()
+ verified = False
+ else:
+ print "core_collector currently set to \"" + coreCollector +
"\""
+
+
+
print "Checking kdump service"
try:
kdump = Command("service kdump status")
@@ -91,7 +125,8 @@
def reboot(self):
- usePanic = self.verifyKDump()
+ self.markOutput("initialize")
+ usePanic = self.configureKDump()
if usePanic:
print "The test will now cause a kernel panic to exercise kdump"
@@ -108,6 +143,7 @@
self.continuation.setInitConfig(self.Name(), method)
# we need a delay here to give v7 time to finish writing results.xml
+ self.closeOutput()
sys.stdout.flush()
self.waitForLull()
@@ -135,7 +171,7 @@
def verifyKDumpImage(self):
# parse /etc/kdump.conf to find the location of the image file
- configFile = ConfigFile("/etc/kdump.conf")
+ configFile = ConfigFile(self.kdumpConfigPath)
imageDirectory = configFile.getParameter("path")
if not imageDirectory:
imageDirectory = "/var/crash"
@@ -169,7 +205,8 @@
# run crash to see if it's a valid image
try:
# just run crash on it and quit, then look for the return value
- crash = Command("echo \"q\" | crash %s
/usr/lib/debug/lib/modules/`uname -r`/vmlinux" % vmcorePath)
+ # using -s to supress startup output, then "sys" command for a
summary, then "q" to quit the interpreter
+ crash = Command("echo \"sys\nq\" | crash -s %s
/usr/lib/debug/lib/modules/`uname -r`/vmlinux" % vmcorePath)
crash.echo()
# if we get here, it must be OK
print "kdump image %s verified"% vmcorePath
@@ -187,10 +224,12 @@
FAILED = 1
if self.incomplete:
+ self.markOutput("verify")
result = self.continuation.verify(marker=self.Name())
self.continuation.removeInitConfig()
if self.continuation.getMethod() == Constants.panic:
result = self.verifyKDumpImage()
+ self.closeOutput()
else:
result = self.reboot()
Show replies by date