From fd83e9aa35fa2553a8afd975e5405ea22f318eab Mon Sep 17 00:00:00 2001 From: Armin Kuster Date: Mon, 11 Nov 2019 20:33:38 -0800 Subject: oeqa/selftest/runtime_test: add crosstab selftest Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/lib/oeqa/selftest/cases/runtime_test.py | 77 ++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/meta/lib/oeqa/selftest/cases/runtime_test.py b/meta/lib/oeqa/selftest/cases/runtime_test.py index 7d3922ce44..4b56e5beca 100644 --- a/meta/lib/oeqa/selftest/cases/runtime_test.py +++ b/meta/lib/oeqa/selftest/cases/runtime_test.py @@ -322,3 +322,80 @@ class Postinst(OESelftestTestCase): self.assertFalse(os.path.isfile(os.path.join(hosttestdir, "rootfs-after-failure")), "rootfs-after-failure file was created") +class SystemTap(OESelftestTestCase): + """ + Summary: The purpose of this test case is to verify native crosstap + works while talking to a target. + Expected: The script should successfully connect to the qemu machine + and run some systemtap examples on a qemu machine. + """ + + @classmethod + def setUpClass(cls): + super(SystemTap, cls).setUpClass() + cls.image = "core-image-minimal" + + def default_config(self): + return """ +# These aren't the actual IP addresses but testexport class needs something defined +TEST_SERVER_IP = "192.168.7.1" +TEST_TARGET_IP = "192.168.7.2" + +EXTRA_IMAGE_FEATURES += "tools-profile dbg-pkgs" +IMAGE_FEATURES_append = " ssh-server-dropbear" + +# enables kernel debug symbols +KERNEL_EXTRA_FEATURES_append = " features/debug/debug-kernel.scc" +KERNEL_EXTRA_FEATURES_append = " features/systemtap/systemtap.scc" + +# add systemtap run-time into target image if it is not there yet +IMAGE_INSTALL_append = " systemtap" +""" + + def test_crosstap_helloworld(self): + self.write_config(self.default_config()) + bitbake('systemtap-native') + systemtap_examples = os.path.join(get_bb_var("WORKDIR","systemtap-native"), "usr/share/systemtap/examples") + bitbake(self.image) + + with runqemu(self.image) as qemu: + cmd = "crosstap -r root@192.168.7.2 -s %s/general/helloworld.stp " % systemtap_examples + result = runCmd(cmd) + self.assertEqual(0, result.status, 'crosstap helloworld returned a non 0 status:%s' % result.output) + + def test_crosstap_pstree(self): + self.write_config(self.default_config()) + + bitbake('systemtap-native') + systemtap_examples = os.path.join(get_bb_var("WORKDIR","systemtap-native"), "usr/share/systemtap/examples") + bitbake(self.image) + + with runqemu(self.image) as qemu: + cmd = "crosstap -r root@192.168.7.2 -s %s/process/pstree.stp" % systemtap_examples + result = runCmd(cmd) + self.assertEqual(0, result.status, 'crosstap pstree returned a non 0 status:%s' % result.output) + + def test_crosstap_syscalls_by_proc(self): + self.write_config(self.default_config()) + + bitbake('systemtap-native') + systemtap_examples = os.path.join(get_bb_var("WORKDIR","systemtap-native"), "usr/share/systemtap/examples") + bitbake(self.image) + + with runqemu(self.image) as qemu: + cmd = "crosstap -r root@192.168.7.2 -s %s/process/ syscalls_by_proc.stp" % systemtap_examples + result = runCmd(cmd) + self.assertEqual(0, result.status, 'crosstap syscalls_by_proc returned a non 0 status:%s' % result.output) + + def test_crosstap_syscalls_by_pid(self): + self.write_config(self.default_config()) + + bitbake('systemtap-native') + systemtap_examples = os.path.join(get_bb_var("WORKDIR","systemtap-native"), "usr/share/systemtap/examples") + bitbake(self.image) + + with runqemu(self.image) as qemu: + cmd = "crosstap -r root@192.168.7.2 -s %s/process/ syscalls_by_pid.stp" % systemtap_examples + result = runCmd(cmd) + self.assertEqual(0, result.status, 'crosstap syscalls_by_pid returned a non 0 status:%s' % result.output) + -- cgit 1.2.3-korg