Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 1 | # |
| 2 | # SPDX-License-Identifier: MIT |
| 3 | # |
| 4 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 5 | from oeqa.selftest.case import OESelftestTestCase |
| 6 | from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu |
| 7 | from oeqa.utils.sshcontrol import SSHControl |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 8 | import os |
| 9 | import re |
| 10 | import tempfile |
| 11 | import shutil |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 12 | import oe.lsb |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 13 | |
| 14 | class TestExport(OESelftestTestCase): |
| 15 | |
| 16 | @classmethod |
| 17 | def tearDownClass(cls): |
| 18 | runCmd("rm -rf /tmp/sdk") |
| 19 | super(TestExport, cls).tearDownClass() |
| 20 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 21 | def test_testexport_basic(self): |
| 22 | """ |
| 23 | Summary: Check basic testexport functionality with only ping test enabled. |
| 24 | Expected: 1. testexport directory must be created. |
| 25 | 2. runexported.py must run without any error/exception. |
| 26 | 3. ping test must succeed. |
| 27 | Product: oe-core |
| 28 | Author: Mariano Lopez <mariano.lopez@intel.com> |
| 29 | """ |
| 30 | |
| 31 | features = 'INHERIT += "testexport"\n' |
| 32 | # These aren't the actual IP addresses but testexport class needs something defined |
| 33 | features += 'TEST_SERVER_IP = "192.168.7.1"\n' |
| 34 | features += 'TEST_TARGET_IP = "192.168.7.1"\n' |
| 35 | features += 'TEST_SUITES = "ping"\n' |
| 36 | self.write_config(features) |
| 37 | |
| 38 | # Build tesexport for core-image-minimal |
| 39 | bitbake('core-image-minimal') |
| 40 | bitbake('-c testexport core-image-minimal') |
| 41 | |
| 42 | testexport_dir = get_bb_var('TEST_EXPORT_DIR', 'core-image-minimal') |
| 43 | |
| 44 | # Verify if TEST_EXPORT_DIR was created |
| 45 | isdir = os.path.isdir(testexport_dir) |
| 46 | self.assertEqual(True, isdir, 'Failed to create testexport dir: %s' % testexport_dir) |
| 47 | |
| 48 | with runqemu('core-image-minimal') as qemu: |
| 49 | # Attempt to run runexported.py to perform ping test |
| 50 | test_path = os.path.join(testexport_dir, "oe-test") |
| 51 | data_file = os.path.join(testexport_dir, 'data', 'testdata.json') |
| 52 | manifest = os.path.join(testexport_dir, 'data', 'manifest') |
| 53 | cmd = ("%s runtime --test-data-file %s --packages-manifest %s " |
| 54 | "--target-ip %s --server-ip %s --quiet" |
| 55 | % (test_path, data_file, manifest, qemu.ip, qemu.server_ip)) |
| 56 | result = runCmd(cmd) |
| 57 | # Verify ping test was succesful |
| 58 | self.assertEqual(0, result.status, 'oe-test runtime returned a non 0 status') |
| 59 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 60 | def test_testexport_sdk(self): |
| 61 | """ |
| 62 | Summary: Check sdk functionality for testexport. |
| 63 | Expected: 1. testexport directory must be created. |
| 64 | 2. SDK tarball must exists. |
| 65 | 3. Uncompressing of tarball must succeed. |
| 66 | 4. Check if the SDK directory is added to PATH. |
| 67 | 5. Run tar from the SDK directory. |
| 68 | Product: oe-core |
| 69 | Author: Mariano Lopez <mariano.lopez@intel.com> |
| 70 | """ |
| 71 | |
| 72 | features = 'INHERIT += "testexport"\n' |
| 73 | # These aren't the actual IP addresses but testexport class needs something defined |
| 74 | features += 'TEST_SERVER_IP = "192.168.7.1"\n' |
| 75 | features += 'TEST_TARGET_IP = "192.168.7.1"\n' |
| 76 | features += 'TEST_SUITES = "ping"\n' |
| 77 | features += 'TEST_EXPORT_SDK_ENABLED = "1"\n' |
| 78 | features += 'TEST_EXPORT_SDK_PACKAGES = "nativesdk-tar"\n' |
| 79 | self.write_config(features) |
| 80 | |
| 81 | # Build tesexport for core-image-minimal |
| 82 | bitbake('core-image-minimal') |
| 83 | bitbake('-c testexport core-image-minimal') |
| 84 | |
| 85 | needed_vars = ['TEST_EXPORT_DIR', 'TEST_EXPORT_SDK_DIR', 'TEST_EXPORT_SDK_NAME'] |
| 86 | bb_vars = get_bb_vars(needed_vars, 'core-image-minimal') |
| 87 | testexport_dir = bb_vars['TEST_EXPORT_DIR'] |
| 88 | sdk_dir = bb_vars['TEST_EXPORT_SDK_DIR'] |
| 89 | sdk_name = bb_vars['TEST_EXPORT_SDK_NAME'] |
| 90 | |
| 91 | # Check for SDK |
| 92 | tarball_name = "%s.sh" % sdk_name |
| 93 | tarball_path = os.path.join(testexport_dir, sdk_dir, tarball_name) |
| 94 | msg = "Couldn't find SDK tarball: %s" % tarball_path |
| 95 | self.assertEqual(os.path.isfile(tarball_path), True, msg) |
| 96 | |
| 97 | # Extract SDK and run tar from SDK |
| 98 | result = runCmd("%s -y -d /tmp/sdk" % tarball_path) |
| 99 | self.assertEqual(0, result.status, "Couldn't extract SDK") |
| 100 | |
| 101 | env_script = result.output.split()[-1] |
| 102 | result = runCmd(". %s; which tar" % env_script, shell=True) |
| 103 | self.assertEqual(0, result.status, "Couldn't setup SDK environment") |
| 104 | is_sdk_tar = True if "/tmp/sdk" in result.output else False |
| 105 | self.assertTrue(is_sdk_tar, "Couldn't setup SDK environment") |
| 106 | |
| 107 | tar_sdk = result.output |
| 108 | result = runCmd("%s --version" % tar_sdk) |
| 109 | self.assertEqual(0, result.status, "Couldn't run tar from SDK") |
| 110 | |
| 111 | |
| 112 | class TestImage(OESelftestTestCase): |
| 113 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 114 | def test_testimage_install(self): |
| 115 | """ |
| 116 | Summary: Check install packages functionality for testimage/testexport. |
| 117 | Expected: 1. Import tests from a directory other than meta. |
| 118 | 2. Check install/uninstall of socat. |
| 119 | Product: oe-core |
| 120 | Author: Mariano Lopez <mariano.lopez@intel.com> |
| 121 | """ |
| 122 | if get_bb_var('DISTRO') == 'poky-tiny': |
| 123 | self.skipTest('core-image-full-cmdline not buildable for poky-tiny') |
| 124 | |
| 125 | features = 'INHERIT += "testimage"\n' |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 126 | features += 'IMAGE_INSTALL_append = " libssl"\n' |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 127 | features += 'TEST_SUITES = "ping ssh selftest"\n' |
| 128 | self.write_config(features) |
| 129 | |
| 130 | # Build core-image-sato and testimage |
| 131 | bitbake('core-image-full-cmdline socat') |
| 132 | bitbake('-c testimage core-image-full-cmdline') |
| 133 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 134 | def test_testimage_dnf(self): |
| 135 | """ |
| 136 | Summary: Check package feeds functionality for dnf |
| 137 | Expected: 1. Check that remote package feeds can be accessed |
| 138 | Product: oe-core |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 139 | Author: Alexander Kanavin <alex.kanavin@gmail.com> |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 140 | """ |
| 141 | if get_bb_var('DISTRO') == 'poky-tiny': |
| 142 | self.skipTest('core-image-full-cmdline not buildable for poky-tiny') |
| 143 | |
| 144 | features = 'INHERIT += "testimage"\n' |
| 145 | features += 'TEST_SUITES = "ping ssh dnf_runtime dnf.DnfBasicTest.test_dnf_help"\n' |
| 146 | # We don't yet know what the server ip and port will be - they will be patched |
| 147 | # in at the start of the on-image test |
| 148 | features += 'PACKAGE_FEED_URIS = "http://bogus_ip:bogus_port"\n' |
| 149 | features += 'EXTRA_IMAGE_FEATURES += "package-management"\n' |
| 150 | features += 'PACKAGE_CLASSES = "package_rpm"\n' |
| 151 | |
Brad Bishop | 6f8dcde | 2018-10-16 10:47:12 +0800 | [diff] [blame] | 152 | bitbake('gnupg-native -c addto_recipe_sysroot') |
| 153 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 154 | # Enable package feed signing |
| 155 | self.gpg_home = tempfile.mkdtemp(prefix="oeqa-feed-sign-") |
Brad Bishop | 96ff198 | 2019-08-19 13:50:42 -0400 | [diff] [blame] | 156 | self.track_for_cleanup(self.gpg_home) |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 157 | signing_key_dir = os.path.join(self.testlayer_path, 'files', 'signing') |
Brad Bishop | 6f8dcde | 2018-10-16 10:47:12 +0800 | [diff] [blame] | 158 | runCmd('gpg --batch --homedir %s --import %s' % (self.gpg_home, os.path.join(signing_key_dir, 'key.secret')), native_sysroot=get_bb_var("RECIPE_SYSROOT_NATIVE", "gnupg-native")) |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 159 | features += 'INHERIT += "sign_package_feed"\n' |
| 160 | features += 'PACKAGE_FEED_GPG_NAME = "testuser"\n' |
| 161 | features += 'PACKAGE_FEED_GPG_PASSPHRASE_FILE = "%s"\n' % os.path.join(signing_key_dir, 'key.passphrase') |
| 162 | features += 'GPG_PATH = "%s"\n' % self.gpg_home |
| 163 | self.write_config(features) |
| 164 | |
| 165 | # Build core-image-sato and testimage |
| 166 | bitbake('core-image-full-cmdline socat') |
| 167 | bitbake('-c testimage core-image-full-cmdline') |
| 168 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 169 | def test_testimage_virgl_gtk(self): |
| 170 | """ |
| 171 | Summary: Check host-assisted accelerate OpenGL functionality in qemu with gtk frontend |
| 172 | Expected: 1. Check that virgl kernel driver is loaded and 3d acceleration is enabled |
| 173 | 2. Check that kmscube demo runs without crashing. |
| 174 | Product: oe-core |
| 175 | Author: Alexander Kanavin <alex.kanavin@gmail.com> |
| 176 | """ |
| 177 | if "DISPLAY" not in os.environ: |
| 178 | self.skipTest("virgl gtk test must be run inside a X session") |
| 179 | distro = oe.lsb.distro_identifier() |
| 180 | if distro and distro == 'debian-8': |
| 181 | self.skipTest('virgl isn\'t working with Debian 8') |
Brad Bishop | 64c979e | 2019-11-04 13:55:29 -0500 | [diff] [blame] | 182 | if distro and distro == 'centos-7': |
| 183 | self.skipTest('virgl isn\'t working with Centos 7') |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 184 | |
| 185 | qemu_packageconfig = get_bb_var('PACKAGECONFIG', 'qemu-system-native') |
| 186 | features = 'INHERIT += "testimage"\n' |
| 187 | if 'gtk+' not in qemu_packageconfig: |
| 188 | features += 'PACKAGECONFIG_append_pn-qemu-system-native = " gtk+"\n' |
| 189 | if 'virglrenderer' not in qemu_packageconfig: |
| 190 | features += 'PACKAGECONFIG_append_pn-qemu-system-native = " virglrenderer"\n' |
| 191 | if 'glx' not in qemu_packageconfig: |
| 192 | features += 'PACKAGECONFIG_append_pn-qemu-system-native = " glx"\n' |
| 193 | features += 'TEST_SUITES = "ping ssh virgl"\n' |
| 194 | features += 'IMAGE_FEATURES_append = " ssh-server-dropbear"\n' |
| 195 | features += 'IMAGE_INSTALL_append = " kmscube"\n' |
Brad Bishop | a34c030 | 2019-09-23 22:34:48 -0400 | [diff] [blame] | 196 | features += 'TEST_RUNQEMUPARAMS = "gtk gl"\n' |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 197 | self.write_config(features) |
| 198 | bitbake('core-image-minimal') |
| 199 | bitbake('-c testimage core-image-minimal') |
| 200 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 201 | def test_testimage_virgl_headless(self): |
| 202 | """ |
| 203 | Summary: Check host-assisted accelerate OpenGL functionality in qemu with egl-headless frontend |
| 204 | Expected: 1. Check that virgl kernel driver is loaded and 3d acceleration is enabled |
| 205 | 2. Check that kmscube demo runs without crashing. |
| 206 | Product: oe-core |
| 207 | Author: Alexander Kanavin <alex.kanavin@gmail.com> |
| 208 | """ |
| 209 | import subprocess, os |
| 210 | try: |
| 211 | content = os.listdir("/dev/dri") |
| 212 | if len([i for i in content if i.startswith('render')]) == 0: |
| 213 | self.skipTest("No render nodes found in /dev/dri: %s" %(content)) |
| 214 | except FileNotFoundError: |
| 215 | self.skipTest("/dev/dri directory does not exist; no render nodes available on this machine.") |
| 216 | try: |
| 217 | dripath = subprocess.check_output("pkg-config --variable=dridriverdir dri", shell=True) |
| 218 | except subprocess.CalledProcessError as e: |
| 219 | 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.") |
| 220 | qemu_packageconfig = get_bb_var('PACKAGECONFIG', 'qemu-system-native') |
| 221 | features = 'INHERIT += "testimage"\n' |
| 222 | if 'virglrenderer' not in qemu_packageconfig: |
| 223 | features += 'PACKAGECONFIG_append_pn-qemu-system-native = " virglrenderer"\n' |
| 224 | if 'glx' not in qemu_packageconfig: |
| 225 | features += 'PACKAGECONFIG_append_pn-qemu-system-native = " glx"\n' |
| 226 | features += 'TEST_SUITES = "ping ssh virgl"\n' |
| 227 | features += 'IMAGE_FEATURES_append = " ssh-server-dropbear"\n' |
| 228 | features += 'IMAGE_INSTALL_append = " kmscube"\n' |
| 229 | features += 'TEST_RUNQEMUPARAMS = "egl-headless"\n' |
| 230 | self.write_config(features) |
| 231 | bitbake('core-image-minimal') |
| 232 | bitbake('-c testimage core-image-minimal') |
| 233 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 234 | class Postinst(OESelftestTestCase): |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 235 | def test_postinst_rootfs_and_boot(self): |
| 236 | """ |
| 237 | Summary: The purpose of this test case is to verify Post-installation |
| 238 | scripts are called when rootfs is created and also test |
| 239 | that script can be delayed to run at first boot. |
| 240 | Dependencies: NA |
| 241 | Steps: 1. Add proper configuration to local.conf file |
| 242 | 2. Build a "core-image-minimal" image |
| 243 | 3. Verify that file created by postinst_rootfs recipe is |
| 244 | present on rootfs dir. |
| 245 | 4. Boot the image created on qemu and verify that the file |
| 246 | created by postinst_boot recipe is present on image. |
| 247 | Expected: The files are successfully created during rootfs and boot |
| 248 | time for 3 different package managers: rpm,ipk,deb and |
| 249 | for initialization managers: sysvinit and systemd. |
| 250 | |
| 251 | """ |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 252 | |
| 253 | import oe.path |
| 254 | |
| 255 | vars = get_bb_vars(("IMAGE_ROOTFS", "sysconfdir"), "core-image-minimal") |
| 256 | rootfs = vars["IMAGE_ROOTFS"] |
| 257 | self.assertIsNotNone(rootfs) |
| 258 | sysconfdir = vars["sysconfdir"] |
| 259 | self.assertIsNotNone(sysconfdir) |
| 260 | # Need to use oe.path here as sysconfdir starts with / |
| 261 | hosttestdir = oe.path.join(rootfs, sysconfdir, "postinst-test") |
| 262 | targettestdir = os.path.join(sysconfdir, "postinst-test") |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 263 | |
| 264 | for init_manager in ("sysvinit", "systemd"): |
| 265 | for classes in ("package_rpm", "package_deb", "package_ipk"): |
| 266 | with self.subTest(init_manager=init_manager, package_class=classes): |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 267 | features = 'CORE_IMAGE_EXTRA_INSTALL = "postinst-delayed-b"\n' |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 268 | features += 'IMAGE_FEATURES += "package-management empty-root-password"\n' |
| 269 | features += 'PACKAGE_CLASSES = "%s"\n' % classes |
| 270 | if init_manager == "systemd": |
| 271 | features += 'DISTRO_FEATURES_append = " systemd"\n' |
| 272 | features += 'VIRTUAL-RUNTIME_init_manager = "systemd"\n' |
| 273 | features += 'DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"\n' |
| 274 | features += 'VIRTUAL-RUNTIME_initscripts = ""\n' |
| 275 | self.write_config(features) |
| 276 | |
| 277 | bitbake('core-image-minimal') |
| 278 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 279 | self.assertTrue(os.path.isfile(os.path.join(hosttestdir, "rootfs")), |
| 280 | "rootfs state file was not created") |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 281 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 282 | with runqemu('core-image-minimal') as qemu: |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 283 | # Make the test echo a string and search for that as |
| 284 | # run_serial()'s status code is useless.' |
| 285 | for filename in ("rootfs", "delayed-a", "delayed-b"): |
| 286 | status, output = qemu.run_serial("test -f %s && echo found" % os.path.join(targettestdir, filename)) |
| 287 | self.assertEqual(output, "found", "%s was not present on boot" % filename) |
| 288 | |
| 289 | |
| 290 | |
| 291 | def test_failing_postinst(self): |
| 292 | """ |
| 293 | Summary: The purpose of this test case is to verify that post-installation |
| 294 | scripts that contain errors are properly reported. |
| 295 | Expected: The scriptlet failure is properly reported. |
| 296 | The file that is created after the error in the scriptlet is not present. |
| 297 | Product: oe-core |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 298 | Author: Alexander Kanavin <alex.kanavin@gmail.com> |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 299 | """ |
| 300 | |
| 301 | import oe.path |
| 302 | |
| 303 | vars = get_bb_vars(("IMAGE_ROOTFS", "sysconfdir"), "core-image-minimal") |
| 304 | rootfs = vars["IMAGE_ROOTFS"] |
| 305 | self.assertIsNotNone(rootfs) |
| 306 | sysconfdir = vars["sysconfdir"] |
| 307 | self.assertIsNotNone(sysconfdir) |
| 308 | # Need to use oe.path here as sysconfdir starts with / |
| 309 | hosttestdir = oe.path.join(rootfs, sysconfdir, "postinst-test") |
| 310 | |
| 311 | for classes in ("package_rpm", "package_deb", "package_ipk"): |
| 312 | with self.subTest(package_class=classes): |
| 313 | features = 'CORE_IMAGE_EXTRA_INSTALL = "postinst-rootfs-failing"\n' |
| 314 | features += 'PACKAGE_CLASSES = "%s"\n' % classes |
| 315 | self.write_config(features) |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 316 | bb_result = bitbake('core-image-minimal', ignore_status=True) |
| 317 | self.assertGreaterEqual(bb_result.output.find("Postinstall scriptlets of ['postinst-rootfs-failing'] have failed."), 0, |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 318 | "Warning about a failed scriptlet not found in bitbake output: %s" %(bb_result.output)) |
| 319 | |
| 320 | self.assertTrue(os.path.isfile(os.path.join(hosttestdir, "rootfs-before-failure")), |
| 321 | "rootfs-before-failure file was not created") |
| 322 | self.assertFalse(os.path.isfile(os.path.join(hosttestdir, "rootfs-after-failure")), |
| 323 | "rootfs-after-failure file was created") |
| 324 | |
Brad Bishop | 1d80a2e | 2019-11-15 16:35:03 -0500 | [diff] [blame] | 325 | class SystemTap(OESelftestTestCase): |
| 326 | """ |
| 327 | Summary: The purpose of this test case is to verify native crosstap |
| 328 | works while talking to a target. |
| 329 | Expected: The script should successfully connect to the qemu machine |
| 330 | and run some systemtap examples on a qemu machine. |
| 331 | """ |
| 332 | |
| 333 | @classmethod |
| 334 | def setUpClass(cls): |
| 335 | super(SystemTap, cls).setUpClass() |
| 336 | cls.image = "core-image-minimal" |
| 337 | |
| 338 | def default_config(self): |
| 339 | return """ |
| 340 | # These aren't the actual IP addresses but testexport class needs something defined |
| 341 | TEST_SERVER_IP = "192.168.7.1" |
| 342 | TEST_TARGET_IP = "192.168.7.2" |
| 343 | |
| 344 | EXTRA_IMAGE_FEATURES += "tools-profile dbg-pkgs" |
| 345 | IMAGE_FEATURES_append = " ssh-server-dropbear" |
| 346 | |
| 347 | # enables kernel debug symbols |
| 348 | KERNEL_EXTRA_FEATURES_append = " features/debug/debug-kernel.scc" |
| 349 | KERNEL_EXTRA_FEATURES_append = " features/systemtap/systemtap.scc" |
| 350 | |
| 351 | # add systemtap run-time into target image if it is not there yet |
| 352 | IMAGE_INSTALL_append = " systemtap" |
| 353 | """ |
| 354 | |
| 355 | def test_crosstap_helloworld(self): |
| 356 | self.write_config(self.default_config()) |
| 357 | bitbake('systemtap-native') |
| 358 | systemtap_examples = os.path.join(get_bb_var("WORKDIR","systemtap-native"), "usr/share/systemtap/examples") |
| 359 | bitbake(self.image) |
| 360 | |
| 361 | with runqemu(self.image) as qemu: |
| 362 | cmd = "crosstap -r root@192.168.7.2 -s %s/general/helloworld.stp " % systemtap_examples |
| 363 | result = runCmd(cmd) |
| 364 | self.assertEqual(0, result.status, 'crosstap helloworld returned a non 0 status:%s' % result.output) |
| 365 | |
| 366 | def test_crosstap_pstree(self): |
| 367 | self.write_config(self.default_config()) |
| 368 | |
| 369 | bitbake('systemtap-native') |
| 370 | systemtap_examples = os.path.join(get_bb_var("WORKDIR","systemtap-native"), "usr/share/systemtap/examples") |
| 371 | bitbake(self.image) |
| 372 | |
| 373 | with runqemu(self.image) as qemu: |
| 374 | cmd = "crosstap -r root@192.168.7.2 -s %s/process/pstree.stp" % systemtap_examples |
| 375 | result = runCmd(cmd) |
| 376 | self.assertEqual(0, result.status, 'crosstap pstree returned a non 0 status:%s' % result.output) |
| 377 | |
| 378 | def test_crosstap_syscalls_by_proc(self): |
| 379 | self.write_config(self.default_config()) |
| 380 | |
| 381 | bitbake('systemtap-native') |
| 382 | systemtap_examples = os.path.join(get_bb_var("WORKDIR","systemtap-native"), "usr/share/systemtap/examples") |
| 383 | bitbake(self.image) |
| 384 | |
| 385 | with runqemu(self.image) as qemu: |
| 386 | cmd = "crosstap -r root@192.168.7.2 -s %s/process/ syscalls_by_proc.stp" % systemtap_examples |
| 387 | result = runCmd(cmd) |
| 388 | self.assertEqual(0, result.status, 'crosstap syscalls_by_proc returned a non 0 status:%s' % result.output) |
| 389 | |
| 390 | def test_crosstap_syscalls_by_pid(self): |
| 391 | self.write_config(self.default_config()) |
| 392 | |
| 393 | bitbake('systemtap-native') |
| 394 | systemtap_examples = os.path.join(get_bb_var("WORKDIR","systemtap-native"), "usr/share/systemtap/examples") |
| 395 | bitbake(self.image) |
| 396 | |
| 397 | with runqemu(self.image) as qemu: |
| 398 | cmd = "crosstap -r root@192.168.7.2 -s %s/process/ syscalls_by_pid.stp" % systemtap_examples |
| 399 | result = runCmd(cmd) |
| 400 | self.assertEqual(0, result.status, 'crosstap syscalls_by_pid returned a non 0 status:%s' % result.output) |
| 401 | |