r1029 - in trunk/server: . cgi cgi/xsl
by gnichols@fedoraproject.org
Author: gnichols
Date: 2011-07-25 14:18:04 +0000 (Mon, 25 Jul 2011)
New Revision: 1029
Added:
trunk/server/cgi/saveFile.py
trunk/server/cgi/saved.py
trunk/server/cgi/template.py
Modified:
trunk/server/cgi/Makefile
trunk/server/cgi/v7xml.py
trunk/server/cgi/xsl/summary.xsl
trunk/server/index.html
Log:
725441 - FEAT: save command should store results on server for review
Modified: trunk/server/cgi/Makefile
===================================================================
--- trunk/server/cgi/Makefile 2011-07-25 14:16:59 UTC (rev 1028)
+++ trunk/server/cgi/Makefile 2011-07-25 14:18:04 UTC (rev 1029)
@@ -16,7 +16,7 @@
.PHONY: clean
-FILES := v7web.py v7xml.py networkTest.py
+FILES := v7web.py v7xml.py networkTest.py saveFile.py saved.py template.py
SUBDIRS := xsl
V7_SERVER_ROOT := /var/www/v7
Added: trunk/server/cgi/saveFile.py
===================================================================
--- trunk/server/cgi/saveFile.py (rev 0)
+++ trunk/server/cgi/saveFile.py 2011-07-25 14:18:04 UTC (rev 1029)
@@ -0,0 +1,77 @@
+#!/usr/bin/python
+# Copyright (c) 2006 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
+#
+
+# this cgi is used by the http transfer portion of the network test. It saves the file enclosure to the v7
+# storage area for the upload portion of the test. The network test uses a simple request for the file
+# for the download test
+
+import os,sys,cgi
+v7ClassLibraryPath = '/usr/share/v7/lib/'
+sys.path.append(v7ClassLibraryPath)
+os.putenv("PYTHONPATH", v7ClassLibraryPath)
+from v7.hash import hashModule
+
+from v7.environment import Environment
+
+environment = Environment()
+
+import cgitb
+cgitb.enable()
+
+
+def saveFiles():
+ ipAddress = cgi.escape(os.environ["REMOTE_ADDR"])
+
+ files = list()
+ fieldStorage = cgi.FieldStorage()
+ try:
+ serverPath = fieldStorage["server-path"]
+ except:
+ print "Error: no server-path is set"
+ return False
+ print "server-path:"
+ if serverPath.value:
+ serverPath = os.path.join(*serverPath.value.split())
+ print serverPath
+ directory = os.path.join(environment.getServerDirectory(), "store", serverPath)
+ print "directory %s" % directory
+ try:
+ os.makedirs(directory)
+ except OSError:
+ # directory exists
+ pass
+ for key in fieldStorage.keys():
+ if fieldStorage[key].name == 'file':
+ path = os.path.join(directory, fieldStorage[key].filename)
+ file = open(path, "wb")
+ file.write(fieldStorage[key].value.decode("base64"))
+ file.close()
+ print " Saved: " + path
+
+
+
+print "Content-type: text/plain";
+print
+
+
+files = saveFiles()
+
+
+
+sys.stdout.flush()
+
+
Property changes on: trunk/server/cgi/saveFile.py
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/server/cgi/saved.py
===================================================================
--- trunk/server/cgi/saved.py (rev 0)
+++ trunk/server/cgi/saved.py 2011-07-25 14:18:04 UTC (rev 1029)
@@ -0,0 +1,78 @@
+#!/usr/bin/python
+# Copyright (c) 2006 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
+#
+
+import os,sys,cgi,lxml, re
+from lxml import etree
+v7ClassLibraryPath = '/usr/share/v7/lib/'
+sys.path.append(v7ClassLibraryPath)
+os.putenv("PYTHONPATH", v7ClassLibraryPath)
+v7ServerRoot = '/var/www/v7'
+
+from v7.environment import Environment
+from template import Template
+
+environment = Environment()
+
+import cgitb
+cgitb.enable()
+
+
+def getParameters():
+ fieldStorage = cgi.FieldStorage()
+ # convert to a regular dict()
+ parameters = { "path": ""}
+ for key in fieldStorage.keys():
+ parameters[key] = fieldStorage[key].value
+
+ return parameters
+
+
+def showSavedResults(parameters):
+ localPath = os.path.join(environment.getServerDirectory(), "store")
+ resultsFileFilter = re.compile("\.(xml|xml.gz)$", re.IGNORECASE)
+ fileNamePattern = re.compile("^v7-results-(?P<hostname>[^\-]+)-(?P<date>[0-9]+)\.xml(.gz)?$")
+ for (root,dirs,files) in os.walk(localPath):
+ files = filter(resultsFileFilter.search, files)
+ if files:
+ info = root[len(localPath):]
+ print " ".join(info.split("/")[1:]) + "<br>"
+
+ for file in files:
+ match = fileNamePattern.search(file)
+ if match:
+ dateStamp = match.group("date")
+ date = "%s-%s-%s" % (dateStamp[4:6], dateStamp[6:8], dateStamp[:4])
+ hostname = match.group("hostname")
+ print " <a href=\"v7xml.py?sheet=summary&content=html&rpath=%s/%s\">%s %s</a><br>" % (root, file, hostname, date)
+ print "<br>"
+
+parameters = getParameters()
+template = Template()
+template.writeHeader()
+print "<!--"
+for key in parameters:
+ print "%s=%s" % (key, parameters[key])
+print" -->"
+
+print """
+ <h2>Saved Test Results</h2>
+ """
+showSavedResults(parameters)
+template.writeFooter()
+sys.stdout.flush()
+
+
Property changes on: trunk/server/cgi/saved.py
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/server/cgi/template.py
===================================================================
--- trunk/server/cgi/template.py (rev 0)
+++ trunk/server/cgi/template.py 2011-07-25 14:18:04 UTC (rev 1029)
@@ -0,0 +1,71 @@
+#!/usr/bin/python
+# Copyright (c) 2006 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
+#
+
+import os
+
+class Template:
+
+ def __init__(self):
+ return
+
+ def getHostName(self):
+ system,node,release,version,machine = os.uname()
+ return node
+
+ def writeHeader(self):
+ print "Content-type: text/html";
+ print """
+
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+
+ <head>
+ <title>Red Hat Hardware Certification</title>
+ <link rel="shortcut icon" href="/v7/images/favicon.ico">
+ <link rel="stylesheet" href="/v7/css/v7.css">
+
+ </head>
+
+ <body id="mainone">
+
+
+ <div id="wrap">
+ <div id="innerwrap">
+
+ <!-- HEADER -->
+ <div id="header">
+ <img src="/v7/images/logo_rh_home.png" alt="Red Hat Home" width="96" height="31" id="rhLogo" />
+ </div><!-- end header -->
+
+ """
+ # Navigation
+ print "<h1>%s</h1><h1> Hardware Certification Test Server</h1>" % self.getHostName()
+ print """
+ <table>
+ <tr>
+ <td><a href="/v7/">Home</a></td>
+ </tr>
+ </table>
+ <br/><br/>
+ """
+
+ def writeFooter(self):
+ print """
+ </div></div>
+ </body>
+ </html>
+ """
Modified: trunk/server/cgi/v7xml.py
===================================================================
--- trunk/server/cgi/v7xml.py 2011-07-25 14:16:59 UTC (rev 1028)
+++ trunk/server/cgi/v7xml.py 2011-07-25 14:18:04 UTC (rev 1029)
@@ -15,13 +15,13 @@
# Author: Greg Nichols
#
-import os,sys,cgi,lxml
+import os,sys,cgi,lxml,gzip
from lxml import etree
v7ClassLibraryPath = '/usr/share/v7/lib/'
sys.path.append(v7ClassLibraryPath)
os.putenv("PYTHONPATH", v7ClassLibraryPath)
-v7ServerRoot = '/var/www/v7'
+
from v7.environment import Environment
environment = Environment()
@@ -33,36 +33,47 @@
def getParameters():
fieldStorage = cgi.FieldStorage()
# convert to a regular dict()
- parameters = { "sheet": "default", "content":"xml", "devices":"\'hide\'", "device-classes": "\'hide\'"}
+ cgiParameters = { "sheet": "default", "content":"xml", "rpath":environment.getResultsPath()}
+ xsltParameters = { "devices":"\'hide\'", "device-classes": "\'hide\'", "rpath":"\'%s\'" % environment.getResultsPath()}
for key in fieldStorage.keys():
- if key in ["sheet", "content"]:
- parameters[key] = fieldStorage[key].value
- else:
- # assume all parameter values are strings (wrap them in ''s)
- parameters[key] = "\'%s\'" % fieldStorage[key].value
- return parameters
+ cgiParameters[key] = fieldStorage[key].value
+ # assume all parameter values are strings (wrap them in ''s)
+ xsltParameters[key] = "\'%s\'" % fieldStorage[key].value
+ return (cgiParameters, xsltParameters)
-def doTransform(parameters):
- xslt = etree.parse("%s/xsl/%s.xsl" % (v7ServerRoot, parameters["sheet"]))
+def doTransform(cgiParameters, xsltParameters):
+ xslt = etree.parse("%s/xsl/%s.xsl" % (environment.getServerDirectory(), cgiParameters["sheet"]))
transform = etree.XSLT(xslt)
- results = etree.parse(environment.getResultsPath())
- output = transform(results, **parameters)
+ resultsPath = environment.getResultsPath()
+ if "rpath" in cgiParameters:
+ resultsPath = cgiParameters["rpath"]
+ if resultsPath[-2:] == "gz":
+ results = gzip.open(resultsPath, 'rb')
+ else:
+ results = open(resultsPath)
+
+ results = etree.parse(results)
+ output = transform(results, **xsltParameters)
# write the transformed doc to the output
output.write(sys.stdout)
sys.stdout.flush()
-parameters = getParameters()
-print "Content-type: text/%s" % parameters["content"];
+(cgiParameters, xsltParameters) = getParameters()
+print "Content-type: text/%s" % cgiParameters["content"];
print
-print "<!--"
-for key in parameters:
- print "%s=%s" % (key, parameters[key])
+print "<!-- cgi parameters"
+for key in cgiParameters:
+ print "%s=%s" % (key, cgiParameters[key])
print" -->"
+print "<!-- xslt parameters"
+for key in xsltParameters:
+ print "%s=%s" % (key, xsltParameters[key])
+print" -->"
-doTransform(parameters)
+doTransform(cgiParameters, xsltParameters)
sys.stdout.flush()
Modified: trunk/server/cgi/xsl/summary.xsl
===================================================================
--- trunk/server/cgi/xsl/summary.xsl 2011-07-25 14:16:59 UTC (rev 1028)
+++ trunk/server/cgi/xsl/summary.xsl 2011-07-25 14:18:04 UTC (rev 1029)
@@ -1,5 +1,6 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:variable name="results" select="HHHH" />
<xsl:template match="/certification-test">
<!-- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -->
@@ -20,7 +21,7 @@
<!-- overview -->
<h1>Hardware Certification Test Suite</h1>
-
+
<table class="overview">
<thead></thead>
@@ -41,9 +42,25 @@
<table class="navigation">
<tr><td>See Also:</td>
<td><a href="/v7/">Home</a></td>
- <td><a href="v7xml.py?sheet=summary&content=html">Summary</a></td>
+ <td>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:text>v7xml.py?sheet=summary</xsl:text>
+ <xsl:text>&content=html</xsl:text>
+ <xsl:text>&rpath=</xsl:text><xsl:value-of select="$rpath"/>
+ </xsl:attribute>
+ Summary
+ </a></td>
- <td><a href="v7xml.py?sheet=device">Devices</a></td>
+ <td>
+ <a>
+
+ <xsl:attribute name="href">
+ <xsl:text>v7xml.py?sheet=device&rpath=</xsl:text><xsl:value-of select="$rpath"/>
+ </xsl:attribute>
+ Devices
+ </a>
+ </td>
</tr>
</table>
@@ -70,6 +87,7 @@
<xsl:if test="@logical-device != ''">
<xsl:text>&device=</xsl:text><xsl:value-of select="$currentTest/@logical-device"/>
</xsl:if>
+ <xsl:text>&rpath=</xsl:text><xsl:value-of select="$rpath"/>
</xsl:attribute>
<xsl:value-of select="@name"/>
</a>
@@ -82,7 +100,7 @@
<a>
<xsl:attribute name="href">
<xsl:text>v7xml.py?sheet=device&udi=</xsl:text><xsl:value-of select="@udi"/>
-
+ <xsl:text>&rpath=</xsl:text><xsl:value-of select="$rpath"/>
</xsl:attribute>
<xsl:value-of select="@logical-device"/>
</a>
@@ -140,6 +158,7 @@
<xsl:if test="$currentTest/@logical-device != ''">
<xsl:text>&device=</xsl:text><xsl:value-of select="$currentTest/@logical-device"/>
</xsl:if>
+ <xsl:text>&rpath=</xsl:text><xsl:value-of select="$rpath"/>
</xsl:attribute>
<xsl:value-of select="$currentRun/summary" />
</a>
Modified: trunk/server/index.html
===================================================================
--- trunk/server/index.html 2011-07-25 14:16:59 UTC (rev 1028)
+++ trunk/server/index.html 2011-07-25 14:18:04 UTC (rev 1029)
@@ -24,12 +24,15 @@
<!-- overview -->
<h1>Hardware Certification Test Suite</h1>
<p> Welcome to the Red Hat v7 Hardware Certification Test Suite.</p>
+
+ <br>
+ Test Results Storage:<br>
+ <a href="cgi/saved.py?sheet=summary&content=html">Saved Test Results</a><br>
<br>
- Test Results:<br>
+ This Server's Test Results:<br>
<a href="cgi/v7xml.py?sheet=summary&content=html">Summary</a><br>
<a href="cgi/v7xml.py">Filtered XML</a> <br>
- <a href="results.xml">Raw XML</a<br>
<br>
<a href="docs">Documentation</a><br>
<br>
12 years, 9 months
r1028 - trunk/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2011-07-25 14:16:59 +0000 (Mon, 25 Jul 2011)
New Revision: 1028
Modified:
trunk/v7/documentbase.py
trunk/v7/hardwaretest.py
trunk/v7/http.py
Log:
725441 - FEAT: save command should store results on server for review
Modified: trunk/v7/documentbase.py
===================================================================
--- trunk/v7/documentbase.py 2011-07-25 14:15:52 UTC (rev 1027)
+++ trunk/v7/documentbase.py 2011-07-25 14:16:59 UTC (rev 1028)
@@ -268,6 +268,10 @@
def compressToFile(self, filename):
self.save(filename)
try:
+ os.remove(filename+".gz")
+ except:
+ pass
+ try:
gzip = Command("gzip %s" % filename)
gzip.run()
return True
Modified: trunk/v7/hardwaretest.py
===================================================================
--- trunk/v7/hardwaretest.py 2011-07-25 14:15:52 UTC (rev 1027)
+++ trunk/v7/hardwaretest.py 2011-07-25 14:16:59 UTC (rev 1028)
@@ -46,6 +46,7 @@
from v7.redhatrelease import RedHatRelease
from v7.daemon import V7Daemon
from v7.log import Log
+from v7.http import V7Http
class HardwareTestHarness(Controller):
@@ -944,17 +945,20 @@
def __save(self):
if self.certification:
path = self.environment.getStoreDirectory()
+ serverPath = list()
self.makeDirectoryPath(path)
- for tag in Tags.vendor, Tags.model, Tags.arch:
+ for tag in Tags.vendor, Tags.make, Tags.model, Tags.arch:
value = self.certification.getHardware(tag)
if len(value) > 0 and value != "unknown":
path += "/%s" % value
self.makeDirectoryPath(path)
+ serverPath.append(value)
for tag in Tags.name, Tags.release:
value = self.certification.getOS(tag)
if len(value) > 0:
path += "/%s" % value
self.makeDirectoryPath(path)
+ serverPath.append(value)
savedFilename = "v7-results"
hostname = self.certification.getOS(Tags.hostname)
@@ -965,8 +969,16 @@
savedFilename += "-%s" % self.certification.timeStringToTimestamp(runTime)
savedFilename += ".xml"
print "Saving current results to:"
- print "%s/%s" % (path, savedFilename)
- self.certification.save("%s/%s" % (path, savedFilename))
+ savedFilePath = os.path.join(path, savedFilename)
+ print savedFilePath
+ self.certification.compressToFile(savedFilePath)
+
+ if self.testServer and self.ui.promptConfirm("Copy results to test server %s?" % self.testServer):
+ request = V7Http(self.testServer, "/v7/cgi/saveFile.py")
+ request.addField("server-path", serverPath)
+ return request.httpUpload(savedFilePath+".gz")
+
+ # otherwise
return True
#otherwise
Modified: trunk/v7/http.py
===================================================================
--- trunk/v7/http.py 2011-07-25 14:15:52 UTC (rev 1027)
+++ trunk/v7/http.py 2011-07-25 14:16:59 UTC (rev 1028)
@@ -16,7 +16,7 @@
#
# HTTP library for v7's tests
-import os, urllib2, httplib
+import os, urllib2, httplib, re, time
class V7Http:
@@ -33,7 +33,11 @@
lines.append('--' + boundary)
lines.append('Content-Disposition: form-data; name="%s"' % name)
lines.append('')
- lines.append(value)
+ if type(value) is list:
+ for item in value:
+ lines.append(item)
+ else:
+ lines.append(value)
for (name, filename, contents) in self.files:
lines.append('--' + boundary)
lines.append('Content-Disposition: form-data; name="%s"; filename="%s"' % (name, filename))
@@ -71,11 +75,30 @@
responseCode, responseMessage, headers = request.getreply()
if responseCode != 200:
print "Error: could not send message (response code %s)" % responseCode
+ print "Host: %s" % self.host
+ print "URL: %s" % self.url
print "Message: %s" % responseMessage
return (0, None)
return (len(self.body), request.file.read())
+ def httpUpload(self, localFilePath):
+ if not self.addFile(localFilePath):
+ print "Error: could not add file %s to request" % localFilePath
+ return False
+ # otherwise
+ print "sending file %s " % localFilePath
+ startTime = time.time()
+ (size, response) = self.send()
+ stopTime = time.time()
+ if not response:
+ # send failed
+ return False
+ print "response: "
+ print response
+ print "Upload took %.2f seconds, %.2f MB/sec" % (stopTime-startTime, size/((stopTime-startTime)*1000000))
+
+ return True
if __name__ == "__main__":
12 years, 9 months
r1027 - trunk
by gnichols@fedoraproject.org
Author: gnichols
Date: 2011-07-25 14:15:52 +0000 (Mon, 25 Jul 2011)
New Revision: 1027
Modified:
trunk/Makefile
Log:
R15
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2011-07-21 13:38:34 UTC (rev 1026)
+++ trunk/Makefile 2011-07-25 14:15:52 UTC (rev 1027)
@@ -14,7 +14,7 @@
# Author: Greg Nichols
V7_VERSION := 1.4
-V7_RELEASE := 14
+V7_RELEASE := 15
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, 9 months
r1026 - tags
by gnichols@fedoraproject.org
Author: gnichols
Date: 2011-07-21 13:38:34 +0000 (Thu, 21 Jul 2011)
New Revision: 1026
Added:
tags/v7-V1-4R14/
Log:
tag version
12 years, 9 months
r1025 - trunk
by gnichols@fedoraproject.org
Author: gnichols
Date: 2011-07-21 13:38:04 +0000 (Thu, 21 Jul 2011)
New Revision: 1025
Modified:
trunk/v7.spec.in
Log:
changelog
Modified: trunk/v7.spec.in
===================================================================
--- trunk/v7.spec.in 2011-07-21 13:34:53 UTC (rev 1024)
+++ trunk/v7.spec.in 2011-07-21 13:38:04 UTC (rev 1025)
@@ -77,12 +77,17 @@
%changelog
-* Fri Jul 15 2011 Greg Nichols <gnichols(a)redhat.com>
+* Thu Jul 21 2011 Greg Nichols <gnichols(a)redhat.com>
-V7 1.4 R13
+V7 1.4 R14
521609 - v7 plan --server says server has error: /var/v7/export
711155 - v7: sh: kudzu: command not found
+ 717779 - Reboot nfs test does not reliably grab an ip address causing the test to fail
+ 711161 - v7 usb test Error: test raised exception on zero-length/non-integer prompt response
+ 702140 - Unable to determine pass/fail state of logs after packaging with v7 submit
+ 573598 - Test Suite should give a caution when user disable INFO test.
+ 559834 - fv_* is not listed in v7 plan on rhel54-server-ia64-xen system
* Tue Jul 12 2011 Greg Nichols <gnichols(a)redhat.com>
12 years, 9 months
r1024 - trunk/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2011-07-21 13:34:53 +0000 (Thu, 21 Jul 2011)
New Revision: 1024
Modified:
trunk/v7/fvtest.py
Log:
559834 - fv_* is not listed in v7 plan on rhel54-server-ia64-xen system
Modified: trunk/v7/fvtest.py
===================================================================
--- trunk/v7/fvtest.py 2011-07-21 13:33:06 UTC (rev 1023)
+++ trunk/v7/fvtest.py 2011-07-21 13:34:53 UTC (rev 1024)
@@ -145,7 +145,11 @@
return False
def __hasVirtualizationCPUFlags(self, verbose=False):
- """ check cpuinfo for virtualization flags """
+ """ check cpuinfo for virtualization flags """
+ if self.hardwarePlatform == "ia64":
+ print "ia64 - assuming virtualization support"
+ return True
+ # otherwise
cpuflags = Command("fgrep flags /proc/cpuinfo")
try:
flags = cpuflags.getString(regex="(vmx|smx|svm)", singleLine=False)
12 years, 9 months
r1023 - trunk/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2011-07-21 13:33:06 +0000 (Thu, 21 Jul 2011)
New Revision: 1023
Modified:
trunk/v7/hardwaretest.py
Log:
573598 - Test Suite should give a caution when user disable INFO test.
Modified: trunk/v7/hardwaretest.py
===================================================================
--- trunk/v7/hardwaretest.py 2011-07-21 13:31:15 UTC (rev 1022)
+++ trunk/v7/hardwaretest.py 2011-07-21 13:33:06 UTC (rev 1023)
@@ -594,7 +594,8 @@
if not self.__checkResultsSize():
return False
tests = self.addMandatoryTests(tests)
-
+ if not tests:
+ return False
print "\nRunning the following tests:"
for test in tests:
udi = test.getShortUDI()
@@ -811,6 +812,11 @@
return tests
# otherwise - debugging - don't add any tests
+ print "Warning: Test runs in debug mode are invalid for certification."
+ if self.certification.getMandatoryTests():
+ print "The following tests will be skipped: %s" % ", ".join(map(TestDocument.getName, self.certification.getMandatoryTests()))
+ if not self.ui.promptConfirm("Do you wish to continue?"):
+ return None
return requestedTests
def doCertify(self):
@@ -830,6 +836,8 @@
if not self.__checkResultsSize():
return False
tests = self.addMandatoryTests(tests)
+ if not tests:
+ return False
if not self.options.tag:
print "\nThe following tests are recommended to complete the certification:"
else:
@@ -1144,30 +1152,20 @@
print "HardwareTest.setTestsEnabled:"
disabled = True
output = "Disabled"
+ count = 0
if self.options.enable:
disabled = False
output = "Enabled"
for test in tests:
+ if disabled and test.getMandatory():
+ print "The %s test must be included in every test run and can not be disabled." % test.getName()
+ continue
test.setDisabled(disabled)
+ count = count + 1
if self.Debugging:
print (output + " test: %s udi: %s") % (test.getName(), test.getUDI())
- print (output + " %u tests") % len(tests)
+ print (output + " %u tests") % count
- def setTestsEnabled(self):
- tests = self._getTestsFromOptions()
- if self.Debugging:
- print "HardwareTest.setTestsEnabled:"
- disabled = True
- output = "Disabled"
- if self.options.enable:
- disabled = False
- output = "Enabled"
- for test in tests:
- test.setDisabled(disabled)
- if self.Debugging:
- print (output + " test: %s udi: %s") % (test.getName(), test.getUDI())
- print (output + " %u tests") % len(tests)
-
def setServerOnTests(self):
tests = self._getTestsFromOptions()
if self.Debugging:
12 years, 9 months
r1022 - trunk/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2011-07-21 13:31:15 +0000 (Thu, 21 Jul 2011)
New Revision: 1022
Modified:
trunk/v7/report.py
Log:
702140 - Unable to determine pass/fail state of logs after packaging with v7 submit
Modified: trunk/v7/report.py
===================================================================
--- trunk/v7/report.py 2011-07-21 13:27:36 UTC (rev 1021)
+++ trunk/v7/report.py 2011-07-21 13:31:15 UTC (rev 1022)
@@ -296,9 +296,6 @@
run = test.getRun(runNumber)
if not run.passed():
combinedTestPass = False
- elif run.getMode() == Constants.auto and test.isInteractive():
- print "Warning: Interactive %s test run in %s mode marked as FAIL" % (test.getName(), run.getMode())
- combinedTestPass = False
if len(testsByName) > 1:
deviceNumber = deviceNumber + 1
@@ -307,6 +304,10 @@
if outputLog:
log = codecs.open(dir + "/output.log", "a", "utf-8" )
log.write(outputLog)
+ if run.passed():
+ log.write(Constants.PASS+"\n")
+ else:
+ log.write(Constants.FAIL+"\n")
log.close()
systemLog = run.getSystemLog()
if systemLog:
12 years, 9 months
r1021 - in trunk: tests/usb v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2011-07-21 13:27:36 +0000 (Thu, 21 Jul 2011)
New Revision: 1021
Modified:
trunk/tests/usb/usb.py
trunk/v7/commandLineUI.py
Log:
711161 - v7 usb test Error: test raised exception on zero-length/non-integer prompt response
Modified: trunk/tests/usb/usb.py
===================================================================
--- trunk/tests/usb/usb.py 2011-07-21 13:23:26 UTC (rev 1020)
+++ trunk/tests/usb/usb.py 2011-07-21 13:27:36 UTC (rev 1021)
@@ -83,7 +83,7 @@
self.result = Constants.FAIL
return 1
- self.numberOfSockets = string.atoi(self.prompt("How many USB sockets are required to be tested? "))
+ self.numberOfSockets = self.promptInteger("How many USB sockets are required to be tested? ")
if self.numberOfSockets < 1:
print("No USB sockets to test")
self.result = Constants.PASS
Modified: trunk/v7/commandLineUI.py
===================================================================
--- trunk/v7/commandLineUI.py 2011-07-21 13:23:26 UTC (rev 1020)
+++ trunk/v7/commandLineUI.py 2011-07-21 13:27:36 UTC (rev 1021)
@@ -34,13 +34,7 @@
sys.stdout.write(question)
if answers:
sys.stdout.write(" (")
- first = True
- for answer in answers:
- if first:
- sys.stdout.write(answer)
- first = False
- else:
- sys.stdout.write("|%s" % answer)
+ sys.stdout.write("|".join(answers))
sys.stdout.write(") ")
sys.stdout.flush()
response = sys.stdin.readline()
@@ -48,6 +42,18 @@
sys.stdout.write("response: %s" % response)
return response.strip()
+ def promptInteger(self, question):
+ while True:
+ sys.stdout.write(question)
+ sys.stdout.flush()
+ response = sys.stdin.readline()
+ try:
+ value = string.atoi(response.strip())
+ sys.stdout.write("response: %u\n" % value)
+ return value
+ except ValueError:
+ sys.stdout.write("Please enter an integer.\n")
+
def promptConfirm(self, question):
YES = "y"
SAMEASYES = ["y", "yes", "ya", "yup", "affirmative", "roger", "go",
12 years, 9 months
r1020 - trunk/tests/kdump
by gnichols@fedoraproject.org
Author: gnichols
Date: 2011-07-21 13:23:26 +0000 (Thu, 21 Jul 2011)
New Revision: 1020
Modified:
trunk/tests/kdump/kdump.py
Log:
https://bugzilla.redhat.com/show_bug.cgi?id=717779
Modified: trunk/tests/kdump/kdump.py
===================================================================
--- trunk/tests/kdump/kdump.py 2011-07-19 10:47:11 UTC (rev 1019)
+++ trunk/tests/kdump/kdump.py 2011-07-21 13:23:26 UTC (rev 1020)
@@ -38,6 +38,7 @@
self.rebootTimeLimit = self.environment.getRebootTimelimit()
self.priority = 1001 # run last
self.coreCollector = "makedumpfile -d 31"
+ self.linkDelay = 60 # sec
self.kdumpConfigPath = "/etc/kdump.conf"
self.redHatRelease = RedHatRelease()
self.serverMode = True # nfs for kdump to nfs
@@ -156,14 +157,44 @@
print e
verified = False
- # configure kdump to use makedumpfile -d 31
+
+ (success, restart) = self.setKdumpConfig()
+
+ if restart:
+ 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 setKdumpConfig(self):
+ """ set kdump configuration, returns (success, restart) """
+ # configure kdump to use makedumpfile -d 31
+ try:
configFile = ConfigFile(self.kdumpConfigPath)
coreCollector = configFile.getParameter("core_collector")
net = configFile.getParameter("net")
+ linkDelay = configFile.getParameter("link_delay")
except IOError, exception:
print "Error: %s" % exception
- return False
+ return (False, False)
restart = False
if not coreCollector:
@@ -190,34 +221,20 @@
restart = True
else:
print "Error: v7 test server not set for network kdump"
- return False
+ return (False, False)
+ if linkDelay:
+ print "link_delay set to %s" % linkDelay
+ else:
+ print "Setting link_delay=%u" % self.linkDelay
+ configFile.addParameter("link_delay", self.linkDelay)
+ restart = True
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
+ return (True, restart)
+
def panic(self):
self.markOutput("initialize")
12 years, 9 months