[LTP] [Patch v6 7/8] swapon/off: enable all_filesystem in swap test

Petr Vorel pvorel@suse.cz
Wed Jan 31 19:53:10 CET 2024


Hi Li,

First, I suppose you wait for Cyril, otherwise I would be for merging up to
previous commit ("libswap: customize swapfile size").

I found a problem in this commit. It looks like this patch breaks testing on
TMPDIR on tmpfs on Tumbleweed kernel 6.8.0-rc1-2.gf4ba5db-default:

TMPDIR=/tmp LTP_SINGLE_FS_TYPE=ntfs ./swapoff01
tst_test.c:1701: TINFO: === Testing on ntfs ===
tst_test.c:1117: TINFO: Formatting /dev/loop0 with ntfs opts='' extra opts=''
The partition start sector was not specified for /dev/loop0 and it could not be obtained automatically.  It has been set to 0.
The number of sectors per track was not specified for /dev/loop0 and it could not be obtained automatically.  It has been set to 0.
The number of heads was not specified for /dev/loop0 and it could not be obtained automatically.  It has been set to 0.
To boot from a device, Windows needs the 'partition start sector', the 'sectors per track' and the 'number of heads' to be set.
Windows will not be able to boot from this device.
tst_test.c:1131: TINFO: Mounting /dev/loop0 to /tmp/LTP_swawDOaMz/mntpoint fstyp=ntfs flags=0
tst_test.c:1131: TINFO: Trying FUSE...
tst_ioctl.c:26: TINFO: FIBMAP ioctl is supported
libswap.c:144: TBROK: Insufficient disk space to create swap file

df -hT /tmp/
Filesystem     Type   Size  Used Avail Use% Mounted on
tmpfs          tmpfs  717M     0  717M   0% /tmp

Test works on 6.6.x stable kernel, but that's due bigger tmpfs.
Could we at least TCONF (see below)?

I also wonder if we could make whole disk size a bit smaller.
The default 300 MB is not enough for XFS, right? But why 512 MB?
On6.8.0-rc1-2.gf4ba5db-default 350 MB is enough to test everything:

...
tst_test.c:1701: TINFO: === Testing on ntfs ===
tst_test.c:1117: TINFO: Formatting /dev/loop0 with ntfs opts='' extra opts=''
The partition start sector was not specified for /dev/loop0 and it could not be obtained automatically.  It has been set to 0.
The number of sectors per track was not specified for /dev/loop0 and it could not be obtained automatically.  It has been set to 0.
The number of heads was not specified for /dev/loop0 and it could not be obtained automatically.  It has been set to 0.
To boot from a device, Windows needs the 'partition start sector', the 'sectors per track' and the 'number of heads' to be set.
Windows will not be able to boot from this device.
tst_test.c:1131: TINFO: Mounting /dev/loop0 to /tmp/LTP_swaWEYzzv/mntpoint fstyp=ntfs flags=0
tst_test.c:1131: TINFO: Trying FUSE...
tst_ioctl.c:26: TINFO: FIBMAP ioctl is supported
swapoff01.c:39: TPASS: Succeeded to turn off swapfile
tst_test.c:1701: TINFO: === Testing on tmpfs ===
tst_test.c:1117: TINFO: Skipping mkfs for TMPFS filesystem
tst_test.c:1098: TINFO: Limiting tmpfs size to 512MB
tst_test.c:1131: TINFO: Mounting ltp-tmpfs to /tmp/LTP_swaWEYzzv/mntpoint fstyp=tmpfs flags=0
tst_ioctl.c:21: TINFO: FIBMAP ioctl is NOT supported: EINVAL (22)
libswap.c:198: TCONF: Swapfile on tmpfs not implemented

Summary:
passed   8
failed   0
broken   0
skipped  1
warnings 0

Kind regards,
Petr

diff --git a/testcases/kernel/syscalls/swapoff/swapoff01.c b/testcases/kernel/syscalls/swapoff/swapoff01.c
index af2a759cb..bde59df77 100644
--- a/testcases/kernel/syscalls/swapoff/swapoff01.c
+++ b/testcases/kernel/syscalls/swapoff/swapoff01.c
@@ -45,8 +45,7 @@ static void setup(void)
 	is_swap_supported(TEST_FILE);

 	if (!tst_fs_has_free(".", 64, TST_MB))
-		tst_brk(TBROK,
-			"Insufficient disk space to create swap file");
+		tst_brk(TCONF, "Insufficient disk space to create swap file");

 	if (make_swapfile(SWAP_FILE, 65536, 1))
 		tst_brk(TBROK, "Failed to create file for swap");


More information about the ltp mailing list