Author: gnichols Date: 2010-06-08 18:04:25 +0000 (Tue, 08 Jun 2010) New Revision: 526
Modified: trunk/v7/controller.py trunk/v7/documentbase.py trunk/v7/hardwaretest.py trunk/v7/test.py Log: 568526 - FEAT: add a reboot test
Modified: trunk/v7/controller.py =================================================================== --- trunk/v7/controller.py 2010-06-07 09:54:52 UTC (rev 525) +++ trunk/v7/controller.py 2010-06-08 18:04:25 UTC (rev 526) @@ -31,8 +31,7 @@
def __init__(self): self.ui = CommandLineUI() - self.systemLogMarker = "v7/runtests[%s]" % os.getpid() - + self.systemLogMarker = "v7/runtests"
def removeDirectory(self, dir): "Remove a directory (and all its contents)" @@ -58,16 +57,20 @@ goodList = pattern.findall(value) return "".join(goodList)
- def getSystemLogMarker(self, markerName, mark): - return self.systemLogMarker+": %s: %s" % (markerName, mark) + def getSystemLogMarker(self, markerName, mark, pid=True): + if pid: + return self.systemLogMarker+"[%s]: %s: %s" % (os.getpid(), markerName, mark) + #otherwise + return self.systemLogMarker+": %s: %s" % (markerName, mark) + + def getSystemLogOpen(self): + return self.systemLogMarker+"[%s]" % os.getpid()
- - def getSystemLog(self, markerName): + def getSystemLog(self, markerName, pid=True): "Get a named section of the system log" # It feels a bit wrong to have this stuff hardcoded, but it works. - beginMark = self.getSystemLogMarker(markerName, "begin") - endMark = self.getSystemLogMarker(markerName, "end") - marker_str=self.systemLogMarker+": %s: " % markerName + beginMark = self.getSystemLogMarker(markerName, "begin", pid) + endMark = self.getSystemLogMarker(markerName, "end", pid) syslog='/var/log/messages' log=open(syslog) contents = ""
Modified: trunk/v7/documentbase.py =================================================================== --- trunk/v7/documentbase.py 2010-06-07 09:54:52 UTC (rev 525) +++ trunk/v7/documentbase.py 2010-06-08 18:04:25 UTC (rev 526) @@ -61,23 +61,14 @@ return child
def setTextNode(self, element, value): + value = self.removeBadCharacters(value) if value: - if type(value) == unicode: - value = value.encode('ascii') value = self.removeBadCharacters(value) # is there an existing child text node? textNode = self.getTextNode(element) if textNode: textNode.data = value return - - if type(value) != type(unicode): - value = self.removeBadCharacters(value) - # is there an existing child text node? - textNode = self.getTextNode(element) - if textNode: - textNode.data = value - return
# else no existing text child note, create it textNode = self.document.createTextNode(value) @@ -120,6 +111,14 @@ return theTimeString.replace(" ", "").replace(":", "").replace("-", "")
def removeBadCharacters(self, value): + if type(value) == unicode: + badUnicode = [u'\xae'] + goodValue = u"" + for uc in value: + if uc not in badUnicode: + goodValue += uc + value = goodValue.encode('ascii') + try: # badnumbers = [0,8,27,246] badnumbers = range(9) # various non-printing characters
Modified: trunk/v7/hardwaretest.py =================================================================== --- trunk/v7/hardwaretest.py 2010-06-07 09:54:52 UTC (rev 525) +++ trunk/v7/hardwaretest.py 2010-06-08 18:04:25 UTC (rev 526) @@ -58,6 +58,7 @@ self.debugLevel = self.options.debug # "off", "low", "medium", or 'high' self.certification = None self.runMode = self.options.mode + self.command = None
self.commands = {'plan': self.doPlan, 'certify': self.doCertify, @@ -164,8 +165,8 @@ def do(self, args):
#server doesn't lock - command = args[0] - if (command == "server"): + self.command = args[0] + if (self.command == "server"): return self.doServer(args)
if not self.getLock(): @@ -175,9 +176,9 @@ result = False # do the command try: - self.commands[command]() + self.commands[self.command]() except KeyError: - print "unknown command: " + command + print "unknown command: " + self.command self.releaseLock() return result
@@ -611,7 +612,7 @@
# Set up our system logging stuff - syslog.openlog(self.systemLogMarker) + syslog.openlog(self.getSystemLogOpen()) syslog.syslog("Beginning test run.") # Make a log dir for this testrun runDirectory=self.makeTestRunDirectory() @@ -621,13 +622,16 @@ runNumber = self.certification.getNumberOfTestRuns() else: runNumber = None - for test in tests: - if not test.isDisabled(): - if not runNumber: - runNumber = self.certification.addTestRun() + + for test in tests: + if not test.isDisabled(): + if not runNumber: + runNumber = self.certification.addTestRun() + run = test.getRun(runNumber) + if not run: run = test.newTestRun() run.setNumber(runNumber) - self.certification.save(self.environment.getResultsPath()) + self.certification.save(self.environment.getResultsPath())
# Start testin'! for test in tests: @@ -934,6 +938,9 @@ if not server or server == "unknown": server = self.testServer runCommand = runCommand + "%s=%s " % (Constants.TESTSERVER, server) + + if self.command == "continue": + runCommand = runCommand + "%s=%s " % (Constants.INCOMPLETE, "1")
runCommand = runCommand + "run" print runCommand
Modified: trunk/v7/test.py =================================================================== --- trunk/v7/test.py 2010-06-07 09:54:52 UTC (rev 525) +++ trunk/v7/test.py 2010-06-08 18:04:25 UTC (rev 526) @@ -76,6 +76,11 @@ except KeyError: self.logicalDeviceName = ""
+ try: + self.incomplete = os.environ[Constants.INCOMPLETE] + except KeyError: + self.incomplete = False + def __cmp__(self, other): if self.interactive and not other.interactive: return -1
v7-commits@lists.stg.fedorahosted.org