diff mbox series

[v5,7/8] swapon/off: enable all_filesystem in swap test

Message ID 20240128024838.2699248-8-liwang@redhat.com
State Superseded
Headers show
Series improvement work on libswap library | expand

Commit Message

Li Wang Jan. 28, 2024, 2:48 a.m. UTC
Signed-off-by: Li Wang <liwang@redhat.com>
---
 testcases/kernel/syscalls/swapoff/swapoff02.c | 11 ++++++-----
 testcases/kernel/syscalls/swapon/swapon02.c   |  4 ++++
 testcases/kernel/syscalls/swapon/swapon03.c   |  4 ++++
 3 files changed, 14 insertions(+), 5 deletions(-)

Comments

Petr Vorel Jan. 29, 2024, 8:03 a.m. UTC | #1
Hi Li,

> +++ b/testcases/kernel/syscalls/swapoff/swapoff02.c
> @@ -18,6 +18,8 @@
>  #include "lapi/syscalls.h"
>  #include "libswap.h"

> +#define MNTPOINT	"mntpoint"
> +
>  static int setup01(void);
>  static void cleanup01(void);

> @@ -84,14 +86,13 @@ static void setup(void)

>  	is_swap_supported("./tstswap");
This needs to be run on MNTPOINT, see swapon01.c (change from second commit I
made: "swapon01: Test on all filesystems").

The same problem is in other tests. Otherwise we check always on TMPDIR
(which TCONF when /tmp is tmpfs).

Kind regards,
Petr

# ./swapoff02
tst_device.c:96: TINFO: Found free device 0 '/dev/loop0'
tst_test.c:1709: TINFO: LTP version: 20230929-307-g5485ddaaf
tst_test.c:1593: TINFO: Timeout per run is 0h 00m 30s
tst_supported_fs_types.c:97: TINFO: Kernel supports ext2
tst_supported_fs_types.c:62: TINFO: mkfs.ext2 does exist
tst_supported_fs_types.c:97: TINFO: Kernel supports ext3
tst_supported_fs_types.c:62: TINFO: mkfs.ext3 does exist
tst_supported_fs_types.c:97: TINFO: Kernel supports ext4
tst_supported_fs_types.c:62: TINFO: mkfs.ext4 does exist
tst_supported_fs_types.c:97: TINFO: Kernel supports xfs
tst_supported_fs_types.c:62: TINFO: mkfs.xfs does exist
tst_supported_fs_types.c:97: TINFO: Kernel supports btrfs
tst_supported_fs_types.c:62: TINFO: mkfs.btrfs does exist
tst_supported_fs_types.c:97: TINFO: Kernel supports bcachefs
tst_supported_fs_types.c:62: TINFO: mkfs.bcachefs does exist
tst_supported_fs_types.c:97: TINFO: Kernel supports vfat
tst_supported_fs_types.c:62: TINFO: mkfs.vfat does exist
tst_supported_fs_types.c:97: TINFO: Kernel supports exfat
tst_supported_fs_types.c:62: TINFO: mkfs.exfat does exist
tst_supported_fs_types.c:132: TINFO: FUSE does support ntfs
tst_supported_fs_types.c:62: TINFO: mkfs.ntfs does exist
tst_supported_fs_types.c:97: TINFO: Kernel supports tmpfs
tst_supported_fs_types.c:49: TINFO: mkfs is not needed for tmpfs
tst_test.c:1669: TINFO: === Testing on ext2 ===
tst_ioctl.c:21: TINFO: FIBMAP ioctl is NOT supported: EINVAL (22)
libswap.c:202: TCONF: Swapfile on tmpfs not implemented
tst_test.c:1669: TINFO: === Testing on ext3 ===
tst_ioctl.c:21: TINFO: FIBMAP ioctl is NOT supported: EINVAL (22)
libswap.c:202: TCONF: Swapfile on tmpfs not implemented
tst_test.c:1669: TINFO: === Testing on ext4 ===
tst_ioctl.c:21: TINFO: FIBMAP ioctl is NOT supported: EINVAL (22)
libswap.c:202: TCONF: Swapfile on tmpfs not implemented
tst_test.c:1669: TINFO: === Testing on xfs ===
tst_ioctl.c:21: TINFO: FIBMAP ioctl is NOT supported: EINVAL (22)
libswap.c:202: TCONF: Swapfile on tmpfs not implemented
tst_test.c:1669: TINFO: === Testing on btrfs ===
tst_ioctl.c:21: TINFO: FIBMAP ioctl is NOT supported: EINVAL (22)
libswap.c:202: TCONF: Swapfile on tmpfs not implemented
tst_test.c:1669: TINFO: === Testing on bcachefs ===
tst_ioctl.c:21: TINFO: FIBMAP ioctl is NOT supported: EINVAL (22)
libswap.c:202: TCONF: Swapfile on tmpfs not implemented
tst_test.c:1669: TINFO: === Testing on vfat ===
tst_ioctl.c:21: TINFO: FIBMAP ioctl is NOT supported: EINVAL (22)
libswap.c:202: TCONF: Swapfile on tmpfs not implemented
tst_test.c:1669: TINFO: === Testing on exfat ===
tst_ioctl.c:21: TINFO: FIBMAP ioctl is NOT supported: EINVAL (22)
libswap.c:202: TCONF: Swapfile on tmpfs not implemented
tst_test.c:1669: TINFO: === Testing on ntfs ===
tst_ioctl.c:21: TINFO: FIBMAP ioctl is NOT supported: EINVAL (22)
libswap.c:202: TCONF: Swapfile on tmpfs not implemented
tst_test.c:1669: TINFO: === Testing on tmpfs ===
tst_ioctl.c:21: TINFO: FIBMAP ioctl is NOT supported: EINVAL (22)
libswap.c:202: TCONF: Swapfile on tmpfs not implemented

Summary:
passed   0
failed   0
broken   0
skipped  10
warnings 0
Li Wang Jan. 29, 2024, 8:26 a.m. UTC | #2
On Mon, Jan 29, 2024 at 4:03 PM Petr Vorel <pvorel@suse.cz> wrote:

> Hi Li,
>
> > +++ b/testcases/kernel/syscalls/swapoff/swapoff02.c
> > @@ -18,6 +18,8 @@
> >  #include "lapi/syscalls.h"
> >  #include "libswap.h"
>
> > +#define MNTPOINT     "mntpoint"
> > +
> >  static int setup01(void);
> >  static void cleanup01(void);
>
> > @@ -84,14 +86,13 @@ static void setup(void)
>
> >       is_swap_supported("./tstswap");
> This needs to be run on MNTPOINT, see swapon01.c (change from second
> commit I
> made: "swapon01: Test on all filesystems").
>
> The same problem is in other tests. Otherwise we check always on TMPDIR
> (which TCONF when /tmp is tmpfs).
>

Oh yes, you're right, I overlooked that. Thanks.
diff mbox series

Patch

diff --git a/testcases/kernel/syscalls/swapoff/swapoff02.c b/testcases/kernel/syscalls/swapoff/swapoff02.c
index cd940b1e7..53060b320 100644
--- a/testcases/kernel/syscalls/swapoff/swapoff02.c
+++ b/testcases/kernel/syscalls/swapoff/swapoff02.c
@@ -18,6 +18,8 @@ 
 #include "lapi/syscalls.h"
 #include "libswap.h"
 
+#define MNTPOINT	"mntpoint"
+
 static int setup01(void);
 static void cleanup01(void);
 
@@ -84,14 +86,13 @@  static void setup(void)
 
 	is_swap_supported("./tstswap");
 
-	if (!tst_fs_has_free(".", 1, TST_KB))
-		tst_brk(TBROK, "Insufficient disk space to create swap file");
-
-	if (tst_fill_file("./swapfile01", 0x00, 1024, 1))
-		tst_brk(TBROK, "Failed to create swapfile");
+	if (make_swapfile("swapfile01", 10, 1))
+		tst_brk(TBROK, "Failed to create file for swap");
 }
 
 static struct tst_test test = {
+	.mntpoint = MNTPOINT,
+	.all_filesystems = 1,
 	.needs_root = 1,
 	.needs_tmpdir = 1,
 	.test = verify_swapoff,
diff --git a/testcases/kernel/syscalls/swapon/swapon02.c b/testcases/kernel/syscalls/swapon/swapon02.c
index f5b0d6d56..acb789fc4 100644
--- a/testcases/kernel/syscalls/swapon/swapon02.c
+++ b/testcases/kernel/syscalls/swapon/swapon02.c
@@ -20,6 +20,8 @@ 
 #include "lapi/syscalls.h"
 #include "libswap.h"
 
+#define MNTPOINT	"mntpoint"
+
 static uid_t nobody_uid;
 static int do_swapoff;
 
@@ -78,6 +80,8 @@  static void verify_swapon(unsigned int i)
 }
 
 static struct tst_test test = {
+	.mntpoint = MNTPOINT,
+	.all_filesystems = 1,
 	.needs_root = 1,
 	.needs_tmpdir = 1,
 	.test = verify_swapon,
diff --git a/testcases/kernel/syscalls/swapon/swapon03.c b/testcases/kernel/syscalls/swapon/swapon03.c
index e13009111..249cb12c3 100644
--- a/testcases/kernel/syscalls/swapon/swapon03.c
+++ b/testcases/kernel/syscalls/swapon/swapon03.c
@@ -22,6 +22,8 @@ 
 #include "swaponoff.h"
 #include "libswap.h"
 
+#define MNTPOINT	"mntpoint"
+
 static int setup_swap(void);
 static int clean_swap(void);
 static int check_and_swapoff(const char *filename);
@@ -265,6 +267,8 @@  static void cleanup(void)
 }
 
 static struct tst_test test = {
+	.mntpoint = MNTPOINT,
+	.all_filesystems = 1,
 	.needs_root = 1,
 	.needs_tmpdir = 1,
 	.forks_child = 1,