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

Unified Diff: mojo/tools/mopy/config.py

Issue 881753002: Run App tests on Android. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Whitespace Created 5 years, 11 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 | « mojo/tools/get_test_list.py ('k') | mojo/tools/test_runner.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/tools/mopy/config.py
diff --git a/mojo/tools/mopy/config.py b/mojo/tools/mopy/config.py
index 7a3ce194847b3778969bf5cf9e63b5002046e9ec..efca6ad7c211441cf0eaf821708545de58359bd6 100644
--- a/mojo/tools/mopy/config.py
+++ b/mojo/tools/mopy/config.py
@@ -119,3 +119,25 @@ class Config(object):
def test_types(self):
"""List of test types to run."""
return self.values.get("test_types", [Config.TEST_TYPE_DEFAULT])
+
+ # Utility methods ------------------------------------------------------------
+
+ def match_target_os(self, selector):
+ """Returns whether the current config matches the target os selector.
+
+ |selector| is a list of strings. Each string is either:
+ * : matches everything.
+ target_os : matches the given target os.
+ !* : rejects everything
+ !target_os : rejects the given target os.
+
+ The last matching selector is considered. If no selector match, the config
+ matches.
+ """
+ for match in reversed(selector):
+ invert = match[0] == "!"
+ if invert:
+ match = match[1:]
+ if match == "*" or self.target_os == match:
+ return not invert
+ return True
« no previous file with comments | « mojo/tools/get_test_list.py ('k') | mojo/tools/test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698