Add tests t092 and t093 for ext4 flex_bg writing support
This commit was merged in pull request #12.
This commit is contained in:
+138
-3
@@ -775,6 +775,74 @@ fat32_test0.raw () {
|
||||
sudo losetup -d $LOOP_DEV
|
||||
}
|
||||
|
||||
ext4_flex_bg_coverage.qcow2 () {
|
||||
local img=$FUNCNAME
|
||||
local img_raw=$(basename $img .qcow2).raw
|
||||
|
||||
fallocate -l 64MiB $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_EXT4 $EXT_MKFS_OPTS -m 0 -b 1024 -g 8192 -G 2 -O none,filetype,sparse_super,large_file,flex_bg $p1
|
||||
sudo debugfs -w -R "set_super_value hash_seed $EXT_HASH_SEED" $p1
|
||||
sudo mount -o sync $p1 $TEMP_DIR
|
||||
sudo chown $USER $TEMP_DIR -R
|
||||
|
||||
mkdir $TEMP_DIR/dir0
|
||||
dd if=/dev/zero of=$TEMP_DIR/dir0/fill0 bs=1M count=16 2>/dev/null || true
|
||||
|
||||
mkdir $TEMP_DIR/dir1
|
||||
touch $TEMP_DIR/dir1/f1.txt
|
||||
dd if=/dev/zero of=$TEMP_DIR/dir1/fill1 bs=1M count=16 2>/dev/null || true
|
||||
|
||||
mkdir $TEMP_DIR/dir2
|
||||
touch $TEMP_DIR/dir2/f2.txt
|
||||
dd if=/dev/zero of=$TEMP_DIR/dir2/fill2 bs=1M count=16 2>/dev/null || true
|
||||
|
||||
mkdir $TEMP_DIR/dir3
|
||||
touch $TEMP_DIR/dir3/f3.txt
|
||||
dd if=/dev/zero of=$TEMP_DIR/dir3/fill3 bs=1M count=16 2>/dev/null || true
|
||||
|
||||
cat /dev/zero > $TEMP_DIR/fill_end 2>/dev/null || true
|
||||
for i in {1..10}; do
|
||||
dd if=/dev/zero of=$TEMP_DIR/fill_$i bs=1K 2>/dev/null || true
|
||||
done
|
||||
rm $TEMP_DIR/dir2/fill2
|
||||
|
||||
sudo umount $TEMP_DIR
|
||||
sudo losetup -d $LOOP_DEV
|
||||
|
||||
qemu-img convert $QEMU_IMG_CONVERT_OPTS $img_raw $img
|
||||
rm $img_raw
|
||||
}
|
||||
|
||||
ext4_flex_bg_full.qcow2 () {
|
||||
local img=$FUNCNAME
|
||||
local img_raw=$(basename $img .qcow2).raw
|
||||
|
||||
fallocate -l 16MiB $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_EXT4 $EXT_MKFS_OPTS -m 0 -b 1024 -O none,filetype,sparse_super,large_file,flex_bg $p1
|
||||
sudo debugfs -w -R "set_super_value hash_seed $EXT_HASH_SEED" $p1
|
||||
sudo mount -o sync $p1 $TEMP_DIR
|
||||
sudo chown $USER $TEMP_DIR -R
|
||||
|
||||
cat /dev/zero > $TEMP_DIR/fill 2>/dev/null || true
|
||||
for i in {1..10}; do
|
||||
dd if=/dev/zero of=$TEMP_DIR/fill_$i bs=1K 2>/dev/null || true
|
||||
done
|
||||
|
||||
sudo umount $TEMP_DIR
|
||||
sudo losetup -d $LOOP_DEV
|
||||
|
||||
qemu-img convert $QEMU_IMG_CONVERT_OPTS $img_raw $img
|
||||
rm $img_raw
|
||||
}
|
||||
|
||||
exfat_s05k_c16k_b16k.qcow2 () {
|
||||
local img=$FUNCNAME
|
||||
local img_raw=$(basename $img .qcow2).raw
|
||||
@@ -1310,7 +1378,7 @@ ext2_extra_isize.qcow2 () {
|
||||
|
||||
sudo debugfs -w -R "set_super_value hash_seed $EXT_HASH_SEED" $p1
|
||||
|
||||
sudo mount $p1 $TEMP_DIR
|
||||
sudo mount -o sync $p1 $TEMP_DIR
|
||||
sudo chown $USER $TEMP_DIR -R
|
||||
|
||||
mkdir $TEMP_DIR/dira
|
||||
@@ -1380,6 +1448,27 @@ ext2_rev0.qcow2 () {
|
||||
rm $img_raw
|
||||
}
|
||||
|
||||
ext4_flex_bg.qcow2 () {
|
||||
local img=$FUNCNAME
|
||||
local img_raw=$(basename $img .qcow2).raw
|
||||
|
||||
fallocate -l 256MiB $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_EXT4 $EXT_MKFS_OPTS -b 1024 -O none,filetype,sparse_super,large_file,flex_bg $p1
|
||||
sudo debugfs -w -R "set_super_value hash_seed $EXT_HASH_SEED" $p1
|
||||
sudo mount -o sync $p1 $TEMP_DIR
|
||||
sudo chown $USER $TEMP_DIR -R
|
||||
|
||||
echo "This is a read test for flex_bg" > $TEMP_DIR/read_test.txt
|
||||
echo "This will be overwritten" > $TEMP_DIR/write_test.txt
|
||||
|
||||
mkdir $TEMP_DIR/full_dir
|
||||
dd if=/dev/zero of=$TEMP_DIR/full_dir/huge_file bs=1M count=130
|
||||
|
||||
sudo umount $TEMP_DIR
|
||||
ext4_csum.qcow2 () {
|
||||
local img=$FUNCNAME
|
||||
local img_raw=$(basename $img .qcow2).raw
|
||||
@@ -1416,7 +1505,52 @@ ext4_csum.qcow2 () {
|
||||
rm $img_raw
|
||||
}
|
||||
|
||||
images=(gpt_large.qcow2 gpt_partitions_s05k.qcow2 gpt_partitions_s4k.qcow2
|
||||
|
||||
ext4_flex_bg_frag.qcow2 () {
|
||||
local img=$FUNCNAME
|
||||
local img_raw=$(basename $img .qcow2).raw
|
||||
|
||||
fallocate -l 64MiB $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_EXT4 -F -q -I 256 -b 1024 -O none,filetype,sparse_super,large_file,flex_bg -g 1024 -G 8 $p1
|
||||
|
||||
cat <<EOF > "$TEMP_DIR/debugfs_cmds.txt"
|
||||
mkdir /test_dir
|
||||
mkdir /dummy_dir
|
||||
EOF
|
||||
|
||||
local temp_dummy="$TEMP_DIR/dummy_temp.txt"
|
||||
echo "X" > "$temp_dummy"
|
||||
|
||||
for i in {1..4864}; do
|
||||
echo "write $temp_dummy /dummy_dir/dummy$i" >> "$TEMP_DIR/debugfs_cmds.txt"
|
||||
done
|
||||
|
||||
local temp_txt="$TEMP_DIR/existing_temp.txt"
|
||||
echo "A" > "$temp_txt"
|
||||
echo "write $temp_txt /test_dir/target.bin" >> "$TEMP_DIR/debugfs_cmds.txt"
|
||||
|
||||
sudo debugfs -w -f "$TEMP_DIR/debugfs_cmds.txt" $p1 >/dev/null 2>&1
|
||||
|
||||
for i in {1..4864}; do
|
||||
echo "rm /dummy_dir/dummy$i" >> "$TEMP_DIR/debugfs_rm_cmds.txt"
|
||||
done
|
||||
sudo debugfs -w -f "$TEMP_DIR/debugfs_rm_cmds.txt" $p1 >/dev/null 2>&1
|
||||
|
||||
rm "$TEMP_DIR/debugfs_cmds.txt"
|
||||
rm "$TEMP_DIR/dummy_temp.txt"
|
||||
rm "$TEMP_DIR/existing_temp.txt"
|
||||
rm "$TEMP_DIR/debugfs_rm_cmds.txt"
|
||||
|
||||
qemu-img convert $QEMU_IMG_CONVERT_OPTS $img_raw $img
|
||||
rm $img_raw
|
||||
}
|
||||
|
||||
images=(gpt_large.qcow2 ext4_flex_bg_frag.qcow2 gpt_partitions_s05k.qcow2 gpt_partitions_s4k.qcow2
|
||||
|
||||
kolibri.raw jfs.qcow2 xfs_lookup_v4.qcow2 xfs_lookup_v5.qcow2
|
||||
xfs_nrext64.qcow2 xfs_bigtime.qcow2 xfs_borg_bit.qcow2
|
||||
xfs_short_dir_i8.qcow2 xfs_v4_ftype0_s05k_b2k_n8k.qcow2
|
||||
@@ -1428,7 +1562,8 @@ 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_rev0.qcow2 ext4_csum.qcow2 ext2_unicode.qcow2)
|
||||
ext2_symlinks.qcow2 ext2_rev0.qcow2 ext4_csum.qcow2 ext2_unicode.qcow2 ext4_flex_bg.qcow2
|
||||
ext4_flex_bg_coverage.qcow2 ext4_flex_bg_full.qcow2)
|
||||
|
||||
TEMP_DIR=$(mktemp -d)
|
||||
LOOP_DEV=$(sudo losetup --find)
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
/> umka_boot
|
||||
/> disk_add ../../img/ext4_flex_bg.qcow2 hd0 -c 524288
|
||||
/hd0: sector_size=512, capacity=524288 (256 MiB), num_partitions=1
|
||||
/hd0/1: fs=ext, start=2048 (1 MiB), length=520192 (254 MiB)
|
||||
/>
|
||||
/> ls70 /hd0/1
|
||||
status = 6 end_of_file, count = 6
|
||||
total = 6
|
||||
-h--f .
|
||||
-h--f ..
|
||||
----f lost+found
|
||||
----- read_test.txt
|
||||
----- write_test.txt
|
||||
----f full_dir
|
||||
/> stat70 /hd0/1/read_test.txt
|
||||
status = 0 success
|
||||
attr: -----
|
||||
size: 32
|
||||
/> read70 /hd0/1/read_test.txt 0 31 -b
|
||||
status = 0 success, count = 31
|
||||
5468697320697320612072656164207465737420666f7220666c65785f6267
|
||||
/>
|
||||
/> rm70 /hd0/1/read_test.txt
|
||||
status = 0 success
|
||||
/> ls70 /hd0/1
|
||||
status = 6 end_of_file, count = 5
|
||||
total = 5
|
||||
-h--f .
|
||||
-h--f ..
|
||||
----f lost+found
|
||||
----- write_test.txt
|
||||
----f full_dir
|
||||
/>
|
||||
/> mkdir70 /hd0/1/new_dir
|
||||
status = 0 success
|
||||
/> ls70 /hd0/1/new_dir
|
||||
status = 6 end_of_file, count = 2
|
||||
total = 2
|
||||
-h--f .
|
||||
-h--f ..
|
||||
/> create70 /hd0/1/new_dir/new_file.txt -h 68656c6c6f
|
||||
status = 0 success, count = 5
|
||||
/> stat70 /hd0/1/new_dir/new_file.txt
|
||||
status = 0 success
|
||||
attr: -----
|
||||
size: 5
|
||||
/> read70 /hd0/1/new_dir/new_file.txt 0 5 -b
|
||||
status = 0 success, count = 5
|
||||
68656c6c6f
|
||||
/>
|
||||
/> ls70 /hd0/1/full_dir
|
||||
status = 6 end_of_file, count = 3
|
||||
total = 3
|
||||
-h--f .
|
||||
-h--f ..
|
||||
----- huge_file
|
||||
/> mkdir70 /hd0/1/full_dir/spill_dir
|
||||
status = 0 success
|
||||
/> ls70 /hd0/1/full_dir/spill_dir
|
||||
status = 6 end_of_file, count = 2
|
||||
total = 2
|
||||
-h--f .
|
||||
-h--f ..
|
||||
/> create70 /hd0/1/full_dir/spill_dir/spill_file.txt -h 7370696c6c6f766572
|
||||
status = 0 success, count = 9
|
||||
/> stat70 /hd0/1/full_dir/spill_dir/spill_file.txt
|
||||
status = 0 success
|
||||
attr: -----
|
||||
size: 9
|
||||
/> read70 /hd0/1/full_dir/spill_dir/spill_file.txt 0 9 -b
|
||||
status = 0 success, count = 9
|
||||
7370696c6c6f766572
|
||||
/>
|
||||
/> rm70 /hd0/1/full_dir/spill_dir/spill_file.txt
|
||||
status = 0 success
|
||||
/> rm70 /hd0/1/full_dir/spill_dir
|
||||
status = 0 success
|
||||
/>
|
||||
/> disk_del hd0
|
||||
/>
|
||||
/> disk_add ../../img/ext4_flex_bg_coverage.qcow2 hd1 -c 131072
|
||||
/hd1: sector_size=512, capacity=131072 (64 MiB), num_partitions=1
|
||||
/hd1/1: fs=ext, start=2048 (1 MiB), length=126976 (62 MiB)
|
||||
/> write70 /hd1/1/dir1/f1.txt 0 -h 1234
|
||||
status = 0 success, count = 2
|
||||
/> write70 /hd1/1/dir3/f3.txt 0 -h 1234
|
||||
status = 0 success, count = 2
|
||||
/> disk_del hd1
|
||||
/>
|
||||
/> disk_add ../../img/ext4_flex_bg_full.qcow2 hd2 -c 32768
|
||||
/hd2: sector_size=512, capacity=32768 (16 MiB), num_partitions=1
|
||||
/hd2/1: fs=ext, start=2048 (1 MiB), length=28672 (14 MiB)
|
||||
/> create70 /hd2/1/fail.txt -h 1234
|
||||
status = 8 disk_full
|
||||
/> disk_del hd2
|
||||
@@ -0,0 +1,36 @@
|
||||
umka_boot
|
||||
disk_add ../../img/ext4_flex_bg.qcow2 hd0 -c 524288
|
||||
|
||||
ls70 /hd0/1
|
||||
stat70 /hd0/1/read_test.txt
|
||||
read70 /hd0/1/read_test.txt 0 31 -b
|
||||
|
||||
rm70 /hd0/1/read_test.txt
|
||||
ls70 /hd0/1
|
||||
|
||||
mkdir70 /hd0/1/new_dir
|
||||
ls70 /hd0/1/new_dir
|
||||
create70 /hd0/1/new_dir/new_file.txt -h 68656c6c6f
|
||||
stat70 /hd0/1/new_dir/new_file.txt
|
||||
read70 /hd0/1/new_dir/new_file.txt 0 5 -b
|
||||
|
||||
ls70 /hd0/1/full_dir
|
||||
mkdir70 /hd0/1/full_dir/spill_dir
|
||||
ls70 /hd0/1/full_dir/spill_dir
|
||||
create70 /hd0/1/full_dir/spill_dir/spill_file.txt -h 7370696c6c6f766572
|
||||
stat70 /hd0/1/full_dir/spill_dir/spill_file.txt
|
||||
read70 /hd0/1/full_dir/spill_dir/spill_file.txt 0 9 -b
|
||||
|
||||
rm70 /hd0/1/full_dir/spill_dir/spill_file.txt
|
||||
rm70 /hd0/1/full_dir/spill_dir
|
||||
|
||||
disk_del hd0
|
||||
|
||||
disk_add ../../img/ext4_flex_bg_coverage.qcow2 hd1 -c 131072
|
||||
write70 /hd1/1/dir1/f1.txt 0 -h 1234
|
||||
write70 /hd1/1/dir3/f3.txt 0 -h 1234
|
||||
disk_del hd1
|
||||
|
||||
disk_add ../../img/ext4_flex_bg_full.qcow2 hd2 -c 32768
|
||||
create70 /hd2/1/fail.txt -h 1234
|
||||
disk_del hd2
|
||||
@@ -0,0 +1,3 @@
|
||||
syscall:f70,f70s0
|
||||
fs:ext,write,create,file,flex_bg
|
||||
blkdev:s05k
|
||||
@@ -0,0 +1 @@
|
||||
10s
|
||||
@@ -0,0 +1,9 @@
|
||||
/> umka_boot
|
||||
/> disk_add ../../img/ext4_flex_bg_frag.qcow2 hd0 -c 131072
|
||||
/hd0: sector_size=512, capacity=131072 (64 MiB), num_partitions=1
|
||||
/hd0/1: fs=ext, start=2048 (1 MiB), length=126976 (62 MiB)
|
||||
/> write70 /hd0/1/test_dir/target.bin 58000000 -h 00
|
||||
status = 0 success, count = 1
|
||||
/> write70 /hd0/1/test_dir/target.bin 69000000 -h 00
|
||||
status = 8 disk_full
|
||||
/> disk_del hd0
|
||||
@@ -0,0 +1,5 @@
|
||||
umka_boot
|
||||
disk_add ../../img/ext4_flex_bg_frag.qcow2 hd0 -c 131072
|
||||
write70 /hd0/1/test_dir/target.bin 58000000 -h 00
|
||||
write70 /hd0/1/test_dir/target.bin 69000000 -h 00
|
||||
disk_del hd0
|
||||
@@ -0,0 +1,2 @@
|
||||
syscall:f70s3
|
||||
fs:ext,ext4,rw,create,write
|
||||
@@ -0,0 +1 @@
|
||||
60s
|
||||
Reference in New Issue
Block a user