diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:49:25 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:49:25 +0000 |
commit | 464df1d5e5ab1322e2dd0a7796939fff1aeefa9a (patch) | |
tree | 6a403684e0978f0287d7f0ec0e5aab1fd31a59e1 /tests/m_assume_storage_prezeroed | |
parent | Initial commit. (diff) | |
download | e2fsprogs-464df1d5e5ab1322e2dd0a7796939fff1aeefa9a.tar.xz e2fsprogs-464df1d5e5ab1322e2dd0a7796939fff1aeefa9a.zip |
Adding upstream version 1.47.0.upstream/1.47.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/m_assume_storage_prezeroed')
-rw-r--r-- | tests/m_assume_storage_prezeroed/expect | 2 | ||||
-rw-r--r-- | tests/m_assume_storage_prezeroed/script | 63 |
2 files changed, 65 insertions, 0 deletions
diff --git a/tests/m_assume_storage_prezeroed/expect b/tests/m_assume_storage_prezeroed/expect new file mode 100644 index 0000000..b735e24 --- /dev/null +++ b/tests/m_assume_storage_prezeroed/expect @@ -0,0 +1,2 @@ +> 10000 +224 diff --git a/tests/m_assume_storage_prezeroed/script b/tests/m_assume_storage_prezeroed/script new file mode 100644 index 0000000..1a8d846 --- /dev/null +++ b/tests/m_assume_storage_prezeroed/script @@ -0,0 +1,63 @@ +test_description="test prezeroed storage metadata allocation" +FILE_SIZE=16M + +LOG=$test_name.log +OUT=$test_name.out +EXP=$test_dir/expect + +if test "$(id -u)" -ne 0 ; then + echo "$test_name: $test_description: skipped (not root)" +elif ! command -v losetup >/dev/null ; then + echo "$test_name: $test_description: skipped (no losetup)" +else + dd if=/dev/zero of=$TMPFILE.1 bs=1 count=0 seek=$FILE_SIZE >> $LOG 2>&1 + dd if=/dev/zero of=$TMPFILE.2 bs=1 count=0 seek=$FILE_SIZE >> $LOG 2>&1 + + LOOP1=$(losetup --show --sector-size 4096 -f $TMPFILE.1) + if [ ! -b "$LOOP1" ]; then + echo "$test_name: $DESCRIPTION: skipped (no loop devices)" + rm -f $TMPFILE.1 $TMPFILE.2 + exit 0 + fi + LOOP2=$(losetup --show --sector-size 4096 -f $TMPFILE.2) + if [ ! -b "$LOOP2" ]; then + echo "$test_name: $DESCRIPTION: skipped (no loop devices)" + rm -f $TMPFILE.1 $TMPFILE.2 + losetup -d $LOOP1 + exit 0 + fi + + echo $MKE2FS -o Linux -t ext4 $LOOP1 >> $LOG 2>&1 + $MKE2FS -o Linux -t ext4 $LOOP1 >> $LOG 2>&1 + sync + stat $TMPFILE.1 >> $LOG 2>&1 + SZ=$(stat -c "%b" $TMPFILE.1) + if test $SZ -gt 10000 ; then + echo "> 10000" > $OUT + else + echo "$SZ" > $OUT + fi + + echo $MKE2FS -o Linux -t ext4 -E assume_storage_prezeroed=1 $LOOP2 >> $LOG 2>&1 + $MKE2FS -o Linux -t ext4 -E assume_storage_prezeroed=1 $LOOP2 >> $LOG 2>&1 + sync + stat $TMPFILE.2 >> $LOG 2>&1 + stat -c "%b" $TMPFILE.2 >> $OUT + + losetup -d $LOOP1 + losetup -d $LOOP2 + rm -f $TMPFILE.1 $TMPFILE.2 + + cmp -s $OUT $EXP + status=$? + + if [ "$status" = 0 ] ; then + echo "$test_name: $test_description: ok" + touch $test_name.ok + else + echo "$test_name: $test_description: failed" + cat $LOG > $test_name.failed + diff $EXP $OUT >> $test_name.failed + fi +fi +unset LOG OUT EXP FILE_SIZE LOOP1 LOOP2 |