All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: Julien Olivain <ju.o@free.fr>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH 1/1] support/testing: add parted runtime test
Date: Mon, 26 Aug 2024 18:55:26 +0200	[thread overview]
Message-ID: <20240826185526.52a21c90@windsurf> (raw)
In-Reply-To: <20240825115239.158016-1-ju.o@free.fr>

On Sun, 25 Aug 2024 13:52:39 +0200
Julien Olivain <ju.o@free.fr> wrote:

> Signed-off-by: Julien Olivain <ju.o@free.fr>
> ---
>  DEVELOPERS                                   |   1 +
>  support/testing/tests/package/test_parted.py | 107 +++++++++++++++++++
>  2 files changed, 108 insertions(+)
>  create mode 100644 support/testing/tests/package/test_parted.py

Thanks, applied to next! Just one comment below.

> +        # For each partition, we create a mount point directory, mount
> +        # the filesystem, copy the reference data file in it, sync the
> +        # filesystem, and compute the sha256 hash of the file. This
> +        # sequence will exercise a bit the partitions and filesystems
> +        # in read/write operations.
> +        for part in range(1, 4):
> +            self.assertRunOk(f"mkdir -p /tmp/MyPart{part}")
> +            self.assertRunOk(f"mount {dev}{part} /tmp/MyPart{part}")
> +            self.assertRunOk(f"cp /tmp/{data_file} /tmp/MyPart{part}/")
> +            self.assertRunOk("sync")

I wasn't sure whether sync or a umount/mount cycle was more appropriate here.

> +            out, ret = self.emulator.run(f"( cd /tmp/MyPart{part} && {hash_cmd} )")

You could have used "cmp" instead to compare files. No need to compute
the hash ahead of time, no need to parse the output of sha256sum, etc:
cmp returns a 0 error code when the files are identical, a non-zero
error code otherwise, so self.assertRunOk() would have worked.

Thanks!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

      reply	other threads:[~2024-08-26 16:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-25 11:52 [Buildroot] [PATCH 1/1] support/testing: add parted runtime test Julien Olivain
2024-08-26 16:55 ` Thomas Petazzoni via buildroot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240826185526.52a21c90@windsurf \
    --to=buildroot@buildroot.org \
    --cc=ju.o@free.fr \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.