summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorMartin Jansa <Martin.Jansa@gmail.com>2023-03-13 15:20:31 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-03-22 13:53:29 +0000
commit7eef95d723a14d9394afee282bab1eed4f83c778 (patch)
tree60b0e6b8bc6d531c844d3909e97289086bc42ad8 /meta
parent248f6f01cf385bd8b3dc09a8dd1c39c5e0cc0f84 (diff)
downloadpoky-7eef95d723a14d9394afee282bab1eed4f83c778.tar.gz
oeqa: loader.py: show warning when skipping selected module and abort if all are skipped
* skipped modules were triggering an ERROR before: poky $ oe-selftest -v -r eSDK.oeSDKExtSelfTest.test_install_libraries_headers imagefeatures.ImageFeatures.test_image_gen_debugfs -K -B /OE/build/poky/build-eSDK 2023-03-13 15:07:53,430 - oe-selftest - ERROR - Not found eSDK.oeSDKExtSelfTest.test_install_libraries_headers in loaded test cases * but didn't show the reason why it wasn't loaded and more importantly -r was ignored when all selected modules were silently skipped * add a warning when skipping some module and abort if some modules were selected, but all ended being skipped: poky $ oe-selftest -v -r eSDK.oeSDKExtSelfTest.test_install_libraries_headers -K -B /OE/build/poky/build-eSDK 2023-03-13 15:11:51,028 - oe-selftest - WARNING - module 'eSDK.oeSDKExtSelfTest.test_install_libraries_headers' was skipped from selected modules, because it doesn't match with module name assumptions: package and module names do not contain upper case characters, whereas class names do 2023-03-13 15:11:51,028 - oe-selftest - ERROR - All selected modules were skipped, this would trigger selftest with all tests and -r ignored. * I was hit by this in oe-selftest -r eSDK.oeSDKExtSelfTest.test_install_libraries_headers which is skipped due to upper case characters in module name and selftest started to run all tests (archiver.Archiver.test_archiver_allows_to_filter_on_recipe_name as first from 529) poky $ oe-selftest -v -r eSDK.oeSDKExtSelfTest.test_install_libraries_headers -K -B /OE/build/poky/build-eSDK 2023-03-13 14:00:52,955 - oe-selftest - DEBUG - Selected tests with -r: ['eSDK.oeSDKExtSelfTest.test_install_libraries_headers'] 2023-03-13 14:00:55,531 - oe-selftest - INFO - Changing cwd to /OE/build/poky/build .. 2023-03-13 14:00:58,128 - oe-selftest - INFO - test_archiver_allows_to_filter_on_recipe_name (archiver.Archiver.test_archiver_allows_to_filter_on_recipe_name) I'll rename eSDK to esdk in next commit to avoid this. * also fix small typo in context I've noticed when debugging this (From OE-Core rev: 15229c9abaf4cc398c31d97d171b9fac57141873) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/core/context.py2
-rw-r--r--meta/lib/oeqa/core/loader.py9
2 files changed, 8 insertions, 3 deletions
diff --git a/meta/lib/oeqa/core/context.py b/meta/lib/oeqa/core/context.py
index 2abe353d27..9313271f58 100644
--- a/meta/lib/oeqa/core/context.py
+++ b/meta/lib/oeqa/core/context.py
@@ -81,7 +81,7 @@ class OETestContext(object):
81 def runTests(self, processes=None, skips=[]): 81 def runTests(self, processes=None, skips=[]):
82 self.runner = self.runnerClass(self, descriptions=False, verbosity=2) 82 self.runner = self.runnerClass(self, descriptions=False, verbosity=2)
83 83
84 # Dinamically skip those tests specified though arguments 84 # Dynamically skip those tests specified though arguments
85 self.skipTests(skips) 85 self.skipTests(skips)
86 86
87 self._run_start_time = time.time() 87 self._run_start_time = time.time()
diff --git a/meta/lib/oeqa/core/loader.py b/meta/lib/oeqa/core/loader.py
index 11978213b8..f25b5970e9 100644
--- a/meta/lib/oeqa/core/loader.py
+++ b/meta/lib/oeqa/core/loader.py
@@ -37,7 +37,7 @@ def _find_duplicated_modules(suite, directory):
37 if path: 37 if path:
38 raise ImportError("Duplicated %s module found in %s" % (module, path)) 38 raise ImportError("Duplicated %s module found in %s" % (module, path))
39 39
40def _built_modules_dict(modules): 40def _built_modules_dict(modules, logger):
41 modules_dict = {} 41 modules_dict = {}
42 42
43 if modules == None: 43 if modules == None:
@@ -48,6 +48,9 @@ def _built_modules_dict(modules):
48 # characters, whereas class names do 48 # characters, whereas class names do
49 m = re.match(r'^([0-9a-z_.]+)(?:\.(\w[^.]*)(?:\.([^.]+))?)?$', module, flags=re.ASCII) 49 m = re.match(r'^([0-9a-z_.]+)(?:\.(\w[^.]*)(?:\.([^.]+))?)?$', module, flags=re.ASCII)
50 if not m: 50 if not m:
51 logger.warn("module '%s' was skipped from selected modules, "\
52 "because it doesn't match with module name assumptions: "\
53 "package and module names do not contain upper case characters, whereas class names do" % module)
51 continue 54 continue
52 55
53 module_name, class_name, test_name = m.groups() 56 module_name, class_name, test_name = m.groups()
@@ -58,6 +61,8 @@ def _built_modules_dict(modules):
58 modules_dict[module_name][class_name] = [] 61 modules_dict[module_name][class_name] = []
59 if test_name and test_name not in modules_dict[module_name][class_name]: 62 if test_name and test_name not in modules_dict[module_name][class_name]:
60 modules_dict[module_name][class_name].append(test_name) 63 modules_dict[module_name][class_name].append(test_name)
64 if modules and not modules_dict:
65 raise OEQATestNotFound("All selected modules were skipped, this would trigger selftest with all tests and -r ignored.")
61 66
62 return modules_dict 67 return modules_dict
63 68
@@ -71,7 +76,7 @@ class OETestLoader(unittest.TestLoader):
71 *args, **kwargs): 76 *args, **kwargs):
72 self.tc = tc 77 self.tc = tc
73 78
74 self.modules = _built_modules_dict(modules) 79 self.modules = _built_modules_dict(modules, tc.logger)
75 80
76 self.tests = tests 81 self.tests = tests
77 self.modules_required = modules_required 82 self.modules_required = modules_required