summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorAníbal Limón <anibal.limon@linux.intel.com>2016-12-05 11:43:21 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-23 12:05:20 +0000
commit2d34b085333ff1d23fc00cacd68aaeed3d630571 (patch)
tree42628ee62ac009a7bfb4a21ef379172294f2dd6c /meta/lib
parent1247118870872f2e8fbbff031a4539c6cbe5a917 (diff)
downloadpoky-2d34b085333ff1d23fc00cacd68aaeed3d630571.tar.gz
oeqa/utils/dump: Move get_host_dumper to OERuntimeTestContextExecutor class
To avoid getVar calls inside a utils module, also moves get_host_dumper import inside testexport isn't needed. [YOCTO #10231] (From OE-Core rev: f8beaf94e943a8b20d146be47a756af312ef107c) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/runtime/context.py18
-rw-r--r--meta/lib/oeqa/utils/dump.py11
2 files changed, 19 insertions, 10 deletions
diff --git a/meta/lib/oeqa/runtime/context.py b/meta/lib/oeqa/runtime/context.py
index ec378bb016..ab7caa62c1 100644
--- a/meta/lib/oeqa/runtime/context.py
+++ b/meta/lib/oeqa/runtime/context.py
@@ -5,6 +5,8 @@ import os
5 5
6from oeqa.core.context import OETestContext, OETestContextExecutor 6from oeqa.core.context import OETestContext, OETestContextExecutor
7from oeqa.core.target.ssh import OESSHTarget 7from oeqa.core.target.ssh import OESSHTarget
8from oeqa.utils.dump import HostDumper
9
8from oeqa.runtime.loader import OERuntimeTestLoader 10from oeqa.runtime.loader import OERuntimeTestLoader
9 11
10class OERuntimeTestContext(OETestContext): 12class OERuntimeTestContext(OETestContext):
@@ -12,10 +14,11 @@ class OERuntimeTestContext(OETestContext):
12 runtime_files_dir = os.path.join( 14 runtime_files_dir = os.path.join(
13 os.path.dirname(os.path.abspath(__file__)), "files") 15 os.path.dirname(os.path.abspath(__file__)), "files")
14 16
15 def __init__(self, td, logger, target, image_packages): 17 def __init__(self, td, logger, target, host_dumper, image_packages):
16 super(OERuntimeTestContext, self).__init__(td, logger) 18 super(OERuntimeTestContext, self).__init__(td, logger)
17 self.target = target 19 self.target = target
18 self.image_packages = image_packages 20 self.image_packages = image_packages
21 self.host_dumper = host_dumper
19 self._set_target_cmds() 22 self._set_target_cmds()
20 23
21 def _set_target_cmds(self): 24 def _set_target_cmds(self):
@@ -39,6 +42,7 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
39 default_target_type = 'simpleremote' 42 default_target_type = 'simpleremote'
40 default_server_ip = '192.168.7.1' 43 default_server_ip = '192.168.7.1'
41 default_target_ip = '192.168.7.2' 44 default_target_ip = '192.168.7.2'
45 default_host_dumper_dir = '/tmp/oe-saved-tests'
42 46
43 def register_commands(self, logger, subparsers): 47 def register_commands(self, logger, subparsers):
44 super(OERuntimeTestContextExecutor, self).register_commands(logger, subparsers) 48 super(OERuntimeTestContextExecutor, self).register_commands(logger, subparsers)
@@ -58,6 +62,11 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
58 help="IP address of device under test, default: %s" \ 62 help="IP address of device under test, default: %s" \
59 % self.default_server_ip) 63 % self.default_server_ip)
60 64
65 runtime_group.add_argument('--host-dumper-dir', action='store',
66 default=self.default_host_dumper_dir,
67 help="Directory where host status is dumped, if tests fails, default: %s" \
68 % self.default_host_dumper_dir)
69
61 runtime_group.add_argument('--packages-manifest', action='store', 70 runtime_group.add_argument('--packages-manifest', action='store',
62 help="Package manifest of the image under test") 71 help="Package manifest of the image under test")
63 72
@@ -90,6 +99,10 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
90 99
91 return image_packages 100 return image_packages
92 101
102 @staticmethod
103 def getHostDumper(cmds, directory):
104 return HostDumper(cmds, directory)
105
93 def _process_args(self, logger, args): 106 def _process_args(self, logger, args):
94 if not args.packages_manifest: 107 if not args.packages_manifest:
95 raise TypeError('Manifest file not provided') 108 raise TypeError('Manifest file not provided')
@@ -98,6 +111,9 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
98 111
99 self.tc_kwargs['init']['target'] = \ 112 self.tc_kwargs['init']['target'] = \
100 OERuntimeTestContextExecutor.getTarget(args.target_type) 113 OERuntimeTestContextExecutor.getTarget(args.target_type)
114 self.tc_kwargs['init']['host_dumper'] = \
115 OERuntimeTestContextExecutor.getHostDumper(None,
116 args.host_dumper_dir)
101 self.tc_kwargs['init']['image_packages'] = \ 117 self.tc_kwargs['init']['image_packages'] = \
102 OERuntimeTestContextExecutor.readPackagesManifest( 118 OERuntimeTestContextExecutor.readPackagesManifest(
103 args.packages_manifest) 119 args.packages_manifest)
diff --git a/meta/lib/oeqa/utils/dump.py b/meta/lib/oeqa/utils/dump.py
index 44037a989d..5a7edc1a86 100644
--- a/meta/lib/oeqa/utils/dump.py
+++ b/meta/lib/oeqa/utils/dump.py
@@ -5,12 +5,6 @@ import datetime
5import itertools 5import itertools
6from .commands import runCmd 6from .commands import runCmd
7 7
8def get_host_dumper(d):
9 cmds = d.getVar("testimage_dump_host")
10 parent_dir = d.getVar("TESTIMAGE_DUMP_DIR")
11 return HostDumper(cmds, parent_dir)
12
13
14class BaseDumper(object): 8class BaseDumper(object):
15 """ Base class to dump commands from host/target """ 9 """ Base class to dump commands from host/target """
16 10
@@ -77,13 +71,12 @@ class HostDumper(BaseDumper):
77 result = runCmd(cmd, ignore_status=True) 71 result = runCmd(cmd, ignore_status=True)
78 self._write_dump(cmd.split()[0], result.output) 72 self._write_dump(cmd.split()[0], result.output)
79 73
80
81class TargetDumper(BaseDumper): 74class TargetDumper(BaseDumper):
82 """ Class to get dumps from target, it only works with QemuRunner """ 75 """ Class to get dumps from target, it only works with QemuRunner """
83 76
84 def __init__(self, cmds, parent_dir, qemurunner): 77 def __init__(self, cmds, parent_dir, runner):
85 super(TargetDumper, self).__init__(cmds, parent_dir) 78 super(TargetDumper, self).__init__(cmds, parent_dir)
86 self.runner = qemurunner 79 self.runner = runner
87 80
88 def dump_target(self, dump_dir=""): 81 def dump_target(self, dump_dir=""):
89 if dump_dir: 82 if dump_dir: