swapoff01: make use of make_swapfile
PATCH 1/1 swapoff01: make use of make_swapfile
This patch updates the swapoff01 test setup by replacing the previous swapfile creation method with a single call to make_swapfile, which now creates a contiguous swap file.
This change simplifies the setup and fix failure on TMPDIR on btrfs.
Note: it is a single fix but better applied with behind the libswap updates.
--- testcases/kernel/syscalls/swapoff/swapoff01.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
testcases/kernel/syscalls/swapoff/swapoff01.c +1 -4
@@ -44,11 +44,8 @@ static void setup(void)tst_brk (TBROK ,"Insufficient disk space to create swap file" ); -if (tst_fill_file ("swapfile01" ,0x00 ,1024 ,65536 )) +if (make_swapfile ("swapfile01" ,1 ))tst_brk (TBROK ,"Failed to create file for swap" ); - -if (system ("mkswap swapfile01 > tmpfile 2>&1" ) !=0 ) -tst_brk (TBROK ,"Failed to make swapfile" ); }static struct tst_test test = {
Signature · 5 lines
2.40.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Li,
Quoted 7 lines
This patch updates the swapoff01 test setup by replacing the previous swapfile creation method with a single call to
make_swapfile, which now creates a contiguous swap file.This change simplifies the setup and fix failure on TMPDIR on btrfs.
Note: it is a single fix but better applied with behind the libswap updates.
This fixes issue on SLES. The only problem is that we makes swap partition much smaller than before (e.g. we loose coverage of testing on big swap).
Kind regards,
Petr
Quoted 23 lines
Suggested-by Petr Vorel <[email protected]>Signed-off-by Li Wang <[email protected]>--- testcases/kernel/syscalls/swapoff/swapoff01.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)testcases/kernel/syscalls/swapoff/swapoff01.c +1
-4@@ -44,11 +44,8 @@ static void setup(void)tst_brk (TBROK ,"Insufficient disk space to create swap file" ); -if (tst_fill_file ("swapfile01" ,0x00 ,1024 ,65536 )) +if (make_swapfile ("swapfile01" ,1 ))tst_brk (TBROK ,"Failed to create file for swap" ); - -if (system ("mkswap swapfile01 > tmpfile 2>&1" ) !=0 ) -tst_brk (TBROK ,"Failed to make swapfile" ); }static struct tst_test test = {
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp