Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 712656 Details for
Bug 921236
FEAT: address prompting quirks from 'hwcert' command refactoring
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
patch improves console output and prompting
0001-921240-FEAT-address-prompting-quirks-from-hwcert-com.patch (text/plain), 19.48 KB, created by
Greg Nichols
on 2013-03-19 13:35:55 UTC
(
hide
)
Description:
patch improves console output and prompting
Filename:
MIME Type:
Creator:
Greg Nichols
Created:
2013-03-19 13:35:55 UTC
Size:
19.48 KB
patch
obsolete
>From 8931ec7ffba63b6ff880dc7f61a4d3334b869ced Mon Sep 17 00:00:00 2001 >From: Greg Nichols <gnichols@redhat.com> >Date: Tue, 19 Mar 2013 09:33:51 -0400 >Subject: [PATCH] 921240 - FEAT: address prompting quirks from 'hwcert' command > refactoring > >--- > Makefile | 2 +- > hwcert-client.spec.in | 6 +++ > hwcert/certificationtest.py | 15 +++--- > hwcert/hardwarecertification.py | 114 ++++++++++++++++++++++++++++++++++------ > hwcert/hardwaretest.py | 73 +++++++++++++++---------- > hwcert/report.py | 14 +---- > hwcert/reporthtml.py | 13 +++-- > hwcert/test.py | 17 +++--- > hwcert/testdocument.py | 17 +++--- > 9 files changed, 184 insertions(+), 87 deletions(-) > >diff --git a/Makefile b/Makefile >index 5194f1a..a9cd45e 100644 >--- a/Makefile >+++ b/Makefile >@@ -14,7 +14,7 @@ > # Author: Greg Nichols > > HWCERT_VERSION := 1.5.9 >-HWCERT_RELEASE := 9 >+HWCERT_RELEASE := 10 > HWCERT_VERSION_RELEASE := $(HWCERT_VERSION)-$(HWCERT_RELEASE) > HWCERT_VERSION_PY := hwcert/version.py > HWCERT_RHEL_VERSION := 5 >diff --git a/hwcert-client.spec.in b/hwcert-client.spec.in >index 5a8a947..22794d7 100644 >--- a/hwcert-client.spec.in >+++ b/hwcert-client.spec.in >@@ -59,6 +59,12 @@ DESTDIR=$RPM_BUILD_ROOT make HWCERT_RHEL_VERSION=%{rhel_version} install > /etc/init.d/hwcert > > %changelog >+* Tue Mar 19 2013 Greg Nichols <gnichols@redhat.com> >+ >+hwcert-client 1.5.9 R10 >+ >+ 921240 - FEAT: address prompting quirks from 'hwcert' command refactoring >+ > * Fri Mar 14 2013 Greg Nichols <gnichols@redhat.com> > > 921227 - Rename v7 to hwcert-backend >diff --git a/hwcert/certificationtest.py b/hwcert/certificationtest.py >index c136903..187f4bd 100644 >--- a/hwcert/certificationtest.py >+++ b/hwcert/certificationtest.py >@@ -108,6 +108,13 @@ class CertificationDocument(DocumentBase): > def getRelease(self): > return self.document.documentElement.getAttribute(Attributes.hwcert_release) > >+ def setTestServer(self, testServer): >+ if testServer: >+ self.setHardware(Tags.test_server, testServer) >+ >+ def getTestServer(self): >+ return self.getHardware(Tags.test_server) >+ > > class ResultsDocument(CertificationDocument): > """ ResultsDocument represents the certification test results """ >@@ -180,15 +187,7 @@ class ResultsDocument(CertificationDocument): > return int(numberOfRunsString) > else: > return 0 >- >- def setTestServer(self, testServer): >- if testServer: >- self.setHardware(Tags.test_server, testServer) >- >- def getTestServer(self): >- return self.getHardware(Tags.test_server) > >- > def getDeviceClass(self, deviceClassName): > return self.deviceClasses[deviceClassName] > >diff --git a/hwcert/hardwarecertification.py b/hwcert/hardwarecertification.py >index 7f63a26..1f72e75 100644 >--- a/hwcert/hardwarecertification.py >+++ b/hwcert/hardwarecertification.py >@@ -14,37 +14,119 @@ > # Author: Greg Nichols > # > >-import os, sys >+import os, sys, time > from optparse import OptionParser > >-from hwcert.controller import Controller >-from hwcert.hardwaretest import HardwareTestHarness >- >+from controller import Controller >+from hardwaretest import HardwareTestHarness >+from resultsengine import ResultsEngine >+ > class HardwareCertification(HardwareTestHarness): >- >+ > def __init__(self ): > # probably need to block old syntax here. > HardwareTestHarness.__init__(self) >- >+ > def run(self): > print "The Red Had Hardware Certification Test Suite" > if not self.getLock(): > return False > print "\nPreparing for certification" > sys.stdout.flush() >+ > while True: >- self.load(silent=True) >- if self.certification: >- # cert results from a prior run, submit them. >- if self.doSubmit(): >- # if submitted, clean >- self.doClean() >- >+ self.load() >+ if self.testResultsReady(): >+ self.submitOrSaveResults() >+ > if not self.ui.promptConfirm("Would you like to continue certification testing?"): > break >- >- self.doCertify() >- >+ if not self.doCertify(): >+ break > self.releaseLock() >+ >+ return True >+ >+ def testResultsReady(self): >+ return self.certification and self.certification.getNumberOfTestRuns() > 0 >+ >+ def submitOrSaveResults(self): >+ if self.catalog.isReachable(): >+ (submitted, success) = self.catalog.submit(self.certification) >+ if success and submitted: >+ self.removeLogFiles() >+ return True >+ >+ if self.doSave(): >+ self.removeLogFiles() >+ return True >+ >+ # otherwise >+ return False >+ >+ def doCertify(self): >+ """ run only tests needed for certification """ >+ >+ if not self.doPlan(): >+ return False >+ >+ engine = ResultsEngine(self.certification) >+ tests = engine.getRemainingTests(self.catalog) >+ >+ # for realtime kernel, just look for remaining realtime tests >+ if self.isRealtime(): >+ tests = self.certification.getTaggedTests(tests, [TestTag.realtime]) >+ >+ if len(tests) == 0: >+ print "Testing appears to be complete." >+ return True >+ >+ tests = self.addMandatoryTests(tests) >+ if not tests: >+ return False >+ >+ print "\nThe following tests are recommended to complete the certification:" >+ >+ # test enable/disable loop >+ abort = False >+ while True: >+ for test in tests: >+ marked = "[ ]" >+ if test.getMandatory(): >+ marked = " " >+ if test.isDisabled(): >+ marked = "[X]" >+ print "%s %-10s %-10s %-36s" % (marked, test.getName(), test.getLogicalDeviceName(), test.getShortUDI()) >+ >+ if self.ui.promptConfirm("Ready to begin testing?"): >+ break >+ >+ if not self.ui.promptConfirm("Would you like to enable or disable tests?"): >+ abort = True >+ break >+ >+ for test in tests: >+ if test.getMandatory(): >+ continue >+ action = "Disable" >+ if test.isDisabled(): >+ action = "Enable" >+ action += " %s test" % test.getName() >+ if test.getLogicalDeviceName(): >+ action += " on %s" % test.getLogicalDeviceName() >+ if self.ui.promptConfirm(action + "?"): >+ test.setDisabled(not test.isDisabled()) >+ # pause here >+ time.sleep(2) >+ print "" > >+ if abort: >+ return False >+ >+ verified = self.verify(tests) >+ if not verified and not self.ui.promptConfirm("Verification failed, would you like to continue testing?"): >+ return False >+ >+ # otherwise >+ self._doRun(tests) > return True >diff --git a/hwcert/hardwaretest.py b/hwcert/hardwaretest.py >index 7679f0a..fe865b4 100644 >--- a/hwcert/hardwaretest.py >+++ b/hwcert/hardwaretest.py >@@ -220,15 +220,13 @@ class HardwareTestHarness(Controller): > return True > > >- def load(self, silent=False): >+ def load(self): > try: > self.certification = ResultsDocument(self.Debugging) > self.certification.load(self.environment.getResultsPath()) > except IOError: > self.certification = None > return >- if not silent: >- print "loaded results %s" % self.environment.getResultsPath() > > def doDiscover(self): > self.certification = ResultsDocument(self.Debugging) >@@ -347,7 +345,8 @@ class HardwareTestHarness(Controller): > self.editCertification() > > self.certification.save(self.environment.getResultsPath()) >- print "saved test plan to %s" % self.environment.getResultsPath() >+ if self.debugLevel != Constants.off: >+ print "saved test plan to %s" % self.environment.getResultsPath() > return True > > def saveNewPlan(self, tests): >@@ -406,35 +405,37 @@ class HardwareTestHarness(Controller): > return self.installRequiredRPMs(self.getRequiredRPMs(tests)) > > def getRequiredRPMs(self, tests): >- print "Checking for additional required packages based on the test plan:" >+ if self.debugLevel != Constants.off: >+ print "Checking for additional required packages based on the test plan:" > requiredRPMs = dict() > for test in tests: > rpms = test.getRequiredRPMs() > if len(rpms) > 0: >- sys.stdout.write(test.Name() + " requires ") >- needComma = False > for rpm in rpms: >- if needComma: >- sys.stdout.write(", ") >- needComma = True >- sys.stdout.write(rpm) > requiredRPMs[rpm] = rpm >- sys.stdout.write("\n") >+ if self.debugLevel != Constants.off: >+ sys.stdout.write(test.Name() + " requires " + ", ".join(rpms)) >+ sys.stdout.write("\n") > return requiredRPMs > > def installRequiredRPMs(self, requiredRPMs): > > while True: > missingRPMs = list() >- print "Checking installed rpms:" >+ if self.debugLevel != Constants.off: >+ print "Checking installed rpms:" > for rpm in requiredRPMs.keys(): > try: > rpmQ = Command("rpm -q " + rpm) >- rpmQ.echo() >+ if self.debugLevel != Constants.off: >+ rpmQ.echo() >+ else: >+ rpmQ.run() > except HwCertCommandException, e: > missingRPMs.append(rpm) > if len(missingRPMs) > 0: >- print "The following rpms are required for testing:" >+ if self.debugLevel != Constants.off: >+ print "The following rpms are required for testing:" > missingRPMList = "" > for rpm in missingRPMs: > missingRPMList = "%s %s" % (missingRPMList, rpm) >@@ -452,12 +453,14 @@ class HardwareTestHarness(Controller): > print "Error: could not install required rpms" > return False > # otherwise >- print "Rechecking required rpms" >+ if self.debugLevel != Constants.off: >+ print "Rechecking required rpms" > else: # user-abort > print "Warning: some tests may fail due to missing rpms" > return False > else: >- print "All required rpms installed" >+ if self.debugLevel != Constants.off: >+ print "All required rpms installed" > return True > print "" > >@@ -661,7 +664,7 @@ class HardwareTestHarness(Controller): > if not udi: udi = "" > print "%-10s %-10s %-36s" % (test.getName(), test.getLogicalDeviceName(), udi) > >- verified = self.__verify(tests) >+ verified = self.verify(tests) > if not verified and self.options.mode != Constants.auto: > if not self.ui.promptConfirm("Verification failed, would you like to continue testing?"): > return False >@@ -696,10 +699,11 @@ class HardwareTestHarness(Controller): > print "No matching tests found." > return False > >- report = Report(self.options, self.certification) >- for test in tests: >- print report.formatTest(test) >- print "" >+ if self.debugLevel != Constants.off: >+ report = Report(self.options, self.certification) >+ for test in tests: >+ print report.formatTest(test) >+ print "" > > # determine test server > if self.testServer: >@@ -735,10 +739,12 @@ class HardwareTestHarness(Controller): > combinedResult = True # assume all tests pass > for test in tests: > if test.isDisabled(): >- print "skipping %s - disabled" % test.getName() >+ if self.debugLevel != Constants.off: >+ print "skipping %s - disabled" % test.getName() > continue > >- print ("running %s on %s") % (test.getName(),test.getUDI()) >+ if self.debugLevel != Constants.off: >+ print ("running %s on %s") % (test.getName(),test.getUDI()) > run = test.getRun(runNumber) > > run.setRunTime(self.getCurrentUTCTime()) >@@ -811,7 +817,8 @@ class HardwareTestHarness(Controller): > print ("Return value was %u") % returnValue > # TODO: clean up tmpdir here? > self.certification.save(self.environment.getResultsPath()) >- print "saved to " + self.environment.getResultsPath() >+ if self.debugLevel != Constants.off: >+ print "saved to " + self.environment.getResultsPath() > > syslog.syslog("Testing complete.") > syslog.closelog() >@@ -924,7 +931,7 @@ class HardwareTestHarness(Controller): > for test in tests: > print "%-10s %-10s %-36s" % (test.getName(), test.getLogicalDeviceName(), test.getShortUDI()) > >- verified = self.__verify(tests) >+ verified = self.verify(tests) > if not verified and self.options.mode != Constants.auto: > if not self.ui.promptConfirm("Verification failed, would you like to continue testing?"): > return False >@@ -945,7 +952,7 @@ class HardwareTestHarness(Controller): > if not self.doPlan(): > return False > >- return self.__verify(self.certification.getTests()) >+ return self.verify(self.certification.getTests()) > > def __checkResultsSize(self): > >@@ -962,7 +969,7 @@ class HardwareTestHarness(Controller): > # size warning was ignored (or mode auto) > return True > >- def __verify(self, testDocuments): >+ def verify(self, testDocuments): > > result = True > >@@ -970,6 +977,8 @@ class HardwareTestHarness(Controller): > failures = 0 > > for testDocument in testDocuments: >+ if testDocument.isDisabled(): >+ continue > test = self.planner.getTest(testDocument.getName()) > testParameters = TestParameters(testDocument, self) > test.setParameters(testParameters) >@@ -988,7 +997,7 @@ class HardwareTestHarness(Controller): > return False > > def doPrint(self, format="text"): >- self.load(silent=True) >+ self.load() > if format == "html": > report = ReportHTML(self.options, self.certification) > return report.Write() >@@ -1420,6 +1429,12 @@ class HardwareTestHarness(Controller): > print "Error: %s is not an integer." % value > if value and int(value) >= 0: > self.certification.setCertificationID(value) >+ >+ # set a local test server >+ value = self.certification.getTestServer() >+ value = self.ui.promptEdit("Local Hardware Certification Test Server: ", value) >+ if len(value) > 0: >+ self.certification.setTestServer(value) > > > # copy over to certification.xml >diff --git a/hwcert/report.py b/hwcert/report.py >index f82dd1c..df71c55 100644 >--- a/hwcert/report.py >+++ b/hwcert/report.py >@@ -124,7 +124,7 @@ class Report(Controller): > print "%-7s %-7s %-36s %s" % ( > test.getName(), > test.getLogicalDeviceName(), >- self.getShortUDI(test), >+ test.getShortUDI(), > summary > ) > continue >@@ -176,14 +176,4 @@ class Report(Controller): > if test.isDisabled(): > disabled = " - DISABLED" > label = test.getLogicalDeviceName() >- return "%-10s %-10s %-36s %s" % (test.getName(), label, self.getShortUDI(test), disabled) >- >- >- def getShortUDI(self, test): >- udi = "" >- if test.getUDI() != "/org/freedesktop/Hal/devices/computer": >- udi = test.getUDI() >- prefix = "/org/freedesktop/Hal/devices/" >- if udi.startswith(prefix): >- udi = udi[len(prefix):] >- return udi >+ return "%-10s %-10s %-36s %s" % (test.getName(), label, test.getShortUDI(), disabled) >diff --git a/hwcert/reporthtml.py b/hwcert/reporthtml.py >index ef1b4d9..8a81e02 100644 >--- a/hwcert/reporthtml.py >+++ b/hwcert/reporthtml.py >@@ -294,9 +294,12 @@ class ReportHTML(Controller): > > > def getShortUDI(self, udi): >- if udi != "/org/freedesktop/Hal/devices/computer": >- prefix = "/org/freedesktop/Hal/devices/" >- if udi.startswith(prefix): >- return udi[len(prefix):] >- # otherwise >+ if not udi: >+ return "" >+ # chop everything before and including /devices/ >+ prefix = "/devices/" >+ if udi.index(prefix): >+ udi = udi[udi.index(prefix)+len(prefix):] >+ # take the last 5 nodes >+ udi = "/".join(udi.split("/")[-5:]) > return udi >diff --git a/hwcert/test.py b/hwcert/test.py >index b5d5e75..1e92e42 100644 >--- a/hwcert/test.py >+++ b/hwcert/test.py >@@ -197,14 +197,15 @@ class Test(CommandLineUI): > return None > > def getShortUDI(self): >- if not self.getUDI(): >- return None >- udi = "" >- if self.getUDI() != "/org/freedesktop/Hal/devices/computer": >- udi = self.getUDI() >- prefix = "/org/freedesktop/Hal/devices/" >- if udi.startswith(prefix): >- udi = udi[len(prefix):] >+ udi = self.getUDI() >+ if not udi: >+ return "" >+ # chop everything before and including /devices/ >+ prefix = "/devices/" >+ if udi.index(prefix) >=0: >+ udi = udi[udi.index(prefix)+len(prefix):] >+ # take the last 5 nodes >+ udi = "/".join(udi.split("/")[-5:]) > return udi > > def getMode(self): >diff --git a/hwcert/testdocument.py b/hwcert/testdocument.py >index 745de7e..9668360 100644 >--- a/hwcert/testdocument.py >+++ b/hwcert/testdocument.py >@@ -85,14 +85,15 @@ class TestDocument(DocumentWrapper): > if udi: > self.element.setAttribute(Attributes.udi, udi) > def getShortUDI(self): >- if not self.getUDI(): >- return None >- udi = "" >- if self.getUDI() != "/org/freedesktop/Hal/devices/computer": >- udi = self.getUDI() >- prefix = "/org/freedesktop/Hal/devices/" >- if udi.startswith(prefix): >- udi = udi[len(prefix):] >+ udi = self.getUDI() >+ if not udi: >+ return "" >+ # chop everything before and including /devices/ >+ prefix = "/devices/" >+ if udi.index(prefix) >=0: >+ udi = udi[udi.index(prefix)+len(prefix):] >+ # take the last 5 nodes >+ udi = "/".join(udi.split("/")[-5:]) > return udi > > def getLabel(self): >-- >1.8.1.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 921236
: 712656 |
716628