From: Tobias Waldekranz <tobias@waldekranz.com>
To: barebox@lists.infradead.org
Subject: [PATCH 08/11] ci: pytest: Generate test data for dm-verity
Date: Thu, 18 Sep 2025 09:43:18 +0200 [thread overview]
Message-ID: <20250918074455.891780-9-tobias@waldekranz.com> (raw)
In-Reply-To: <20250918074455.891780-1-tobias@waldekranz.com>
Create a small FAT fs with a couple of files, and the corresponding
hash tree. Then create a modified copy that we can use to make sure
that errors are detected.
Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
---
scripts/generate_testfs.sh | 44 ++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/scripts/generate_testfs.sh b/scripts/generate_testfs.sh
index 3c200bd401..1c358ff846 100755
--- a/scripts/generate_testfs.sh
+++ b/scripts/generate_testfs.sh
@@ -28,3 +28,47 @@ generate_fit()
${KBUILD_OUTPUT}/testfs/barebox-gzipped.fit
}
[ -f .github/testfs/${KBUILD_DEFCONFIG}-gzipped.its ] && generate_fit
+
+alias pad128k="dd if=/dev/zero bs=128k count=1 status=none"
+
+generate_dm_verity()
+{
+ work=$(mktemp -d)
+ cd ${work}
+
+ # Create two dummy files; use lots of padding to make sure that
+ # when we alter the contents of 'english' in root-bad, 'latin' is
+ # still be readable, as their contents wont (a) share the same
+ # hash block and (b) the block cache layer won't accedentally read
+ # the invalid block.
+
+ pad128k >latin
+ echo -n "veritas vos liberabit" >>latin
+ pad128k >>latin
+
+ pad128k >english
+ echo -n "truth will set you free" >>english
+ pad128k >>english
+
+ truncate -s 1M good.fat
+ mkfs.vfat good.fat
+ mcopy -i good.fat latin english ::
+
+ veritysetup format \
+ --root-hash-file=good.hash \
+ good.fat good.verity
+
+ sed 's/truth will set you free/LIAR LIAR PANTS ON FIRE/' \
+ <good.fat >bad.fat
+
+ cd -
+ cp \
+ ${work}/good.fat \
+ ${work}/good.verity \
+ ${work}/good.hash \
+ ${work}/bad.fat \
+ ${KBUILD_OUTPUT}/testfs
+
+ rm -rf ${work}
+}
+generate_dm_verity
--
2.43.0
next prev parent reply other threads:[~2025-09-18 7:45 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-18 7:43 [PATCH 00/11] dm: verity: Add transparent integrity checking target Tobias Waldekranz
2025-09-18 7:43 ` [PATCH 01/11] dm: Add helper to manage a lower device Tobias Waldekranz
2025-09-18 7:43 ` [PATCH 02/11] dm: linear: Refactor to make use of the generalized cdev management Tobias Waldekranz
2025-09-18 7:43 ` [PATCH 03/11] dm: verity: Add transparent integrity checking target Tobias Waldekranz
2025-09-18 13:06 ` Sascha Hauer
2025-09-18 7:43 ` [PATCH 04/11] dm: verity: Add helper to parse superblock information Tobias Waldekranz
2025-09-18 7:43 ` [PATCH 05/11] commands: veritysetup: Create dm-verity devices Tobias Waldekranz
2025-09-18 7:43 ` [PATCH 06/11] ci: pytest: Open up testfs to more consumers than the FIT test Tobias Waldekranz
2025-09-22 15:38 ` Ahmad Fatoum
2025-09-18 7:43 ` [PATCH 07/11] ci: pytest: Enable testfs feature on malta boards Tobias Waldekranz
2025-09-22 15:40 ` Ahmad Fatoum
2025-09-18 7:43 ` Tobias Waldekranz [this message]
2025-09-22 15:41 ` [PATCH 08/11] ci: pytest: Generate test data for dm-verity Ahmad Fatoum
2025-09-18 7:43 ` [PATCH 09/11] test: pytest: add basic dm-verity test Tobias Waldekranz
2025-09-22 15:44 ` Ahmad Fatoum
2025-09-18 7:43 ` [PATCH 10/11] ci: pytest: Centralize feature discovery to a separate step Tobias Waldekranz
2025-09-22 15:45 ` Ahmad Fatoum
2025-09-18 7:43 ` [PATCH 11/11] ci: pytest: Enable device-mapper labgrid tests Tobias Waldekranz
2025-09-22 15:46 ` Ahmad Fatoum
2025-09-18 14:08 ` [PATCH 00/11] dm: verity: Add transparent integrity checking target Sascha Hauer
2025-09-18 15:38 ` Tobias Waldekranz
2025-09-23 6:30 ` Sascha Hauer
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=20250918074455.891780-9-tobias@waldekranz.com \
--to=tobias@waldekranz.com \
--cc=barebox@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox