From cff5d3aa37c4f73b7f8c1f6e42321310834db040 Mon Sep 17 00:00:00 2001 From: Matou Date: Tue, 26 May 2026 20:31:38 +0300 Subject: [PATCH] added t073 --- img/gen.sh | 40 +++++++++++++++++++++++++++++++++------- test/t073/ref.log | 11 +++++++++++ test/t073/run.us | 4 ++++ test/t073/tags.txt | 3 +++ test/t073/timeout.txt | 1 + 5 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 test/t073/ref.log create mode 100644 test/t073/run.us create mode 100644 test/t073/tags.txt create mode 100644 test/t073/timeout.txt diff --git a/img/gen.sh b/img/gen.sh index ca98128..f76d1d1 100755 --- a/img/gen.sh +++ b/img/gen.sh @@ -946,12 +946,12 @@ ext2_symlinks.qcow2 () { fallocate -l 15MiB $img_raw $SGDISK --clear --new=0:0:0 $img_raw > /dev/null - local LOOP_DEV=$(sudo losetup --find --show -P $img_raw) + sudo losetup -P $LOOP_DEV $img_raw local p1="$LOOP_DEV"p1 $MKFS_EXT2 -b 1024 $EXT_MKFS_OPTS $p1 - sudo debugfs -w -R "set_super_value hash_seed $EXT_HASH_SEED" $p1 > /dev/null 2>&1 + sudo debugfs -w -R "set_super_value hash_seed $EXT_HASH_SEED" $p1 sudo mount $p1 $TEMP_DIR sudo chown $USER $TEMP_DIR -R @@ -1267,12 +1267,12 @@ ext2_extra_isize.qcow2 () { fallocate -l 15MiB $img_raw $SGDISK --clear --new=0:0:0 $img_raw > /dev/null - local LOOP_DEV=$(sudo losetup --find --show -P $img_raw) + sudo losetup -P $LOOP_DEV $img_raw local p1="$LOOP_DEV"p1 $MKFS_EXT2 -b 1024 -I 256 -O extra_isize $EXT_MKFS_OPTS $p1 - sudo debugfs -w -R "set_super_value hash_seed $EXT_HASH_SEED" $p1 > /dev/null 2>&1 + sudo debugfs -w -R "set_super_value hash_seed $EXT_HASH_SEED" $p1 sudo mount $p1 $TEMP_DIR sudo chown $USER $TEMP_DIR -R @@ -1308,8 +1308,34 @@ ext2_extra_isize.qcow2 () { sudo umount $TEMP_DIR - sudo debugfs -w -R "set_inode_field file_ctime_crtime ctime 20200101000000" $p1 > /dev/null 2>&1 - sudo debugfs -w -R "set_inode_field file_ctime_crtime crtime 20100101000000" $p1 > /dev/null 2>&1 + sudo debugfs -w -R "set_inode_field file_ctime_crtime ctime 20200101000000" $p1 + sudo debugfs -w -R "set_inode_field file_ctime_crtime crtime 20100101000000" $p1 + + sudo losetup -d $LOOP_DEV + + qemu-img convert $QEMU_IMG_CONVERT_OPTS $img_raw $img + rm $img_raw +} + +ext2_rev0.qcow2 () { + local img=$FUNCNAME + local img_raw=$(basename $img .qcow2).raw + + fallocate -l 18MiB $img_raw + $SGDISK --clear --new=0:0:0 $img_raw > /dev/null + sudo losetup -P $LOOP_DEV $img_raw + local p1="$LOOP_DEV"p1 + + $MKFS_EXT2 -E revision=0 $EXT_MKFS_OPTS $p1 + + sudo debugfs -w -R "set_super_value feature_compat 0" $p1 + sudo debugfs -w -R "set_super_value feature_incompat 0" $p1 + sudo debugfs -w -R "set_super_value feature_ro_compat 0" $p1 + sudo debugfs -w -R "set_super_value first_ino 0" $p1 + sudo debugfs -w -R "set_super_value inode_size 0" $p1 + + # Zero out all modern extensions after the UUID (offset 120 to 1024) + sudo dd if=/dev/zero of=$p1 bs=1 seek=$((1024 + 120)) count=$((1024 - 120)) conv=notrunc sudo losetup -d $LOOP_DEV @@ -1329,7 +1355,7 @@ images=(gpt_large.qcow2 gpt_partitions_s05k.qcow2 gpt_partitions_s4k.qcow2 exfat_s05k_c16k_b16k.qcow2 exfat_s05k_c8k_b8k.qcow2 xfs_samehash_s05k.raw ext2_s05k.qcow2 ext4_s05k.qcow2 fat12_s05k.qcow2 fat16_s05k.qcow2 iso9660_s2k_dir_all.qcow2 ext2_extra_isize.qcow2 - ext2_symlinks.qcow2) + ext2_symlinks.qcow2 ext2_rev0.qcow2) TEMP_DIR=$(mktemp -d) LOOP_DEV=$(losetup --find) diff --git a/test/t073/ref.log b/test/t073/ref.log new file mode 100644 index 0000000..c0705d1 --- /dev/null +++ b/test/t073/ref.log @@ -0,0 +1,11 @@ +/> umka_boot +/> disk_add ../../img/ext2_rev0.qcow2 hd0 -c 0 +/hd0: sector_size=512, capacity=36864 (18 MiB), num_partitions=1 +/hd0/1: fs=ext, start=2048 (1 MiB), length=32768 (16 MiB) +/> ls70 /hd0/1/ +status = 6 end_of_file, count = 3 +total = 3 +-h--f . +-h--f .. +----f lost+found +/> disk_del hd0 diff --git a/test/t073/run.us b/test/t073/run.us new file mode 100644 index 0000000..881a20e --- /dev/null +++ b/test/t073/run.us @@ -0,0 +1,4 @@ +umka_boot +disk_add ../../img/ext2_rev0.qcow2 hd0 -c 0 +ls70 /hd0/1/ +disk_del hd0 \ No newline at end of file diff --git a/test/t073/tags.txt b/test/t073/tags.txt new file mode 100644 index 0000000..5e5035c --- /dev/null +++ b/test/t073/tags.txt @@ -0,0 +1,3 @@ +syscall:f70 +fs:ext,ext2 +ext:rev0 diff --git a/test/t073/timeout.txt b/test/t073/timeout.txt new file mode 100644 index 0000000..39e1887 --- /dev/null +++ b/test/t073/timeout.txt @@ -0,0 +1 @@ +10s