btrfs-progs: tests: test full 64bit timestamp conversion on ext4

Verify that [acm]time are copied from the ext4 source without loss of ns
precision.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2021-01-05 16:56:21 +01:00
parent b3df561fbf
commit df2bdf97d2
1 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,38 @@
#!/bin/bash
# Check if [acm]time values are copied from ext4 with full precision
source "$TEST_TOP/common"
source "$TEST_TOP/common.convert"
setup_root_helper
prepare_test_dev
check_prereq btrfs-convert
check_global_prereq mke2fs
convert_test_prep_fs ext4 mke2fs -t ext4 -b 4096
run_check $SUDO_HELPER touch "$TEST_MNT/file"
# Read time values
run_check stat "$TEST_MNT/file"
atime=$(run_check_stdout stat --format=%x "$TEST_MNT/file")
mtime=$(run_check_stdout stat --format=%y "$TEST_MNT/file")
ctime=$(run_check_stdout stat --format=%z "$TEST_MNT/file")
run_check_umount_test_dev
convert_test_do_convert
run_check_mount_test_dev
run_check stat "$TEST_MNT/file"
# Verify
time=$(run_check_stdout stat --format=%x "$TEST_MNT/file")
if [ "$time" != "$atime" ]; then
_fail "atime on converted inode does not match"
fi
time=$(run_check_stdout stat --format=%y "$TEST_MNT/file")
if [ "$time" != "$mtime" ]; then
_fail "mtime on converted inoded does not match"
fi
time=$(run_check_stdout stat --format=%z "$TEST_MNT/file")
if [ "$time" != "$mtime" ]; then
_fail "ctime on converted inoded does not match"
fi
run_check_umount_test_dev