From 5b0cf78fa87b9858eb09cbbfe41d68023ad75d83 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Thu, 2 Jan 2020 22:34:52 +0100 Subject: [PATCH 1/1] tests: fuse: use stat instead of relying on "ls -l" output On my Fedora 31 system, this currently fails because the test expects the file mode bits to be printed as "-rw-r--r--" but I get "-rw-r--r--." instead, perhaps due to selinux. Fix this to use stat --format instead to extract the bits we want to check here (user, group, mode, timestamp). While at it, I noticed that this test has some confusion with timezones and only worked because 'ls -l' doesn't show the time in this case since the file is so old. Fix that by making _everything_ here use UTC, instead of just some parts. Signed-off-by: Johannes Berg (cherry picked from commit c38e02f0f5daa4ddf4d2c0a553d717d1f3ad02e5) Tested-by: Rob Browning --- t/test-fuse.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/t/test-fuse.sh b/t/test-fuse.sh index 4603e80..1732d66 100755 --- a/t/test-fuse.sh +++ b/t/test-fuse.sh @@ -44,6 +44,8 @@ savename() print strftime('%Y-%m-%d-%H%M%S', localtime($secs))" } +export TZ=UTC + WVPASS bup init WVPASS cd "$tmpdir" @@ -93,12 +95,12 @@ WVPASS fusermount -uz mnt WVSTART "extended metadata" WVPASS bup fuse --meta mnt -result=$(TZ=UTC LC_ALL=C WVPASS ls -l mnt/src/latest/) || exit $? readonly user=$(WVPASS id -un) || $? readonly group=$(WVPASS id -gn) || $? -WVPASSEQ "$result" "total 1 --rw-r--r-- 1 $user $group 8 Nov 11 2011 foo --rw-r--r-- 1 $user $group 8 Jan 1 1970 pre-epoch" +result="$(stat --format='%A %U %G %x' mnt/src/latest/foo)" +WVPASSEQ "$result" "-rw-r--r-- $user $group 2011-11-11 11:11:00.000000000 +0000" +result="$(stat --format='%A %U %G %x' mnt/src/latest/pre-epoch)" +WVPASSEQ "$result" "-rw-r--r-- $user $group 1970-01-01 00:00:00.000000000 +0000" WVPASS fusermount -uz mnt WVPASS rm -rf "$tmpdir" -- 2.39.2