From 79b6e96682fdd929fc2a154618b5363f626ec108 Mon Sep 17 00:00:00 2001 From: Chen Qi Date: Fri, 1 Jun 2018 13:02:58 +0800 Subject: 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 Signed-off-by: Richard Purdie --- meta/lib/oeqa/core/loader.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'meta/lib/oeqa/core') 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): class_name = case.__class__.__name__ test_name = case._testMethodName - if self.modules: + # 'auto' is a reserved key word to run test cases automatically + # warn users if their test case belong to a module named 'auto' + if module_name_small == "auto": + bb.warn("'auto' is a reserved key word for TEST_SUITES. " + "But test case '%s' is detected to belong to auto module. " + "Please condier using a new name for your module." % str(case)) + + # check if case belongs to any specified module + # if 'auto' is specified, such check is skipped + if self.modules and not 'auto' in self.modules: module = None try: module = self.modules[module_name_small] @@ -245,7 +254,7 @@ class OETestLoader(unittest.TestLoader): for tcName in testCaseNames: case = self._getTestCase(testCaseClass, tcName) # Filer by case id - if not (self.tests and not 'all' in self.tests + if not (self.tests and not 'auto' in self.tests and not getCaseID(case) in self.tests): self._handleTestCaseDecorators(case) @@ -309,14 +318,14 @@ class OETestLoader(unittest.TestLoader): module_name = module.__name__ # Normal test modules are loaded if no modules were specified, - # if module is in the specified module list or if 'all' is in + # if module is in the specified module list or if 'auto' is in # module list. # Underscore modules are loaded only if specified in module list. load_module = True if not module_name.startswith('_') \ and (not self.modules \ or module_name in self.modules \ or module_name_small in self.modules \ - or 'all' in self.modules) \ + or 'auto' in self.modules) \ else False load_underscore = True if module_name.startswith('_') \ -- cgit v1.2.3-54-g00ecf