oetest.py: Add command line parameter support for tag in testexport
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 oetest.py: Add command line parameter support for tag in testexport
From: Mariano Lopez <[email protected]>
This allows to use a command line argument to change the tag used to filter test instead of rebuilding the tests.
[YOCTO #8532]
--- meta/lib/oeqa/oetest.py | 10 +++++++--- meta/lib/oeqa/runexported.py | 6 +++++- 2 files changed, 12 insertions(+), 4 deletions(-)
meta/lib/oeqa/oetest.py +7 -3
@@ -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 = {}
@@ -592,6 +590,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
@@ -612,8 +612,12 @@ 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, *args, **kwargs): super(ExportTestContext, self).__init__(d, target, exported) + + tag = kwargs.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):
meta/lib/oeqa/runexported.py +5 -1
@@ -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"]) + kwargs = {} + kwargs["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, **kwargs) tc.loadTests() tc.runTests()
Signature · 1 line
2.6.6
Hello Mariano, comments below
Quoted 9 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of [email protected]
Sent: Monday, July 4, 2016 12:28 AM
To: [email protected]
Subject: [OE-core] [PATCH 1/1]oetest.py: Add command line parameter support for tag in testexport
Quoted 3 lines
From: Mariano Lopez <[email protected]>
This allows to use a command line argument to change the tag used to
filter
Quoted 33 lines
test instead of rebuilding the tests.
[YOCTO #8532]
Signed-off-by Mariano Lopez <[email protected]>--- meta/lib/oeqa/oetest.py | 10 +++++++--- meta/lib/oeqa/runexported.py | 6 +++++- 2 files changed, 12 insertions(+), 4 deletions(-)meta/lib/oeqa/oetest.py index renamed from meta/lib/oeqa/oetest.py +0
-04a740fb..339f34d 100644
meta/lib/oeqa/oetest.py +2
-2@@ -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 = {}@@ -592,6 +590,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
meta/lib/oeqa/oetest.py class ImageTestContext(RuntimeTestContext): · line 616
Quoted 6 lines
meta/lib/oeqa/oetest.py +1
-1@@ -612,8 +612,12 @@ 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, *args, **kwargs):
Is the use of kwargs necessary? If not, it would be preferable to have a Named var here instead. Kwargs breaks readability.
Quoted 14 lines
meta/lib/oeqa/oetest.py +5
-0super(ExportTestContext, self).__init__(d, target, exported) + + tag = kwargs.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):meta/lib/oeqa/runexported.py +0
-0
meta/lib/oeqa/runexported.py def main(): · line 81
Quoted 1 line
meta/lib/oeqa/runexported.py +0
-0@@ -81,6 +81,7 @@ def main(): specified in the json if that directory actually exists or it
will error out.")
meta/lib/oeqa/runexported.py def main(): · line 82
Quoted 1 line
meta/lib/oeqa/runexported.py +0
-0parser.add_argument("-l", "--log-dir", dest="log_dir", help="This
sets the
meta/lib/oeqa/runexported.py def main(): · line 84
Quoted 2 lines
meta/lib/oeqa/runexported.py +0
-0path for TEST_LOG_DIR. If not specified \ the current dir is used. This is used for usually creating a
ssh log file and
meta/lib/oeqa/runexported.py def main(): · line 87
Quoted 3 lines
meta/lib/oeqa/runexported.py +2
-0a scp test file.") + parser.add_argument("-a", "--tag", dest="tag", help="Only run test + with specified tag.")
dest="tag_flag" or "tag_arg" is semantically better.
Quoted 16 lines
parser.add_argument("json", help="The json file exported by the build
system", default="testdata.json", nargs='?')args =
parser.parse_args()meta/lib/oeqa/runexported.py +3
-0@@ -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"]) + kwargs = {} + kwargs["tag"] = args.tag + extract_sdk(d)target = FakeTarget(d)
meta/lib/oeqa/runexported.py def main(): · line 121
Quoted 5 lines
meta/lib/oeqa/runexported.py +1
-1@@ -114,7 +118,7 @@ def main(): setattr(target, key, loaded["target"][key]) target.exportStart() - tc = ExportTestContext(d, target, True) + tc = ExportTestContext(d, target, True, **kwargs)
If you don't want to mess with the inputs of this function by using kwargs then you
Can consider passing an object that includes the variables you want. I'd only suggest
it if this function signature will grow.
Quoted 11 lines
meta/lib/oeqa/runexported.py +0
-1tc.loadTests() tc.runTests() --2.6.6
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Quoted 7 lines · Benjamin Esquivel
Hello Mariano, comments below
meta/lib/oeqa/oetest.py class ImageTestContext(RuntimeTestContext): · line 615
Quoted 3 lines
class ExportTestContext(RuntimeTestContext):
meta/lib/oeqa/oetest.py +1
-1- def __init__(self, d, target, exported=False): + def __init__(self, d, target, exported=False, *args, **kwargs):Is the use of kwargs necessary? If not, it would be preferable to have a Named var here instead. Kwargs breaks readability.
Is not really necessary at this point. The idea here was to be easier to extend the class in child classes, but I see your point with the kwargs being to generic.
Quoted 7 lines
meta/lib/oeqa/runexported.py def main(): · line 121
Quoted 3 lines
target.exportStart()meta/lib/oeqa/runexported.py +1
-1- tc = ExportTestContext(d, target, True) + tc = ExportTestContext(d, target, True, **kwargs)If you don't want to mess with the inputs of this function by using kwargs then you can consider passing an object that includes the variables you want. I'd only suggest it if this function signature will grow.
Right now, it just require a single variable that is an argument from the cli, so I will use a dict for that purpose, per our discussion.
Signature · 1 line
Mariano Lopez