From patchwork Sat Oct 26 17:52:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Carrier X-Patchwork-Id: 1184775 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=orolia.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=orolia.com header.i=@orolia.com header.b="MI/fhmuA"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 470pVM0bDZz9sPZ for ; Sun, 27 Oct 2019 04:52:58 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5560B8526D; Sat, 26 Oct 2019 17:52:55 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Lfxw7wVtPNYu; Sat, 26 Oct 2019 17:52:54 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 14F35851D6; Sat, 26 Oct 2019 17:52:54 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 7E1C21BF44A for ; Sat, 26 Oct 2019 17:52:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 73A94203A0 for ; Sat, 26 Oct 2019 17:52:52 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Cd30IRpajUJF for ; Sat, 26 Oct 2019 17:52:51 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00077.outbound.protection.outlook.com [40.107.0.77]) by silver.osuosl.org (Postfix) with ESMTPS id AFD2E2039C for ; Sat, 26 Oct 2019 17:52:50 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PjrEn6Ocn4nNfHcGZTdoNBMoY+q2MFFU2WuutBti6X6LK4rPiSBLCGNjI7qug/0Qv9pTv9lKz+8ZN+seIVjcIw1uwmX+DBljBDHN4pRu0SF8WHr9lTfGhN3pDTj2nQwU/+mgm5OLHzXtuu+HZ6qE+Fs5RtKjwl8Szix23XdmTWoJm89vI/SJbJGBijXdWmyEMVKCOePtgLSCXVASuXPTFC5oB91OpM1S6Fw2iHmvOm+Fe+6zO5W3ySl0qzspRKmMF53P+V3HNIPc4F0Ng/beGD3RjNqHdB9pawordTcjY8OCAHf8xuh1WvLQ3T0OZgbG+FoT9jbpV4BsrhMRBZKd4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5Liob84KCj397mULmlkTMG0aXPNoSVkxZTZwPUN8QOU=; b=hgwhRML0C9yixVHdBy63R+NdD594ZLg3hWQBgmNWJaTwtuo24MLCUfulGAz7vBr6UaP/YAuSdSUDnN7UBDhtZ4aQv2VSkgLN6/QgDEu875n2VtL13Awf3X6W6durUWohuQRaxJQzotfKb4Wciu+H7jNRXQBIwds5Vca/JqHqoyZlbVZS73AQh7F88vnDke+7FUsqOxIZoE52Qim/hGXCUJQsoJsSXU9rlEuAf+KDptftJ5xP/4Bp1ZURjRMwyoFaGNixM41UDVB+2q15c5OzKEdjOWICm44tqOw/Ljb5+6SxAywl665mytmEy5EY290Fhez30vCXe7WyU9Mc0rpKjA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=orolia.com; dmarc=pass action=none header.from=orolia.com; dkim=pass header.d=orolia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orolia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5Liob84KCj397mULmlkTMG0aXPNoSVkxZTZwPUN8QOU=; b=MI/fhmuAIS9aPiMoHrOK5VE2jHcMBkLDlevLb8vEDkxDnmKB00D2aBV/LzW+ynRPHeJqR07+qnMwv708ielSFUCnJJ+eHSR7+PAoR4FfqvqdFIvfElAt6b+ZA1bqbSqIr4ZELS36ac6xZ4KqzUf4CgJPeStuP+P78QcckJyN2xc= Received: from AM6PR06MB4341.eurprd06.prod.outlook.com (20.176.243.160) by AM6PR06MB5237.eurprd06.prod.outlook.com (20.178.88.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2387.24; Sat, 26 Oct 2019 17:52:47 +0000 Received: from AM6PR06MB4341.eurprd06.prod.outlook.com ([fe80::a1a4:fdfd:d096:50dc]) by AM6PR06MB4341.eurprd06.prod.outlook.com ([fe80::a1a4:fdfd:d096:50dc%7]) with mapi id 15.20.2387.025; Sat, 26 Oct 2019 17:52:47 +0000 From: Nicolas Carrier To: "buildroot@buildroot.org" Thread-Topic: [PATCH v2 2/2] support/testing/tests/package/: runtime test Thread-Index: AQHVjCYt9NjO2wuCtEySNVBIL1Od1g== Date: Sat, 26 Oct 2019 17:52:47 +0000 Message-ID: <20191026175237.20737-2-nicolas.carrier@orolia.com> References: <20191026175237.20737-1-nicolas.carrier@orolia.com> In-Reply-To: <20191026175237.20737-1-nicolas.carrier@orolia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: LNXP265CA0050.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5d::14) To AM6PR06MB4341.eurprd06.prod.outlook.com (2603:10a6:20b:26::32) authentication-results: spf=none (sender IP is ) smtp.mailfrom=nicolas.carrier@orolia.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.20.1 x-originating-ip: [176.157.204.145] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d655a49b-7200-43d2-51a4-08d75a3d4fb1 x-ms-traffictypediagnostic: AM6PR06MB5237:|AM6PR06MB5237: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-forefront-prvs: 0202D21D2F x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(136003)(346002)(39840400004)(396003)(376002)(366004)(199004)(189003)(102836004)(476003)(6506007)(386003)(5660300002)(256004)(6916009)(2906002)(2351001)(5640700003)(6512007)(6486002)(66066001)(316002)(2501003)(50226002)(71200400001)(71190400001)(6436002)(486006)(76176011)(66556008)(2616005)(52116002)(8676002)(66476007)(25786009)(11346002)(64756008)(99286004)(107886003)(14454004)(66446008)(1730700003)(81156014)(81166006)(8936002)(26005)(86362001)(186003)(36756003)(305945005)(4326008)(1076003)(7736002)(478600001)(66946007)(6116002)(3846002)(44832011)(446003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR06MB5237; H:AM6PR06MB4341.eurprd06.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: orolia.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: z9/hKvmew/TGHdI22ZeC681l2hRNuxp/HKvz0jCjn1trHqIwMVgmLYcHfIFSlZVdot8lazjpItfQ5Vq46CTf0mQSrd9TeSjFvN8iyBmPumsl2hxLo7c+LzPMFSLbZqvpWaORTRnnn/BZ77Tgl4ZiovrBcOcCthbJTFPdgkrAZxwRMh3gLW1ckUSJAuglhGVtctodD8hC7eql3qOFY8sFZN+RNJMkt5ON3TSJ+MF2nqlHWj5NE0Ai0H6l4g8eIYlm9QcG35QL510ZxHV4a1tciSa51JxdrfFjjEBJsfAM9t9PRXuA1rFn0B4CV05SCM7e6xt8WIXdn3HQIDKIdhco+wYOrCj96EzQu3OLkdqu5eXiMa+xhZA/5Cp3LOf5FzIfxruGm+gjWxyAF3QNm/dOuqX4ZICiXdtuumlQN+6xyQPU4JRtSL+MGX9qcztAc39j MIME-Version: 1.0 X-OriginatorOrg: orolia.com X-MS-Exchange-CrossTenant-Network-Message-Id: d655a49b-7200-43d2-51a4-08d75a3d4fb1 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Oct 2019 17:52:47.3809 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a263030c-9c1b-421f-9471-1dec0b29c664 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: bfYE4qLN/4BTKCUFmFGQmgTGBSlYgGkcFVPSlSKZbyuyvguty4VlKjPbsxlN/a6oIAgrm36N+lokEbK/o3zyrvfA+A+ag0XA2Bo30tHcDVc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR06MB5237 Subject: [Buildroot] [PATCH v2 2/2] support/testing/tests/package/: runtime test X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicolas Carrier Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This patch implements a simple test in which a dummy file system image is created, then `bmaptool create` and `bmaptool copy` are used to copy it to another file. Signed-off-by: Nicolas Carrier --- Changes v1 -> v2: - removed spurious trace --- .../tests/package/sample_bmap_tools.sh | 15 ++++++ .../testing/tests/package/test_bmap_tools.py | 53 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100755 support/testing/tests/package/sample_bmap_tools.sh create mode 100644 support/testing/tests/package/test_bmap_tools.py diff --git a/support/testing/tests/package/sample_bmap_tools.sh b/support/testing/tests/package/sample_bmap_tools.sh new file mode 100755 index 0000000000..7c90368c17 --- /dev/null +++ b/support/testing/tests/package/sample_bmap_tools.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# simple test which creates a dummy file system image, then use bmaptool create +# and bmaptool copy to copy it to another file + +set -xeu + +# create the necessary test files +dd if=/dev/zero of=disk.img bs=2M count=1 +mkfs.ext4 disk.img +fallocate -d disk.img +dd if=/dev/zero of=copy.img bs=2M count=1 + +# do a test copy of the file system image +bmaptool create -o disk.img.bmap disk.img +bmaptool copy disk.img copy.img diff --git a/support/testing/tests/package/test_bmap_tools.py b/support/testing/tests/package/test_bmap_tools.py new file mode 100644 index 0000000000..192b84387e --- /dev/null +++ b/support/testing/tests/package/test_bmap_tools.py @@ -0,0 +1,53 @@ +import os +import sys +import infra + +from infra.basetest import BRTest +from abc import ABC, abstractproperty + +class AbstractBmapToolsTest(BRTest, ABC): + __test__ = False + sample_script = "tests/package/sample_bmap_tools.sh" + + copy_script = 'tests/package/copy-sample-script-to-target.sh' + config = f''' + {infra.basetest.BASIC_TOOLCHAIN_CONFIG} + BR2_TARGET_ROOTFS_CPIO=y + BR2_PACKAGE_BMAP_TOOLS=y + BR2_ROOTFS_POST_BUILD_SCRIPT="{infra.filepath(copy_script)}" + BR2_ROOTFS_POST_SCRIPT_ARGS="{infra.filepath(sample_script)}" + # BR2_TARGET_ROOTFS_TAR is not set + BR2_PACKAGE_UTIL_LINUX=y + BR2_PACKAGE_UTIL_LINUX_FALLOCATE=y + BR2_PACKAGE_E2FSPROGS=y + BR2_PACKAGE_UTIL_LINUX_LIBUUID=y + ''' + + def __init__(self, names): + super(AbstractBmapToolsTest, self).__init__(names) + self.config += f"BR2_PACKAGE_PYTHON{self.python_version}=y" + + @abstractproperty + def python_version(self): + pass + + def login(self): + cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio") + self.emulator.boot(arch="armv5", + kernel="builtin", + options=["-initrd", cpio_file]) + self.emulator.login() + + def test_run(self): + self.login() + cmd = f"/root/{os.path.basename(self.sample_script)}" + _, exit_code = self.emulator.run(cmd, timeout=10) + self.assertEqual(exit_code, 0) + +class TestPy2BmapTools(AbstractBmapToolsTest): + __test__ = True + python_version = "" + +class TestPy3BmapTools(AbstractBmapToolsTest): + __test__ = True + python_version = "3"