summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Dreyfus <manu@netbsd.org>2014-11-30 18:26:17 +0100
committerVijay Bellur <vbellur@redhat.com>2014-12-03 10:13:51 -0800
commit2ca5b712f93dde62aadbf34f954ad53089490ded (patch)
tree5411e1f34627f537dc6353506b0d3d772b4f4f67
parent8261f0deb9bf75611135a6571bc4d9cef687ad37 (diff)
Regression test portability: basic/file-snapshot.t
- For some odd reason, setfattr(1) could fail on big-file just after it was created by touch(1). Add a test in between to wait for the file to be visible by ls(1). - After switching to a snapshot, the file content is still in kernel cache, and the old content may be readen for a few seconds after the snapshot switch. Use ( cd $M0 && umount $M0 ) to flush vnodes and therefore invalidate the cache. - Unmount the mount point at the end of the test for the cleanliness sake. BUG: 1129939 Change-Id: I5a0d14db13e79323147761dfe50c41ae6a1cb844 Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org> Reviewed-on: http://review.gluster.org/9220 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rwxr-xr-xtests/basic/file-snapshot.t7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/basic/file-snapshot.t b/tests/basic/file-snapshot.t
index 8178f728284..f61de379fcf 100755
--- a/tests/basic/file-snapshot.t
+++ b/tests/basic/file-snapshot.t
@@ -24,6 +24,7 @@ TEST $CLI volume set $V0 performance.io-cache off;
TEST $GFS -s $H0 --volfile-id $V0 $M0;
TEST touch $M0/big-file;
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "$M0/big-file" ls $M0/big-file
TEST setfattr -n trusted.glusterfs.block-format -v qcow2:10GB $M0/big-file;
@@ -38,6 +39,10 @@ echo '1234567890' > $M0/data-file2
TEST dd if=$M0/data-file2 of=$M0/big-file conv=notrunc;
TEST setfattr -n trusted.glusterfs.block-snapshot-create -v image2 $M0/big-file;
+# big-file may still be in kernel page cache, this will fail to umount
+# but it will purge vnode and therefore invalidate the cache.
+( cd $M0 && umount $M0 )
+
TEST setfattr -n trusted.glusterfs.block-snapshot-goto -v image1 $M0/big-file;
TEST dd if=$M0/big-file of=$M0/out-file1 bs=11 count=1;
@@ -47,6 +52,8 @@ TEST dd if=$M0/big-file of=$M0/out-file2 bs=11 count=1;
TEST cmp $M0/data-file1 $M0/out-file1;
TEST cmp $M0/data-file2 $M0/out-file2;
+force_umount $M0
+
TEST $CLI volume stop $V0;
EXPECT 'Stopped' volinfo_field $V0 'Status';