@@ -84,14 +84,7 @@ static void setup(void)
tst_tmpdir();
- switch ((fs_type = tst_fs_type(cleanup, "."))) {
- case TST_NFS_MAGIC:
- case TST_TMPFS_MAGIC:
- tst_brkm(TCONF, cleanup,
- "Cannot do swapon on a file on %s filesystem",
- tst_fs_type_name(fs_type));
- break;
- }
+ is_swap_supported(cleanup, "swapon", "./tstswap");
make_swapfile(cleanup, "swapfile01");
}
@@ -132,14 +132,7 @@ static void setup(void)
tst_tmpdir();
- switch ((fs_type = tst_fs_type(cleanup, "."))) {
- case TST_NFS_MAGIC:
- case TST_TMPFS_MAGIC:
- tst_brkm(TCONF, cleanup,
- "Cannot do swapon on a file on %s filesystem",
- tst_fs_type_name(fs_type));
- break;
- }
+ is_swap_supported(cleanup, "swapon", "./tstswap");
SAFE_TOUCH(cleanup, "notswap", 0777, NULL);
make_swapfile(cleanup, "swapfile01");
@@ -153,7 +153,7 @@ static int setup_swap(void)
int j, fd;
int status;
int res = 0;
- char filename[15];
+ char filename[FILENAME_MAX];
char buf[BUFSIZ + 1];
/* Find out how many swapfiles (1 line per entry) already exist */
@@ -333,14 +333,7 @@ static void setup(void)
tst_tmpdir();
- switch ((fs_type = tst_fs_type(cleanup, "."))) {
- case TST_NFS_MAGIC:
- case TST_TMPFS_MAGIC:
- tst_brkm(TCONF, cleanup,
- "Cannot do swapon on a file on %s filesystem",
- tst_fs_type_name(fs_type));
- break;
- }
+ is_swap_supported(cleanup, "swapon", "./tstswap");
TEST_PAUSE;
}
Of swap operations. Signed-off-by: Murphy Zhou <xzhou@redhat.com> --- testcases/kernel/syscalls/swapon/swapon01.c | 9 +-------- testcases/kernel/syscalls/swapon/swapon02.c | 9 +-------- testcases/kernel/syscalls/swapon/swapon03.c | 11 ++--------- 3 files changed, 4 insertions(+), 25 deletions(-)