syscalls/swapon/swapon0{1..3}: remove checking if fs type is BTRFS
PATCH 1/1 syscalls/swapon/swapon0{1..3}: remove checking if fs type is BTRFS
remove redundant tasks as BTRFS is checked in is_swap_supported()
support status")
--- testcases/kernel/syscalls/swapon/swapon01.c | 7 ------- testcases/kernel/syscalls/swapon/swapon02.c | 5 ----- testcases/kernel/syscalls/swapon/swapon03.c | 15 +-------------- 3 files changed, 1 insertion(+), 26 deletions(-)
testcases/kernel/syscalls/swapon/swapon01.c +0 -7
@@ -32,18 +32,11 @@ static void cleanup(void);char *TCID ="swapon01" ;int TST_TOTAL =1 ; -static long fs_type; -static void verify_swapon (void ) {TEST (ltp_syscall (__NR_swapon,"./swapfile01" ,0 ));if (TEST_RETURN ==-1 ) { -if (fs_type ==TST_BTRFS_MAGIC && errno ==EINVAL ) { -tst_brkm (TCONF , cleanup, -"Swapfile on BTRFS not implemeted" ); -return ; - }tst_resm (TFAIL |TTERRNO ,"Failed to turn on swapfile" ); }else {tst_resm (TPASS ,"Succeeded to turn on swapfile" );
testcases/kernel/syscalls/swapon/swapon02.c +0 -5
@@ -81,11 +81,6 @@ static void verify_swapon(struct test_case_t *test)return ; } -if (fs_type ==TST_BTRFS_MAGIC && errno ==EINVAL ) { -tst_resm (TCONF ,"Swapfile on BTRFS not implemeted" ); -return ; - } -tst_resm (TFAIL ,"swapon(2) failed to produce expected error:" " %d, errno: %s and got %d." , test->exp_errno, test->exp_errval,TEST_ERRNO );
testcases/kernel/syscalls/swapon/swapon03.c +1 -14
@@ -52,8 +52,6 @@ int TST_TOTAL = 1;static int swapfiles; -static long fs_type; -int testfiles =3 ; static struct swap_testfile_t { char *filename;
@@ -215,9 +213,6 @@ static int setup_swap(void)/* turn on the swap file */ res =ltp_syscall (__NR_swapon, filename,0 );if (res !=0 ) { -if (fs_type ==TST_BTRFS_MAGIC && errno ==EINVAL ) -exit (2 ); -if (errno ==EPERM ) {printf ("Successfully created %d " "swapfiles\n" , j);
@@ -233,16 +228,8 @@ static int setup_swap(void) }else waitpid (pid, &status,0 ); -switch (WEXITSTATUS (status)) { -case 0 : -break ; -case 2 : -tst_brkm (TCONF , cleanup,"Swapfile on BTRFS not implemeted" ); -break ; -default : +if (WEXITSTATUS (status) ==1 )tst_brkm (TFAIL , cleanup,"Failed to setup swaps" ); -break ; - }/* Create all needed extra swapfiles for testing */ for (j =0 ; j < testfiles; j++)
--
2.29.2
PATCH 1/1 syscalls/swapon/swapon0{1..3}: remove checking if fs type is BTRFS
Hi Qi,
Can we rename subject to 'Remove the check for BTRFS'?
Quoted 39 lines · QI Fuli
remove redundant tasks as BTRFS is checked in
is_swap_supported()Fixes caf453532("syscalls/swapon/swapon0{1..3}: use helpers to checksupport status")
Signed-off-by QI Fuli <[email protected]>--- testcases/kernel/syscalls/swapon/swapon01.c | 7 ------- testcases/kernel/syscalls/swapon/swapon02.c | 5 ----- testcases/kernel/syscalls/swapon/swapon03.c | 15 +-------------- 3 files changed, 1 insertion(+), 26 deletions(-)testcases/kernel/syscalls/swapon/swapon01.c +0
-7@@ -32,18 +32,11 @@ static void cleanup(void);char *TCID ="swapon01" ;int TST_TOTAL =1 ; -static long fs_type; -static void verify_swapon (void ) {TEST (ltp_syscall (__NR_swapon,"./swapfile01" ,0 ));if (TEST_RETURN ==-1 ) { -if (fs_type ==TST_BTRFS_MAGIC && errno ==EINVAL ) { -tst_brkm (TCONF , cleanup, -"Swapfile on BTRFS not implemeted" ); -return ; - }tst_resm (TFAIL |TTERRNO ,"Failed to turn on swapfile" ); }else {tst_resm (TPASS ,"Succeeded to turn on swapfile" );testcases/kernel/syscalls/swapon/swapon02.c +0
-0
testcases/kernel/syscalls/swapon/swapon02.c static void verify_swapon(struct test_case_t *test) · line 88
Quoted 8 lines
testcases/kernel/syscalls/swapon/swapon02.c +0
-5@@ -81,11 +81,6 @@ static void verify_swapon(struct test_case_t *test)return ; } -if (fs_type ==TST_BTRFS_MAGIC && errno ==EINVAL ) { -tst_resm (TCONF ,"Swapfile on BTRFS not implemeted" ); -return ; - } -
Hi Qi,
The following check for btrfs can be removed as well:
-------------------------------------------------------------
static void setup(void)
{
...
??????? if (ltp_syscall(__NR_swapon, "alreadyused", 0)) { ??????????????? if (fs_type != TST_BTRFS_MAGIC || errno != EINVAL) ??????????????????????? tst_resm(TWARN | TERRNO, "swapon(alreadyused)
failed");
...
-------------------------------------------------------------
Note: also remove fs_type variable.
Other than these, it looks good to me.
Best Regards,
Xiao Yang
Quoted 48 lines
testcases/kernel/syscalls/swapon/swapon02.c +0
-0tst_resm (TFAIL ,"swapon(2) failed to produce expected error:" " %d, errno: %s and got %d." , test->exp_errno, test->exp_errval,TEST_ERRNO );testcases/kernel/syscalls/swapon/swapon03.c +1
-15@@ -52,8 +52,6 @@ int TST_TOTAL = 1;static int swapfiles; -static long fs_type; -int testfiles =3 ; static struct swap_testfile_t { char *filename;@@ -215,9 +213,6 @@ static int setup_swap(void)/* turn on the swap file */ res =ltp_syscall (__NR_swapon, filename,0 );if (res !=0 ) { -if (fs_type ==TST_BTRFS_MAGIC && errno ==EINVAL ) -exit (2 ); -if (errno ==EPERM ) {printf ("Successfully created %d " "swapfiles\n" , j);@@ -233,16 +228,8 @@ static int setup_swap(void) }else waitpid (pid, &status,0 ); -switch (WEXITSTATUS (status)) { -case 0 : -break ; -case 2 : -tst_brkm (TCONF , cleanup,"Swapfile on BTRFS not implemeted" ); -break ; -default : +if (WEXITSTATUS (status) ==1 )tst_brkm (TFAIL , cleanup,"Failed to setup swaps" ); -break ; - }/* Create all needed extra swapfiles for testing */ for (j =0 ; j < testfiles; j++) --2.29.2
PATCH 1/1 syscalls/swapon/swapon0{1..3}: remove checking if fs type is BTRFS
Hi,
Quoted 5 lines · Xiao Yang
Hi Qi,
Can we rename subject to 'Remove the check for BTRFS'?
Yes.
Quoted 66 lines · QI Fuli
Quoted 39 lines
remove redundant tasks as BTRFS is checked in
is_swap_supported()Fixes caf453532("syscalls/swapon/swapon0{1..3}: use helpers to checksupport status")
Signed-off-by QI Fuli <[email protected]>--- testcases/kernel/syscalls/swapon/swapon01.c | 7 ------- testcases/kernel/syscalls/swapon/swapon02.c | 5 ----- testcases/kernel/syscalls/swapon/swapon03.c | 15 +-------------- 3 files changed, 1 insertion(+), 26 deletions(-)testcases/kernel/syscalls/swapon/swapon01.c +0
-7@@ -32,18 +32,11 @@ static void cleanup(void);char *TCID ="swapon01" ;int TST_TOTAL =1 ; -static long fs_type; -static void verify_swapon (void ) {TEST (ltp_syscall (__NR_swapon,"./swapfile01" ,0 ));if (TEST_RETURN ==-1 ) { -if (fs_type ==TST_BTRFS_MAGIC && errno ==EINVAL ) { -tst_brkm (TCONF , cleanup, -"Swapfile on BTRFS not implemeted" ); -return ; - }tst_resm (TFAIL |TTERRNO ,"Failed to turn on swapfile" ); }else {tst_resm (TPASS ,"Succeeded to turn on swapfile" );testcases/kernel/syscalls/swapon/swapon02.c +0
-0testcases/kernel/syscalls/swapon/swapon02.c static void verify_swapon(struct test_case_t *test) · line 88
Quoted 8 lines
testcases/kernel/syscalls/swapon/swapon02.c +0
-5@@ -81,11 +81,6 @@ static void verify_swapon(struct test_case_t *test)return ; } -if (fs_type ==TST_BTRFS_MAGIC && errno ==EINVAL ) { -tst_resm (TCONF ,"Swapfile on BTRFS not implemeted" ); -return ; - } -Hi Qi,
The following check for btrfs can be removed as well:
-------------------------------------------------------------
static void setup(void)
{
...if (ltp_syscall(__NR_swapon, "alreadyused", 0)) { if (fs_type != TST_BTRFS_MAGIC || errno != EINVAL) tst_resm(TWARN | TERRNO, "swapon(alreadyused) failed");...
-------------------------------------------------------------
Quoted 7 lines
Note: also remove
fs_typevariable.Other than these, it looks good to me.
Best Regards,
Xiao Yang
Ok, I got it.
I will send a v2 patch.
Thank you very much.
QI
Quoted 43 lines
Quoted 43 lines
testcases/kernel/syscalls/swapon/swapon02.c +0
-0tst_resm (TFAIL ,"swapon(2) failed to produce expected error:" " %d, errno: %s and got %d." , test->exp_errno, test->exp_errval,TEST_ERRNO );testcases/kernel/syscalls/swapon/swapon03.c +1
-14@@ -52,8 +52,6 @@ int TST_TOTAL = 1;static int swapfiles; -static long fs_type; -int testfiles =3 ; static struct swap_testfile_t { char *filename;@@ -215,9 +213,6 @@ static int setup_swap(void)/* turn on the swap file */ res =ltp_syscall (__NR_swapon, filename,0 );if (res !=0 ) { -if (fs_type ==TST_BTRFS_MAGIC && errno ==EINVAL ) -exit (2 ); -if (errno ==EPERM ) {printf ("Successfully created %d " "swapfiles\n" , j);@@ -233,16 +228,8 @@ static int setup_swap(void) }else waitpid (pid, &status,0 ); -switch (WEXITSTATUS (status)) { -case 0 : -break ; -case 2 : -tst_brkm (TCONF , cleanup,"Swapfile on BTRFS not implemeted" ); -break ; -default : +if (WEXITSTATUS (status) ==1 )tst_brkm (TFAIL , cleanup,"Failed to setup swaps" ); -break ; - }
Quoted 4 lines
Quoted 4 lines
testcases/kernel/syscalls/swapon/swapon03.c +0
-1/* Create all needed extra swapfiles for testing */ for (j =0 ; j < testfiles; j++) --2.29.2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210319/bcdbee12/attachment-0001.htm>