r989 - trunk/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2011-07-07 19:01:40 +0000 (Thu, 07 Jul 2011)
New Revision: 989
Modified:
trunk/v7/commandLineUI.py
Log:
684075 - the hardware <make/> tag in results.xml is never set.
Modified: trunk/v7/commandLineUI.py
===================================================================
--- trunk/v7/commandLineUI.py 2011-07-07 19:00:39 UTC (rev 988)
+++ trunk/v7/commandLineUI.py 2011-07-07 19:01:40 UTC (rev 989)
@@ -14,6 +14,7 @@
# Author: Greg Nichols
#
import string, os, sys, copy, re
+import readline
from tags import Constants
@@ -66,6 +67,16 @@
def promptContinue(self, message):
return self.promptConfirm(question=("%s - continue? " % message))
+
+ def promptEdit(self, label, value):
+ if not value:
+ value = ""
+ readline.set_startup_hook(lambda: readline.insert_text(value))
+ try:
+ return raw_input(label)
+ finally:
+ readline.set_startup_hook()
+
12 years, 10 months
r988 - trunk/tests/storage
by gnichols@fedoraproject.org
Author: gnichols
Date: 2011-07-07 19:00:39 +0000 (Thu, 07 Jul 2011)
New Revision: 988
Modified:
trunk/tests/storage/storage.py
Log:
704031 - Include additional LVM debugging info in storage test
Modified: trunk/tests/storage/storage.py
===================================================================
--- trunk/tests/storage/storage.py 2011-07-07 18:59:18 UTC (rev 987)
+++ trunk/tests/storage/storage.py 2011-07-07 19:00:39 UTC (rev 988)
@@ -380,24 +380,37 @@
else:
print "Error: raw I/O test failed !"
return False
+
+ def logLVM(self):
+ try:
+ # these commands write to standard error for no reason
+ Command("pvdisplay").echoIgnoreErrors()
+ Command("vgdisplay").echoIgnoreErrors()
+ Command("lvdisplay").echoIgnoreErrors()
+ except Exception, exception:
+ print "Warning: could not log LVM info"
+ print exception
+
+ return True
- def run(self):
+ def runStorage(self):
"""Overall test strategy: Instruct the tester to install RHEL *only* on
a single disk. We can use the swap partition for testing that disk, and
every other (unused) disk we can test directly."""
+
# check for dt first
if os.path.exists("/usr/sbin/dt"):
print "Found dt package."
else:
print "Error: No dt package found !"
- return 1
+ return False
# complains error if can not find any testable block device
storageDevice = self.getLogicalDeviceName()
if storageDevice:
print "Start testing on /dev/%s ..." % storageDevice
else:
print "Error: Can not find any block device to test ! "
- return 1
+ return False
# initialize
size = 0
isLvm = "false"
@@ -409,7 +422,7 @@
print "Found %s in /proc/partitions." % storageDevice
else:
print "Error: Can not find %s in /proc/partitions !" % storageDevice
- return 1
+ return False
# grab hw info
self.grabHardwareInfo()
# If there's a swap device, use that for testing
@@ -441,7 +454,7 @@
# check the test device
testdev = self.getTestDevice(storageDevice,swapdev,isLvm)
if not testdev:
- return 1
+ return False
# Set device-appropriate blocksizes and other special stuff.
if storageDevice[0:4] == "dasd":
minBs = 4096
@@ -458,16 +471,16 @@
print "\n*** Raw I/O testing passed.\n"
returnValue=0
else:
- return 1
+ return False
else:
- return 1
+ return False
# Clean up, try to restore swap if needed.
if testdev == swapdev:
if self.restoreSwap(swapdev,swapLabel):
print "restored the swap device."
else:
print "Error: restore swap error !"
- return 1
+ return False
# try to remove temp directories
os.system("rmdir %s.* 2>/dev/null" % storageDevice)
if returnValue == 0:
@@ -476,7 +489,19 @@
returnValue = 1
result = "failed"
print "\nStorage test on device %s %s" % (storageDevice, result)
- return returnValue
+ return (returnValue == 0)
+
+ def run(self):
+ FAILED = 1
+ PASSED = 0
+
+ if not self.runSubTest(self.logLVM, "LVM", "Log LVM info"):
+ return FAILED
+
+ if not self.runSubTest(self.runStorage, "Test storage I/O"):
+ return FAILED
+
+ return PASSED
if __name__ == "__main__":
test = StorageTest()
12 years, 10 months
r987 - trunk/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2011-07-07 18:59:18 +0000 (Thu, 07 Jul 2011)
New Revision: 987
Modified:
trunk/v7/documentbase.py
Log:
705326 - fv_network is tagged as interactive, v7 --mode auto will result in fv failures
Modified: trunk/v7/documentbase.py
===================================================================
--- trunk/v7/documentbase.py 2011-07-07 18:54:48 UTC (rev 986)
+++ trunk/v7/documentbase.py 2011-07-07 18:59:18 UTC (rev 987)
@@ -214,7 +214,7 @@
element.appendChild(tagElement)
def getTags(self):
- tagElements = self.element.getElementsByTagName(Tags.tag)
+ tagElements = self.getChildElements(Tags.tag)
tags = list()
for tagElement in tagElements:
tag = self.getTextNode(tagElement)
12 years, 10 months
r986 - trunk/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2011-07-07 18:54:48 +0000 (Thu, 07 Jul 2011)
New Revision: 986
Modified:
trunk/v7/hardwaretest.py
Log:
710173 - Remove test verification prompt if no errors found\n 684075 - the hardware <make/> tag in results.xml is never set.
Modified: trunk/v7/hardwaretest.py
===================================================================
--- trunk/v7/hardwaretest.py 2011-07-07 18:51:28 UTC (rev 985)
+++ trunk/v7/hardwaretest.py 2011-07-07 18:54:48 UTC (rev 986)
@@ -600,9 +600,8 @@
if not self.ui.promptConfirm("Verification failed, would you like to continue testing?"):
return False
- # otherwise overriding verification failure, or passed verification and user continue
- if not verified or self.options.mode == Constants.auto or self.ui.promptConfirm("Run these tests?"):
- return self._doRun(tests)
+ # otherwise overriding verification failure or passed verification
+ return self._doRun(tests)
else:
print "Error: no tests match the supplied options"
return False
@@ -971,8 +970,9 @@
self.certification.setHardware(Tags.arch, arch)
if self.Debugging:
print "Getting Bios Info for %s" % arch
- foundVendor = False
- foundModel = False
+ vendor = ""
+ make = ""
+ model = ""
if arch in ['i386','i586','i686','x86_64']:
dmidecode = os.popen("/usr/sbin/dmidecode")
@@ -982,48 +982,39 @@
(key,val)=[t.strip() for t in line.split(':',1) if line.find(':')]
if key == "Manufacturer":
- self.certification.setHardware(Tags.vendor, val)
- if self.Debugging: print "Vendor: %s" % val
- foundVendor = True
+ vendor = val
if key == "Product Name":
- self.certification.setHardware(Tags.model, val)
- if self.Debugging: print "Model: %s" % val
- foundModel = True
- if foundModel and foundVendor:
+ model = val
+ if vendor and model:
break
dmidecode.close()
elif os.path.exists('/proc/device-tree/model'):
f=open('/proc/device-tree/model')
model = f.readline().strip()
- if self.Debugging: print "Model: %s" % model
- self.certification.setHardware(Tags.model, model)
- foundModel = True
f.close()
elif arch in ['s390','s390x']:
- self.certification.setHardware(Tags.vendor, 'IBM')
- if self.Debugging: print "Vendor: IBM"
- self.certification.setHardware(Tags.make, 'eServer zSeries')
- if self.Debugging: print "Make: eServer zSeries"
+ vendor = 'IBM'
+ make = 'eServer zSeries'
# try asking the humans for it
- if not (foundModel and foundVendor) and self.options.mode == Constants.normal:
- print "Unable to determine model and vendor"
+ if self.options.mode == Constants.normal:
+ print "Please verify the vendor, make, and model:"
- vendor = self.ui.prompt("Please enter the vendor: ")
- if len(vendor) > 0:
- foundVendor = True
+ vendor = self.ui.promptEdit("Vendor: ", vendor)
+ if vendor:
self.certification.setHardware(Tags.vendor, vendor)
- model = self.ui.prompt("Please enter the model: ")
- if len(model) > 0:
- foundModel = True
+ make = self.ui.promptEdit("Make: ", make)
+ if make:
+ self.certification.setHardware(Tags.make, make)
+ model = self.ui.promptEdit("Model: ", model)
+ if model:
self.certification.setHardware(Tags.model, model)
-
+
+ else: # --mode auto
+ self.certification.setHardware(Tags.model, model)
+ self.certification.setHardware(Tags.make, make)
+ self.certification.setHardware(Tags.vendor, vendor)
- if not foundModel:
- self.certification.setHardware(Tags.model, "unknown model")
- if not foundVendor:
- self.certification.setHardware(Tags.vendor, "unknown vendor")
-
def getArch(self):
system,node,release,version,machine = os.uname()
12 years, 10 months
r985 - trunk/tests/info
by gnichols@fedoraproject.org
Author: gnichols
Date: 2011-07-07 18:51:28 +0000 (Thu, 07 Jul 2011)
New Revision: 985
Modified:
trunk/tests/info/info.py
Log:
714848 - Preview kernel taint should be error but not warning\n 708046 - info.py backtraces in checkModuleVenderAndBuildHost with v7CommandException is not defined
Modified: trunk/tests/info/info.py
===================================================================
--- trunk/tests/info/info.py 2011-07-07 18:48:23 UTC (rev 984)
+++ trunk/tests/info/info.py 2011-07-07 18:51:28 UTC (rev 985)
@@ -56,10 +56,13 @@
taintedFile = open("/proc/sys/kernel/tainted", "r")
tainted = int(taintedFile.readline())
if tainted != 0:
- print "Warning: kernel is tainted (value = %u)" % tainted
if tainted != Constants.TAINT_UNSIGNED_MODULE:
# fail for taints other than unsigned modules; modules will be checked later
+ print "Error: kernel is tainted (value = %u)" % tainted
success = False
+ else:
+ print "Warning: kernel is tainted (value = %u)" % tainted
+
if tainted & Constants.TAINT_PROPRIETARY_MODULE:
print "Please remove the non-GPL modules."
if tainted & Constants.TAINT_TECHPREVIEW_MODULE:
@@ -221,7 +224,7 @@
if "redhat.com" not in buildhost:
print "Error: Driver module %s was built on %s and not built at Red Hat." % (module, buildhost)
result = False
- except v7CommandException, exception:
+ except V7CommandException, exception:
print "Error: could not determine driver packaging info for module %s" % module
print exception
result = False
12 years, 10 months
r984 - trunk/tests/rteval
by gnichols@fedoraproject.org
Author: gnichols
Date: 2011-07-07 18:48:23 +0000 (Thu, 07 Jul 2011)
New Revision: 984
Modified:
trunk/tests/rteval/v7_rteval.py
Log:
716557 - Change v7_rteval.py maximum latency from 100us to 150us.
Modified: trunk/tests/rteval/v7_rteval.py
===================================================================
--- trunk/tests/rteval/v7_rteval.py 2011-07-07 18:44:54 UTC (rev 983)
+++ trunk/tests/rteval/v7_rteval.py 2011-07-07 18:48:23 UTC (rev 984)
@@ -100,7 +100,7 @@
report = self.rteval.XMLreport()
xpath = report.xpathNewContext()
- ok_values = {"/rteval/cyclictest/system/statistics/maximum": 100.0,
+ ok_values = {"/rteval/cyclictest/system/statistics/maximum": 150.0,
"/rteval/cyclictest/system/statistics/standard_deviation": 3.0}
for k in ok_values.keys():
12 years, 10 months
r983 - in trunk/tests: . kdump reboot
by gnichols@fedoraproject.org
Author: gnichols
Date: 2011-07-07 18:44:54 +0000 (Thu, 07 Jul 2011)
New Revision: 983
Added:
trunk/tests/kdump/
trunk/tests/kdump/Makefile
trunk/tests/kdump/kdump.py
Modified:
trunk/tests/reboot/reboot.py
Log:
718290 - Can the kdump variation of the reboot test be moved to be the kdump test?
Added: trunk/tests/kdump/Makefile
===================================================================
--- trunk/tests/kdump/Makefile (rev 0)
+++ trunk/tests/kdump/Makefile 2011-07-07 18:44:54 UTC (rev 983)
@@ -0,0 +1,30 @@
+# V7
+TOPLEVEL_NAMESPACE=/V7
+
+# The name of the package under test:
+PACKAGE_NAME=v7
+
+# The path of the test below the package:
+RELATIVE_PATH=kdump
+
+# Version of the Test. Used with make tag.
+export TESTVERSION=1.0
+
+# The compiled namespace of the test.
+export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH)
+
+.PHONY: all install download clean
+
+FILES=kdump.py
+
+run: $(FILES) build
+
+build: $(BUILT_FILES)
+ chmod a+x ./kdump.py
+
+clean:
+ rm -f $(BUILT_FILES)
+
+# Include Common Makefile
+include $(DESTDIR)/usr/share/v7/lib/v7-make.include
+
Added: trunk/tests/kdump/kdump.py
===================================================================
--- trunk/tests/kdump/kdump.py (rev 0)
+++ trunk/tests/kdump/kdump.py 2011-07-07 18:44:54 UTC (rev 983)
@@ -0,0 +1,301 @@
+#!/usr/bin/python
+# Copyright (c) 2008 Red Hat, Inc. All rights reserved. This copyrighted material
+# is made available to anyone wishing to use, modify, copy, or
+# redistribute it subject to the terms and conditions of the GNU General
+# Public License v.2.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Greg Nichols <gnichols(a)redhat.com>
+
+import os, string, sys, time, syslog, re
+
+from v7.tags import Constants, DeviceClass, TestTag
+from v7.test import Test
+from v7.command import Command, V7CommandException
+from v7.controller import Controller
+from v7.environment import Environment
+from v7.documentbase import DocumentWrapper
+from v7.continuation import Continuation
+from v7.configfile import ConfigFile
+
+
+class KDumpTest(Test):
+
+ def __init__(self):
+ Test.__init__(self, name="kdump")
+ self.interactive = False # will prompt in --mode normal, but runs ok in --mode auto
+ self.deviceClass = DeviceClass.system
+ self.environment = Environment()
+ self.continuation = Continuation(self.environment)
+ self.rebootTimeLimit = self.environment.getRebootTimelimit()
+ self.priority = 1001 # run last
+ self.coreCollector = "makedumpfile -d 31"
+ self.kdumpConfigPath = "/etc/kdump.conf"
+
+ def getRequiredRPMs(self):
+ rpms = ["kernel-debug", "kernel-debuginfo", "kexec-tools"]
+ return rpms
+
+ def plan(self, devices):
+ tests = list()
+ # plan kdump twice: once on storage (local disk) and once over network
+ for dumpMethod in [Constants.nfs, Constants.local]:
+ test = self.makeCopy()
+ test.setLogicalDeviceName(dumpMethod)
+ tests.append(test)
+ return tests
+
+ def verify(self):
+ if self.getLogicalDeviceName() == Constants.nfs and (self.getTestServer() == None or self.getTestServer() == "unknown"):
+ print "kdump test for %s failed verification: No test server was set." % self.getLogicalDeviceName()
+ return False
+ return True
+
+
+ def tags(self):
+ # nanny-prompting in --mode normal, will run --mode auto
+ return [TestTag.noninteractive, TestTag.certification]
+
+ 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
+
+ # check crashkernel on kernel command line
+ kernelBootParams = Command("cat /proc/cmdline")
+ kdump = None
+ try:
+ kernelBootParams = Command("cat /proc/cmdline")
+ kdump = kernelBootParams.getString(regex=".+ crashkernel=(?P<kdump>[^\ ]+)", regexGroup="kdump")
+ print "Found crashkernel=%s boot parameter" % kdump
+ except:
+ print "Error: \"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)
+ timeout = getPanic.getInteger()
+ print "Kernel panic reboot timeout is %u" % timeout
+ if timeout is 0:
+ print "Setting to 1 sec."
+ setPanic = Command("echo 1 > " + procPanicTimeout)
+ setPanic.echo()
+ if getPanic.getInteger() is not 1:
+ print "Error: could not set panic timeout"
+ verifited = False
+ except V7CommandException, e:
+ print "Error: 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")
+ net = configFile.getParameter("net")
+ except IOError, exception:
+ print "Error: %s" % exception
+ return False
+
+ restart = False
+ if not coreCollector:
+ print "Adding core_collector = %s to %s" % (self.coreCollector, self.kdumpConfigPath)
+ configFile.addParameter("core_collector", self.coreCollector)
+ restart = True
+ else:
+ print "core_collector currently set to \"" + coreCollector + "\""
+
+ if net:
+ if self.getLogicalDeviceName() == Constants.local:
+ print "removing net setting for local disk dump"
+ configFile.removeParameter("net")
+ restart = True
+ else:
+ print "Network Dump set to %s" % net
+ elif self.getLogicalDeviceName() == Constants.nfs:
+ if self.getTestServer() and self.getTestServer() != "unknown":
+ net = "%s:/var/v7/export" % self.getTestServer()
+ print "Adding net %s to %s" % (net, self.kdumpConfigPath)
+ configFile.addParameter("net", net)
+ restart = True
+ else:
+ print "Error: v7 test server not set for network kdump"
+ return False
+
+
+ if restart:
+ configFile.save()
+ 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
+
+
+ print "Checking kdump service"
+ try:
+ kdump = Command("service kdump status")
+ kdump.getString("is operational")
+ print "kdump is running"
+ except V7CommandException, e:
+ print "Error: kdump is not running - can not test it"
+ print e
+ verified = False
+
+ return verified
+
+
+ def panic(self):
+ self.markOutput("initialize")
+ if not self.configureKDump():
+ return False
+
+ # otherwise
+ print "The test will now cause a kernel panic to exercise kdump"
+
+ if self.getMode() != Constants.auto:
+ if not self.promptConfirm("Ready to restart?"):
+ return False
+
+ # set up restart, and log start time
+ self.continuation.setInitConfig(self.Name(), Constants.panic)
+
+ # we need a delay here to give v7 time to finish writing results.xml
+ self.closeOutput()
+ sys.stdout.flush()
+ self.waitForLull()
+
+ try:
+ Command("echo 1 > /proc/sys/kernel/sysrq").echo()
+ Command("echo \"c\" > /proc/sysrq-trigger").echo()
+ except Exception, e:
+ print "Error: attempt to cause kernel panic failed"
+ print e
+ return False
+
+ # wait here for reboot
+ waitTime = 60 #sec
+ print "Waiting for kernel panic..."
+ time.sleep(waitTime)
+ print "Error: The kernel panic took too long"
+ return False
+
+ def verifyKDumpImage(self):
+ imageDirectory = self.getImageDirectory()
+ if not imageDirectory:
+ return False
+
+ # find the vmcore image file matching the timestamp
+ # vmcore directories are like this: 127.0.0.1-2011-03-10-13:18:27
+ vmcoreDirectoryPattern = re.compile("(?P<ipaddr>[0-9]+\.[0-9]+\.[0-9]+)-(?P<date>[0-9]+-[0-9]+-[0-9]+)-(?P<time>[0-9]+:[0-9]+:[0-9]+)")
+ minimumDuration = None
+ directoryMatch = None
+ for (root,dirs,files) in os.walk(imageDirectory):
+ for dir in dirs:
+ match = vmcoreDirectoryPattern.search(dir)
+ if match:
+ timestamp = "%s %s" % (match.group("date"), match.group("time"))
+ duration = self.continuation.getDuration(timestamp)
+ print "%s took %s" % (dir, duration)
+ if not directoryMatch or (duration.seconds < minimumDuration):
+ minimumDuration = duration.seconds
+ directoryMatch = dir
+ # accept it if it's less than reboot time limit
+ if directoryMatch and (minimumDuration < self.rebootTimeLimit*60):
+ vmcorePath = os.path.join(imageDirectory, directoryMatch, "vmcore")
+ print "Found kdump image: " + vmcorePath
+ else:
+ print "Error: could not locate vmcore file"
+ if directoryMatch:
+ print "Closest match is " + os.path.join(imageDirectory, directoryMatch, "vmcore")
+ print "Reboot timestamp: " + self.continuation.getTimestamp()
+ return False
+
+ # run crash to see if it's a valid image
+ try:
+ # just run crash on it and quit, then look for the return value
+ # 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
+ return True
+ except V7CommandException, exception:
+ print "Error: could not verify kdump image %s" % vmcorePath
+ print exception
+ crash.printErrors()
+
+ return False
+
+ def getImageDirectory(self):
+ # parse /etc/kdump.conf to find the location of the image file
+ configFile = ConfigFile(self.kdumpConfigPath)
+ imageDirectory = configFile.getParameter("path")
+ if not imageDirectory:
+ imageDirectory = "/var/crash"
+
+ # if nfs network dump, mount the filesystem
+ net = configFile.getParameter("net")
+ if net:
+ print "Attempting to mount net setting %s as nfs." % net
+ try:
+ localPath = "v7-net"
+ Command("mkdir %s" % localPath).echo()
+ Command("mount %s %s" % (net, localPath)).echo()
+ if os.path.isabs(imageDirectory):
+ imageDirectory = localPath + imageDirectory
+ else:
+ imageDirectory = os.path.join(localPath, imageDirectory)
+ except V7CommandException, exception:
+ print "Error: could not mount nfs image directory"
+ print exception
+ print exception.command.printErrors()
+ return None
+
+ print "Looking for vmcore image directories under " + imageDirectory
+ return imageDirectory
+
+
+ def run(self):
+ PASSED = 0
+ FAILED = 1
+
+ if self.incomplete and self.continuation.isInitialized():
+ 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.panic()
+
+ if result: return PASSED
+
+ # otherwise
+ return FAILED
+
+
+if __name__ == "__main__":
+ test = RebootTest()
+ returnValue = test.do(sys.argv)
+ sys.exit(returnValue)
Modified: trunk/tests/reboot/reboot.py
===================================================================
--- trunk/tests/reboot/reboot.py 2011-07-07 18:44:08 UTC (rev 982)
+++ trunk/tests/reboot/reboot.py 2011-07-07 18:44:54 UTC (rev 983)
@@ -38,148 +38,21 @@
self.priority = 1001 # run last
self.coreCollector = "makedumpfile -d 31"
self.kdumpConfigPath = "/etc/kdump.conf"
-
- def getRequiredRPMs(self):
- rpms = ["kernel-debug", "kernel-debuginfo", "kexec-tools"]
- return rpms
- def plan(self, devices):
- tests = list()
- # plan reboot twice: once on storage (local disk) and once over network
- for dumpMethod in [Constants.nfs, Constants.local]:
- test = self.makeCopy()
- test.setLogicalDeviceName(dumpMethod)
- tests.append(test)
- return tests
-
- def verify(self):
- if self.getLogicalDeviceName() == Constants.nfs and (self.getTestServer() == None or self.getTestServer() == "unknown"):
- print "Reboot test for %s failed verification: No test server was set." % self.getLogicalDeviceName()
- return False
- return True
-
-
def tags(self):
return [TestTag.noninteractive, TestTag.certification]
- 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
-
- # check crashkernel on kernel command line
- kernelBootParams = Command("cat /proc/cmdline")
- kdump = None
- try:
- kernelBootParams = Command("cat /proc/cmdline")
- kdump = kernelBootParams.getString(regex=".+ crashkernel=(?P<kdump>[^\ ]+)", regexGroup="kdump")
- print "Found crashkernel=%s boot parameter" % kdump
- except:
- 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)
- timeout = getPanic.getInteger()
- print "Kernel panic reboot timeout is %u" % timeout
- if timeout is 0:
- print "Setting to 1 sec."
- setPanic = Command("echo 1 > " + procPanicTimeout)
- setPanic.echo()
- if getPanic.getInteger() is not 1:
- print "Error: could not set panic timeout"
- verifited = False
- except V7CommandException, e:
- 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")
- net = configFile.getParameter("net")
- except IOError, exception:
- print "Error: %s" % exception
- return False
-
- restart = False
- if not coreCollector:
- print "Adding core_collector = %s to %s" % (self.coreCollector, self.kdumpConfigPath)
- configFile.addParameter("core_collector", self.coreCollector)
- restart = True
- else:
- print "core_collector currently set to \"" + coreCollector + "\""
-
- if net:
- if self.getLogicalDeviceName() == Constants.local:
- print "removing net setting for local disk dump"
- configFile.removeParameter("net")
- restart = True
- else:
- print "Network Dump set to %s" % net
- elif self.getLogicalDeviceName() == Constants.nfs:
- if self.getTestServer() and self.getTestServer() != "unknown":
- net = "%s:/var/v7/export" % self.getTestServer()
- print "Adding net %s to %s" % (net, self.kdumpConfigPath)
- configFile.addParameter("net", net)
- restart = True
- else:
- print "Error: v7 test server not set for network dump"
- return False
-
-
- if restart:
- configFile.save()
- 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
-
-
- print "Checking kdump service"
- try:
- kdump = Command("service kdump status")
- kdump.getString("is operational")
- print "kdump is running"
- except V7CommandException, e:
- print "Warning: kdump is not running - can not test it"
- print e
- verified = False
-
- return verified
-
-
+
def reboot(self):
self.markOutput("initialize")
- usePanic = self.configureKDump()
-
- if usePanic:
- print "The test will now cause a kernel panic to exercise kdump"
- else:
- print "The system must be restarted for this test"
+ print "The system must be restarted for this test"
if self.getMode() != Constants.auto:
if not self.promptConfirm("Ready to restart?"):
return False
# set up restart, and log start time
- method = Constants.reboot
- if usePanic: method = Constants.panic
- self.continuation.setInitConfig(self.Name(), method)
+ self.continuation.setInitConfig(self.Name(), Constants.reboot)
# we need a delay here to give v7 time to finish writing results.xml
self.closeOutput()
@@ -187,103 +60,19 @@
self.waitForLull()
try:
- if usePanic:
- Command("echo 1 > /proc/sys/kernel/sysrq").echo()
- Command("echo \"c\" > /proc/sysrq-trigger").echo()
- else:
- Command("shutdown -r 0").echo()
+ Command("shutdown -r 0").echo()
except Exception, e:
- print "Error: reboot failed"
+ print "Error: attempt to reboot failed"
print e
return False
# wait here for reboot
waitTime = 60 #sec
- if usePanic:
- mode = "kernel panic"
- else:
- mode = "shutdown"
- print "Waiting for %s..." % mode
+ print "Waiting for shutdown..." % mode
time.sleep(waitTime)
- print "Error: %s took too long" % mode
+ print "Error: shutdown took too long" % mode
return False
-
- def verifyKDumpImage(self):
- imageDirectory = self.getImageDirectory()
- if not imageDirectory:
- return False
-
- # find the vmcore image file matching the timestamp
- # vmcore directories are like this: 127.0.0.1-2011-03-10-13:18:27
- vmcoreDirectoryPattern = re.compile("(?P<ipaddr>[0-9]+\.[0-9]+\.[0-9]+)-(?P<date>[0-9]+-[0-9]+-[0-9]+)-(?P<time>[0-9]+:[0-9]+:[0-9]+)")
- minimumDuration = None
- directoryMatch = None
- for (root,dirs,files) in os.walk(imageDirectory):
- for dir in dirs:
- match = vmcoreDirectoryPattern.search(dir)
- if match:
- timestamp = "%s %s" % (match.group("date"), match.group("time"))
- duration = self.continuation.getDuration(timestamp)
- print "%s took %s" % (dir, duration)
- if not directoryMatch or (duration.seconds < minimumDuration):
- minimumDuration = duration.seconds
- directoryMatch = dir
- # accept it if it's less than reboot time limit
- if directoryMatch and (minimumDuration < self.rebootTimeLimit*60):
- vmcorePath = os.path.join(imageDirectory, directoryMatch, "vmcore")
- print "Found kdump image: " + vmcorePath
- else:
- print "Error: could not locate vmcore file"
- if directoryMatch:
- print "Closest match is " + os.path.join(imageDirectory, directoryMatch, "vmcore")
- print "Reboot timestamp: " + self.continuation.getTimestamp()
- return False
-
- # run crash to see if it's a valid image
- try:
- # just run crash on it and quit, then look for the return value
- # 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
- return True
- except V7CommandException, exception:
- print "Error: could not verify kdump image %s" % vmcorePath
- print exception
- crash.printErrors()
- return False
-
- def getImageDirectory(self):
- # parse /etc/kdump.conf to find the location of the image file
- configFile = ConfigFile(self.kdumpConfigPath)
- imageDirectory = configFile.getParameter("path")
- if not imageDirectory:
- imageDirectory = "/var/crash"
-
- # if nfs network dump, mount the filesystem
- net = configFile.getParameter("net")
- if net:
- print "Attempting to mount net setting %s as nfs." % net
- try:
- localPath = "v7-net"
- Command("mkdir %s" % localPath).echo()
- Command("mount %s %s" % (net, localPath)).echo()
- if os.path.isabs(imageDirectory):
- imageDirectory = localPath + imageDirectory
- else:
- imageDirectory = os.path.join(localPath, imageDirectory)
- except V7CommandException, exception:
- print "Error: could not mount nfs image directory"
- print exception
- print exception.command.printErrors()
- return None
-
- print "Looking for vmcore image directories under " + imageDirectory
- return imageDirectory
-
-
def run(self):
PASSED = 0
FAILED = 1
@@ -292,8 +81,6 @@
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()
12 years, 10 months
r982 - trunk
by gnichols@fedoraproject.org
Author: gnichols
Date: 2011-07-07 18:44:08 +0000 (Thu, 07 Jul 2011)
New Revision: 982
Modified:
trunk/Makefile
Log:
R9
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2011-07-06 18:58:51 UTC (rev 981)
+++ trunk/Makefile 2011-07-07 18:44:08 UTC (rev 982)
@@ -14,7 +14,7 @@
# Author: Greg Nichols
V7_VERSION := 1.4
-V7_RELEASE := 8
+V7_RELEASE := 9
V7_VERSION_RELEASE := $(V7_VERSION)-$(V7_RELEASE)
V7_VERSION_PY := v7/version.py
V7_SVN_MODULE := svn+ssh://svn.fedorahosted.org/svn/v7
12 years, 10 months
r981 - tags
by gnichols@fedoraproject.org
Author: gnichols
Date: 2011-07-06 18:58:51 +0000 (Wed, 06 Jul 2011)
New Revision: 981
Added:
tags/v7-V1-4R8/
Log:
tag version
12 years, 10 months
r980 - trunk
by gnichols@fedoraproject.org
Author: gnichols
Date: 2011-07-06 18:58:29 +0000 (Wed, 06 Jul 2011)
New Revision: 980
Modified:
trunk/Makefile
Log:
R8
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2011-07-06 18:58:03 UTC (rev 979)
+++ trunk/Makefile 2011-07-06 18:58:29 UTC (rev 980)
@@ -14,7 +14,7 @@
# Author: Greg Nichols
V7_VERSION := 1.4
-V7_RELEASE := 7
+V7_RELEASE := 8
V7_VERSION_RELEASE := $(V7_VERSION)-$(V7_RELEASE)
V7_VERSION_PY := v7/version.py
V7_SVN_MODULE := svn+ssh://svn.fedorahosted.org/svn/v7
12 years, 10 months