Skip to contentSkip to conversation

fix oe-selftest and testimage.bbclass

PATCH New Robert Yang 1 participant 3 messages Jul 12, 2016

lore
Share & tools
lore
#0 lore raw

cover fix oe-selftest and testimage.bbclass

The following changes since commit b17f91ed06a604e3d356fe17756bfe2ca61594b7:

tune-ppce500mc.inc: pass -mcpu=e500mc for ppce500mc kernel compile (2016-07-10 14:12:07 +0100)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib rbt/test
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=rbt/test

Robert Yang (2):
oe-selftest: print errors when failed to find test testimage.bbclass: INHERIT -> IMAGE_CLASSES

 meta/classes/testimage.bbclass |  2 +-
 scripts/oe-selftest            | 12 ++++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)
Signature · 1 line
2.9.0
#1 lore raw

PATCH 1/2 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
---
 scripts/oe-selftest | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
scripts/oe-selftest +10 -2
index df76f94..303b1d5 100755
@@ -262,16 +262,22 @@ def get_testsuite_by(criteria, keyword):
         result = []
         remaining = values[:]
         for key in keyword:
+            found = False
             if key in remaining:
                 # Regular matching of exact item
                 result.append(key)
                 remaining.remove(key)
+                found = True
             else:
                 # Wildcard matching
                 pattern = re.compile(fnmatch.translate(r"%s" % key))
                 added = [x for x in remaining if pattern.match(x)]
-                result.extend(added)
-                remaining = [x for x in remaining if x not in added]
+                if added:
+                    result.extend(added)
+                    remaining = [x for x in remaining if x not in added]
+                    found = True
+            if not found:
+                log.error("Failed to find test: %s" % key)
 
         return result
 
@@ -455,6 +461,8 @@ def main():
             criteria = args.run_tests_by[0]
             keyword = args.run_tests_by[1:]
             ts = sorted([ tc.fullpath for tc in get_testsuite_by(criteria, keyword) ])
+        if not ts:
+            return 1
 
     if args.list_tests_by and len(args.list_tests_by) >= 2:
         valid_options = ['name', 'class', 'module', 'id', 'tag']
Signature · 1 line
2.9.0
#2 lore raw

PATCH 2/2 testimage.bbclass: INHERIT -> IMAGE_CLASSES

In reply to Robert Yang

Use IMAGE_CLASSES which is only seen by image recipe.

---
 meta/classes/testimage.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/testimage.bbclass +1 -1
index 7fd0f62..6d8cc6e 100644
@@ -8,7 +8,7 @@
 # To use it add testimage to global inherit and call your target image with -c testimage
 # You can try it out like this:
 # - first build a qemu core-image-sato
-# - add INHERIT += "testimage" in local.conf
+# - add IMAGE_CLASSES += "testimage" in local.conf
 # - then bitbake core-image-sato -c testimage. That will run a standard suite of tests.
 
 # You can set (or append to) TEST_SUITES in local.conf to select the tests
Signature · 1 line
2.9.0