blob: 4cfec94d85b799d3fba8615d8a1b5af83c146679 [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001#
2# SPDX-License-Identifier: MIT
3#
4
Brad Bishopd7bf8c12018-02-25 22:55:05 -05005from oeqa.selftest.case import OESelftestTestCase
6from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu
7from oeqa.utils.sshcontrol import SSHControl
Brad Bishopd7bf8c12018-02-25 22:55:05 -05008import os
9import re
10import tempfile
11import shutil
Brad Bishop19323692019-04-05 15:28:33 -040012import oe.lsb
Andrew Geissler82c905d2020-04-13 13:39:40 -050013from oeqa.core.decorator.data import skipIfNotQemu
Brad Bishopd7bf8c12018-02-25 22:55:05 -050014
15class TestExport(OESelftestTestCase):
16
Brad Bishopd7bf8c12018-02-25 22:55:05 -050017 def test_testexport_basic(self):
18 """
19 Summary: Check basic testexport functionality with only ping test enabled.
20 Expected: 1. testexport directory must be created.
21 2. runexported.py must run without any error/exception.
22 3. ping test must succeed.
23 Product: oe-core
24 Author: Mariano Lopez <mariano.lopez@intel.com>
25 """
26
27 features = 'INHERIT += "testexport"\n'
28 # These aren't the actual IP addresses but testexport class needs something defined
29 features += 'TEST_SERVER_IP = "192.168.7.1"\n'
30 features += 'TEST_TARGET_IP = "192.168.7.1"\n'
31 features += 'TEST_SUITES = "ping"\n'
32 self.write_config(features)
33
34 # Build tesexport for core-image-minimal
35 bitbake('core-image-minimal')
36 bitbake('-c testexport core-image-minimal')
37
38 testexport_dir = get_bb_var('TEST_EXPORT_DIR', 'core-image-minimal')
39
40 # Verify if TEST_EXPORT_DIR was created
41 isdir = os.path.isdir(testexport_dir)
42 self.assertEqual(True, isdir, 'Failed to create testexport dir: %s' % testexport_dir)
43
44 with runqemu('core-image-minimal') as qemu:
45 # Attempt to run runexported.py to perform ping test
46 test_path = os.path.join(testexport_dir, "oe-test")
47 data_file = os.path.join(testexport_dir, 'data', 'testdata.json')
48 manifest = os.path.join(testexport_dir, 'data', 'manifest')
49 cmd = ("%s runtime --test-data-file %s --packages-manifest %s "
50 "--target-ip %s --server-ip %s --quiet"
51 % (test_path, data_file, manifest, qemu.ip, qemu.server_ip))
52 result = runCmd(cmd)
53 # Verify ping test was succesful
54 self.assertEqual(0, result.status, 'oe-test runtime returned a non 0 status')
55
Brad Bishopd7bf8c12018-02-25 22:55:05 -050056 def test_testexport_sdk(self):
57 """
58 Summary: Check sdk functionality for testexport.
59 Expected: 1. testexport directory must be created.
60 2. SDK tarball must exists.
61 3. Uncompressing of tarball must succeed.
62 4. Check if the SDK directory is added to PATH.
63 5. Run tar from the SDK directory.
64 Product: oe-core
65 Author: Mariano Lopez <mariano.lopez@intel.com>
66 """
67
68 features = 'INHERIT += "testexport"\n'
69 # These aren't the actual IP addresses but testexport class needs something defined
70 features += 'TEST_SERVER_IP = "192.168.7.1"\n'
71 features += 'TEST_TARGET_IP = "192.168.7.1"\n'
72 features += 'TEST_SUITES = "ping"\n'
73 features += 'TEST_EXPORT_SDK_ENABLED = "1"\n'
74 features += 'TEST_EXPORT_SDK_PACKAGES = "nativesdk-tar"\n'
75 self.write_config(features)
76
77 # Build tesexport for core-image-minimal
78 bitbake('core-image-minimal')
79 bitbake('-c testexport core-image-minimal')
80
81 needed_vars = ['TEST_EXPORT_DIR', 'TEST_EXPORT_SDK_DIR', 'TEST_EXPORT_SDK_NAME']
82 bb_vars = get_bb_vars(needed_vars, 'core-image-minimal')
83 testexport_dir = bb_vars['TEST_EXPORT_DIR']
84 sdk_dir = bb_vars['TEST_EXPORT_SDK_DIR']
85 sdk_name = bb_vars['TEST_EXPORT_SDK_NAME']
86
87 # Check for SDK
88 tarball_name = "%s.sh" % sdk_name
89 tarball_path = os.path.join(testexport_dir, sdk_dir, tarball_name)
90 msg = "Couldn't find SDK tarball: %s" % tarball_path
91 self.assertEqual(os.path.isfile(tarball_path), True, msg)
92
Andrew Geissler09036742021-06-25 14:25:14 -050093 with tempfile.TemporaryDirectory() as tmpdirname:
94 # Extract SDK and run tar from SDK
95 result = runCmd("%s -y -d %s" % (tarball_path, tmpdirname))
96 self.assertEqual(0, result.status, "Couldn't extract SDK")
Brad Bishopd7bf8c12018-02-25 22:55:05 -050097
Andrew Geissler09036742021-06-25 14:25:14 -050098 env_script = result.output.split()[-1]
99 result = runCmd(". %s; which tar" % env_script, shell=True)
100 self.assertEqual(0, result.status, "Couldn't setup SDK environment")
101 is_sdk_tar = True if tmpdirname in result.output else False
102 self.assertTrue(is_sdk_tar, "Couldn't setup SDK environment")
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500103
Andrew Geissler09036742021-06-25 14:25:14 -0500104 tar_sdk = result.output
105 result = runCmd("%s --version" % tar_sdk)
106 self.assertEqual(0, result.status, "Couldn't run tar from SDK")
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500107
108
109class TestImage(OESelftestTestCase):
110
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500111 def test_testimage_install(self):
112 """
113 Summary: Check install packages functionality for testimage/testexport.
114 Expected: 1. Import tests from a directory other than meta.
115 2. Check install/uninstall of socat.
116 Product: oe-core
117 Author: Mariano Lopez <mariano.lopez@intel.com>
118 """
119 if get_bb_var('DISTRO') == 'poky-tiny':
120 self.skipTest('core-image-full-cmdline not buildable for poky-tiny')
121
122 features = 'INHERIT += "testimage"\n'
Patrick Williams213cb262021-08-07 19:21:33 -0500123 features += 'IMAGE_INSTALL:append = " libssl"\n'
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500124 features += 'TEST_SUITES = "ping ssh selftest"\n'
125 self.write_config(features)
126
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500127 bitbake('core-image-full-cmdline socat')
128 bitbake('-c testimage core-image-full-cmdline')
129
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500130 def test_testimage_dnf(self):
131 """
132 Summary: Check package feeds functionality for dnf
133 Expected: 1. Check that remote package feeds can be accessed
134 Product: oe-core
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800135 Author: Alexander Kanavin <alex.kanavin@gmail.com>
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500136 """
137 if get_bb_var('DISTRO') == 'poky-tiny':
138 self.skipTest('core-image-full-cmdline not buildable for poky-tiny')
139
140 features = 'INHERIT += "testimage"\n'
141 features += 'TEST_SUITES = "ping ssh dnf_runtime dnf.DnfBasicTest.test_dnf_help"\n'
142 # We don't yet know what the server ip and port will be - they will be patched
143 # in at the start of the on-image test
144 features += 'PACKAGE_FEED_URIS = "http://bogus_ip:bogus_port"\n'
145 features += 'EXTRA_IMAGE_FEATURES += "package-management"\n'
146 features += 'PACKAGE_CLASSES = "package_rpm"\n'
147
Brad Bishop6f8dcde2018-10-16 10:47:12 +0800148 bitbake('gnupg-native -c addto_recipe_sysroot')
149
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500150 # Enable package feed signing
151 self.gpg_home = tempfile.mkdtemp(prefix="oeqa-feed-sign-")
Brad Bishop96ff1982019-08-19 13:50:42 -0400152 self.track_for_cleanup(self.gpg_home)
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500153 signing_key_dir = os.path.join(self.testlayer_path, 'files', 'signing')
Andrew Geisslerc9f78652020-09-18 14:11:35 -0500154 runCmd('gpgconf --list-dirs --homedir %s; gpg -v --batch --homedir %s --import %s' % (self.gpg_home, self.gpg_home, os.path.join(signing_key_dir, 'key.secret')), native_sysroot=get_bb_var("RECIPE_SYSROOT_NATIVE", "gnupg-native"), shell=True)
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500155 features += 'INHERIT += "sign_package_feed"\n'
156 features += 'PACKAGE_FEED_GPG_NAME = "testuser"\n'
157 features += 'PACKAGE_FEED_GPG_PASSPHRASE_FILE = "%s"\n' % os.path.join(signing_key_dir, 'key.passphrase')
158 features += 'GPG_PATH = "%s"\n' % self.gpg_home
Andrew Geisslerf0343792020-11-18 10:42:21 -0600159 features += 'PSEUDO_IGNORE_PATHS .= ",%s"\n' % self.gpg_home
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500160 self.write_config(features)
161
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500162 bitbake('core-image-full-cmdline socat')
163 bitbake('-c testimage core-image-full-cmdline')
164
Andrew Geissler82c905d2020-04-13 13:39:40 -0500165 def test_testimage_virgl_gtk_sdl(self):
Brad Bishop19323692019-04-05 15:28:33 -0400166 """
Andrew Geissler82c905d2020-04-13 13:39:40 -0500167 Summary: Check host-assisted accelerate OpenGL functionality in qemu with gtk and SDL frontends
Brad Bishop19323692019-04-05 15:28:33 -0400168 Expected: 1. Check that virgl kernel driver is loaded and 3d acceleration is enabled
169 2. Check that kmscube demo runs without crashing.
170 Product: oe-core
171 Author: Alexander Kanavin <alex.kanavin@gmail.com>
172 """
173 if "DISPLAY" not in os.environ:
174 self.skipTest("virgl gtk test must be run inside a X session")
175 distro = oe.lsb.distro_identifier()
176 if distro and distro == 'debian-8':
177 self.skipTest('virgl isn\'t working with Debian 8')
Andrew Geisslerc182c622020-05-15 14:13:32 -0500178 if distro and distro == 'debian-9':
179 self.skipTest('virgl isn\'t working with Debian 9')
Brad Bishop64c979e2019-11-04 13:55:29 -0500180 if distro and distro == 'centos-7':
181 self.skipTest('virgl isn\'t working with Centos 7')
Andrew Geissler82c905d2020-04-13 13:39:40 -0500182 if distro and distro == 'opensuseleap-15.0':
183 self.skipTest('virgl isn\'t working with Opensuse 15.0')
Brad Bishop19323692019-04-05 15:28:33 -0400184
185 qemu_packageconfig = get_bb_var('PACKAGECONFIG', 'qemu-system-native')
Andrew Geissler1e34c2d2020-05-29 16:02:59 -0500186 qemu_distrofeatures = get_bb_var('DISTRO_FEATURES', 'qemu-system-native')
Brad Bishop19323692019-04-05 15:28:33 -0400187 features = 'INHERIT += "testimage"\n'
188 if 'gtk+' not in qemu_packageconfig:
Patrick Williams213cb262021-08-07 19:21:33 -0500189 features += 'PACKAGECONFIG:append:pn-qemu-system-native = " gtk+"\n'
Andrew Geissler82c905d2020-04-13 13:39:40 -0500190 if 'sdl' not in qemu_packageconfig:
Patrick Williams213cb262021-08-07 19:21:33 -0500191 features += 'PACKAGECONFIG:append:pn-qemu-system-native = " sdl"\n'
Andrew Geissler1e34c2d2020-05-29 16:02:59 -0500192 if 'opengl' not in qemu_distrofeatures:
Patrick Williams213cb262021-08-07 19:21:33 -0500193 features += 'DISTRO_FEATURES:append = " opengl"\n'
Brad Bishop19323692019-04-05 15:28:33 -0400194 features += 'TEST_SUITES = "ping ssh virgl"\n'
Patrick Williams213cb262021-08-07 19:21:33 -0500195 features += 'IMAGE_FEATURES:append = " ssh-server-dropbear"\n'
196 features += 'IMAGE_INSTALL:append = " kmscube"\n'
Andrew Geissler82c905d2020-04-13 13:39:40 -0500197 features_gtk = features + 'TEST_RUNQEMUPARAMS = "gtk gl"\n'
198 self.write_config(features_gtk)
199 bitbake('core-image-minimal')
200 bitbake('-c testimage core-image-minimal')
201 features_sdl = features + 'TEST_RUNQEMUPARAMS = "sdl gl"\n'
202 self.write_config(features_sdl)
Brad Bishop19323692019-04-05 15:28:33 -0400203 bitbake('core-image-minimal')
204 bitbake('-c testimage core-image-minimal')
205
Brad Bishop19323692019-04-05 15:28:33 -0400206 def test_testimage_virgl_headless(self):
207 """
208 Summary: Check host-assisted accelerate OpenGL functionality in qemu with egl-headless frontend
209 Expected: 1. Check that virgl kernel driver is loaded and 3d acceleration is enabled
210 2. Check that kmscube demo runs without crashing.
211 Product: oe-core
212 Author: Alexander Kanavin <alex.kanavin@gmail.com>
213 """
214 import subprocess, os
215 try:
216 content = os.listdir("/dev/dri")
217 if len([i for i in content if i.startswith('render')]) == 0:
218 self.skipTest("No render nodes found in /dev/dri: %s" %(content))
219 except FileNotFoundError:
220 self.skipTest("/dev/dri directory does not exist; no render nodes available on this machine.")
221 try:
222 dripath = subprocess.check_output("pkg-config --variable=dridriverdir dri", shell=True)
223 except subprocess.CalledProcessError as e:
224 self.skipTest("Could not determine the path to dri drivers on the host via pkg-config.\nPlease install Mesa development files (particularly, dri.pc) on the host machine.")
Andrew Geissler1e34c2d2020-05-29 16:02:59 -0500225 qemu_distrofeatures = get_bb_var('DISTRO_FEATURES', 'qemu-system-native')
Brad Bishop19323692019-04-05 15:28:33 -0400226 features = 'INHERIT += "testimage"\n'
Andrew Geissler1e34c2d2020-05-29 16:02:59 -0500227 if 'opengl' not in qemu_distrofeatures:
Patrick Williams213cb262021-08-07 19:21:33 -0500228 features += 'DISTRO_FEATURES:append = " opengl"\n'
Brad Bishop19323692019-04-05 15:28:33 -0400229 features += 'TEST_SUITES = "ping ssh virgl"\n'
Patrick Williams213cb262021-08-07 19:21:33 -0500230 features += 'IMAGE_FEATURES:append = " ssh-server-dropbear"\n'
231 features += 'IMAGE_INSTALL:append = " kmscube"\n'
Brad Bishop19323692019-04-05 15:28:33 -0400232 features += 'TEST_RUNQEMUPARAMS = "egl-headless"\n'
233 self.write_config(features)
234 bitbake('core-image-minimal')
235 bitbake('-c testimage core-image-minimal')
236
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500237class Postinst(OESelftestTestCase):
Andrew Geissler82c905d2020-04-13 13:39:40 -0500238
239 def init_manager_loop(self, init_manager):
240 import oe.path
241
242 vars = get_bb_vars(("IMAGE_ROOTFS", "sysconfdir"), "core-image-minimal")
243 rootfs = vars["IMAGE_ROOTFS"]
244 self.assertIsNotNone(rootfs)
245 sysconfdir = vars["sysconfdir"]
246 self.assertIsNotNone(sysconfdir)
247 # Need to use oe.path here as sysconfdir starts with /
248 hosttestdir = oe.path.join(rootfs, sysconfdir, "postinst-test")
249 targettestdir = os.path.join(sysconfdir, "postinst-test")
250
251 for classes in ("package_rpm", "package_deb", "package_ipk"):
252 with self.subTest(init_manager=init_manager, package_class=classes):
253 features = 'CORE_IMAGE_EXTRA_INSTALL = "postinst-delayed-b"\n'
254 features += 'IMAGE_FEATURES += "package-management empty-root-password"\n'
255 features += 'PACKAGE_CLASSES = "%s"\n' % classes
256 if init_manager == "systemd":
Patrick Williams213cb262021-08-07 19:21:33 -0500257 features += 'DISTRO_FEATURES:append = " systemd"\n'
Andrew Geissler82c905d2020-04-13 13:39:40 -0500258 features += 'VIRTUAL-RUNTIME_init_manager = "systemd"\n'
259 features += 'DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"\n'
260 features += 'VIRTUAL-RUNTIME_initscripts = ""\n'
261 self.write_config(features)
262
263 bitbake('core-image-minimal')
264
265 self.assertTrue(os.path.isfile(os.path.join(hosttestdir, "rootfs")),
266 "rootfs state file was not created")
267
268 with runqemu('core-image-minimal') as qemu:
269 # Make the test echo a string and search for that as
270 # run_serial()'s status code is useless.'
271 for filename in ("rootfs", "delayed-a", "delayed-b"):
272 status, output = qemu.run_serial("test -f %s && echo found" % os.path.join(targettestdir, filename))
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600273 self.assertIn("found", output, "%s was not present on boot" % filename)
Andrew Geissler82c905d2020-04-13 13:39:40 -0500274
275
276
277 @skipIfNotQemu('qemuall', 'Test only runs in qemu')
278 def test_postinst_rootfs_and_boot_sysvinit(self):
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500279 """
280 Summary: The purpose of this test case is to verify Post-installation
281 scripts are called when rootfs is created and also test
282 that script can be delayed to run at first boot.
283 Dependencies: NA
284 Steps: 1. Add proper configuration to local.conf file
285 2. Build a "core-image-minimal" image
286 3. Verify that file created by postinst_rootfs recipe is
287 present on rootfs dir.
288 4. Boot the image created on qemu and verify that the file
289 created by postinst_boot recipe is present on image.
290 Expected: The files are successfully created during rootfs and boot
291 time for 3 different package managers: rpm,ipk,deb and
Andrew Geissler82c905d2020-04-13 13:39:40 -0500292 for initialization managers: sysvinit.
293
294 """
295 self.init_manager_loop("sysvinit")
296
297
298 @skipIfNotQemu('qemuall', 'Test only runs in qemu')
299 def test_postinst_rootfs_and_boot_systemd(self):
300 """
301 Summary: The purpose of this test case is to verify Post-installation
302 scripts are called when rootfs is created and also test
303 that script can be delayed to run at first boot.
304 Dependencies: NA
305 Steps: 1. Add proper configuration to local.conf file
306 2. Build a "core-image-minimal" image
307 3. Verify that file created by postinst_rootfs recipe is
308 present on rootfs dir.
309 4. Boot the image created on qemu and verify that the file
310 created by postinst_boot recipe is present on image.
311 Expected: The files are successfully created during rootfs and boot
312 time for 3 different package managers: rpm,ipk,deb and
313 for initialization managers: systemd.
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500314
315 """
Brad Bishop316dfdd2018-06-25 12:45:53 -0400316
Andrew Geissler82c905d2020-04-13 13:39:40 -0500317 self.init_manager_loop("systemd")
Brad Bishop316dfdd2018-06-25 12:45:53 -0400318
319
320 def test_failing_postinst(self):
321 """
322 Summary: The purpose of this test case is to verify that post-installation
323 scripts that contain errors are properly reported.
324 Expected: The scriptlet failure is properly reported.
325 The file that is created after the error in the scriptlet is not present.
326 Product: oe-core
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800327 Author: Alexander Kanavin <alex.kanavin@gmail.com>
Brad Bishop316dfdd2018-06-25 12:45:53 -0400328 """
329
330 import oe.path
331
332 vars = get_bb_vars(("IMAGE_ROOTFS", "sysconfdir"), "core-image-minimal")
333 rootfs = vars["IMAGE_ROOTFS"]
334 self.assertIsNotNone(rootfs)
335 sysconfdir = vars["sysconfdir"]
336 self.assertIsNotNone(sysconfdir)
337 # Need to use oe.path here as sysconfdir starts with /
338 hosttestdir = oe.path.join(rootfs, sysconfdir, "postinst-test")
339
340 for classes in ("package_rpm", "package_deb", "package_ipk"):
341 with self.subTest(package_class=classes):
342 features = 'CORE_IMAGE_EXTRA_INSTALL = "postinst-rootfs-failing"\n'
343 features += 'PACKAGE_CLASSES = "%s"\n' % classes
344 self.write_config(features)
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800345 bb_result = bitbake('core-image-minimal', ignore_status=True)
346 self.assertGreaterEqual(bb_result.output.find("Postinstall scriptlets of ['postinst-rootfs-failing'] have failed."), 0,
Brad Bishop316dfdd2018-06-25 12:45:53 -0400347 "Warning about a failed scriptlet not found in bitbake output: %s" %(bb_result.output))
348
349 self.assertTrue(os.path.isfile(os.path.join(hosttestdir, "rootfs-before-failure")),
350 "rootfs-before-failure file was not created")
351 self.assertFalse(os.path.isfile(os.path.join(hosttestdir, "rootfs-after-failure")),
352 "rootfs-after-failure file was created")
353
Brad Bishop1d80a2e2019-11-15 16:35:03 -0500354class SystemTap(OESelftestTestCase):
355 """
356 Summary: The purpose of this test case is to verify native crosstap
357 works while talking to a target.
358 Expected: The script should successfully connect to the qemu machine
359 and run some systemtap examples on a qemu machine.
360 """
361
362 @classmethod
363 def setUpClass(cls):
364 super(SystemTap, cls).setUpClass()
365 cls.image = "core-image-minimal"
366
367 def default_config(self):
368 return """
369# These aren't the actual IP addresses but testexport class needs something defined
370TEST_SERVER_IP = "192.168.7.1"
371TEST_TARGET_IP = "192.168.7.2"
372
373EXTRA_IMAGE_FEATURES += "tools-profile dbg-pkgs"
Patrick Williams213cb262021-08-07 19:21:33 -0500374IMAGE_FEATURES:append = " ssh-server-dropbear"
Brad Bishop1d80a2e2019-11-15 16:35:03 -0500375
376# enables kernel debug symbols
Patrick Williams213cb262021-08-07 19:21:33 -0500377KERNEL_EXTRA_FEATURES:append = " features/debug/debug-kernel.scc"
378KERNEL_EXTRA_FEATURES:append = " features/systemtap/systemtap.scc"
Brad Bishop1d80a2e2019-11-15 16:35:03 -0500379
380# add systemtap run-time into target image if it is not there yet
Patrick Williams213cb262021-08-07 19:21:33 -0500381IMAGE_INSTALL:append = " systemtap-runtime"
Brad Bishop1d80a2e2019-11-15 16:35:03 -0500382"""
383
384 def test_crosstap_helloworld(self):
385 self.write_config(self.default_config())
386 bitbake('systemtap-native')
387 systemtap_examples = os.path.join(get_bb_var("WORKDIR","systemtap-native"), "usr/share/systemtap/examples")
388 bitbake(self.image)
389
390 with runqemu(self.image) as qemu:
391 cmd = "crosstap -r root@192.168.7.2 -s %s/general/helloworld.stp " % systemtap_examples
392 result = runCmd(cmd)
393 self.assertEqual(0, result.status, 'crosstap helloworld returned a non 0 status:%s' % result.output)
394
395 def test_crosstap_pstree(self):
396 self.write_config(self.default_config())
397
398 bitbake('systemtap-native')
399 systemtap_examples = os.path.join(get_bb_var("WORKDIR","systemtap-native"), "usr/share/systemtap/examples")
400 bitbake(self.image)
401
402 with runqemu(self.image) as qemu:
403 cmd = "crosstap -r root@192.168.7.2 -s %s/process/pstree.stp" % systemtap_examples
404 result = runCmd(cmd)
405 self.assertEqual(0, result.status, 'crosstap pstree returned a non 0 status:%s' % result.output)
406
407 def test_crosstap_syscalls_by_proc(self):
408 self.write_config(self.default_config())
409
410 bitbake('systemtap-native')
411 systemtap_examples = os.path.join(get_bb_var("WORKDIR","systemtap-native"), "usr/share/systemtap/examples")
412 bitbake(self.image)
413
414 with runqemu(self.image) as qemu:
415 cmd = "crosstap -r root@192.168.7.2 -s %s/process/ syscalls_by_proc.stp" % systemtap_examples
416 result = runCmd(cmd)
417 self.assertEqual(0, result.status, 'crosstap syscalls_by_proc returned a non 0 status:%s' % result.output)
418
419 def test_crosstap_syscalls_by_pid(self):
420 self.write_config(self.default_config())
421
422 bitbake('systemtap-native')
423 systemtap_examples = os.path.join(get_bb_var("WORKDIR","systemtap-native"), "usr/share/systemtap/examples")
424 bitbake(self.image)
425
426 with runqemu(self.image) as qemu:
427 cmd = "crosstap -r root@192.168.7.2 -s %s/process/ syscalls_by_pid.stp" % systemtap_examples
428 result = runCmd(cmd)
429 self.assertEqual(0, result.status, 'crosstap syscalls_by_pid returned a non 0 status:%s' % result.output)
430