[gnome-continuous-yocto/gnomeostree-3.28-rocko: 1702/8267] oetest.py: Add command line parameter support for tag in testexport



commit 84d854c98bd201f3e92e440c1d9a64ba4f31e6da
Author: Mariano Lopez <mariano lopez linux intel com>
Date:   Mon Jul 4 12:23:16 2016 +0000

    oetest.py: Add command line parameter support for tag in testexport
    
    This allows to use a command line argument to change the
    tag used to filter test instead of rebuilding the tests.
    
    [YOCTO #8532]
    
    (From OE-Core rev: 928e0eecdb126f7d0bacd05b7057fc825e0d8f05)
    
    Signed-off-by: Mariano Lopez <mariano lopez linux intel com>
    Signed-off-by: Ross Burton <ross burton intel com>
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 meta/lib/oeqa/oetest.py      |   16 +++++++++++++---
 meta/lib/oeqa/runexported.py |    6 +++++-
 2 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/meta/lib/oeqa/oetest.py b/meta/lib/oeqa/oetest.py
index e63ca56..9132a19 100644
--- a/meta/lib/oeqa/oetest.py
+++ b/meta/lib/oeqa/oetest.py
@@ -397,8 +397,6 @@ class RuntimeTestContext(TestContext):
     def __init__(self, d, target, exported=False):
         super(RuntimeTestContext, self).__init__(d, exported)
 
-        self.tagexp =  d.getVar("TEST_SUITES_TAGS", True)
-
         self.target = target
 
         self.pkgmanifest = {}
@@ -598,6 +596,8 @@ class ImageTestContext(RuntimeTestContext):
     def __init__(self, d, target, host_dumper):
         super(ImageTestContext, self).__init__(d, target)
 
+        self.tagexp = d.getVar("TEST_SUITES_TAGS", True)
+
         self.host_dumper = host_dumper
 
         self.sigterm = False
@@ -618,8 +618,18 @@ class ImageTestContext(RuntimeTestContext):
         super(ImageTestContext, self).install_uninstall_packages(test_id, pkg_dir, install)
 
 class ExportTestContext(RuntimeTestContext):
-    def __init__(self, d, target, exported=False):
+    def __init__(self, d, target, exported=False, parsedArgs={}):
+        """
+        This class is used when exporting tests and when are executed outside OE environment.
+
+        parsedArgs can contain the following:
+            - tag:      Filter test by tag.
+        """
         super(ExportTestContext, self).__init__(d, target, exported)
+
+        tag = parsedArgs.get("tag", None)
+        self.tagexp = tag if tag != None else d.getVar("TEST_SUITES_TAGS", True)
+
         self.sigterm = None
 
     def install_uninstall_packages(self, test_id, install=True):
diff --git a/meta/lib/oeqa/runexported.py b/meta/lib/oeqa/runexported.py
index 125e86d..7e245c4 100755
--- a/meta/lib/oeqa/runexported.py
+++ b/meta/lib/oeqa/runexported.py
@@ -81,6 +81,7 @@ def main():
             specified in the json if that directory actually exists or it will error out.")
     parser.add_argument("-l", "--log-dir", dest="log_dir", help="This sets the path for TEST_LOG_DIR. If not 
specified \
             the current dir is used. This is used for usually creating a ssh log file and a scp test file.")
+    parser.add_argument("-a", "--tag", dest="tag", help="Only run test with specified tag.")
     parser.add_argument("json", help="The json file exported by the build system", default="testdata.json", 
nargs='?')
 
     args = parser.parse_args()
@@ -107,6 +108,9 @@ def main():
         if not os.path.isdir(d["DEPLOY_DIR"]):
             print("WARNING: The path to DEPLOY_DIR does not exist: %s" % d["DEPLOY_DIR"])
 
+    parsedArgs = {}
+    parsedArgs["tag"] = args.tag
+
     extract_sdk(d)
 
     target = FakeTarget(d)
@@ -114,7 +118,7 @@ def main():
         setattr(target, key, loaded["target"][key])
 
     target.exportStart()
-    tc = ExportTestContext(d, target, True)
+    tc = ExportTestContext(d, target, True, parsedArgs)
     tc.loadTests()
     tc.runTests()
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]