Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA48AC07E95 for ; Fri, 2 Jul 2021 19:49:06 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5CCC661353 for ; Fri, 2 Jul 2021 19:49:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5CCC661353 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 93697829BE; Fri, 2 Jul 2021 21:49:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="s6/GrmGe"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 59583829C3; Fri, 2 Jul 2021 21:49:02 +0200 (CEST) Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 76A7082916 for ; Fri, 2 Jul 2021 21:48:58 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qk1-x72e.google.com with SMTP id f6so10527138qka.0 for ; Fri, 02 Jul 2021 12:48:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=yOnxi5rNNoHyNBzQYIN/eyn7axQ3JGxu8BOxS0Dhdrg=; b=s6/GrmGeI4Va9dULqWmlOp6gVYgxCXhab/70wZUvQnRlx9DPMi7c5JuuCqoGKlGgje U9rt/rsbT+4QdmqvMzWeQ8SZYsl/tJm3f/yHu2Luz2p2IMM3wdK2BkM4eeSUAquTAA0A m9mwImmOu0L0U2hLZkcix3c8n2i7gUaK7YYCQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=yOnxi5rNNoHyNBzQYIN/eyn7axQ3JGxu8BOxS0Dhdrg=; b=R1nGFsmRwCEHDfnr7qsCUlUzdITQM0hKgcB+PX6g/+c94i42tWddrNBkzwEp3RIiKx n8RYEo8Exnvs22+vnCwyrdgA1GufqeWlStgiqcdjDqKOJG/fCwSpD2qktqIgo1dZFB2E RD5NaqMxWRXNpMDjiKcdZzKjMgD7+vwMXVCQ/Y2/VL5Y+tnIPGL+0ZC6NovW5y2pxhCr H6g57BD/8qXrK+YTdOYJbesZr2dKKZjfE70HPS8tCogYi1OMupRYVH0cwtwQouFt8vZr 5p6sAeAxQ9RaIUEy5L3PiyZEAdCZDgcj4sgP6Loij89m1I9Dm+aJmJ6zuXW7cJP4/DeG opZw== X-Gm-Message-State: AOAM5326JBMq6MgQUH1sycSO8MvVmJawmsipVsM0I9N4NBSm016rVfW/ 42RkQhNrawJahsEjn2mujK+kug== X-Google-Smtp-Source: ABdhPJz0oQXgUhuBEKbDUfObn3kKlYAfb16NCf3Nu3DRVTjG9b8sL1QmrhcyFbtNeEt6sJOU5fsStA== X-Received: by 2002:ae9:f00c:: with SMTP id l12mr1498115qkg.141.1625255337222; Fri, 02 Jul 2021 12:48:57 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-447a-194c-2139-e81a.res6.spectrum.com. [2603:6081:7b01:cbda:447a:194c:2139:e81a]) by smtp.gmail.com with ESMTPSA id 128sm1826681qkf.102.2021.07.02.12.48.55 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Jul 2021 12:48:56 -0700 (PDT) Date: Fri, 2 Jul 2021 15:48:54 -0400 From: Tom Rini To: Sean Anderson Cc: u-boot@lists.denx.de, Andy Shevchenko , Alper Nebi Yasak , Heinrich Schuchardt , Akashi Takahiro , Simon Glass Subject: Re: [RFC] Start using guestfish for U-Boot fs tests Message-ID: <20210702194854.GB9516@bill-the-cat> References: <20210702190107.GA9516@bill-the-cat> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="rE73rQd35h8teUzG" Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.9.4 (2018-02-28) 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.103.2 at phobos.denx.de X-Virus-Status: Clean --rE73rQd35h8teUzG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 02, 2021 at 03:22:14PM -0400, Sean Anderson wrote: >=20 >=20 > On 7/2/21 3:01 PM, Tom Rini wrote: > > Hey all, > > > > I started taking a look at moving to guestfish to see if this resolves > > the latest problem I've run in to: > > https://source.denx.de/u-boot/u-boot/-/jobs/284763#L307 > > which I think is due to guestmount not being done in time for the test. > > So I started converting things to use guestfish directly: > > > > diff --git a/test/py/tests/test_fs/conftest.py b/test/py/tests/test_fs/= conftest.py > > index 7325486cdb1a..e8899cfdd118 100644 > > --- a/test/py/tests/test_fs/conftest.py > > +++ b/test/py/tests/test_fs/conftest.py > > @@ -265,10 +265,10 @@ def fs_obj_basic(request, u_boot_config): > > fs_ubtype =3D fstype_to_ubname(fs_type) > > check_ubconfig(u_boot_config, fs_ubtype) > > > > - mount_dir =3D u_boot_config.persistent_data_dir + '/mnt' > > + data_dir =3D u_boot_config.persistent_data_dir + '/data' > > > > - small_file =3D mount_dir + '/' + SMALL_FILE > > - big_file =3D mount_dir + '/' + BIG_FILE > > + small_file =3D data_dir + '/' + SMALL_FILE > > + big_file =3D data_dir + '/' + BIG_FILE > > > > try: > > > > @@ -279,26 +279,14 @@ def fs_obj_basic(request, u_boot_config): > > return > > > > try: > > - check_call('mkdir -p %s' % mount_dir, shell=3DTrue) > > + check_call('mkdir -p %s' % data_dir, shell=3DTrue) > > except CalledProcessError as err: > > pytest.skip('Preparing mount folder failed for filesystem: ' = + fs_type + '. {}'.format(err)) > > call('rm -f %s' % fs_img, shell=3DTrue) > > return > > > > try: > > - # Mount the image so we can populate it. > > - mount_fs(fs_type, fs_img, mount_dir) > > - except CalledProcessError as err: > > - pytest.skip('Mounting to folder failed for filesystem: ' + fs_= type + '. {}'.format(err)) > > - call('rmdir %s' % mount_dir, shell=3DTrue) > > - call('rm -f %s' % fs_img, shell=3DTrue) > > - return > > - > > - try: > > - # Create a subdirectory. > > - check_call('mkdir %s/SUBDIR' % mount_dir, shell=3DTrue) > > - > > - # Create big file in this image. > > + # Create big file to copy in to the image. > > # Note that we work only on the start 1MB, couple MBs in the = 2GB range > > # and the last 1 MB of the huge 2.5GB file. > > # So, just put random values only in those areas. > > @@ -309,10 +297,14 @@ def fs_obj_basic(request, u_boot_config): > > check_call('dd if=3D/dev/urandom of=3D%s bs=3D1M count=3D1 se= ek=3D2499' > > % big_file, shell=3DTrue) > > > > - # Create a small file in this image. > > + # Create a small file to copy in to the image. > > check_call('dd if=3D/dev/urandom of=3D%s bs=3D1M count=3D1' > > % small_file, shell=3DTrue) > > > > + # Copy the files in to the image and add a subdirectory. > > + # Create a subdirectory. > > + check_call('guestfish add %s : run : mount /dev/sda / : mkdir = /SUBDIR : copy-in %s %s /' > > + % (fs_img, big_file, small_file), shell=3DTrue) > > # Delete the small file copies which possibly are written as = part of a > > # previous test. > > # check_call('rm -f "%s.w"' % MB1, shell=3DTrue) > > @@ -357,13 +349,11 @@ def fs_obj_basic(request, u_boot_config): > > > > except CalledProcessError as err: > > pytest.skip('Setup failed for filesystem: ' + fs_type + '. {}= '.format(err)) > > - umount_fs(mount_dir) > > return > > else: > > - umount_fs(mount_dir) > > yield [fs_ubtype, fs_img, md5val] > > finally: > > - call('rmdir %s' % mount_dir, shell=3DTrue) > > + call('rmdir %s' % data_dir, shell=3DTrue) > > call('rm -f %s' % fs_img, shell=3DTrue) > > > > # > > > > The problem here is that a test run went from taking about 5 minutes to > > taking about 17 minutes. I can reduce this to closer to 15 minutes with > > LIBGUESTFS_BACKEND=3Ddirect and using libguestfs-make-fixed-appliance to > > make an appliance we reuse. But that's still too long to be usable. > > I'm hoping someone has some ideas here on how to improve things. >=20 > Have we tried using fuse? I've had good results with fuse2fs (although > it does not support the journal), and there is a fusefat package as > well. Example usage: >=20 > mkdir -p root > truncate -s 1G root.img > mkfs.ext4 -q $@ > fuse2fs -o fakeroot root.img root > fakeroot tar -C root -xf rootfs.tar > fusermount -u root >=20 > If you don't need correct permissions, you can skip the fakeroot stuff. I think fuse directly (guestfs stuff uses fuse under the hood) is probably out as we wouldn't be able to convert squashfs for example. --=20 Tom --rE73rQd35h8teUzG Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmDfbZkACgkQFHw5/5Y0 tyxBmQv+MbB/WCDFkmrnyZcy2R8zGmFTYhMqh+SMNhzyEMi/jUL/qxm5G4Wfl3u3 9hfk8MUyadR7Wqjc3rM4tszn+j9Xhx74OK8P0F9SQ5hrLqH64rXDNTsjPtNpBG6U AElT/P8BDYuPFC1xTy4n+CcjzzJ1XOOGIwI8Xr1VCc7tV1+Tqzfor+FqoLAxVx6n Rq12PfAM3WyrhcvYul4V+hjJBSypJp8EiG8lgasUhUBQWXpO7p221+vgSmE+jNyK kv+rBRCuA5G04Zict8yhLrXoalciGErf5mUdbpbOCLEDyYrRxypPyZWlHpQs5yDJ ATlOb6eTVgWexHKwp7VfTR7TA8Xwomq+AmMnHvX9owTzMXvvL57Pcze2pTRjwd8U YleayHk+ibsha/I9v5qdrUICNiRa1dJmZyNhkFr8HKuksTIDGCnkkQZdkDLPkUjg GjvFsbekR/OmU0+e0mEHyrpp591+wYPqFJVSIxYx5L7MavU8S0KTih5uOfUvWY2o NA8XfFTn =qKY7 -----END PGP SIGNATURE----- --rE73rQd35h8teUzG--