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 714559 Details for
Bug 921247
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 ui improvements against R20
0001-921247-FEAT-address-prompting-quirks-from-hwcert-com.patch (text/plain), 13.09 KB, created by
Greg Nichols
on 2013-03-22 14:29:10 UTC
(
hide
)
Description:
additional ui improvements against R20
Filename:
MIME Type:
Creator:
Greg Nichols
Created:
2013-03-22 14:29:10 UTC
Size:
13.09 KB
patch
obsolete
>From 2cc136ca40ff720864fa63fd6db3296483ecb79e Mon Sep 17 00:00:00 2001 >From: Greg Nichols <gnichols@redhat.com> >Date: Fri, 22 Mar 2013 10:27:53 -0400 >Subject: [PATCH] 921247 - 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 | 13 +++--- > hwcert/test.py | 1 + > 8 files changed, 88 insertions(+), 42 deletions(-) > >diff --git a/Makefile b/Makefile >index 92621df..50d6422 100644 >--- a/Makefile >+++ b/Makefile >@@ -14,7 +14,7 @@ > # Author: Greg Nichols > > HWCERT_VERSION := 1.7.0 >-HWCERT_RELEASE := 20 >+HWCERT_RELEASE := 21 > HWCERT_VERSION_RELEASE := $(HWCERT_VERSION)-$(HWCERT_RELEASE) > HWCERT_VERSION_PY := hwcert/version.py > HWCERT_RHEL_VERSION := 7 >diff --git a/hwcert-client.spec.in b/hwcert-client.spec.in >index b2e524a..f90f668 100644 >--- a/hwcert-client.spec.in >+++ b/hwcert-client.spec.in >@@ -78,7 +78,7 @@ DESTDIR=$RPM_BUILD_ROOT make HWCERT_RHEL_VERSION=%{rhel_version} install > %changelog > * Wed Mar 20 2013 Greg Nichols <gnichols@redhat.com> > >-hwcert-client 1.7.0 R20 >+hwcert-client 1.7.0 R21 > > 921247 - 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 877002e..daccd23 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 = "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 fd9d88f..0dbc8c6 100644 >--- a/hwcert/hardwaretest.py >+++ b/hwcert/hardwaretest.py >@@ -50,9 +50,9 @@ class HardwareTestHarness(Controller): > > Debugging=True > >- def __init__(self): >+ def __init__(self, echoResponses=True): > self.getOptions() >- Controller.__init__(self, self.options.debug) >+ Controller.__init__(self, self.options.debug, echoResponses) > self.environment = Environment() > self.makeDirectoryPath(self.environment.getDataDirectory()) > self.testServer = self.options.server >@@ -575,7 +575,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) >@@ -590,14 +591,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 1e7d517..1a9cfe6 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 921247
:
712651
|
713444
| 714559 |
716574