diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2016-07-12 05:04:01 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-07-21 07:47:52 +0100 |
commit | 736eab6e73928a6ba1b4b68f506f97a0e0286e66 (patch) | |
tree | 0ef4a51edc43ac817fa0436b5bbb1521c84a7f0a /scripts/oe-selftest | |
parent | e1aa836bb9f2e3d3616f7303501e4bab48d2d429 (diff) | |
download | poky-736eab6e73928a6ba1b4b68f506f97a0e0286e66.tar.gz |
oe-selftest: print errors when failed to find test
For example:
$ oe-selftest --run-tests-by name hello world
2016-07-12 00:33:28,678 - selftest - ERROR - Failed to find test: hello
2016-07-12 00:33:28,679 - selftest - ERROR - Failed to find test: world
(From OE-Core rev: 665a0f93bde0d61e0c7ceab072ca3f1f22b2f700)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/oe-selftest')
-rwxr-xr-x | scripts/oe-selftest | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/scripts/oe-selftest b/scripts/oe-selftest index df76f94f7a..303b1d52ea 100755 --- a/scripts/oe-selftest +++ b/scripts/oe-selftest | |||
@@ -262,16 +262,22 @@ def get_testsuite_by(criteria, keyword): | |||
262 | result = [] | 262 | result = [] |
263 | remaining = values[:] | 263 | remaining = values[:] |
264 | for key in keyword: | 264 | for key in keyword: |
265 | found = False | ||
265 | if key in remaining: | 266 | if key in remaining: |
266 | # Regular matching of exact item | 267 | # Regular matching of exact item |
267 | result.append(key) | 268 | result.append(key) |
268 | remaining.remove(key) | 269 | remaining.remove(key) |
270 | found = True | ||
269 | else: | 271 | else: |
270 | # Wildcard matching | 272 | # Wildcard matching |
271 | pattern = re.compile(fnmatch.translate(r"%s" % key)) | 273 | pattern = re.compile(fnmatch.translate(r"%s" % key)) |
272 | added = [x for x in remaining if pattern.match(x)] | 274 | added = [x for x in remaining if pattern.match(x)] |
273 | result.extend(added) | 275 | if added: |
274 | remaining = [x for x in remaining if x not in added] | 276 | result.extend(added) |
277 | remaining = [x for x in remaining if x not in added] | ||
278 | found = True | ||
279 | if not found: | ||
280 | log.error("Failed to find test: %s" % key) | ||
275 | 281 | ||
276 | return result | 282 | return result |
277 | 283 | ||
@@ -455,6 +461,8 @@ def main(): | |||
455 | criteria = args.run_tests_by[0] | 461 | criteria = args.run_tests_by[0] |
456 | keyword = args.run_tests_by[1:] | 462 | keyword = args.run_tests_by[1:] |
457 | ts = sorted([ tc.fullpath for tc in get_testsuite_by(criteria, keyword) ]) | 463 | ts = sorted([ tc.fullpath for tc in get_testsuite_by(criteria, keyword) ]) |
464 | if not ts: | ||
465 | return 1 | ||
458 | 466 | ||
459 | if args.list_tests_by and len(args.list_tests_by) >= 2: | 467 | if args.list_tests_by and len(args.list_tests_by) >= 2: |
460 | valid_options = ['name', 'class', 'module', 'id', 'tag'] | 468 | valid_options = ['name', 'class', 'module', 'id', 'tag'] |