From c78dad79b9e9f82c401ed0c382ba461fa68c61a5 Mon Sep 17 00:00:00 2001 From: hukoyu Date: Thu, 20 Aug 2020 21:08:34 +0000 Subject: [PATCH] Fix 2 tests about mount/umount --- .../kernel/syscalls/fdatasync/fdatasync03.c | 19 +++++++------------ .../sync_file_range/sync_file_range02.c | 11 ++++------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/testcases/kernel/syscalls/fdatasync/fdatasync03.c b/testcases/kernel/syscalls/fdatasync/fdatasync03.c index b7bd5d1951c..53715192b63 100644 --- a/testcases/kernel/syscalls/fdatasync/fdatasync03.c +++ b/testcases/kernel/syscalls/fdatasync/fdatasync03.c @@ -19,24 +19,21 @@ #include #include "tst_test.h" -#define MNTPOINT "mnt_point" -#define FNAME MNTPOINT"/test" +#define FNAME "/data/test" #define FILE_SIZE_MB 32 #define FILE_SIZE (FILE_SIZE_MB * TST_MB) #define MODE 0644 -#define dev "/dev/vda" +#define dev "/dev/vdb" static void verify_fdatasync(void) { int fd; unsigned long written; - rmdir(MNTPOINT); - SAFE_MKDIR(MNTPOINT, 0644); - SAFE_MOUNT(dev, MNTPOINT, "ext4", 0, NULL); - fd = SAFE_OPEN(FNAME, O_RDWR|O_CREAT, MODE); - tst_dev_bytes_written(dev); + fd = SAFE_OPEN(FNAME, O_RDWR|O_CREAT, MODE); + + tst_dev_bytes_written(dev); tst_fill_fd(fd, 0, TST_MB, FILE_SIZE_MB); @@ -45,12 +42,10 @@ static void verify_fdatasync(void) if (TST_RET) tst_brk(TFAIL | TTERRNO, "fdatasync(fd) failed"); - written = tst_dev_bytes_written(dev); + written = tst_dev_bytes_written(dev); SAFE_CLOSE(fd); - remove(FNAME); - SAFE_UMOUNT(MNTPOINT); - SAFE_RMDIR(MNTPOINT); + remove(FNAME); if (written >= FILE_SIZE) tst_res(TPASS, "Test file data synced to device"); diff --git a/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c b/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c index 46d274ebf8a..f31420aec12 100644 --- a/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c +++ b/testcases/kernel/syscalls/sync_file_range/sync_file_range02.c @@ -21,13 +21,14 @@ #include "lapi/sync_file_range.h" #include "check_sync_file_range.h" -#define MNTPOINT "mnt_point" +#define MNTPOINT "/data" #define FNAME1 MNTPOINT"/test1" #define FNAME2 MNTPOINT"/test2" #define FNAME3 MNTPOINT"/test3" #define FILE_SZ_MB 32 #define FILE_SZ (FILE_SZ_MB * TST_MB) #define MODE 0644 +#define dev "/dev/vdb" struct testcase { char *fname; @@ -48,7 +49,7 @@ static void verify_sync_file_range(struct testcase *tc) lseek(fd, tc->write_off, SEEK_SET); - tst_dev_bytes_written(tst_device->dev); + tst_dev_bytes_written(dev); tst_fill_fd(fd, 0, TST_MB, tc->write_size_mb); @@ -60,7 +61,7 @@ static void verify_sync_file_range(struct testcase *tc) if (TST_RET) tst_brk(TFAIL | TTERRNO, "sync_file_range() failed"); - written = tst_dev_bytes_written(tst_device->dev); + written = tst_dev_bytes_written(dev); fsync(fd); @@ -124,10 +125,6 @@ static void setup(void) static struct tst_test test = { .tcnt = ARRAY_SIZE(testcases), .needs_root = 1, - .mount_device = 1, - .all_filesystems = 1, - .dev_fs_flags = TST_FS_SKIP_FUSE, - .mntpoint = MNTPOINT, .setup = setup, .test = run, };