r270 - trunk/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2009-12-22 17:57:33 +0000 (Tue, 22 Dec 2009)
New Revision: 270
Modified:
trunk/v7/command.py
Log:
484657 - hts uses code deprecated in python 2.6
Modified: trunk/v7/command.py
===================================================================
--- trunk/v7/command.py 2009-12-22 17:57:21 UTC (rev 269)
+++ trunk/v7/command.py 2009-12-22 17:57:33 UTC (rev 270)
@@ -19,7 +19,7 @@
# __main__ self test function at the end of this file.
-import os,re, commands, exceptions, popen2, string, sys
+import os,re, commands, subprocess, string, sys
class Command:
@@ -37,18 +37,29 @@
self.errors = None
self.returnValue = 0
self.signal = 0
+ self.pipe = None
def _run(self):
- commandPipe = popen2.Popen3(self.command, capturestderr=True)
- self.output = commandPipe.fromchild.readlines()
- result = commandPipe.wait()
- self.returnValue = (result >> 8) & 0xFF
- self.signal = result & 0xFF
- self.errors = None
-
- if commandPipe.childerr:
- self.errors = commandPipe.childerr.readlines()
- # always print error messages
+ # commandPipe = popen2.Popen3(self.command, capturestderr=True)
+ self.pipe = subprocess.Popen(self.command, shell=True,
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,)
+ (output, errors) = self.pipe.communicate()
+ if output:
+ self.output = output.splitlines()
+ # make the last line has the new line at the end
+ if self.output[-1][-1:] != '\n':
+ self.output[-1] = self.output[-1] + '\n'
+ if errors:
+ self.errors = errors.splitlines()
+ # make the last line has the new line at the end
+ if self.errors[-1][-1:] != '\n':
+ self.errors[-1] = self.output[-1] + '\n'
+ self.returnValue = (self.pipe.returncode >> 8) & 0xFF
+ self.signal = self.pipe.returncode & 0xFF
+
+ if self.errors:
for line in self.errors:
sys.stderr.write( line )
sys.stderr.flush()
@@ -77,26 +88,26 @@
is echo'd on stdout. """
self._run()
self._checkErrors()
- for line in self.output:
- sys.stdout.write( line )
+ self.printOutput()
return 0
def echoIgnoreErrors(self):
""" like echo, except don't raise exception on errors """
self._run()
- for line in self.output:
- sys.stdout.write( line )
+ self.printOutput()
return 0
def printOutput(self):
- for line in self.output:
- sys.stdout.write( line )
- sys.stdout.flush()
+ if self.output:
+ for line in self.output:
+ sys.stdout.write( line )
+ sys.stdout.flush()
def printErrors(self):
- for line in self.errors:
- sys.stderr.write( line )
- sys.stderr.flush()
+ if self.errors:
+ for line in self.errors:
+ sys.stderr.write( line )
+ sys.stderr.flush()
def _getString(self, regex=None, regexGroup=None, singleLine=True, returnList=False, ignoreErrors=False):
@@ -121,27 +132,28 @@
self._run()
if self.singleLine:
- if len(self.output) > 1:
+ if self.output and len(self.output) > 1:
raise V7CommandException(self, "Found %u lines of output, expected 1" % len(self.output))
- line = self.output[0].strip()
- if not self.regex:
- return line
- # otherwise, try the regex
- pattern = re.compile(self.regex)
- match = pattern.match(line)
- if match:
- if self.regexGroup:
- return match.group(self.regexGroup)
- # otherwise, no group, return the whole line
- return line
-
- # no regex match try a grep-style match
- if not self.regexGroup:
- match = pattern.search(line)
- if match:
- return match.group()
+ if self.output:
+ line = self.output[0].strip()
+ if not self.regex:
+ return line
+ # otherwise, try the regex
+ pattern = re.compile(self.regex)
+ match = pattern.match(line)
+ if match:
+ if self.regexGroup:
+ return match.group(self.regexGroup)
+ # otherwise, no group, return the whole line
+ return line
+ # no regex match try a grep-style match
+ if not self.regexGroup:
+ match = pattern.search(line)
+ if match:
+ return match.group()
+
# otherwise
raise V7CommandException(self, "no match for regular expression %s" % self.regex)
@@ -153,25 +165,26 @@
result = None
if returnList:
result = list()
- for line in self.output:
- if self.regexGroup:
- match = pattern.match(line)
- if match:
- if self.regexGroup:
+ if self.output:
+ for line in self.output:
+ if self.regexGroup:
+ match = pattern.match(line)
+ if match:
+ if self.regexGroup:
+ if returnList:
+ result.append(match.group(self.regexGroup))
+ else:
+ return match.group(self.regexGroup)
+ else:
+ # otherwise, return the matching line
+ match = pattern.search(line)
+ if match:
if returnList:
- result.append(match.group(self.regexGroup))
+ result.append(match.group())
else:
- return match.group(self.regexGroup)
- else:
- # otherwise, return the matching line
- match = pattern.search(line)
- if match:
- if returnList:
- result.append(match.group())
- else:
- return match.group()
- if result:
- return result
+ return match.group()
+ if result:
+ return result
# otherwise
raise V7CommandException(self, "no match for regular expression %s" % self.regex)
@@ -199,14 +212,22 @@
value = self.getString(regex, regexGroup, singleLine)
return string.atoi(value)
-class V7CommandException(exceptions.Exception):
+class V7CommandException(Exception):
def __init__(self, command, message):
self.message = message
self.command = command
def __str__(self):
return "\"%s\" %s" % (self.command.command, self.message)
+
+ # BaseException.message has been deprecated since Python 2.6. To prevent
+ # DeprecationWarning from popping up over this pre-existing attribute, use
+ # a new property that takes lookup precedence.
+ def _get_message(self): return self.__message
+ def _set_message(self, value): self.__message = value
+ message = property(_get_message, _set_message)
+
if __name__ == "__main__":
14 years, 4 months
r269 - trunk/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2009-12-22 17:57:21 +0000 (Tue, 22 Dec 2009)
New Revision: 269
Modified:
trunk/v7/Makefile
Log:
484657 - hts uses code deprecated in python 2.6
Modified: trunk/v7/Makefile
===================================================================
--- trunk/v7/Makefile 2009-12-22 17:56:46 UTC (rev 268)
+++ trunk/v7/Makefile 2009-12-22 17:57:21 UTC (rev 269)
@@ -18,27 +18,19 @@
V7_CLASS_LIB := /usr/share/v7/lib
-ifeq (, $(shell grep Nahant /etc/redhat-release))
- PYTHON_VERSION := 2.4
+ifeq ($(V7_RHEL_VERSION), 4)
+ COMMAND_PY := command-popen2.py
else
- PYTHON_VERSION := 2.3
+ COMMAND_PY := command.py
endif
-
-SITE_PACKAGES := /usr/lib/python$(PYTHON_VERSION)/site-packages
-
install:
rm -rf $(DESTDIR)$(V7_CLASS_LIB)/v7
mkdir -p $(DESTDIR)$(V7_CLASS_LIB)/v7
cp -r ./*.py $(DESTDIR)$(V7_CLASS_LIB)/v7/
-
-install-site-packages:
- rm -rf $(DESTDIR)$(V7_CLASS_LIB)/v7
- rm -rf $(DESTDIR)$(SITE_PACKAGES)/v7
- mkdir -p $(DESTDIR)$(SITE_PACKAGES)/v7
- cp -r ./*.py $(DESTDIR)$(SITE_PACKAGES)/v7/
+ rm $(DESTDIR)$(V7_CLASS_LIB)/v7/command-popen2.py
+ cp ./$(COMMAND_PY) $(DESTDIR)$(V7_CLASS_LIB)/v7/command.py
clean:
rm -rf $(DESTDIR)$(V7_CLASS_LIB)/v7
- rm -rf $(DESTDIR)$(SITE_PACKAGES)/v7
14 years, 4 months
r268 - trunk
by gnichols@fedoraproject.org
Author: gnichols
Date: 2009-12-22 17:56:46 +0000 (Tue, 22 Dec 2009)
New Revision: 268
Modified:
trunk/v7.spec.in
Log:
484657 - hts uses code deprecated in python 2.6
Modified: trunk/v7.spec.in
===================================================================
--- trunk/v7.spec.in 2009-12-22 17:55:48 UTC (rev 267)
+++ trunk/v7.spec.in 2009-12-22 17:56:46 UTC (rev 268)
@@ -1,5 +1,6 @@
%define version @V7_VERSION@
%define release @V7_RELEASE@
+%define rhel_version @V7_RHEL_VERSION@
# The behaviour of the rpm-build package for python files varies between
# releases. Sometime in the FC4 timeframe it gained a file
@@ -11,7 +12,7 @@
Name: v7
Summary: Red Hat Hardware Test Suite
Version: %{version}
-Release: %{release}
+Release: %{release}.el%{rhel_version}
Group: Development/Tools
License: GPL
URL: http://redhat.com
@@ -67,6 +68,16 @@
/usr/share/man/man8/v7.8.gz
%changelog
+* Thu Dec 17 2009 Greg Nichols <gnichols(a)redhat.com>
+
+V7 1.0 R21
+
+ 525736 - Feat: CLI to manually provide/override vendor/make/model values in results.xml
+ 526071 - v7 man page refers to --last option as "--latest"
+ 548517 - v7 plan traceback: no such attribute runForVirtualization
+ 517311 - submit command causes a traceback if no tests have run
+ 536929 - v7 should augment HAL device detection with other sources
+
* Tue Sep 29 2009 Greg Nichols <gnichols(a)redhat.com>
V7 1.0 R19
14 years, 4 months
r267 - trunk
by gnichols@fedoraproject.org
Author: gnichols
Date: 2009-12-22 17:55:48 +0000 (Tue, 22 Dec 2009)
New Revision: 267
Modified:
trunk/Makefile
Log:
484657 - hts uses code deprecated in python 2.6
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2009-12-21 20:18:22 UTC (rev 266)
+++ trunk/Makefile 2009-12-22 17:55:48 UTC (rev 267)
@@ -18,13 +18,14 @@
V7_VERSION_RELEASE := $(V7_VERSION)-$(V7_RELEASE)
V7_VERSION_PY := v7/version.py
V7_SVN_MODULE := svn+ssh://svn.fedorahosted.org/svn/v7
+V7_RHEL_VERSION := 5
.PHONY: clean install
SUBDIRS := test-env v7 tests docs
all:
- for i in $(SUBDIRS); do $(MAKE) V7_VERSION=$(V7_VERSION) V7_RELEASE=$(V7_RELEASE) -C $$i; done
+ for i in $(SUBDIRS); do $(MAKE) V7_VERSION=$(V7_VERSION) V7_RELEASE=$(V7_RELEASE) V7_RHEL_VERSION=$(V7_RHEL_VERSION) -C $$i; done
install-noarch: install
@@ -36,12 +37,13 @@
@echo "# $(V7_VERSION_PY) is automatically-generated - DO NOT EDIT" >> $(V7_VERSION_PY)
@echo "version = '$(V7_VERSION)'" >> $(V7_VERSION_PY)
@echo "release = '$(V7_RELEASE)'" >> $(V7_VERSION_PY)
+ @echo "rhel_version = '$(V7_RHEL_VERSION)'" >> $(V7_VERSION_PY)
install: mark-version
mkdir -p $(DESTDIR)/usr/share/v7
mkdir -p $(DESTDIR)/var/v7
mkdir -p $(DESTDIR)/var/v7/docs
- for i in $(SUBDIRS); do $(MAKE) -C $$i DESTDIR=$(DESTDIR) V7_VERSION=$(V7_VERSION) V7_RELEASE=$(V7_RELEASE) install; done
+ for i in $(SUBDIRS); do $(MAKE) -C $$i DESTDIR=$(DESTDIR) V7_VERSION=$(V7_VERSION) V7_RELEASE=$(V7_RELEASE) V7_RHEL_VERSION=$(V7_RHEL_VERSION) install; done
clean:
$(MAKE) -C tests clean
@@ -52,10 +54,10 @@
rm -f v7.spec.el4
$(MAKE) -C docs clean
-package: install v7-$(V7_VERSION_RELEASE).tar.bz2
+package: install v7-$(V7_VERSION_RELEASE).el$(V7_RHEL_VERSION).tar.bz2
-v7-$(V7_VERSION_RELEASE).tar.bz2: /tmp/v7/exclude v7.spec
+v7-$(V7_VERSION_RELEASE).el$(V7_RHEL_VERSION).tar.bz2: /tmp/v7/exclude v7.spec
tar cjS -f $@ -X /tmp/v7/exclude --exclude $@ *
@@ -70,12 +72,13 @@
echo "*.bz2" >> $@
v7.spec: v7.spec.in Makefile
- cat $< | sed -e 's/@V7_VERSION@/$(V7_VERSION)/g' -e 's/@V7_RELEASE@/$(V7_RELEASE)/g' > $@
+ cat $< | sed -e 's/@V7_VERSION@/$(V7_VERSION)/g' -e 's/@V7_RELEASE@/$(V7_RELEASE)/g' -e 's/@V7_RHEL_VERSION@/$(V7_RHEL_VERSION)/g'> $@
srpm: package
- rpmbuild -ts v7-$(V7_VERSION_RELEASE).tar.bz2
+ rpmbuild -ts v7-$(V7_VERSION_RELEASE).el$(V7_RHEL_VERSION).tar.bz2
rpm: package
- rpmbuild -tb v7-$(V7_VERSION_RELEASE).tar.bz2
+ rpmbuild -tb v7-$(V7_VERSION_RELEASE).el$(V7_RHEL_VERSION).tar.bz2
+
14 years, 4 months
r266 - trunk/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2009-12-21 20:18:22 +0000 (Mon, 21 Dec 2009)
New Revision: 266
Modified:
trunk/v7/hardwaretest.py
Log:
517311 - submit command causes a traceback if no tests have run
Modified: trunk/v7/hardwaretest.py
===================================================================
--- trunk/v7/hardwaretest.py 2009-12-21 20:12:58 UTC (rev 265)
+++ trunk/v7/hardwaretest.py 2009-12-21 20:18:22 UTC (rev 266)
@@ -673,7 +673,7 @@
def doSubmit(self):
self.load()
- if self.certification:
+ 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"
14 years, 4 months
r265 - trunk/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2009-12-21 20:12:58 +0000 (Mon, 21 Dec 2009)
New Revision: 265
Modified:
trunk/v7/planner.py
Log:
548517 - v7 plan traceback: no such attribute runForVirtualization
Modified: trunk/v7/planner.py
===================================================================
--- trunk/v7/planner.py 2009-12-17 16:09:13 UTC (rev 264)
+++ trunk/v7/planner.py 2009-12-21 20:12:58 UTC (rev 265)
@@ -76,11 +76,6 @@
if self.options.debug == Constants.high:
print "found a %s in %s" % (thing, file)
print "test %s run for device: %s" % (test.Name(), test.RunForDevice())
-
- if self.virtualization and not test.runForVirtualization():
- if self.options.debug == Constants.high:
- print "Test does not support virtualization"
- continue
self.deviceTests.append(test)
14 years, 4 months
r264 - trunk
by gnichols@fedoraproject.org
Author: gnichols
Date: 2009-12-17 16:09:13 +0000 (Thu, 17 Dec 2009)
New Revision: 264
Modified:
trunk/Makefile
Log:
R12 bump
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2009-12-17 15:58:29 UTC (rev 263)
+++ trunk/Makefile 2009-12-17 16:09:13 UTC (rev 264)
@@ -14,7 +14,7 @@
# Author: Greg Nichols
V7_VERSION := 1.0
-V7_RELEASE := 20
+V7_RELEASE := 21
V7_VERSION_RELEASE := $(V7_VERSION)-$(V7_RELEASE)
V7_VERSION_PY := v7/version.py
V7_SVN_MODULE := svn+ssh://svn.fedorahosted.org/svn/v7
14 years, 5 months
r263 - trunk/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2009-12-17 15:58:29 +0000 (Thu, 17 Dec 2009)
New Revision: 263
Modified:
trunk/v7/hardwaretest.py
Log:
525736 - Feat: CLI to manually provide/override vendor/make/model values in results.xml
Modified: trunk/v7/hardwaretest.py
===================================================================
--- trunk/v7/hardwaretest.py 2009-12-17 15:57:36 UTC (rev 262)
+++ trunk/v7/hardwaretest.py 2009-12-17 15:58:29 UTC (rev 263)
@@ -19,7 +19,6 @@
import syslog
import errno
import tempfile
-import md5
import time
import copy
import socket
@@ -92,6 +91,9 @@
parser.add_option("-e", "--enable",
action="store_true", dest="enable", default=False,
help="Re-enable a test")
+ parser.add_option("-d", "--model",
+ action="store_true", dest="model", default=False,
+ help="Edit model and vendor information")
parser.add_option("-s", "--rhts",
action="store_true", dest="rhts", default=False,
help="report test results to RHTS")
@@ -286,6 +288,9 @@
if self.options.server:
self.checkTestServer(self.options.server)
self.setServerOnTests()
+
+ if self.options.model:
+ self.editModel()
self.certification.save(self.environment.getResultsPath())
print "saved test plan to %s" % self.environment.getResultsPath()
@@ -607,7 +612,7 @@
# get HAL info
try:
hal=Hal()
- run.appendDevices(deviceClass.getDevices(hal))
+ run.appendDevices(deviceClass.getDevicesFromDetector(hal))
except dbus_bindings.DBusException, e:
print "Test error: %s" % e
syslog.syslog("Test error: %s" % e)
@@ -620,7 +625,7 @@
if not kudzu.isValid():
success = False
else:
- run.appendDevices(deviceClass.getDevices(kudzu))
+ run.appendDevices(deviceClass.getDevicesFromDetector(kudzu))
return success
@@ -1056,6 +1061,16 @@
except V7CommandException, e:
print "Error: HAL daemons \"%s\" is not running - please start it." % daemon
print e
+
+ def editModel(self):
+ editable = [Tags.vendor, Tags.make, Tags.model]
+ for tag in editable:
+ value = self.certification.getHardware(tag)
+ answers = list()
+ answers.append(value)
+ value = self.ui.prompt("Please enter the %s:" % tag, answers)
+ if len(value) > 0:
+ self.certification.setHardware(tag, value)
14 years, 5 months
r262 - trunk/docs/man
by gnichols@fedoraproject.org
Author: gnichols
Date: 2009-12-17 15:57:36 +0000 (Thu, 17 Dec 2009)
New Revision: 262
Modified:
trunk/docs/man/v7.8.in
Log:
525736 - Feat: CLI to manually provide/override vendor/make/model values in results.xml
Modified: trunk/docs/man/v7.8.in
===================================================================
--- trunk/docs/man/v7.8.in 2009-12-08 15:20:06 UTC (rev 261)
+++ trunk/docs/man/v7.8.in 2009-12-17 15:57:36 UTC (rev 262)
@@ -51,7 +51,7 @@
.SS plan
.P
-.B v7 plan [ ( --disable | --enable | --add) (--test <testname> | --udi <udi> | --device <device>) [--server <v7 server host>]
+.B v7 plan [ ( --disable | --enable | --add) (--test <testname> | --udi <udi> | --device <device>) [--server <v7 server host>] [--model]
.P
The plan command analyzes the hardware devices and system configuration
@@ -96,9 +96,13 @@
Enables Kudzu-based hardware detection during test planning. Normally, v7 uses HAL for device detection.
+.B --model
+
+Prompts the user to edit vendor, make and model information in the test plan.
+
.SS print
.P
-.B v7 print [--report (plan|summary|full) ] [ --udi <udi>| --test <test name>] [--failures] [--latest]
+.B v7 print [--report (plan|summary|full) ] [ --udi <udi>| --test <test name>] [--failures] [--last]
.P
The
.I print
14 years, 5 months
r261 - tags
by gnichols@fedoraproject.org
Author: gnichols
Date: 2009-12-08 15:20:06 +0000 (Tue, 08 Dec 2009)
New Revision: 261
Added:
tags/v7-V1-0R20/
Log:
tag version
Copied: tags/v7-V1-0R20 (from rev 260, trunk)
14 years, 5 months