oe-selftest: crosstap: add tests for crosstap script
PATCH 1/1 oe-selftest: crosstap: add tests for crosstap script
QA team were testing crosstap script manually. Add automated tests and systemtap file to test that crosstap script will instructs SystemTap to print hello world in qemu. This test will first built core-image-minimal image with tools-profile & ssh-server-openssh features and build systemtap-native on the host machine. Finally this test will boot the image with qemu and then execute crosstap script to print hello world on qemu.
--- meta/lib/oeqa/files/trace_begin_hello.stp | 5 +++++ meta/lib/oeqa/selftest/cases/crosstap.py | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 meta/lib/oeqa/files/trace_begin_hello.stp create mode 100644 meta/lib/oeqa/selftest/cases/crosstap.py
meta/lib/oeqa/files/trace_begin_hello.stp new file +5 -0
@@ -0,0 +1,5 @@ +probe begin +{ + printf ("hello world\n") + exit () +}
meta/lib/oeqa/selftest/cases/crosstap.py new file +25 -0
@@ -0,0 +1,25 @@ +from oeqa.selftest.case import OESelftestTestCase +from oeqa.utils.commands import bitbake, get_bb_vars, runCmd, runqemu +import os + +class CrossTapTest(OESelftestTestCase): + + def test_crosstap_can_use_systemtap_on_qemu(self): + self.write_config('EXTRA_IMAGE_FEATURES += "tools-profile ssh-server-openssh"') + result = bitbake('core-image-minimal') + self.assertEqual(result.status, 0, msg="Bitbake core-image-minimal failed. Bitbake output: %s" % result.output) + result = bitbake('systemtap-native') + self.assertEqual(result.status, 0, msg="Bitbake systemtap-native failed. Bitbake output: %s" % result.output) + + recipe = 'core-image-minimal' + bb_vars = get_bb_vars(['MACHINE', 'DEPLOY_DIR_IMAGE']) + machine = bb_vars['MACHINE'] + deploy_dir_image = bb_vars['DEPLOY_DIR_IMAGE'] + qemuboot_conf = "%s-%s.qemuboot.conf" % (recipe, machine) + qemuboot_conf = os.path.join(deploy_dir_image, qemuboot_conf) + cmd_common = "runqemu nographic" + cmd = "%s %s" % (cmd_common, qemuboot_conf) + with runqemu(recipe, ssh=True, launch_cmd=cmd) as qemu: + systap_file = os.path.join(self.tc.files_dir, 'trace_begin_hello.stp') + result = runCmd("crosstap root@%s %s" % (qemu.ip, systap_file)) + self.assertTrue('hello world' in result.output, 'Crosstap failed.')
Signature · 1 line
2.7.4
Quoted 7 lines · Yeoh Ee Peng
QA team were testing crosstap script manually. Add automated tests and systemtap file to test that crosstap script will instructs SystemTap to print hello world in qemu. This test will first built core-image-minimal image with tools-profile & ssh-server-openssh features and build systemtap-native on the host machine. Finally this test will boot the image with qemu and then execute crosstap script to print hello world on qemu.
Thanks, this looks much nicer now, doesn't it? :) I have no further comments, this is fine.
Alex
Hi Alex,
Yes, reusing existing runqemu made this testcase more concise and easier to maintain. Thank you very much for your inputs and sharing!
Thanks,
Ee Peng
-----Original Message-----
From: Alexander Kanavin [mailto:[email protected]]
Sent: Tuesday, March 27, 2018 6:32 PM
To: Yeoh, Ee Peng <[email protected]>; [email protected]
Subject: Re: [OE-core] [PATCH] oe-selftest: crosstap: add tests for crosstap script
Quoted 7 lines · Yeoh Ee Peng
QA team were testing crosstap script manually. Add automated tests and systemtap file to test that crosstap script will instructs SystemTap to print hello world in qemu. This test will first built core-image-minimal image with tools-profile & ssh-server-openssh features and build systemtap-native on the host machine. Finally this test will boot the image with qemu and then execute crosstap script to print hello world on qemu.
Thanks, this looks much nicer now, doesn't it? :) I have no further comments, this is fine.
Alex