Convert syscalls/swap{on,off}/ to the new API
cover Convert syscalls/swap{on,off}/ to the new API
From: QI Fuli <[email protected]>
Rename libs/libltpswapon libs/libltpswap and Convert it to the new API Convert syscalls/swap{on,off}/ to the new API
QI Fuli (6):
libs/libltpswap: Add libs/libltpswap by using the new API syscalls/swapon/swapon01: Convert swapon01 to the new API syscalls/swapon/swapon02: Convert swapon02 to the new API syscalls/swapon/swapon03: Convert swapon03 to the new API syscalls/swapoff/swapoff01: Convert swapoff01 to the new API syscalls/swapoff/swapoff02: Convert swapoff02 to the new API
include/libswap.h | 24 ++
include/libswapon.h | 39 ---
libs/{libltpswapon => libltpswap}/Makefile | 2 +-
libs/libltpswap/libswap.c | 63 +++++
libs/libltpswapon/libswapon.c | 90 -------
testcases/kernel/syscalls/swapoff/Makefile | 4 +-
testcases/kernel/syscalls/swapoff/swapoff01.c | 94 ++------
testcases/kernel/syscalls/swapoff/swapoff02.c | 142 ++++-------
testcases/kernel/syscalls/swapon/Makefile | 4 +-
testcases/kernel/syscalls/swapon/swapon01.c | 83 ++-----
testcases/kernel/syscalls/swapon/swapon02.c | 145 ++++-------
testcases/kernel/syscalls/swapon/swapon03.c | 227 +++++++-----------
12 files changed, 317 insertions(+), 600 deletions(-)
create mode 100644 include/libswap.h
delete mode 100644 include/libswapon.h
rename libs/{libltpswapon => libltpswap}/Makefile (89%)
create mode 100644 libs/libltpswap/libswap.c
delete mode 100644 libs/libltpswapon/libswapon.cSignature · 1 line
2.30.2
PATCH 1/6 libs/libltpswap: Add libs/libltpswap by using the new API
From: QI Fuli <[email protected]>
--- include/libswap.h | 24 +++++++++++++++ libs/libltpswap/Makefile | 12 ++++++++ libs/libltpswap/libswap.c | 63 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 include/libswap.h create mode 100644 libs/libltpswap/Makefile create mode 100644 libs/libltpswap/libswap.c
include/libswap.h new file +24 -0
@@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved. +* Author: Stanislav Kholmanskikh <[email protected]> +*/ + +/* +* Contains common content for all swapon/swapoff tests +*/ + +#ifndef __LIBSWAP_H__ +#define __LIBSWAP_H__ + +/* +* Make a swap file +*/ +int make_swapfile (const char *swapfile,int safe); + +/* +* Check swapon/swapoff support status of filesystems or files +* we are testing on. +*/ +void is_swap_supported (const char *filename); +#endif /* __LIBSWAP_H__ */
libs/libltpswap/Makefile new file +12 -0
@@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) Richard Purdie <[email protected]> + +top_srcdir ?= ../.. + +include $(top_srcdir)/include/mk/env_pre.mk + +INTERNAL_LIB := libltpswap.a + +include $(top_srcdir)/include/mk/lib.mk +include $(top_srcdir)/include/mk/generic_leaf_target.mk
libs/libltpswap/libswap.c new file +63 -0
63 lines not on this page · raw message
Signature · 1 line
2.30.2
PATCH 2/6 syscalls/swapon/swapon01: Convert swapon01 to the new API
In reply to QI FuliFrom: QI Fuli <[email protected]>
--- testcases/kernel/syscalls/swapon/Makefile | 4 +- testcases/kernel/syscalls/swapon/swapon01.c | 83 +++++---------------- 2 files changed, 22 insertions(+), 65 deletions(-)
testcases/kernel/syscalls/swapon/Makefile +2 -2
@@ -8,10 +8,10 @@ endif top_srcdir ?= ../../../.. -LTPLIBS = ltpswapon +LTPLIBS = ltpswap include $(top_srcdir)/include/mk/testcases.mk -LTPLDLIBS = -lltpswapon +LTPLDLIBS = -lltpswap include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/swapon/swapon01.c +20 -63
108 lines not on this page · raw message
Signature · 1 line
2.30.2
PATCH 3/6 syscalls/swapon/swapon02: Convert swapon02 to the new API
In reply to QI FuliFrom: QI Fuli <[email protected]>
--- testcases/kernel/syscalls/swapon/swapon02.c | 145 +++++++------------- 1 file changed, 52 insertions(+), 93 deletions(-)
testcases/kernel/syscalls/swapon/swapon02.c +52 -93
@@ -1,18 +1,9 @@ -/* Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved. -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of version 2 of the GNU General Public License as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it would be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write the Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -* +// SPDX-License-Identifier: GPL-2.0-or-later + +/* +* Copyright (c) Wipro Technologies Ltd, 2002. All Rights Reserved. */ +/* * This test case checks whether swapon(2) system call returns * 1. ENOENT when the path does not exist
@@ -21,41 +12,27 @@* 4. EBUSY when the specified path is already being used as a swap area */ -#include <unistd.h> #include <errno.h> -#include <stdlib.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <sys/stat.h> -#include <fcntl.h> #include <pwd.h> -#include <string.h> -#include <sys/utsname.h> -#include <signal.h> -#include "test.h" + +#include "tst_test.h" #include "lapi/syscalls.h" -#include "safe_macros.h" -#include "libswapon.h" +#include "libswap.h" -static void setup (void ); -static void cleanup (void );static void setup01 (void );static void cleanup01 (void ); -char *TCID ="swapon02" ; -int TST_TOTAL =4 ; -static uid_t nobody_uid;static int do_swapoff; -static struct test_case_t { +static struct tcase {char *err_desc;int exp_errno;char *exp_errval;char *path;void (*setup)(void );void (*cleanup)(void ); -} testcases[] = { +} tcases[] = { {"Path does not exist" ,ENOENT ,"ENOENT" ,"./doesnotexist" ,NULL ,NULL }, {"Invalid path" ,EINVAL ,"EINVAL" ,"./notswap" ,NULL ,NULL }, {"Permission denied" ,EPERM ,"EPERM" ,"./swapfile01" ,
@@ -63,87 +40,69 @@ static struct test_case_t { {"File already used", EBUSY, "EBUSY", "./alreadyused", NULL, NULL}, }; -static void verify_swapon (struct test_case_t *test) -{ -if (test->setup) - test->setup (); - -TEST (ltp_syscall (__NR_swapon, test->path,0 )); - -if (test->cleanup) - test->cleanup (); - -if (TEST_RETURN ==-1 &&TEST_ERRNO == test->exp_errno) { -tst_resm (TPASS ,"swapon(2) expected failure;" -" Got errno - %s : %s" , - test->exp_errval, test->err_desc); -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 ); -} - -int main (int ac,char **av) -{ -int lc, i; - -tst_parse_opts (ac, av,NULL ,NULL ); - -setup (); - -for (lc =0 ;TEST_LOOPING (lc); lc++) { - tst_count =0 ; -for (i =0 ; i <TST_TOTAL ; i++) -verify_swapon (testcases + i); - } - -cleanup (); -tst_exit (); -} -static void setup01 (void ) { -SAFE_SETEUID (cleanup, nobody_uid); +SAFE_SETEUID (nobody_uid); }static void cleanup01 (void ) { -SAFE_SETEUID (cleanup,0 ); +SAFE_SETEUID (0 ); }static void setup (void ) {struct passwd *nobody; -tst_sig (FORK ,DEF_HANDLER , cleanup); - -tst_require_root (); - - nobody =SAFE_GETPWNAM (cleanup,"nobody" ); + nobody =SAFE_GETPWNAM ("nobody" ); nobody_uid = nobody->pw_uid; -tst_tmpdir (); - -is_swap_supported (cleanup,"./tstswap" ); +is_swap_supported ("./tstswap" ); -SAFE_TOUCH (cleanup,"notswap" ,0777 ,NULL ); -make_swapfile (cleanup,"swapfile01" ,0 ); -make_swapfile (cleanup,"alreadyused" ,0 ); +SAFE_TOUCH ("notswap" ,0777 ,NULL ); +make_swapfile ("swapfile01" ,0 ); +make_swapfile ("alreadyused" ,0 ); -if (ltp_syscall (__NR_swapon,"alreadyused" ,0 )) -tst_resm (TWARN |TERRNO ,"swapon(alreadyused) failed" ); +if (tst_syscall (__NR_swapon,"alreadyused" ,0 )) +tst_res (TWARN |TERRNO ,"swapon(alreadyused) failed" );else do_swapoff =1 ; - -TEST_PAUSE ; }void cleanup (void ) { -if (do_swapoff &<p_syscall (__NR_swapoff,"alreadyused" )) -tst_resm (TWARN |TERRNO ,"swapoff(alreadyused) failed" ); +if (do_swapoff &&tst_syscall (__NR_swapoff,"alreadyused" )) +tst_res (TWARN |TERRNO ,"swapoff(alreadyused) failed" ); +} -tst_rmdir (); +static void verify_swapon (unsigned int i) +{ +struct tcase *tc = tcases + i; +if (tc->setup) + tc->setup (); + +TEST (tst_syscall (__NR_swapon, tc->path,0 )); + +if (tc->cleanup) + tc->cleanup (); + +if (TST_RET ==-1 &&TST_ERR == tc->exp_errno) { +tst_res (TPASS ,"swapon(2) expected failure;" +" Got errno - %s : %s" , + tc->exp_errval, tc->err_desc); +return ; + } + +tst_res (TFAIL ,"swapon(2) failed to produce expected error:" +" %d, errno: %s and got %d." , tc->exp_errno, + tc->exp_errval,TST_ERR ); } + +static struct tst_test test = { + .needs_root =1 , + .needs_tmpdir =1 , + .test = verify_swapon, + .tcnt =ARRAY_SIZE (tcases), + .setup = setup, + .cleanup = cleanup +};
Signature · 1 line
2.30.2
PATCH 4/6 syscalls/swapon/swapon03: Convert swapon03 to the new API
In reply to QI FuliFrom: QI Fuli <[email protected]>
--- testcases/kernel/syscalls/swapon/swapon03.c | 227 ++++++++------------ 1 file changed, 85 insertions(+), 142 deletions(-)
testcases/kernel/syscalls/swapon/swapon03.c +85 -142
@@ -1,23 +1,10 @@ -/****************************************************************************** -* +// SPDX-License-Identifier: GPL-2.0-or-later + +/* * Copyright (c) International Business Machines Corp., 2007 * Created by <[email protected]> * -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See -* the GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -* -******************************************************************************/ +*/ /* * This test case checks whether swapon(2) system call returns:
@@ -25,31 +12,20 @@* */ -#include <sys/types.h> -#include <unistd.h> +#include <stdio.h> #include <errno.h> #include <stdlib.h> #include <sys/wait.h> -#include <sys/stat.h> -#include <sys/utsname.h> -#include <fcntl.h> -#include <pwd.h> -#include <string.h> -#include <signal.h> -#include "test.h" + +#include "tst_test.h" #include "lapi/syscalls.h" #include "swaponoff.h" -#include "libswapon.h" +#include "libswap.h" -static void setup (void ); -static void cleanup (void );static int setup_swap (void );static int clean_swap (void );static int check_and_swapoff (const char *filename); -char *TCID ="swapon03" ; -int TST_TOTAL =1 ; -static int swapfiles;int testfiles =3 ;
@@ -63,82 +39,60 @@ static struct swap_testfile_t {int expected_errno =EPERM ; -int main (int ac,char **av) +static void verify_swapon (void ) { -int lc; - -tst_parse_opts (ac, av,NULL ,NULL ); - -setup (); +if (setup_swap () <0 ) { +clean_swap (); +tst_brk (TBROK ,"Setup failed, quitting the test" ); + } -for (lc =0 ;TEST_LOOPING (lc); lc++) { - tst_count =0 ; +TEST (tst_syscall (__NR_swapon, swap_testfiles[0 ].filename,0 )); -if (setup_swap () <0 ) { -clean_swap (); -tst_brkm (TBROK , cleanup, -"Setup failed, quitting the test" ); - } +if ((TST_RET ==-1 ) && (TST_ERR == expected_errno)) { +tst_res (TPASS ,"swapon(2) got expected failure (%d)," , + expected_errno); + }else if (TST_RET <0 ) { +tst_res (TFAIL |TTERRNO , +"swapon(2) failed to produce expected error " +"(%d). System reboot recommended." , + expected_errno); + }else { +/* Probably the system supports MAX_SWAPFILES > 30, +* let's try with MAX_SWAPFILES == 32 */ -TEST (ltp_syscall (__NR_swapon, swap_testfiles[0 ].filename,0 )); +/* Call swapon sys call once again for 32 +* now we can't receive an error */ +TEST (tst_syscall (__NR_swapon, swap_testfiles[1 ].filename,0 )); -if ((TEST_RETURN ==-1 ) && (TEST_ERRNO == expected_errno)) { -tst_resm (TPASS ,"swapon(2) got expected failure (%d)," , - expected_errno); - }else if (TEST_RETURN <0 ) { -tst_resm (TFAIL |TTERRNO , -"swapon(2) failed to produce expected error " -"(%d). System reboot recommended." , - expected_errno); +/* Check return code (now we're expecting success) */ +if (TST_RET <0 ) { +tst_res (TFAIL |TTERRNO , +"swapon(2) got an unexpected failure" ); }else { -/* Probably the system supports MAX_SWAPFILES > 30, -* let's try with MAX_SWAPFILES == 32 */ - -/* Call swapon sys call once again for 32 -* now we can't receive an error */ -TEST (ltp_syscall - (__NR_swapon, swap_testfiles[1 ].filename,0 )); - -/* Check return code (now we're expecting success) */ -if (TEST_RETURN <0 ) { -tst_resm (TFAIL |TTERRNO , -"swapon(2) got an unexpected failure" ); +/* Call swapon sys call once again for 33 +* now we have to receive an error */ +TEST (tst_syscall (__NR_swapon, swap_testfiles[2 ].filename,0 )); + +/* Check return code (should be an error) */ +if ((TST_RET ==-1 ) && (TST_ERR == expected_errno)) { +tst_res (TPASS , +"swapon(2) got expected failure;" +" Got errno = %d, probably your" +" MAX_SWAPFILES is 32" , + expected_errno); }else { -/* Call swapon sys call once again for 33 -* now we have to receive an error */ -TEST (ltp_syscall - (__NR_swapon, swap_testfiles[2 ].filename, -0 )); - -/* Check return code (should be an error) */ -if ((TEST_RETURN ==-1 ) - && (TEST_ERRNO == expected_errno)) { -tst_resm (TPASS , -"swapon(2) got expected failure;" -" Got errno = %d, probably your" -" MAX_SWAPFILES is 32" , - expected_errno); - }else { -tst_resm (TFAIL , -"swapon(2) failed to produce" -" expected error: %d, got %s." -" System reboot after execution of LTP" -" test suite is recommended." , - expected_errno, -strerror (TEST_ERRNO )); - } - +tst_res (TFAIL , +"swapon(2) failed to produce" +" expected error: %d, got %s." +" System reboot after execution of LTP" +" test suite is recommended." , + expected_errno,strerror (TST_ERR )); } } - -if (clean_swap () <0 ) -tst_brkm (TBROK , cleanup, -"Cleanup failed, quitting the test" ); - } -cleanup (); -tst_exit (); +if (clean_swap () <0 ) +tst_brk (TBROK ,"Cleanup failed, quitting the test" ); }
@@ -157,22 +111,20 @@ static int setup_swap(void)/* Find out how many swapfiles (1 line per entry) already exist */ swapfiles =0 ; -if (seteuid (0 ) <0 ) { -tst_brkm (TFAIL |TERRNO , cleanup,"Failed to call seteuid" ); - } +if (seteuid (0 ) <0 ) +tst_brk (TFAIL |TERRNO ,"Failed to call seteuid" );/* This includes the first (header) line */ if ((fd =open ("/proc/swaps" ,O_RDONLY )) ==-1 ) { -tst_brkm (TFAIL |TERRNO , cleanup, -"Failed to find out existing number of swap files" ); +tst_brk (TFAIL |TERRNO , +"Failed to find out existing number of swap files" ); } do { char *p = buf; res = read(fd, buf, BUFSIZ); if (res < 0) { - tst_brkm(TFAIL | TERRNO, cleanup, - "Failed to find out existing number of swap " - "files"); + tst_brk(TFAIL | TERRNO, + "Failed to find out existing number of swap files"); } buf[res] = '\0'; while ((p = strchr(p, '\n'))) {
@@ -184,18 +136,14 @@ static int setup_swap(void)if (swapfiles) swapfiles--;/* don't count the /proc/swaps header */ -if (swapfiles <0 ) { -tst_brkm (TFAIL , cleanup, -"Failed to find existing number of swapfiles" ); - } +if (swapfiles <0 ) +tst_brk (TFAIL ,"Failed to find existing number of swapfiles" );/* Determine how many more files are to be created */ swapfiles =MAX_SWAPFILES - swapfiles; -if (swapfiles >MAX_SWAPFILES ) { +if (swapfiles >MAX_SWAPFILES ) swapfiles =MAX_SWAPFILES ; - } - - pid =FORK_OR_VFORK (); + pid =SAFE_FORK ();if (pid ==0 ) {/*create and turn on remaining swapfiles */ for (j =0 ; j < swapfiles; j++) {
@@ -208,18 +156,16 @@ static int setup_swap(void) }/* Create the swapfile */ -make_swapfile (cleanup, filename,0 ); +make_swapfile (filename,0 );/* turn on the swap file */ - res =ltp_syscall (__NR_swapon, filename,0 ); + res =tst_syscall (__NR_swapon, filename,0 );if (res !=0 ) {if (errno ==EPERM ) { -printf ("Successfully created %d " -"swapfiles\n" , j); +printf ("Successfully created %d swapfiles\n" , j);break ; }else { -printf ("Failed to create " -"swapfile: %s\n" , filename); +printf ("Failed to create swapfile: %s\n" , filename);exit (1 ); } }
@@ -229,11 +175,11 @@ static int setup_swap(void)waitpid (pid, &status,0 );if (WEXITSTATUS (status)) -tst_brkm (TFAIL , cleanup,"Failed to setup swaps" ); +tst_brk (TFAIL ,"Failed to setup swaps" );/* Create all needed extra swapfiles for testing */ for (j =0 ; j < testfiles; j++) -make_swapfile (cleanup, swap_testfiles[j].filename,0 ); +make_swapfile (swap_testfiles[j].filename,0 );return 0 ;
@@ -250,22 +196,21 @@ static int clean_swap(void)for (j =0 ; j < swapfiles; j++) {if (snprintf (filename,sizeof (filename),"swapfile%02d" , j +2 ) <0 ) { -tst_resm (TWARN ,"sprintf() failed to create filename" ); -tst_resm (TWARN ,"Failed to turn off swap files. System" +tst_res (TWARN ,"sprintf() failed to create filename" ); +tst_res (TWARN ,"Failed to turn off swap files. System" " reboot after execution of LTP test" " suite is recommended" );return -1 ; }if (check_and_swapoff (filename) !=0 ) { -tst_resm (TWARN ,"Failed to turn off swap file %s." , - filename); +tst_res (TWARN ,"Failed to turn off swap file %s." , filename);return -1 ; } }for (j =0 ; j < testfiles; j++) {if (check_and_swapoff (swap_testfiles[j].filename) !=0 ) { -tst_resm (TWARN ,"Failed to turn off swap file %s." , +tst_res (TWARN ,"Failed to turn off swap file %s." , swap_testfiles[j].filename);return -1 ; }
@@ -284,8 +229,7 @@ static int check_and_swapoff(const char *filename)if (snprintf (cmd_buffer,sizeof (cmd_buffer),"grep -q '%s.*file' /proc/swaps" , filename) <0 ) { -tst_resm (TWARN , -"sprintf() failed to create the command string" ); +tst_res (TWARN ,"sprintf() failed to create the command string" ); }else { rc =0 ;
@@ -293,9 +237,9 @@ static int check_and_swapoff(const char *filename)if (system (cmd_buffer) ==0 ) {/* now we need to swapoff the file */ -if (ltp_syscall (__NR_swapoff, filename) !=0 ) { +if (tst_syscall (__NR_swapoff, filename) !=0 ) { -tst_resm (TWARN ,"Failed to turn off swap " +tst_res (TWARN ,"Failed to turn off swap " "file. system reboot after " "execution of LTP test suite " "is recommended" );
@@ -311,23 +255,22 @@ static int check_and_swapoff(const char *filename)static void setup (void ) { -tst_sig (FORK ,DEF_HANDLER , cleanup); - -tst_require_root (); -if (access ("/proc/swaps" ,F_OK )) -tst_brkm (TCONF ,NULL ,"swap not supported by kernel" ); - -tst_tmpdir (); - -is_swap_supported (cleanup,"./tstswap" ); +tst_brk (TCONF ,"swap not supported by kernel" ); -TEST_PAUSE ; +is_swap_supported ("./tstswap" ); }static void cleanup (void ) {clean_swap (); - -tst_rmdir (); } + +static struct tst_test test = { + .needs_root =1 , + .needs_tmpdir =1 , + .forks_child =1 , + .test_all = verify_swapon, + .setup = setup, + .cleanup = cleanup +};
Signature · 1 line
2.30.2
PATCH 5/6 syscalls/swapoff/swapoff01: Convert swapoff01 to the new API
In reply to QI FuliFrom: QI Fuli <[email protected]>
--- testcases/kernel/syscalls/swapoff/Makefile | 4 +- testcases/kernel/syscalls/swapoff/swapoff01.c | 94 +++++-------------- 2 files changed, 27 insertions(+), 71 deletions(-)
testcases/kernel/syscalls/swapoff/Makefile +2 -2
@@ -3,10 +3,10 @@ top_srcdir ?= ../../../.. -LTPLIBS = ltpswapon +LTPLIBS = ltpswap include $(top_srcdir)/include/mk/testcases.mk -LTPLDLIBS = -lltpswapon +LTPLDLIBS = -lltpswap include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/swapoff/swapoff01.c +25 -69
124 lines not on this page · raw message
Signature · 1 line
2.30.2
PATCH 6/6 syscalls/swapoff/swapoff02: Convert swapoff02 to the new API
In reply to QI FuliFrom: QI Fuli <[email protected]>
convert swapoff02 to the new API and remove libs/libltpswapon
--- include/libswapon.h | 39 ----- libs/libltpswapon/Makefile | 12 -- libs/libltpswapon/libswapon.c | 90 ----------- testcases/kernel/syscalls/swapoff/swapoff02.c | 142 ++++++------------ 4 files changed, 43 insertions(+), 240 deletions(-) delete mode 100644 include/libswapon.h delete mode 100644 libs/libltpswapon/Makefile delete mode 100644 libs/libltpswapon/libswapon.c
include/libswapon.h deleted +0 -39
@@ -1,39 +0,0 @@ -/* -* Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation; either version 2 of -* the License, or (at your option) any later version. -* -* This program is distributed in the hope that it would be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write the Free Software Foundation, -* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -* -* Author: Stanislav Kholmanskikh <[email protected]> -* -*/ - -/* -* Contains common content for all swapon tests -*/ - -#ifndef __LIBSWAPON_H__ -#define __LIBSWAPON_H__ - -/* -* Make a swap file -*/ -int make_swapfile (void (cleanup )(void ),const char *swapfile,int safe); - -/* -* Check swapon/swapoff support status of filesystems or files -* we are testing on. -*/ -void is_swap_supported (void (cleanup )(void ),const char *filename); -#endif /* __LIBSWAPON_H__ */
libs/libltpswapon/Makefile deleted +0 -12
@@ -1,12 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later -# -# Copyright (C) Richard Purdie <[email protected]> - -top_srcdir ?= ../.. - -include $(top_srcdir)/include/mk/env_pre.mk - -INTERNAL_LIB := libltpswapon.a - -include $(top_srcdir)/include/mk/lib.mk -include $(top_srcdir)/include/mk/generic_leaf_target.mk
libs/libltpswapon/libswapon.c deleted +0 -90
90 lines not on this page · raw message
testcases/kernel/syscalls/swapoff/swapoff02.c +43 -99
195 lines not on this page · raw message
Signature · 1 line
2.30.2
cover Convert syscalls/swap{on, off}/ to the new API
In reply to QI FuliHi Fuli,
QI Fuli <[email protected]> wrote:
From: QI Fuli <[email protected]>
Quoted 4 lines
Rename libs/libltpswapon libs/libltpswap and Convert it to the new API Convert syscalls/swap{on,off}/ to the new API
Quoted 8 lines
QI Fuli (6):
libs/libltpswap: Add libs/libltpswap by using the new API syscalls/swapon/swapon01: Convert swapon01 to the new API syscalls/swapon/swapon02: Convert swapon02 to the new API syscalls/swapon/swapon03: Convert swapon03 to the new API syscalls/swapoff/swapoff01: Convert swapoff01 to the new API syscalls/swapoff/swapoff02: Convert swapoff02 to the new API
I made some changes based on your patchset and pushed it.
* remove the libs/libltpswapon from patch 1/6
* add [Description] in the comment to make ltp/docparse happy
* fix some TTERRNO/TERRNO usage issues
* code indent issue e.g. add brackets while more than two lines in if...else sentence
Btw, next time you can add '-v2' parameter when generating the second patch version.
git format-patch -v2 -6 ...
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20210329/3ad0518b/attachment.htm>
cover Convert syscalls/swap{on, off}/ to the new API
Hi Li Wang,
Quoted 21 lines · Li Wang
Hi Fuli,
QI Fuli <[email protected] <mailto:[email protected]>> wrote:
From: QI Fuli <[email protected] <mailto:[email protected]>>
Rename libs/libltpswapon libs/libltpswap and Convert it to the new API Convert syscalls/swap{on,off}/ to the new API
QI Fuli (6):
libs/libltpswap: Add libs/libltpswap by using the new API syscalls/swapon/swapon01: Convert swapon01 to the new API syscalls/swapon/swapon02: Convert swapon02 to the new API syscalls/swapon/swapon03: Convert swapon03 to the new API syscalls/swapoff/swapoff01: Convert swapoff01 to the new API syscalls/swapoff/swapoff02: Convert swapoff02 to the new APII made some changes based on your patchset and pushed it.
Quoted 8 lines
* remove the libs/libltpswapon from patch 1/6
* add [Description] in the comment to make ltp/docparse happy
* fix some TTERRNO/TERRNO usage issues
* code indent issue e.g. add brackets while more than two lines in if...else sentenceBtw, next time you can add '-v2' parameter when generating the second patch version.
git format-patch -v2 -6 ...
Thank you very much for the help.
Best,
QI
Quoted 4 lines
Signature · 3 lines
-- Regards, Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210329/c79f51b0/attachment-0001.htm>