]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/runtime/context.py: Add defaults for runtime context
authorMariano Lopez <mariano.lopez@linux.intel.com>
Wed, 18 Jan 2017 13:19:52 +0000 (13:19 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 23 Jan 2017 12:03:57 +0000 (12:03 +0000)
This adds default values to OERuntimeTestContextExecutor class in
order to make easier the execution of exported test that were
generated with testexport class.

[YOCTO #10686]

Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
meta/lib/oeqa/runtime/context.py

index 10b8b5480912cd55daa1cf68b9edb1215f23d674..e5e0141c2a492effb914980a3fc8d46301113229 100644 (file)
@@ -42,12 +42,15 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
     default_cases = os.path.join(os.path.abspath(os.path.dirname(__file__)),
             'cases')
     default_data = None
+    default_test_data = 'data/testdata.json'
+    default_tests = ''
 
     default_target_type = 'simpleremote'
+    default_manifest = 'data/manifest'
     default_server_ip = '192.168.7.1'
     default_target_ip = '192.168.7.2'
     default_host_dumper_dir = '/tmp/oe-saved-tests'
-    default_extract_dir = 'extract_dir'
+    default_extract_dir = 'packages/extracted'
 
     def register_commands(self, logger, subparsers):
         super(OERuntimeTestContextExecutor, self).register_commands(logger, subparsers)
@@ -73,10 +76,14 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
                 % self.default_host_dumper_dir)
 
         runtime_group.add_argument('--packages-manifest', action='store',
-                help="Package manifest of the image under test")
+                default=self.default_manifest,
+                help="Package manifest of the image under testi, default: %s" \
+                % self.default_manifest)
 
         runtime_group.add_argument('--extract-dir', action='store',
-                help='Directory where extracted packages reside')
+                default=self.default_extract_dir,
+                help='Directory where extracted packages reside, default: %s' \
+                % self.default_extract_dir)
 
         runtime_group.add_argument('--qemu-boot', action='store',
                 help="Qemu boot configuration, only needed when target_type is QEMU.")
@@ -97,7 +104,7 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
 
     @staticmethod
     def readPackagesManifest(manifest):
-        if not os.path.exists(manifest):
+        if not manifest or not os.path.exists(manifest):
             raise OSError("Manifest file not exists: %s" % manifest)
 
         image_packages = set()
@@ -124,16 +131,13 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
 
         self.tc_kwargs['init']['target'] = \
                 OERuntimeTestContextExecutor.getTarget(args.target_type,
-                        args.target_ip, args.server_ip, **target_kwargs)
+                        None, args.target_ip, args.server_ip, **target_kwargs)
         self.tc_kwargs['init']['host_dumper'] = \
                 OERuntimeTestContextExecutor.getHostDumper(None,
                         args.host_dumper_dir)
         self.tc_kwargs['init']['image_packages'] = \
                 OERuntimeTestContextExecutor.readPackagesManifest(
                         args.packages_manifest)
-
-        self.tc_kwargs['init']['extract_dir'] = \
-                OERuntimeTestContextExecutor.readPackagesManifest(
-                        args.extract_dir)
+        self.tc_kwargs['init']['extract_dir'] = args.extract_dir
 
 _executor_class = OERuntimeTestContextExecutor