summaryrefslogtreecommitdiffstats
path: root/tests/f_verity/mkimage.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtests/f_verity/mkimage.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/f_verity/mkimage.sh b/tests/f_verity/mkimage.sh
new file mode 100755
index 0000000..565083e
--- /dev/null
+++ b/tests/f_verity/mkimage.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# This is the script that was used to create the image.gz in this directory.
+
+set -e -u
+
+mkdir -p mnt
+umount mnt &> /dev/null || true
+
+dd if=/dev/zero of=image bs=4096 count=128
+mke2fs -O 'verity,extents' -b 4096 -N 128 image
+mount image mnt
+
+# Create a verity file, but make it fragmented so that it needs at least one
+# extent tree index node, in order to cover the scan_extent_node() case.
+for i in {1..80}; do
+ head -c 4096 /dev/zero > mnt/tmp_$i
+done
+for i in {1..80..2}; do
+ rm mnt/tmp_$i
+done
+head -c $((40 * 4096)) /dev/zero > mnt/file
+fsverity enable mnt/file
+rm mnt/tmp_*
+
+umount mnt
+rmdir mnt
+gzip -9 -f image