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

Unified Diff: scripts/slave/unittests/expect_tests/pipeline.py

Issue 240053005: Various minor improvements to recipe_simulation_test.py. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 6 years, 8 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
Index: scripts/slave/unittests/expect_tests/pipeline.py
diff --git a/scripts/slave/unittests/expect_tests/pipeline.py b/scripts/slave/unittests/expect_tests/pipeline.py
index d3fb32a34187f8bebda43086d5d1e0dacd4c904d..09136b28299f213ac27fb3146c418929d38b53cc 100644
--- a/scripts/slave/unittests/expect_tests/pipeline.py
+++ b/scripts/slave/unittests/expect_tests/pipeline.py
@@ -10,7 +10,8 @@ import signal
import traceback
from .type_definitions import (
- Test, UnknownError, TestError, Result, ResultStageAbort)
+ Test, UnknownError, TestError, NoMatchingTestsError,
+ Result, ResultStageAbort)
def gen_loop_process(gen, test_queue, result_queue, opts, kill_switch,
@@ -28,18 +29,22 @@ def gen_loop_process(gen, test_queue, result_queue, opts, kill_switch,
@type kill_switch: multiprocessing.Event()
@type cover_ctx: cover.CoverageContext().create_subprocess_context()
"""
+ # Implicitly append '*'' to globs that don't specify it.
+ globs = ['%s%s' % (g, '*' if '*' not in g else '') for g in opts.test_glob]
+
matcher = re.compile(
'^%s$' % '|'.join('(?:%s)' % glob.fnmatch.translate(g)
- for g in opts.test_glob if g[0] != '-'))
+ for g in globs if g[0] != '-'))
if matcher.pattern == '^$':
matcher = re.compile('^.*$')
neg_matcher = re.compile(
'^%s$' % '|'.join('(?:%s)' % glob.fnmatch.translate(g[1:])
- for g in opts.test_glob if g[0] == '-'))
+ for g in globs if g[0] == '-'))
def generate_tests():
paths_seen = set()
+ seen_tests = False
try:
for test in gen():
if kill_switch.is_set():
@@ -58,7 +63,10 @@ def gen_loop_process(gen, test_queue, result_queue, opts, kill_switch,
else:
paths_seen.add(test_path)
if not neg_matcher.match(test.name) and matcher.match(test.name):
+ seen_tests = True
yield test
+ if not seen_tests:
+ result_queue.put_nowait(NoMatchingTestsError())
except KeyboardInterrupt:
pass
finally:
« no previous file with comments | « scripts/slave/unittests/expect_tests/main.py ('k') | scripts/slave/unittests/expect_tests/type_definitions.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698