From patchwork Mon Aug 10 12:37:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joao Marcos Costa X-Patchwork-Id: 1342822 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BQFqD3w7yz9sRN for ; Mon, 10 Aug 2020 22:37:42 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A12A781260; Mon, 10 Aug 2020 14:37:33 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id C85C481269; Mon, 10 Aug 2020 14:37:31 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 28C26808B3 for ; Mon, 10 Aug 2020 14:37:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=joaomarcos.costa@bootlin.com X-Originating-IP: 46.193.64.106 Received: from localhost.localdomain (eth-east-parth2-46-193-64-106.wb.wifirst.net [46.193.64.106]) (Authenticated sender: joaomarcos.costa@bootlin.com) by relay2-d.mail.gandi.net (Postfix) with ESMTPA id 4CC7540014; Mon, 10 Aug 2020 12:37:28 +0000 (UTC) From: Joao Marcos Costa To: u-boot@lists.denx.de Cc: joaomarcos.costa@bootlin.com, miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com Subject: [PATCH] test/py: fix SquashFS tests Date: Mon, 10 Aug 2020 14:37:27 +0200 Message-Id: <20200810123727.19717-1-joaomarcos.costa@bootlin.com> X-Mailer: git-send-email 2.17.1 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Use "cons.config.build_dir" instead of writing to the source directory (read-only). This will fix the test failures in Azure. Signed-off-by: Joao Marcos Costa --- test/py/tests/test_fs/test_squashfs/sqfs_common.py | 12 ++++++------ .../py/tests/test_fs/test_squashfs/test_sqfs_load.py | 9 +++++---- test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py | 9 +++++---- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/test/py/tests/test_fs/test_squashfs/sqfs_common.py b/test/py/tests/test_fs/test_squashfs/sqfs_common.py index 9ef7b19ad9..2dc344d1b2 100644 --- a/test/py/tests/test_fs/test_squashfs/sqfs_common.py +++ b/test/py/tests/test_fs/test_squashfs/sqfs_common.py @@ -20,9 +20,9 @@ def sqfs_generate_file(path, size): file.close() # generate image with three files and a symbolic link -def sqfs_generate_image(): - src = "test/py/tests/test_fs/test_squashfs/sqfs_src/" - dest = "test/py/tests/test_fs/test_squashfs/sqfs" +def sqfs_generate_image(cons): + src = os.path.join(cons.config.build_dir, "sqfs_src/") + dest = os.path.join(cons.config.build_dir, "sqfs") os.mkdir(src) sqfs_generate_file(src + "frag_only", 100) sqfs_generate_file(src + "blks_frag", 5100) @@ -31,9 +31,9 @@ def sqfs_generate_image(): os.system("mksquashfs " + src + " " + dest + " -b 4096 -always-use-fragments") # removes all files created by sqfs_generate_image() -def sqfs_clean(): - src = "test/py/tests/test_fs/test_squashfs/sqfs_src/" - dest = "test/py/tests/test_fs/test_squashfs/sqfs" +def sqfs_clean(cons): + src = os.path.join(cons.config.build_dir, "sqfs_src/") + dest = os.path.join(cons.config.build_dir, "sqfs") os.remove(src + "frag_only") os.remove(src + "blks_frag") os.remove(src + "blks_only") diff --git a/test/py/tests/test_fs/test_squashfs/test_sqfs_load.py b/test/py/tests/test_fs/test_squashfs/test_sqfs_load.py index 9b828fdf04..eb1baae5c5 100644 --- a/test/py/tests/test_fs/test_squashfs/test_sqfs_load.py +++ b/test/py/tests/test_fs/test_squashfs/test_sqfs_load.py @@ -12,9 +12,10 @@ from sqfs_common import * @pytest.mark.buildconfigspec('fs_squashfs') @pytest.mark.requiredtool('mksquashfs') def test_sqfs_load(u_boot_console): - sqfs_generate_image() + cons = u_boot_console + sqfs_generate_image(cons) command = "sqfsload host 0 $kernel_addr_r " - path = "test/py/tests/test_fs/test_squashfs/sqfs" + path = os.path.join(cons.config.build_dir, "sqfs") try: output = u_boot_console.run_command("host bind 0 " + path) @@ -29,5 +30,5 @@ def test_sqfs_load(u_boot_console): output = u_boot_console.run_command(command + "sym") assert "100 bytes read in" in output except: - sqfs_clean() - sqfs_clean() + sqfs_clean(cons) + sqfs_clean(cons) diff --git a/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py b/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py index dc31f1a50e..3a7b75c778 100644 --- a/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py +++ b/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py @@ -12,8 +12,9 @@ from sqfs_common import * @pytest.mark.buildconfigspec('fs_squashfs') @pytest.mark.requiredtool('mksquashfs') def test_sqfs_ls(u_boot_console): - sqfs_generate_image() - path = "test/py/tests/test_fs/test_squashfs/sqfs" + cons = u_boot_console + sqfs_generate_image(cons) + path = os.path.join(cons.config.build_dir, "sqfs") try: output = u_boot_console.run_command("host bind 0 " + path) output = u_boot_console.run_command("sqfsls host 0") @@ -22,5 +23,5 @@ def test_sqfs_ls(u_boot_console): output = u_boot_console.run_command("sqfsls host 0 xxx") assert "** Cannot find directory. **" in output except: - sqfs_clean() - sqfs_clean() + sqfs_clean(cons) + sqfs_clean(cons)