Author: gnichols
Date: 2011-04-06 12:27:33 +0000 (Wed, 06 Apr 2011)
New Revision: 863
Modified:
trunk/v7/certificationtest.py
trunk/v7/environment.py
trunk/v7/hardwaretest.py
trunk/v7/report.py
Log:
593982 - FEAT: v7 should provide multiple results rpms when results.xml gets too large
Modified: trunk/v7/certificationtest.py
===================================================================
--- trunk/v7/certificationtest.py 2011-04-06 12:14:30 UTC (rev 862)
+++ trunk/v7/certificationtest.py 2011-04-06 12:27:33 UTC (rev 863)
@@ -29,6 +29,7 @@
class CertificationDocument(DocumentBase):
def __init__(self, topElement=None, document=None, debugging=False):
+ DocumentBase.__init__(self)
self.element = topElement
self.document = document
self.currentTestElement = None
@@ -391,14 +392,15 @@
subtestsByName[subtest.getName()].append(subtest)
return subtestsByName
+ def deleteAttachments(self):
+ for attachmentElement in self.document.getElementsByTagName(Tags.attachment):
+ attachmentElement.parentNode.removeChild(attachmentElement)
+
if __name__ == "__main__":
doc = CertificationDocument()
doc.load("/var/v7/results.xml")
- for test in doc.getTests():
- for run in test.getRuns():
- run.merge("/var/v7/results.xml")
- print "merged"
- doc.save("test.xml")
+ doc.deleteAttachments()
+ doc.save("test.xml")
print "done"
Modified: trunk/v7/environment.py
===================================================================
--- trunk/v7/environment.py 2011-04-06 12:14:30 UTC (rev 862)
+++ trunk/v7/environment.py 2011-04-06 12:27:33 UTC (rev 863)
@@ -42,7 +42,7 @@
self.defaultGuestBootDirectory = '/usr/lib/xen/boot/'
self.defaultPartnerServerURL =
"ftp://partners.redhat.com/a166eabc5cf5df158922f9b06e5e7b21/hwcert/"
self.defaultMaximumAttachmentFileSize = 64 * 1048576 # bytes
- self.defaultResultsWarningSize = 16 * 1048576 # bytes
+ self.defaultResultsWarningSize = 12 * 1048576 # bytes
self.defaultFVGuestTimelimit = 60 # minutes
self.defaultRebootTimelimit = 10 # minutes
Modified: trunk/v7/hardwaretest.py
===================================================================
--- trunk/v7/hardwaretest.py 2011-04-06 12:14:30 UTC (rev 862)
+++ trunk/v7/hardwaretest.py 2011-04-06 12:27:33 UTC (rev 863)
@@ -585,6 +585,8 @@
tests = self.certification.getFilteredTests(self.options)
if len(tests) > 0:
+ if not self.__checkResultsSize():
+ return False
tests = self.addMandatoryTests(tests)
print "\nRunning the following tests:"
@@ -814,6 +816,8 @@
tests = self.certification.getTaggedTests(tests, self.options.tag)
if len(tests) > 0:
+ if not self.__checkResultsSize():
+ return False
tests = self.addMandatoryTests(tests)
if not self.options.tag:
print "\nThe following tests are recommended to complete the
certification:"
@@ -844,16 +848,25 @@
return False
return self.__verify(self.certification.getTests())
+
+ def __checkResultsSize(self):
+ if self.certification.getLoadedFileSize() <
self.environment.getResultsWarningSize():
+ return True
+
+ # otherwise
+ print "Warning: the test results may be too large to submit to the hardware
catalog."
+ print "File: %s is %u MB" % (self.certification.getLoadedFilePath(),
int(self.certification.getLoadedFileSize()/1048576))
+ if self.options.mode != Constants.auto and self.ui.promptConfirm("Would you
like to package the current results first?"):
+ self.doSubmit()
+ return False
+
+ # size warning was ignored (or mode auto)
+ return True
+
def __verify(self, testDocuments):
- # check the results file size
result = True
- if self.certification.getLoadedFileSize() >
self.environment.getResultsWarningSize():
- result = False
- print "Warning: the test results may be too large to submit to the
hardware catalog."
- print "File: %s is %u MB" %
(self.certification.getLoadedFilePath(),
int(self.certification.getLoadedFileSize()/1048576))
-
# just call verify on each test directly
failures = 0
@@ -887,11 +900,14 @@
def doSubmit(self):
self.load()
+ self.__submit()
+
+ def __submit(self):
if self.certification and self.certification.getNumberOfTestRuns() > 0:
report = Report(self.options, self.certification)
if report.WriteResultsRPM(self.environment.getLogDirectory()):
- print "Warning: not removing old logs"
- # self.removeLogFiles()
+ self.__save()
+ self.removeLogFiles()
print "done."
return True
# otherwise
@@ -903,6 +919,10 @@
def doSave(self):
self.load()
+ self.__save()
+
+
+ def __save(self):
if self.certification:
path = self.environment.getStoreDirectory()
self.makeDirectoryPath(path)
Modified: trunk/v7/report.py
===================================================================
--- trunk/v7/report.py 2011-04-06 12:14:30 UTC (rev 862)
+++ trunk/v7/report.py 2011-04-06 12:27:33 UTC (rev 863)
@@ -23,6 +23,8 @@
from v7.controller import Controller
from v7.command import Command, V7CommandException
from v7.hash import hashModule
+from v7.certificationtest import CertificationDocument
+from v7.environment import Environment
class Report(Controller):
@@ -32,6 +34,7 @@
self.Debugging = options.debug
self.specFileName = "v7-results-rpm.spec"
self.tarFileName = "v7-results.tar.bz2"
+ self.environment = Environment()
def Write(self):
if not self.certification:
@@ -198,8 +201,13 @@
# write the test plan and results xml to etc/v7
etcDirectory = submissionDirectory + "/etc/v7"
self.makeDirectoryPath(etcDirectory)
- shutil.copy(self.options.data + "/" + self.options.results,
etcDirectory + "/.")
+ resultsXML = CertificationDocument()
+ resultsXML.load(os.path.join(self.options.data,
self.environment.getResultsFileName()))
+ resultsXML.save(os.path.join(etcDirectory,
self.environment.getResultsFileName()))
+ shutil.copy("/etc/v7.xml", os.path.join(etcDirectory,
"v7.xml")) # save v7 environment settings
+
+
#write a system.conf for backwards compatability
self.generateRHR2systemConf(etcDirectory)
@@ -232,8 +240,9 @@
Command("echo \"\n%s\n----------------------------\" >>
/var/v7/package.log" % rpmBuild.command).run()
rpmBuild.run()
- print "Moving the results rpm to data directory %s" %
self.options.data
+
rpm = Command("cat
/var/v7/package.log").getString(regex="Wrote: (?P<rpm>[^\ ]+)$",
regexGroup="rpm", singleLine=False)
+ print "Moving the results rpm to %s" %
os.path.join(self.options.data, os.path.basename(rpm.strip()))
Command("mv %s %s" % (rpm.strip(), self.options.data)).echo()
except V7CommandException, exception:
print exception
Show replies by date