diff options
author | Theodore Ts'o <tytso@mit.edu> | 2021-05-07 18:47:11 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2021-05-07 18:47:11 -0400 |
commit | 9ae89fe3a96f089ed5683df1cd0660e7e1694af0 (patch) | |
tree | ff84ac032705d49c127ec711c8e766ae1a6551ff | |
parent | f53fa5a2ac40d595908f4ae868cca2bd195c0a88 (diff) | |
download | e2fsprogs-9ae89fe3a96f089ed5683df1cd0660e7e1694af0.tar.gz |
tests: add test of Direct I/O support in the Unix I/O manager
This test requires root, and only works on Linux systems.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r-- | tests/u_direct_io/expect | 61 | ||||
-rw-r--r-- | tests/u_direct_io/script | 44 |
2 files changed, 105 insertions, 0 deletions
diff --git a/tests/u_direct_io/expect b/tests/u_direct_io/expect new file mode 100644 index 000000000..b0cdc7302 --- /dev/null +++ b/tests/u_direct_io/expect @@ -0,0 +1,61 @@ +mke2fs -F -o Linux -t ext4 -O ^metadata_csum,^uninit_bg -D $LOOP +Creating filesystem with 32768 4k blocks and 32768 inodes + +Allocating group tables: done +Writing inode tables: done +Creating journal (4096 blocks): done +Writing superblocks and filesystem accounting information: done + +debugfs -D -R stats $LOOP +Filesystem volume name: <none> +Last mounted on: <not available> +Filesystem magic number: 0xEF53 +Filesystem revision #: 1 (dynamic) +Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super large_file huge_file dir_nlink extra_isize +Default mount options: (none) +Filesystem state: clean +Errors behavior: Continue +Filesystem OS type: Linux +Inode count: 32768 +Block count: 32768 +Reserved block count: 1638 +Overhead clusters: 5131 +Free blocks: 27631 +Free inodes: 32757 +First block: 0 +Block size: 4096 +Fragment size: 4096 +Reserved GDT blocks: 7 +Blocks per group: 32768 +Fragments per group: 32768 +Inodes per group: 32768 +Inode blocks per group: 1024 +Flex block group size: 16 +Mount count: 0 +Check interval: 15552000 (6 months) +Reserved blocks uid: 0 +Reserved blocks gid: 0 +First inode: 11 +Inode size: 128 +Journal inode: 8 +Default directory hash: half_md4 +Journal backup: inode blocks +Directories: 2 + Group 0: block bitmap at 9, inode bitmap at 25, inode table at 41 + 27631 free blocks, 32757 free inodes, 2 used directories +e2fsck -fn -N test_filesys $LOOP +Pass 1: Checking inodes, blocks, and sizes +Pass 2: Checking directory structure +Pass 3: Checking directory connectivity +Pass 4: Checking reference counts +Pass 5: Checking group summary information +test_filesys: 11/32768 files (9.1% non-contiguous), 5137/32768 blocks +Exit status is 0 +e2fsck -fn -N test_filesys $TMPFILE +Pass 1: Checking inodes, blocks, and sizes +Pass 2: Checking directory structure +Pass 3: Checking directory connectivity +Pass 4: Checking reference counts +Pass 5: Checking group summary information +test_filesys: 11/32768 files (9.1% non-contiguous), 5137/32768 blocks +Exit status is 0 diff --git a/tests/u_direct_io/script b/tests/u_direct_io/script new file mode 100644 index 000000000..0b5d70830 --- /dev/null +++ b/tests/u_direct_io/script @@ -0,0 +1,44 @@ +DESCRIPTION="direct I/O in unix_io" +OUT=$test_name.log +if test "$(id -u)" -ne 0 ; then + echo "$test_name: $DESCRIPTION: skipped (not root)" +elif ! command -v losetup >/dev/null ; then + echo "$test_name: $DESCRIPTION: skipped (no losetup)" +elif test ! -x $DEBUGFS_EXE; then + echo "$test_name: $DESCRIPTION: skipped (no debugfs)" +else + dd if=/dev/zero of=$TMPFILE bs=1M count=128 > /dev/null 2>&1 + LOOP=$(losetup --show --sector-size 4096 -f $TMPFILE) + echo mke2fs -F -o Linux -t ext4 -O ^metadata_csum,^uninit_bg -D \$LOOP > $OUT + $MKE2FS -F -o Linux -t ext4 -O ^metadata_csum,^uninit_bg -D $LOOP 2>&1 | \ + sed -f $cmd_dir/filter.sed >> $OUT + + echo debugfs -D -R stats \$LOOP >> $OUT + $DEBUGFS -D -R stats $LOOP 2>&1 | sed -f $cmd_dir/filter.sed >> $OUT + + echo e2fsck -fn -N test_filesys \$LOOP > $OUT.new + $FSCK -fn -N test_filesys $LOOP >> $OUT.new 2>&1 + echo Exit status is $? >> $OUT.new + sed -f $cmd_dir/filter.sed $OUT.new >> $OUT + rm -f $OUT.new + + losetup -d $LOOP + + echo e2fsck -fn -N test_filesys \$TMPFILE > $OUT.new + $FSCK -fn -N test_filesys $TMPFILE >> $OUT.new 2>&1 + echo Exit status is $? >> $OUT.new + sed -f $cmd_dir/filter.sed $OUT.new >> $OUT + rm -f $OUT.new + + cmp -s $test_name.log $test_dir/expect + + if [ "$?" -eq 0 ]; then + echo "$test_name: $DESCRIPTION: ok" + touch $test_name.ok + else + echo "$test_name: $DESCRIPTION: failed" + diff $DIFF_OPTS $test_dir/expect $test_name.log >> $test_name.failed + fi +fi + +unset LOOP |