]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
src/seek_sanity_test: fix test15 SEEK_HOLE expected results
authorLuis Henriques <lhenriques@suse.com>
Tue, 23 May 2017 16:19:55 +0000 (17:19 +0100)
committerEryu Guan <eguan@redhat.com>
Tue, 23 May 2017 16:25:47 +0000 (00:25 +0800)
Filesystesm with the "default behavior" will always return the
offset of the end of the file when lseek'ing with SEEK_HOLE.  This
test does the following:

 - fallocate 4 << 20 bytes
 - write PAGE_SIZE bytes at offset 0
 - writes PAGE_SIZE bytes at offset 4 << 20

Thus, using lseek in an FS with the "default behavior" will set the
position at 4 << 20 + PAGE_SIZE.

Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Luis Henriques <lhenriques@suse.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
src/seek_sanity_test.c

index d52e2b6dab795232dfb03f1bef67b17f9e2fa8c5..064a8fa5822ff6bffcab1c048bed800e4682244a 100644 (file)
@@ -334,12 +334,15 @@ static int test15(int fd, int testnum)
        if (ret)
                goto out;
 
+       /* update file size */
+       filsz += bufsz;
+
        /* offset at the beginning */
        ret += do_lseek(testnum,  1, fd, filsz, SEEK_HOLE, 0, bufsz);
        ret += do_lseek(testnum,  2, fd, filsz, SEEK_HOLE, 1, bufsz);
        ret += do_lseek(testnum,  3, fd, filsz, SEEK_DATA, 0, 0);
        ret += do_lseek(testnum,  4, fd, filsz, SEEK_DATA, 1, 1);
-       ret += do_lseek(testnum,  5, fd, filsz, SEEK_DATA, bufsz, filsz);
+       ret += do_lseek(testnum,  5, fd, filsz, SEEK_DATA, bufsz, filsz - bufsz);
 
 out:
        do_free(buf);