summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2019-06-21 09:18:03 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-06-21 15:32:36 +0100
commit4a36552ef957fa91df49229911f3543773d9395a (patch)
treea1ffea0fb2115da3a9e3d85fb6ea785699648fb9 /meta/lib
parent44d5ec6d7465595bc1aecb346ed53405ad3a57d7 (diff)
downloadpoky-4a36552ef957fa91df49229911f3543773d9395a.tar.gz
oeqa: avoid class setup method to run when skipping the whole class
For now, even if we have specified to skip the whole module/class via command line, e.g., `oe-selftest -R gotoolchain', the class setup method is still run. This at least results in unnecessary builds, and at worst results in ERROR, if the setup method fails. So improve the skipping mechanism to avoid class setup method to run when specified to skip. (From OE-Core rev: b0b79bf65f5e5e65958090a4a88622b42df896bf) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/core/case.py2
-rw-r--r--meta/lib/oeqa/core/context.py8
2 files changed, 10 insertions, 0 deletions
diff --git a/meta/lib/oeqa/core/case.py b/meta/lib/oeqa/core/case.py
index 54977c809f..aca144e9dc 100644
--- a/meta/lib/oeqa/core/case.py
+++ b/meta/lib/oeqa/core/case.py
@@ -32,6 +32,8 @@ class OETestCase(unittest.TestCase):
32 @classmethod 32 @classmethod
33 def _oeSetUpClass(clss): 33 def _oeSetUpClass(clss):
34 _validate_td_vars(clss.td, clss.td_vars, "class") 34 _validate_td_vars(clss.td, clss.td_vars, "class")
35 if hasattr(clss, 'setUpHooker') and callable(getattr(clss, 'setUpHooker')):
36 clss.setUpHooker()
35 clss.setUpClassMethod() 37 clss.setUpClassMethod()
36 38
37 @classmethod 39 @classmethod
diff --git a/meta/lib/oeqa/core/context.py b/meta/lib/oeqa/core/context.py
index 7882697e28..68819cc338 100644
--- a/meta/lib/oeqa/core/context.py
+++ b/meta/lib/oeqa/core/context.py
@@ -50,10 +50,18 @@ class OETestContext(object):
50 def func(): 50 def func():
51 raise unittest.SkipTest(skipmsg) 51 raise unittest.SkipTest(skipmsg)
52 return func 52 return func
53 class_ids = {}
53 for test in self.suites: 54 for test in self.suites:
55 if test.__class__ not in class_ids:
56 class_ids[test.__class__] = '.'.join(test.id().split('.')[:-1])
54 for skip in skips: 57 for skip in skips:
55 if (test.id()+'.').startswith(skip+'.'): 58 if (test.id()+'.').startswith(skip+'.'):
56 setattr(test, 'setUp', skipfuncgen('Skip by the command line argument "%s"' % skip)) 59 setattr(test, 'setUp', skipfuncgen('Skip by the command line argument "%s"' % skip))
60 for tclass in class_ids:
61 cid = class_ids[tclass]
62 for skip in skips:
63 if (cid + '.').startswith(skip + '.'):
64 setattr(tclass, 'setUpHooker', skipfuncgen('Skip by the command line argument "%s"' % skip))
57 65
58 def loadTests(self, module_paths, modules=[], tests=[], 66 def loadTests(self, module_paths, modules=[], tests=[],
59 modules_manifest="", modules_required=[], filters={}): 67 modules_manifest="", modules_required=[], filters={}):