summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/testexport.bbclass1
-rw-r--r--meta/classes/testimage.bbclass5
-rw-r--r--meta/lib/oeqa/runtime/context.py18
-rw-r--r--meta/lib/oeqa/utils/dump.py11
4 files changed, 22 insertions, 13 deletions
diff --git a/meta/classes/testexport.bbclass b/meta/classes/testexport.bbclass
index 00cf24e735..5398b3c767 100644
--- a/meta/classes/testexport.bbclass
+++ b/meta/classes/testexport.bbclass
@@ -163,7 +163,6 @@ def exportTests(d,tc):
163def testexport_main(d): 163def testexport_main(d):
164 from oeqa.oetest import ExportTestContext 164 from oeqa.oetest import ExportTestContext
165 from oeqa.targetcontrol import get_target_controller 165 from oeqa.targetcontrol import get_target_controller
166 from oeqa.utils.dump import get_host_dumper
167 166
168 test_create_extract_dirs(d) 167 test_create_extract_dirs(d)
169 export_dir = d.getVar("TEST_EXPORT_DIR") 168 export_dir = d.getVar("TEST_EXPORT_DIR")
diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass
index 6fed408613..62ecaef502 100644
--- a/meta/classes/testimage.bbclass
+++ b/meta/classes/testimage.bbclass
@@ -128,8 +128,8 @@ def testimage_main(d):
128 import signal 128 import signal
129 from oeqa.oetest import ImageTestContext 129 from oeqa.oetest import ImageTestContext
130 from oeqa.targetcontrol import get_target_controller 130 from oeqa.targetcontrol import get_target_controller
131 from oeqa.utils.dump import get_host_dumper
132 from bb.utils import export_proxies 131 from bb.utils import export_proxies
132 from oeqa.utils.dump import HostDumper
133 133
134 pn = d.getVar("PN") 134 pn = d.getVar("PN")
135 bb.utils.mkdirhier(d.getVar("TEST_LOG_DIR")) 135 bb.utils.mkdirhier(d.getVar("TEST_LOG_DIR"))
@@ -139,7 +139,8 @@ def testimage_main(d):
139 export_proxies(d) 139 export_proxies(d)
140 140
141 # we need the host dumper in test context 141 # we need the host dumper in test context
142 host_dumper = get_host_dumper(d) 142 host_dumper = HostDumper(d.getVar("testimage_dump_host", True),
143 d.getVar("TESTIMAGE_DUMP_DIR", True))
143 144
144 # the robot dance 145 # the robot dance
145 target = get_target_controller(d) 146 target = get_target_controller(d)
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: