[oe-commits] [openembedded-core] 20/68: oeqa/core/loader.py: support the 'auto' keyword

git at git.openembedded.org git at git.openembedded.org
Mon Jul 2 10:46:42 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch sumo
in repository openembedded-core.

commit 8c247f5141f15160d670b49d9963f4143faedff5
Author: Chen Qi <Qi.Chen at windriver.com>
AuthorDate: Fri Jun 1 13:02:58 2018 +0800

    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 at windriver.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
    Signed-off-by: Armin Kuster <akuster808 at gmail.com>
---
 meta/lib/oeqa/core/loader.py | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/meta/lib/oeqa/core/loader.py b/meta/lib/oeqa/core/loader.py
index a4744de..98fc0f6 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('_') \

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list