diff options
author | Chen Qi <Qi.Chen@windriver.com> | 2018-06-01 13:02:58 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-06-04 15:15:00 +0100 |
commit | 79b6e96682fdd929fc2a154618b5363f626ec108 (patch) | |
tree | cfc210d111c6a21c9819f3069a5d5861a11b42c1 /meta/lib | |
parent | 5d9d5b869d506aaa6c908146569dc6603163225b (diff) | |
download | poky-79b6e96682fdd929fc2a154618b5363f626ec108.tar.gz |
oeqa/core/loader.py: support the 'auto' keyword
In previous OEQA, having 'auto' in TEST_SUITES results in executing
as many test cases as possible.
This behaviour is broken for now. From the codes in core/loader.py,
I can see that it tries to use another keyword 'all'. But in fact,
it does not work.
I've checked the current manual. The manual says using 'auto'.
Below is the current information in manual.
"""
Alternatively, you can provide the "auto" option to have all applicable
tests run against the image.
TEST_SUITES_append = " auto"
"""
So we should restore this behaviour. This patch does so.
Also, output warning message is some module is named as 'auto', as this
is a reserved keyword.
(From OE-Core rev: a65460a063a958cc887c756db5f7ab18e3f5a8c1)
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/loader.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/meta/lib/oeqa/core/loader.py b/meta/lib/oeqa/core/loader.py index a4744dee03..98fc0f696a 100644 --- a/meta/lib/oeqa/core/loader.py +++ b/meta/lib/oeqa/core/loader.py | |||
@@ -155,7 +155,16 @@ class OETestLoader(unittest.TestLoader): | |||
155 | class_name = case.__class__.__name__ | 155 | class_name = case.__class__.__name__ |
156 | test_name = case._testMethodName | 156 | test_name = case._testMethodName |
157 | 157 | ||
158 | if self.modules: | 158 | # 'auto' is a reserved key word to run test cases automatically |
159 | # warn users if their test case belong to a module named 'auto' | ||
160 | if module_name_small == "auto": | ||
161 | bb.warn("'auto' is a reserved key word for TEST_SUITES. " | ||
162 | "But test case '%s' is detected to belong to auto module. " | ||
163 | "Please condier using a new name for your module." % str(case)) | ||
164 | |||
165 | # check if case belongs to any specified module | ||
166 | # if 'auto' is specified, such check is skipped | ||
167 | if self.modules and not 'auto' in self.modules: | ||
159 | module = None | 168 | module = None |
160 | try: | 169 | try: |
161 | module = self.modules[module_name_small] | 170 | module = self.modules[module_name_small] |
@@ -245,7 +254,7 @@ class OETestLoader(unittest.TestLoader): | |||
245 | for tcName in testCaseNames: | 254 | for tcName in testCaseNames: |
246 | case = self._getTestCase(testCaseClass, tcName) | 255 | case = self._getTestCase(testCaseClass, tcName) |
247 | # Filer by case id | 256 | # Filer by case id |
248 | if not (self.tests and not 'all' in self.tests | 257 | if not (self.tests and not 'auto' in self.tests |
249 | and not getCaseID(case) in self.tests): | 258 | and not getCaseID(case) in self.tests): |
250 | self._handleTestCaseDecorators(case) | 259 | self._handleTestCaseDecorators(case) |
251 | 260 | ||
@@ -309,14 +318,14 @@ class OETestLoader(unittest.TestLoader): | |||
309 | module_name = module.__name__ | 318 | module_name = module.__name__ |
310 | 319 | ||
311 | # Normal test modules are loaded if no modules were specified, | 320 | # Normal test modules are loaded if no modules were specified, |
312 | # if module is in the specified module list or if 'all' is in | 321 | # if module is in the specified module list or if 'auto' is in |
313 | # module list. | 322 | # module list. |
314 | # Underscore modules are loaded only if specified in module list. | 323 | # Underscore modules are loaded only if specified in module list. |
315 | load_module = True if not module_name.startswith('_') \ | 324 | load_module = True if not module_name.startswith('_') \ |
316 | and (not self.modules \ | 325 | and (not self.modules \ |
317 | or module_name in self.modules \ | 326 | or module_name in self.modules \ |
318 | or module_name_small in self.modules \ | 327 | or module_name_small in self.modules \ |
319 | or 'all' in self.modules) \ | 328 | or 'auto' in self.modules) \ |
320 | else False | 329 | else False |
321 | 330 | ||
322 | load_underscore = True if module_name.startswith('_') \ | 331 | load_underscore = True if module_name.startswith('_') \ |