From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mail.openembedded.org (Postfix) with ESMTP id 1D649784CC for ; Tue, 27 Mar 2018 08:50:35 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2018 01:50:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,366,1517904000"; d="scan'208";a="27868957" Received: from echidna.jf.intel.com ([10.54.77.42]) by fmsmga008.fm.intel.com with ESMTP; 27 Mar 2018 01:50:35 -0700 From: Yeoh Ee Peng To: openembedded-core@lists.openembedded.org Date: Mon, 26 Mar 2018 18:37:00 -0700 Message-Id: <1522114620-28569-1-git-send-email-ee.peng.yeoh@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [PATCH] oe-selftest: crosstap: add tests for crosstap script X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Mar 2018 08:50:36 -0000 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. Signed-off-by: Yeoh Ee Peng --- 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 diff --git a/meta/lib/oeqa/files/trace_begin_hello.stp b/meta/lib/oeqa/files/trace_begin_hello.stp new file mode 100644 index 0000000..5ad5f15 --- /dev/null +++ b/meta/lib/oeqa/files/trace_begin_hello.stp @@ -0,0 +1,5 @@ +probe begin +{ + printf ("hello world\n") + exit () +} \ No newline at end of file diff --git a/meta/lib/oeqa/selftest/cases/crosstap.py b/meta/lib/oeqa/selftest/cases/crosstap.py new file mode 100644 index 0000000..57523cb --- /dev/null +++ b/meta/lib/oeqa/selftest/cases/crosstap.py @@ -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.') -- 2.7.4