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 714697 Details for
Bug 921240
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]
additional improvements against R34
0001-921240-FEAT-address-prompting-quirks-from-hwcert-com.patch (text/plain), 12.93 KB, created by
Greg Nichols
on 2013-03-22 17:50:12 UTC
(
hide
)
Description:
additional improvements against R34
Filename:
MIME Type:
Creator:
Greg Nichols
Created:
2013-03-22 17:50:12 UTC
Size:
12.93 KB
patch
obsolete
>From dc3dc9c7835d911704ee4b1f21ddd3faf9342661 Mon Sep 17 00:00:00 2001 >From: Greg Nichols <gnichols@redhat.com> >Date: Fri, 22 Mar 2013 13:47:51 -0400 >Subject: [PATCH] 921240 - FEAT: address prompting quirks from 'hwcert' command > refactoring > >--- > Makefile | 2 +- > hwcert-client.spec.in | 2 +- > hwcert/certificationtest.py | 5 +++ > hwcert/commandLineUI.py | 11 +++-- > hwcert/controller.py | 4 +- > hwcert/hardwarecertification.py | 92 +++++++++++++++++++++++++++-------------- > hwcert/hardwaretest.py | 11 +++-- > hwcert/test.py | 1 + > 8 files changed, 87 insertions(+), 41 deletions(-) > >diff --git a/Makefile b/Makefile >index 6559445..d48435f 100644 >--- a/Makefile >+++ b/Makefile >@@ -14,7 +14,7 @@ > # Author: Greg Nichols > > HWCERT_VERSION := 1.6.4 >-HWCERT_RELEASE := 34 >+HWCERT_RELEASE := 35 > HWCERT_VERSION_RELEASE := $(HWCERT_VERSION)-$(HWCERT_RELEASE) > HWCERT_VERSION_PY := hwcert/version.py > HWCERT_RHEL_VERSION := 6 >diff --git a/hwcert-client.spec.in b/hwcert-client.spec.in >index 0c3803a..154217c 100644 >--- a/hwcert-client.spec.in >+++ b/hwcert-client.spec.in >@@ -81,7 +81,7 @@ DESTDIR=$RPM_BUILD_ROOT make HWCERT_RHEL_VERSION=%{rhel_version} install > %changelog > * Tue Mar 19 2013 Greg Nichols <gnichols@redhat.com> > >-hwcert-client 1.6.4 R34 >+hwcert-client 1.6.4 R35 > > 921240 - FEAT: address prompting quirks from 'hwcert' command refactoring > >diff --git a/hwcert/certificationtest.py b/hwcert/certificationtest.py >index f7b28bb..c22dd45 100644 >--- a/hwcert/certificationtest.py >+++ b/hwcert/certificationtest.py >@@ -366,6 +366,11 @@ class ResultsDocument(CertificationDocument): > # otherwise > return None > >+ def getTest(self, otherTest): >+ """ find a test that is a best match otherTest's important attributes - class, udi, device """ >+ return self.getDeviceClass(otherTest.getDeviceClassName()).getTest(otherTest) >+ >+ > def getTestCounts(self, runNumber): > tests = self.getTests() > count = 0 >diff --git a/hwcert/commandLineUI.py b/hwcert/commandLineUI.py >index bcb1353..d91bf75 100644 >--- a/hwcert/commandLineUI.py >+++ b/hwcert/commandLineUI.py >@@ -19,7 +19,11 @@ import readline, getpass > > from tags import Constants > >-class CommandLineUI: >+class CommandLineUI: >+ >+ def __init__(self, echoResponses=True): >+ self.echo = echoResponses >+ > # utilities > def printPipe(self, pipe): > while 1: >@@ -38,7 +42,7 @@ class CommandLineUI: > sys.stdout.write(") ") > sys.stdout.flush() > response = sys.stdin.readline() >- if response.strip(): >+ if response.strip() and self.echo: > sys.stdout.write("response: %s" % response) > return response.strip() > >@@ -53,7 +57,8 @@ class CommandLineUI: > response = sys.stdin.readline() > try: > value = string.atoi(response.strip()) >- sys.stdout.write("response: %u\n" % value) >+ if self.echo: >+ sys.stdout.write("response: %u\n" % value) > return value > except ValueError: > sys.stdout.write("Please enter an integer.\n") >diff --git a/hwcert/controller.py b/hwcert/controller.py >index dd7b18a..bf2b937 100644 >--- a/hwcert/controller.py >+++ b/hwcert/controller.py >@@ -30,8 +30,8 @@ from hwcert.tags import Constants > > class Controller: > >- def __init__(self, debug=Constants.off): >- self.ui = CommandLineUI() >+ def __init__(self, debug=Constants.off, echoResponses=True): >+ self.ui = CommandLineUI(echoResponses) > self.systemLogMarker = "hwcert/runtests" > self.systemLogBootMarker = "kernel: Linux version" > self.debug = debug >diff --git a/hwcert/hardwarecertification.py b/hwcert/hardwarecertification.py >index 07a96d8..a040e61 100644 >--- a/hwcert/hardwarecertification.py >+++ b/hwcert/hardwarecertification.py >@@ -21,12 +21,16 @@ from controller import Controller > from hardwaretest import HardwareTestHarness > from resultsengine import ResultsEngine > from certificationtest import ResultsDocument >+from testdocument import TestDocument > > class HardwareCertification(HardwareTestHarness): > > def __init__(self ): > # probably need to block old syntax here. >- HardwareTestHarness.__init__(self) >+ HardwareTestHarness.__init__(self, echoResponses=False) >+ self.markSelected = "->" >+ self.markUnSelected = " " >+ self.markMandatory = "<>" > > def run(self): > print "The Red Hat Hardware Certification Test Suite" >@@ -88,11 +92,11 @@ class HardwareCertification(HardwareTestHarness): > # test enable/disable loop > while True: > self.showTests(tests) >- answer = self.ui.prompt("Ready to begin testing?", ["yes", "edit", "quit"]) >+ answer = self.ui.prompt("Ready to begin testing?", ["run", "edit", "quit"]) > > if answer[0] == "q": > return False >- if answer[0] == "y": >+ if answer[0] == "y" or answer == "run": > break > > self.editTests(tests) >@@ -106,21 +110,28 @@ class HardwareCertification(HardwareTestHarness): > return True > > def showTests(self, tests): >+ # should clearscreen be configurable? >+ os.system("clear") > lineNumber = 1 > for test in tests: >- marked = "->" >+ marked = self.markSelected > if test.getMandatory(): >- marked = "<>" >+ marked = self.markMandatory > if test.isDisabled(): >- marked = " " >+ marked = self.markUnSelected > print "%2u %s %-10s %-10s %-36s" % (lineNumber, marked, test.getName(), test.getLogicalDeviceName(), test.getShortUDI()) > lineNumber += 1 > > def editTests(self, tests): > while True: >- os.system("clear") > self.showTests(tests) > answer = self.ui.prompt("Test Selection (<number>|<name(s)>|select all|remove all|done): ") >+ if not answer.strip(): >+ if not self.showEditSyntaxHelp(): >+ return >+ # otherwise, try again >+ continue >+ > if answer == "done": > return > try: >@@ -140,18 +151,29 @@ class HardwareCertification(HardwareTestHarness): > continue > > # otherwise, names? >- names = answer.split(" ") >- for name in names: >- found = False >- for test in tests: >- if test.getName() == name.strip(", "): >- if not self.checkMandatory(test): >- test.setDisabled(not test.isDisabled()) >- found = True >- if not found: >- print "Test name %s not found." % name.strip(", ") >- # pause here >- time.sleep(2) >+ testsFromAnswer = list() >+ names = [w.strip(", ") for w in answer.split(" ")] >+ if len(names) is 2: >+ # see if it's <test> <device> syntax >+ matchingTests = filter(lambda test: TestDocument.getName(test) == names[0] >+ and TestDocument.getLogicalDeviceName(test) == names[1], tests) >+ testsFromAnswer.extend(matchingTests) >+ >+ if names and len(testsFromAnswer) is 0: >+ #assume it's a list of test names >+ for name in names: >+ matchingTests = filter(lambda test: TestDocument.getName(test) == name, tests) >+ if not matchingTests: >+ if not self.showEditSyntaxHelp(answer): >+ return >+ # bad list of names, forget the whole answer, and ask again >+ break >+ testsFromAnswer.extend(matchingTests) >+ >+ for test in testsFromAnswer: >+ if not self.checkMandatory(test): >+ test.setDisabled(not test.isDisabled()) >+ > > def checkMandatory(self, test, silent=False): > if test.getMandatory(): >@@ -161,6 +183,25 @@ class HardwareCertification(HardwareTestHarness): > time.sleep(2) > return True > return False >+ >+ def showEditSyntaxHelp(self, answer=None): >+ print "" >+ if answer: >+ print"Error: could not find test(s) from your response: %s\n" % answer >+ >+ print "Key:" >+ print " %s indicates a test selected to run" % self.markSelected >+ print " %s indicates a test that is mandatory for each test run" % self.markMandatory >+ if self.markUnSelected.strip(): >+ print " %s indicates a test that will not be run" % self.markUnSelected >+ print "" >+ print "To toggle test selection, enter one of the following:" >+ print " <number> an integer indicating the test's position on the list" >+ print " <test name> <device> the test name and device" >+ print " <list of test names> a space or comma separated list of tests" >+ print " select all - select all recommended tests" >+ print " remove all - remove all non-mandatory tests from the test run" >+ return self.ui.promptConfirm("Continue?") > > def saveResultsToCertificationDoc(self): > # saving full results.xml to certification.xml >@@ -172,18 +213,9 @@ class HardwareCertification(HardwareTestHarness): > certificationDocument = ResultsDocument() > certificationDocument.load(self.environment.getCertificationPath()) > for oldTest in certificationDocument.getTests(): >- print "old test: %s" % oldTest.getName() > if oldTest.getMandatory(): > continue > if oldTest.hasPassed() or oldTest.isDisabled(): >- test = self.certification.getDeviceClass(oldTest.getDeviceClassName()).getTest(oldTest) >- if test: >- "new test: %s" % test.getName() >- if oldTest.hasPassed(): >- print " PASS" >- test.setDisabled(True) >- elif oldTest.isDisabled(): >+ test = self.certification.getTest(oldTest) >+ if test and (oldTest.hasPassed() or oldTest.isDisabled()): > test.setDisabled(True) >- print " disabled" >- else: >- print " -" >diff --git a/hwcert/hardwaretest.py b/hwcert/hardwaretest.py >index 77b6d35..e8fb4a2 100644 >--- a/hwcert/hardwaretest.py >+++ b/hwcert/hardwaretest.py >@@ -51,7 +51,7 @@ class HardwareTestHarness(Controller): > > Debugging=True > >- def __init__(self): >+ def __init__(self, echoResponses=True): > self.getOptions() > Controller.__init__(self, self.options.debug) > self.environment = Environment() >@@ -580,7 +580,8 @@ class HardwareTestHarness(Controller): > return success > > def checkTestServer(self, server): >- print "Verifying HwCert Server..." >+ if self.debugLevel != Constants.off: >+ print "Verifying HwCert Server..." > result = True > try: > request = urllib2.Request('http://%s/hwcert/cgi/hwCertWeb.py?command=status' % server) >@@ -595,14 +596,16 @@ class HardwareTestHarness(Controller): > if match: > hwcertServerVersion = match.group("version") > hwcertServerRelease = match.group("release") >- print "Version %s Release %s" % (hwcertServerVersion, hwcertServerRelease) >+ if self.debugLevel != Constants.off: >+ print "Version %s Release %s" % (hwcertServerVersion, hwcertServerRelease) > if hwcertServerVersion + "." + hwcertServerRelease < Constants.hwCertServerMinimumVersion: > print "Error: HwCert server is from a prior release." > print "This is a likely cause of test failures" > result = False > match = statusPattern.search(line) > if match: >- print "Status: %s" % match.group("status") >+ if self.debugLevel != Constants.off: >+ print "Status: %s" % match.group("status") > if match.group("status") == Constants.running: > serverRunning = True > else: >diff --git a/hwcert/test.py b/hwcert/test.py >index 870499a..ce8285b 100644 >--- a/hwcert/test.py >+++ b/hwcert/test.py >@@ -24,6 +24,7 @@ class Test(CommandLineUI): > > > def __init__(self, name): >+ CommandLineUI.__init__(self, echoResponses=True) > self.returnValue = 1 > self.result = Constants.ABORT > self.device = None >-- >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 921240
:
712653
|
713881
| 714697 |
716615