Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(423)

Unified Diff: server/site_wifitest.py

Issue 3405016: add per-step failure support for WiFi tests (Closed) Base URL: ssh://git@chromiumos-git//autotest.git
Patch Set: handle success case Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: server/site_wifitest.py
diff --git a/server/site_wifitest.py b/server/site_wifitest.py
index 5f070b8cd14b082e385c06fb0bcde413c1a6455f..7be9311dd31862ae2c3b7a0a41266f95d0a0b95b 100644
--- a/server/site_wifitest.py
+++ b/server/site_wifitest.py
@@ -186,10 +186,17 @@ class WiFiTest(object):
"""
Run a WiFi test. Each step is interpreted as a method either
in this class or the ancillary router class and invoked with
- the supplied parameter dictionary.
+ the supplied parameter dictionary. If the method is prefixed
+ with '!' then we expect the operation to fail; this is useful,
+ for example, for testing parameter checking in flimflam.
"""
for s in self.steps:
method = s[0]
+ if method[0] == '!':
+ expect_failure = True
+ method = method[1:]
+ else:
+ expect_failure = False
if len(s) > 1:
params = s[1]
else:
@@ -204,7 +211,12 @@ class WiFiTest(object):
else:
self.prefix = method
- logging.info("%s: step '%s' params %s", self.name, method, params)
+ if expect_failure is True:
+ logging.info("%s: step '%s' (expect failure) params %s",
+ self.name, method, params)
+ else:
+ logging.info("%s: step '%s' params %s", self.name, method,
+ params)
func = getattr(self, method, None)
if func is None:
@@ -212,12 +224,15 @@ class WiFiTest(object):
if func is not None:
try:
func(params)
+ if expect_failure is True:
+ raise error.TestFail("Expected failure")
except Exception, e:
+ if expect_failure is True:
+ continue
logging.error("%s: Step '%s' failed: %s; abort test",
self.name, method, str(e))
self.cleanup(params)
raise e
- break
else:
logging.error("%s: Step '%s' unknown; abort test",
self.name, method)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698