lib/parse_opts: Get rid of the long unused -p and -P options
PATCH 1/23 lib/parse_opts: Get rid of the long unused -p and -P options
--- lib/parse_opts.c | 87 -------------------------------------------------------- 1 file changed, 87 deletions(-)
lib/parse_opts.c +0 -87
@@ -51,13 +51,10 @@#endif /* Define flags and args for standard options */ -static int STD_PAUSE =0 ;/* flag indicating to pause before actual start, */ -/* for contention mode */ static int STD_INFINITE =0 ;/* flag indciating to loop forever */ int STD_LOOP_COUNT =1 ;/* number of iterations */ static float STD_LOOP_DURATION =0.0 ;/* duration value in fractional seconds */ -static float STD_LOOP_DELAY =0.0 ;/* loop delay value in fractional seconds */ static char **STD_opt_arr =NULL ;/* array of option strings */ static int STD_argind =1 ;/* argv index to next argv element */
@@ -90,8 +87,6 @@ static struct std_option_t { {"h", " -h Show this help screen\n", NULL, NULL}, {"i:", " -i n Execute test n times\n", NULL, NULL}, {"I:", " -I x Execute test for x seconds\n", NULL, NULL}, - {"p", " -p Pause for SIGUSR1 before starting\n", NULL, NULL}, - {"P:", " -P x Pause for x seconds between iterations\n", NULL, NULL}, #ifdef UCLINUX {"C:", " -C ARG Run the child process with arguments ARG (for internal use)\n",
@@ -213,19 +208,12 @@ const char *parse_opts(int ac, char **av, const option_t * user_optarr,if (STD_LOOP_COUNT ==0 )STD_INFINITE =1 ;break ; -case 'P' :/* Delay between iterations */ - options |= OPT_delay; -STD_LOOP_DELAY =atof (optarg); -break ;case 'I' :/* Time duration */ options |= OPT_duration;STD_LOOP_DURATION =atof (optarg);if (STD_LOOP_DURATION ==0.0 )STD_INFINITE =1 ;break ; -case 'p' :/* Pause for SIGUSR1 */ -STD_PAUSE =1 ; -break ;case 'h' :/* Help */ print_help (uhf);exit (0 );
@@ -345,20 +333,6 @@ const char *parse_opts(int ac, char **av, const option_t * user_optarr, } } } -/* -* If the USC_LOOP_DELAY environmental variable is set, -* use that number as delay in factional seconds (same as -P option). -* The -P option with arg will be used even if this env var is set. -*/ -if (!(options & OPT_delay) && (ptr =getenv (USC_LOOP_DELAY )) !=NULL ) { -if (sscanf (ptr,"%f" , &ftmp) ==1 && ftmp >=0.0 ) { -STD_LOOP_DELAY = ftmp; -if (Debug) -printf - ("Using env %s, set STD_LOOP_DELAY = %f\n" , -USC_LOOP_DELAY , ftmp); - } - }/* * The following are special system testing envs to turn on special
@@ -465,46 +439,20 @@ const char *parse_opts(int ac, char **av, const option_t * user_optarr,#if UNIT_TEST printf ("The following variables after option and env parsing:\n" );printf ("STD_LOOP_DURATION = %f\n" ,STD_LOOP_DURATION ); -printf ("STD_LOOP_DELAY = %f\n" ,STD_LOOP_DELAY );printf ("STD_LOOP_COUNT = %d\n" ,STD_LOOP_COUNT );printf ("STD_INFINITE = %d\n" ,STD_INFINITE ); -printf ("STD_PAUSE = %d\n" ,STD_PAUSE );#endif return NULL ; } -/* -* routine to goto when we get the SIGUSR1 for STD_PAUSE -*/ -static void STD_go (int sig) -{ - (void )sig; -return ; -} -/*********************************************************************** * This function will do desired end of global setup test * hooks. -* Currently it will only do a pause waiting for sigusr1 if -* STD_PAUSE is set. -* ***********************************************************************/ int usc_global_setup_hook (void ) {#ifndef UCLINUX -/* temp variable to store old signal action to be restored after pause */ -int (*_TMP_FUNC) (void ); - -/* -* pause waiting for sigusr1. -*/ -if (STD_PAUSE ) { - _TMP_FUNC = (int (*)())signal (SIGUSR1 , STD_go); -pause (); -signal (SIGUSR1 , (void (*)())_TMP_FUNC); - } -if (STD_TP_sbrk || STD_LP_sbrk) STD_start_break =sbrk (0 );/* get original sbreak size */
@@ -548,8 +496,6 @@ int usc_test_looping(int counter) {static int first_time =1 ;static uint64_t stop_time =0 ; -static uint64_t delay; -uint64_t ct, end;int keepgoing =0 ;/*
@@ -569,39 +515,6 @@ int usc_test_looping(int counter) (uint64_t ) (USECS_PER_SEC *STD_LOOP_DURATION ) +get_current_time (); } - -/* -* If doing delay each iteration, calcuate the number -* of clocks for each delay. -*/ -if (STD_LOOP_DELAY ) - delay =USECS_PER_SEC *STD_LOOP_DELAY ; - } - -/* -* if delay each iteration, loop for delay clocks. -* This will not be done on first iteration. -* The delay will happen before determining if -* there will be another iteration. -*/ -else if (STD_LOOP_DELAY ) { - ct =get_current_time (); - end = ct + delay; -while (ct < end) { -/* -* The following are special test hooks in the delay loop. -*/ -if (STD_LD_recfun) { -if (Debug) -printf - ("calling usc_recressive_func(0, %d, *STD_bigstack)\n" , - STD_LD_recfun); -usc_recressive_func (0 , STD_LD_recfun, - *STD_bigstack); - } - - ct =get_current_time (); - } }if (STD_INFINITE )
Signature · 1 line
2.10.2
PATCH 2/23 syscalls/mkdir09: Small cleanup
* Get rid of UCLINUX ifdefs
* Remove useless comments
* Make use of tst_parse_opts()
--- testcases/kernel/syscalls/mkdir/mkdir09.c | 184 ++++++------------------------ 1 file changed, 32 insertions(+), 152 deletions(-)
testcases/kernel/syscalls/mkdir/mkdir09.c +32 -152
@@ -21,11 +21,7 @@/* 10/30/2002 Port to LTP [email protected] */ /* -* NAME -* mkdir.c - Stress test of mkdir call. -* -* CALLS -* mkdir, rmdir +* Stress test of mkdir call. * * ALGORITHM * Create multiple processes which create subdirectories in the
@@ -37,12 +33,10 @@* -t = number of seconds to run test * -d = number of directories created in test directory * -* RESTRICTIONS -* */ -#include <stdio.h> /* needed by testhead.h */ -#include <sys/wait.h> /* needed by testhead.h */ +#include <stdio.h> +#include <sys/wait.h> #include <sys/types.h> #include <sys/param.h> #include <sys/stat.h>
@@ -62,16 +56,9 @@#define MODE_RWX 07770#define DIR_NAME "./X.%d" -/* used by getopt */ -extern char *optarg; -extern int optind, opterr; -char *goodopts ="c:t:d:" ; -int errflg; -char *TCID ="mkdir09" ;int TST_TOTAL =1 ; -int child_groups, test_time, nfiles;char testdir[MAXPATHLEN ];int parent_pid, sigchld, sigterm, jump;void term (int sig);
@@ -88,88 +75,60 @@ int runtest(void);void setup (void );void cleanup (void ); -#ifdef UCLINUX -static char *argv0; -void dochild1_uclinux (void ); -void dochild2_uclinux (void ); -void dochild3_uclinux (void ); -static int group_uclinux; -#endif - -/*--------------------------------------------------------------*/ -/*--------------------------------------------------------------*/ -/*--------------------------------------------------------------*/ +static int child_groups =2 ; +static int test_time =5 ; +static int nfiles =5 ; + +static char *opt_child_groups; +static char *opt_test_time; +static char *opt_nfiles; + +static option_t options[] = { + {"c:" ,NULL , &opt_child_groups}, + {"t:" ,NULL , &opt_test_time}, + {"d:" ,NULL , &opt_nfiles}, + {NULL ,NULL ,NULL } +}; + +static void usage (void ) +{ +printf (" -c Child groups\n" ); +printf (" -t Test runtime\n" ); +printf (" -d Directories\n" ); +} +int main (int argc,char *argv[]) { -int c; +tst_parse_opts (argc, argv, options, usage); -#ifdef UCLINUX +if (opt_child_groups) + child_groups =atoi (opt_child_groups); -tst_parse_opts (argc, argv,NULL ,NULL ); +if (opt_test_time) + test_time =atoi (opt_test_time); - argv0 = argv[0 ]; -maybe_run_child (&dochild1_uclinux,"nd" ,1 , &nfiles); -maybe_run_child (&dochild2_uclinux,"n" ,2 ); -maybe_run_child (&dochild3_uclinux,"nd" ,3 , &group_uclinux); -#endif +if (opt_nfiles) + nfiles =atoi (opt_nfiles);setup (); -/* Set up to catch SIGTERM signal */ if (signal (SIGTERM , term) ==SIG_ERR ) {tst_brkm (TFAIL , cleanup,"Error setting up SIGTERM signal, ERRNO = %d" , errno); } -/* Set up to catch SIGCHLD signal */ if (signal (SIGCHLD , chld) ==SIG_ERR ) {tst_brkm (TFAIL , cleanup,"Error setting up SIGCHLD signal, ERRNO = %d" , errno); } -/* Default argument settings. */ - - child_groups =2 ; - test_time =5 ;/* 0 = run forever or till signal */ - nfiles =5 ; - -/* Get command line options */ - -while ((c =getopt (argc, argv, goodopts)) !=EOF ) { -switch (c) { -case 'c' : - child_groups =atoi (optarg); -break ; -case 't' : - test_time =atoi (optarg); -break ; -case 'd' : - nfiles =atoi (optarg); -break ; -case '?' : - errflg++; -break ; -default : -break ; - } - } -if (errflg) { -tst_resm (TINFO , -"USAGE : mkdir09 -c #child_groups -t#test_time -d#directories" ); -tst_resm (TINFO ,"Bad argument count." ); - - } -runtest ();cleanup ();tst_exit (); - } -/*--------------------------------------------------------------*/ -int runtest (void ) {int i, j;
@@ -316,34 +275,13 @@ int getchild(int group, int child, int children) }else if (pid ==0 ) {/* child does this */ switch (children %NCHILD ) {case 0 : -#ifdef UCLINUX -if (self_exec (argv0,"nd" ,1 , nfiles) <0 ) { -massmurder (); -tst_brkm (TBROK , cleanup,"\tself_exec failed" ); - } -#else dochild1 ();/* create existing directories */ -#endif break ;/* so lint won't complain */ case 1 : -#ifdef UCLINUX -if (self_exec (argv0,"n" ,2 ) <0 ) { -massmurder (); -tst_brkm (TBROK , cleanup,"\tself_exec failed" ); - } -#else dochild2 ();/* remove nonexistant directories */ -#endif break ;case 2 : -#ifdef UCLINUX -if (self_exec (argv0,"nd" ,3 , group) <0 ) { -massmurder (); -tst_brkm (TBROK , cleanup,"\tself_exec failed" ); - } -#else dochild3 (group);/* create/delete directories */ -#endif break ;default : tst_brkm(TFAIL, cleanup,
@@ -415,19 +353,6 @@ int dochild1(void)exit (0 ); } -#ifdef UCLINUX -void dochild1_uclinux (void ) -{ -/* Set up to catch SIGTERM signal */ -if (signal (SIGTERM , term) ==SIG_ERR ) { -tst_brkm (TFAIL , cleanup, -"Error setting up SIGTERM signal, ERRNO = %d" , errno); - } - -dochild1 (); -} -#endif -int dochild2 (void ) {/* Child routine which attempts to remove directories from the
@@ -462,19 +387,6 @@ int dochild2(void)return 0 ; } -#ifdef UCLINUX -void dochild2_uclinux (void ) -{ -/* Set up to catch SIGTERM signal */ -if (signal (SIGTERM , term) ==SIG_ERR ) { -tst_brkm (TFAIL , cleanup, -"Error setting up SIGTERM signal, ERRNO = %d" , errno); - } - -dochild2 (); -} -#endif -int dochild3 (int group) {/* Child routine which creates and deletes directories in the
@@ -518,19 +430,6 @@ int dochild3(int group)exit (0 ); } -#ifdef UCLINUX -void dochild3_uclinux (void ) -{ -/* Set up to catch SIGTERM signal */ -if (signal (SIGTERM , term) ==SIG_ERR ) { -tst_brkm (TFAIL , cleanup, -"Error setting up SIGTERM signal, ERRNO = %d" , errno); - } - -dochild3 (group_uclinux); -} -#endif -int massmurder (void ) { registerint j;
@@ -546,35 +445,16 @@ int massmurder(void)return 0 ; } -/*************************************************************** -* * setup() - performs all ONE TIME setup for this test. -* ***************************************************************/ void setup (void ) { -tst_sig (NOFORK ,DEF_HANDLER , cleanup);TEST_PAUSE ; -/* Create a temporary directory and make it current. */ tst_tmpdir (); - } -/*************************************************************** -* * cleanup() - performs all ONE TIME cleanup for this test at -* * completion or premature exit. -* ***************************************************************/ void cleanup (void ) { - -/* -* * Remove the temporary directory. -* */ tst_rmdir (); - -/* -* * Exit with return code appropriate for results. -* */ - }
Signature · 1 line
2.10.2
PATCH 3/23 syscalls/rename14: Small cleanup
In reply to Cyril Hrubis* Get rid of UCLINUX ifdefs
* Make use of tst_parse_opts()
--- testcases/kernel/syscalls/rename/rename14.c | 45 +++++++---------------------- 1 file changed, 11 insertions(+), 34 deletions(-)
testcases/kernel/syscalls/rename/rename14.c +11 -34
@@ -43,7 +43,6 @@#include <sys/stat.h> #include <fcntl.h> -/** LTP Port **/ #include "test.h" #define FAILED 0
@@ -53,30 +52,25 @@ int local_flag = PASSED;char *TCID ="rename14" ;int TST_TOTAL =1 ; -/**************/ #define RUNTIME 45int kidpid[2 ];int parent_pid; +int term (void ); +int al (void ); +void dochild1 (void ); +void dochild2 (void ); +int main (int argc,char *argv[]) {int pid;sigset_t set;struct sigaction act, oact; -int term (); -int al (); -void dochild1 (); -void dochild2 (); - -#ifdef UCLINUX tst_parse_opts (argc, argv,NULL ,NULL ); -maybe_run_child (&dochild1,"n" ,1 ); -maybe_run_child (&dochild2,"n" ,2 ); -#endif sigemptyset (&set); act.sa_handler = (void (*)())term; act.sa_mask = set;
@@ -94,21 +88,13 @@ int main(int argc, char *argv[]) } parent_pid =getpid ();tst_tmpdir (); -/*--------------------------------------------------------------*/ pid =FORK_OR_VFORK (); -if (pid <0 ) { +if (pid <0 )tst_brkm (TBROK ,NULL ,"fork() returned %d" , pid); - } -if (pid ==0 ) { -#ifdef UCLINUX -if (self_exec (argv[0 ],"n" ,1 ) <0 ) { -tst_resm (TBROK ,"self_exec failed" ); - } -#else +if (pid ==0 )dochild1 (); -#endif - } + kidpid[0 ] = pid; pid =FORK_OR_VFORK ();if (pid <0 ) {
@@ -116,15 +102,9 @@ int main(int argc, char *argv[]) (void )unlink ("./rename14" );tst_brkm (TBROK ,NULL ,"fork() returned %d" , pid); } -if (pid ==0 ) { -#ifdef UCLINUX -if (self_exec (argv[0 ],"n" ,1 ) <0 ) { -tst_resm (TBROK ,"self_exec failed" ); - } -#else +if (pid ==0 )dochild2 (); -#endif - } + kidpid[1 ] = pid;alarm (RUNTIME );
@@ -148,8 +128,6 @@ int main(int argc, char *argv[])tst_exit (); } -/* FUNCTIONS GO HERE */ -int term (void ) {if (parent_pid !=getpid ())
@@ -183,7 +161,6 @@ void dochild1(void)void dochild2 (void ) { -for (;;) { +for (;;)rename ("./rename14" ,"./rename14xyz" ); - } }
Signature · 1 line
2.10.2
PATCH 4/23 syscalls/rename14: Change default runtime from 45s to 5s
In reply to Cyril Hrubis--- testcases/kernel/syscalls/rename/rename14.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/rename/rename14.c +1 -1
@@ -53,7 +53,7 @@ int local_flag = PASSED;char *TCID ="rename14" ;int TST_TOTAL =1 ; -#define RUNTIME 45 +#define RUNTIME 5int kidpid[2 ];int parent_pid;
Signature · 1 line
2.10.2
PATCH 5/23 syscalls/accept4_01: Make use of tst_parse_opts()
In reply to Cyril Hrubis--- testcases/kernel/syscalls/accept4/accept4_01.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/accept4/accept4_01.c +19 -3
@@ -200,14 +200,30 @@ static int create_listening_socket(int port_num)return lfd; } +static char *opt_port; + +static option_t options[] = { + {"p:" ,NULL , &opt_port}, + {NULL ,NULL ,NULL } +}; + +static void usage (void ) +{ +printf (" -p Port\n" ); +} +int main (int argc,char *argv[]) {struct sockaddr_in conn_addr;int lfd; -int port_num; +int port_num =PORT_NUM ; + +tst_parse_opts (argc, argv, options, usage); + +if (opt_port) + port_num =atoi (opt_port);setup (); - port_num = (argc >1 ) ?atoi (argv[1 ]) :PORT_NUM ;memset (&conn_addr,0 ,sizeof (struct sockaddr_in )); conn_addr.sin_family =AF_INET ;
@@ -220,7 +236,7 @@ int main(int argc, char *argv[])do_test (lfd, &conn_addr,SOCK_CLOEXEC ,0 );do_test (lfd, &conn_addr,0 ,SOCK_NONBLOCK );do_test (lfd, &conn_addr,SOCK_CLOEXEC ,SOCK_NONBLOCK ); - +close (lfd);cleanup ();tst_exit ();
Signature · 1 line
2.10.2
PATCH 6/23 syscalls/bind02: Small cleanup
In reply to Cyril HrubisGet rid of hacked up option to specify user for the test, the rest of the LTP testcases use nobody just fine.
--- testcases/kernel/syscalls/bind/bind02.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
testcases/kernel/syscalls/bind/bind02.c +2 -12
@@ -69,7 +69,6 @@ struct group *gr;uid_t uid;gid_t gid; -char nobody_uid[] ="nobody" ;int rc;
@@ -122,21 +121,12 @@ void try_bind(void)int main (int argc,char *argv[]) { +char *username ="nobody" ; -/* FreeBSD has set limits for user login name -- MAXLOGNAME, but -* Linux doesn't have that limitation apparently. */ -char *username =NULL ; +tst_parse_opts (argc, argv,NULL ,NULL );tst_require_root (); -if (argc !=2 ) { -tst_resm (TINFO ,"Defaulting to user nobody" ); - username =strdup (nobody_uid); - }else { -/* Get test user uid/gid. */ - username = argv[1 ]; - } -if ((pw =getpwnam (username)) ==NULL ) {tst_brkm (TBROK ,0 ,"Username - %s - not found" , username); }
Signature · 1 line
2.10.2
PATCH 7/23 syscalls/dup3_01: Small cleanup
In reply to Cyril Hrubis* Get rid of useless comments
* Make use of tst_parse_opts()
--- testcases/kernel/syscalls/dup3/dup3_01.c | 40 ++------------------------------ 1 file changed, 2 insertions(+), 38 deletions(-)
testcases/kernel/syscalls/dup3/dup3_01.c +2 -38
@@ -65,51 +65,13 @@char *TCID ="dup3_01" ;int TST_TOTAL =1 ; -/* Extern Global Functions */ -/******************************************************************************/ -/* */ -/* Function: cleanup */ -/* */ -/* Description: Performs all one time clean up for this test on successful */ -/* completion, premature exit or failure. Closes all temporary */ -/* files, removes all temporary directories exits the test with */ -/* appropriate return code by calling tst_exit() function. */ -/* */ -/* Input: None. */ -/* */ -/* Output: None. */ -/* */ -/* Return: On failure - Exits calling tst_exit(). Non '0' return code. */ -/* On success - Exits calling tst_exit(). With '0' return code. */ -/* */ -/******************************************************************************/ void cleanup (void ) {tst_rmdir (); } -/* Local Functions */ -/******************************************************************************/ -/* */ -/* Function: setup */ -/* */ -/* Description: Performs all one time setup for this test. This function is */ -/* typically used to capture signals, create temporary dirs */ -/* and temporary files that may be used in the course of this */ -/* test. */ -/* */ -/* Input: None. */ -/* */ -/* Output: None. */ -/* */ -/* Return: On failure - Exits by calling cleanup(). */ -/* On success - returns 0. */ -/* */ -/******************************************************************************/ void setup (void ) { -/* Capture signals if any */ -/* Create temporary directories */ TEST_PAUSE ;tst_tmpdir (); }
@@ -118,6 +80,8 @@ int main(int argc, char *argv[]) {int fd, coe; +tst_parse_opts (argc, argv,NULL ,NULL ); +if ((tst_kvercmp (2 ,6 ,27 )) <0 )tst_brkm (TCONF ,NULL ,"This test can only run on kernels that are 2.6.27 and higher" );
Signature · 1 line
2.10.2
PATCH 8/23 syscalls/everntfd2_01: Small cleanup
In reply to Cyril Hrubis* Get rid of useless comments
* Make use of tst_parse_opts()
--- testcases/kernel/syscalls/eventfd2/eventfd2_01.c | 41 ++---------------------- 1 file changed, 2 insertions(+), 39 deletions(-)
testcases/kernel/syscalls/eventfd2/eventfd2_01.c +2 -39
@@ -69,52 +69,13 @@ char *TCID = "eventfd2_01";int testno;int TST_TOTAL =1 ; -/* Extern Global Functions */ -/******************************************************************************/ -/* */ -/* Function: cleanup */ -/* */ -/* Description: Performs all one time clean up for this test on successful */ -/* completion, premature exit or failure. Closes all temporary */ -/* files, removes all temporary directories exits the test with */ -/* appropriate return code by calling tst_exit() function. */ -/* */ -/* Input: None. */ -/* */ -/* Output: None. */ -/* */ -/* Return: On failure - Exits calling tst_exit(). Non '0' return code. */ -/* On success - Exits calling tst_exit(). With '0' return code. */ -/* */ -/******************************************************************************/ void cleanup (void ) { -tst_rmdir (); } -/* Local Functions */ -/******************************************************************************/ -/* */ -/* Function: setup */ -/* */ -/* Description: Performs all one time setup for this test. This function is */ -/* typically used to capture signals, create temporary dirs */ -/* and temporary files that may be used in the course of this */ -/* test. */ -/* */ -/* Input: None. */ -/* */ -/* Output: None. */ -/* */ -/* Return: On failure - Exits by calling cleanup(). */ -/* On success - returns 0. */ -/* */ -/******************************************************************************/ void setup (void ) { -/* Capture signals if any */ -/* Create temporary directories */ TEST_PAUSE ;tst_tmpdir (); }
@@ -123,6 +84,8 @@ int main(int argc, char *argv[]) {int fd, coe; +tst_parse_opts (argc, argv,NULL ,NULL ); +if ((tst_kvercmp (2 ,6 ,27 )) <0 ) {tst_brkm (TCONF ,NULL ,"This test can only run on kernels that are 2.6.27 and higher" );
Signature · 1 line
2.10.2
PATCH 9/23 syscalls/fmtmsg01: Small cleanup
In reply to Cyril Hrubis* Get rid of useless comments
* Get rid of UCLINUX ifdefs
* Make use of tst_parse_opts()
--- testcases/kernel/syscalls/fmtmsg/fmtmsg01.c | 40 +++++++---------------------- 1 file changed, 9 insertions(+), 31 deletions(-)
testcases/kernel/syscalls/fmtmsg/fmtmsg01.c +9 -31
@@ -21,16 +21,10 @@/* 06/30/2001 Port to Linux [email protected] */ /* -* NAME -* fmtmsg -- test fmtmsg(3C) and addseverity(3C) -* -* CALLS -* fmtmsg(3), addseverity(3C) +* fmtmsg(3C) and addseverity(3C) * * ALGORITHM * Check basic functionality using various messages and severity levels. -* -* RESTRICTIONS */ #include <sys/types.h>
@@ -38,12 +32,11 @@#include <fcntl.h> #include <ctype.h> #include <stdio.h> -#if !defined(UCLINUX ) && !defined(__UCLIBC__) +#if !defined(__UCLIBC__)#include <fmtmsg.h> /* interface definition */ #endif #include <string.h> -/***** LTP Port *****/ #include <stdlib.h> #include <unistd.h> #include <errno.h>
@@ -63,9 +56,6 @@ int blenter();int blexit ();void setup (); -/***** ** ** *****/ -//char progname[]= "fmtmsg1()"; -char ch;char buf[80 ];char *str1 ="LTP:fmtmsg: INFO: LTP fmtmsg() test1 message, NOT an error" ;
@@ -80,15 +70,16 @@ void clearbuf(void) buf[i] ='\0' ; } -#if !defined(UCLINUX ) && !defined(__UCLIBC__) +#if !defined(__UCLIBC__) -/*--------------------------------------------------------------*/ int main (int argc,char *argv[]) {int fd, ret_val;FILE *fp; -setup ();/* temp file is now open */ +tst_parse_opts (argc, argv,NULL ,NULL ); + +setup ();/*--------------------------------------------------------------*/ blenter ();
@@ -218,18 +209,10 @@ int main(int argc, char *argv[]) }blexit (); -/*--------------------------------------------------------------*/ -/* Clean up any files created by test before call to anyfail. */ - -anyfail ();/* THIS CALL DOES NOT RETURN - EXITS!! */ +anyfail ();tst_exit (); } -/*--------------------------------------------------------------*/ - -/***** LTP Port *****/ -/* FUNCTIONS GO HERE */ -int anyfail (void ) { (local_flag == FAILED) ? tst_resm(TFAIL,
@@ -247,14 +230,12 @@ void setup(void)int blenter (void ) { -//tst_resm(TINFO, "Enter block %d", block_number); local_flag =PASSED ;return 0 ; }int blexit (void ) { -//tst_resm(TINFO, "Exitng test"); (local_flag ==FAILED ) ?tst_resm (TFAIL ,"Test failed" ) :tst_resm (TPASS ,"Test passed" );
@@ -265,10 +246,7 @@ int blexit(void)int main (void ) { -tst_resm (TINFO ,"test is not available on uClinux" ); -tst_exit (); +tst_brkm (TCONF ,NULL ,"test is not available on uClibc" ); } -#endif /* if !defined(UCLINUX) */ - -/***** ** ** *****/ +#endif /* if !defined(__UCLIBC__) */
Signature · 1 line
2.10.2
PATCH 10/23 syscalls/kill12: Small cleanup
In reply to Cyril Hrubis* Get rid of UCLINUX ifdefs
* Remove useless comments
* Make use of tst_parse_opts()
--- testcases/kernel/syscalls/kill/kill12.c | 38 +++------------------------------ 1 file changed, 3 insertions(+), 35 deletions(-)
testcases/kernel/syscalls/kill/kill12.c +3 -35
@@ -25,8 +25,8 @@/*====================================================================== >KEYS: < kill(), wait(), signal() >WHAT: < Check that when a child is killed by its parent, it returns the -< correct values to the waiting parent--the child sets signal to -< ignore the kill +< correct values to the waiting parent--the child sets signal to +< ignore the kill >HOW: < For each signal: Send that signal to a child that has elected < to catch the signal, check that the correct status was returned < to the waiting parent.
@@ -46,8 +46,6 @@#include <sys/wait.h> #include <errno.h> -//char progname[] = "kill2()"; -/***** LTP Port *****/ #include "test.h" #define ITER 3#define FAILED 0
@@ -71,29 +69,19 @@ void ok_exit();int forkfail ();void do_child (); -/***** ** ** *****/ -int chflag; -/*--------------------------------------------------------------------*/ int main (int argc,char **argv) { -/***** BEGINNING OF MAIN. *****/ int pid, npid;int nsig, exno, nexno, status;int ret_val =0 ;int core;void chsig (); -#ifdef UCLINUX -tst_parse_opts (argc, argv,NULL ,NULL ); -maybe_run_child (&do_child,"dd" , &temp, &sig); -#endif -setup (); -//tempdir(); /* move to new directory */ 12/20/2003 blenter (); exno =1 ;
@@ -113,14 +101,7 @@ int main(int argc, char **argv) }if (pid ==0 ) { -#ifdef UCLINUX -if (self_exec (argv[0 ],"dd" , temp, sig) <0 ) { -tst_brkm (TBROK ,NULL ,"self_exec FAILED - " -"terminating test." ); - } -#else do_child (); -#endif }else {//fprintf(temp, "Testing signal %d\n", sig);
@@ -196,19 +177,15 @@ int main(int argc, char **argv)if (ret_val) local_flag =FAILED ; -/*--------------------------------------------------------------------*/ anyfail ();tst_exit (); -}/******** END OF MAIN. ********/ - -/*--------------------------------------------------------------------*/ +}void chsig (void ) { chflag++; } -/****** LTP Port *****/ int anyfail (void ) { (local_flag == FAILED) ? tst_resm(TFAIL,
@@ -221,13 +198,6 @@ void do_child(void) {int exno =1 ; -#ifdef UCLINUX -if (sigset (SIGCHLD , chsig) ==SIG_ERR ) { -fprintf (temp,"\tsigset failed, errno = %d\n" , errno); -fail_exit (); - } -#endif -sigset (sig,SIG_IGN );/* set to ignore signal */ kill (getppid (),SIGCHLD );/* tell parent we are ready */ while (!chflag)
@@ -264,5 +234,3 @@ int forkfail(void) {tst_brkm (TBROK ,NULL ,"FORK FAILED - terminating test." ); } - -/****** ** ** *******/
Signature · 1 line
2.10.2
PATCH 11/23 syscalls/mallopt01: Make use of tst_parse_opts()
In reply to Cyril Hrubis--- testcases/kernel/syscalls/mallopt/mallopt01.c | 2 ++ 1 file changed, 2 insertions(+)
testcases/kernel/syscalls/mallopt/mallopt01.c +2 -0
@@ -70,6 +70,8 @@ int main(int argc, char *argv[]) {char *buf; +tst_parse_opts (argc, argv,NULL ,NULL ); +tst_tmpdir (); buf =SAFE_MALLOC (NULL ,20480 );
Signature · 1 line
2.10.2
PATCH 12/23 syscalls/memset01: Small cleanup.
In reply to Cyril Hrubis* Get rid of useless comments
* Get rid of unused function declarations
* Make use of tst_parse_opts()
--- testcases/kernel/syscalls/memset/memset01.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-)
testcases/kernel/syscalls/memset/memset01.c +3 -17
@@ -39,12 +39,10 @@#include <stdlib.h> #include <errno.h> -/***** LTP Port *****/ #include "test.h" char *TCID ="memset01" ; -/***** ** ** *****/ #undef BSIZE#define BSIZE 4096#define LEN 100
@@ -53,26 +51,20 @@ char *TCID = "memset01";char buf[BSIZE ]; -/***** LTP Port *****/ int local_flag =PASSED ;int block_number;int TST_TOTAL =1 ; -int anyfail (); -void setup (); -int blenter (); -/***** ** ** *****/ - -void fill (); +void fill (void );int checkit (char *str); -/*--------------------------------------------------------------*/ int main (int argc,char *argv[]) { registerint i, j;char *p; -/*--------------------------------------------------------------*/ +tst_parse_opts (argc, argv,NULL ,NULL ); + local_flag =PASSED ;fill ();
@@ -99,18 +91,12 @@ int main(int argc, char *argv[]) (local_flag ==FAILED ) ?tst_resm (TFAIL ,"Test failed" ) :tst_resm (TPASS ,"Test passed" ); -/*--------------------------------------------------------------*/ -/* Clean up any files created by test before call to anyfail. */ - (local_flag ==FAILED ) ?tst_resm (TFAIL ,"Test failed" ) :tst_resm (TPASS ,"Test passed" );tst_exit (); } -/*--------------------------------------------------------------*/ -/* FUNCTIONS GO HERE */ -void fill (void ) { registerint i;
Signature · 1 line
2.10.2
PATCH 13/23 syscalls/memcpy01: Small cleanup.
In reply to Cyril Hrubis* Get rid of useless comments
* Make use of tst_parse_opts()
--- testcases/kernel/syscalls/memcpy/memcpy01.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
testcases/kernel/syscalls/memcpy/memcpy01.c +4 -13
@@ -44,42 +44,38 @@#include <string.h> #include <errno.h> -/***** LTP Port *****/ #include "test.h" char *TCID ="memcpy1" ; -/***** ** ** *****/ +#undef BSIZE#define BSIZE 4096#define LEN 100#define FAILED 0#define PASSED 1 -/***** LTP Port *****/ int local_flag =PASSED ;int block_number;FILE *temp;int TST_TOTAL =1 ; -/***** ** ** *****/ char buf[BSIZE ]; -/***** LTP Port *****/ int anyfail ();int blenter ();int blexit ();void setup (); -/***** ** ** *****/ void clearit ();void fill (char *str);int checkit (char *str); -/*--------------------------------------------------------------*/ int main (int argc,char *argv[]) {char *p, *q; +tst_parse_opts (argc, argv,NULL ,NULL ); +setup ();/* temp file is now open */ /*--------------------------------------------------------------*/ blenter ();
@@ -135,16 +131,11 @@ int main(int argc, char *argv[]) }blexit (); -/*--------------------------------------------------------------*/ -/* Clean up any files created by test before call to anyfail. */ -anyfail ();/* THIS CALL DOES NOT RETURN - EXITS!! */ +anyfail ();tst_exit (); } -/*--------------------------------------------------------------*/ -/* FUNCTIONS GO HERE */ -void clearit (void ) { registerint i;
Signature · 1 line
2.10.2
PATCH 14/23 syscalls/eventfd2_02: Small cleanup.
In reply to Cyril Hrubis* Get rid of useless comments
* Make use of tst_parse_opts()
--- testcases/kernel/syscalls/eventfd2/eventfd2_02.c | 41 ++---------------------- 1 file changed, 2 insertions(+), 39 deletions(-)
testcases/kernel/syscalls/eventfd2/eventfd2_02.c +2 -39
@@ -66,52 +66,13 @@ char *TCID = "eventfd2_02";int testno;int TST_TOTAL =1 ; -/* Extern Global Functions */ -/******************************************************************************/ -/* */ -/* Function: cleanup */ -/* */ -/* Description: Performs all one time clean up for this test on successful */ -/* completion, premature exit or failure. Closes all temporary */ -/* files, removes all temporary directories exits the test with */ -/* appropriate return code by calling tst_exit() function. */ -/* */ -/* Input: None. */ -/* */ -/* Output: None. */ -/* */ -/* Return: On failure - Exits calling tst_exit(). Non '0' return code. */ -/* On success - Exits calling tst_exit(). With '0' return code. */ -/* */ -/******************************************************************************/ void cleanup (void ) { -tst_rmdir (); } -/* Local Functions */ -/******************************************************************************/ -/* */ -/* Function: setup */ -/* */ -/* Description: Performs all one time setup for this test. This function is */ -/* typically used to capture signals, create temporary dirs */ -/* and temporary files that may be used in the course of this */ -/* test. */ -/* */ -/* Input: None. */ -/* */ -/* Output: None. */ -/* */ -/* Return: On failure - Exits by calling cleanup(). */ -/* On success - returns 0. */ -/* */ -/******************************************************************************/ void setup (void ) { -/* Capture signals if any */ -/* Create temporary directories */ TEST_PAUSE ;tst_tmpdir (); }
@@ -120,6 +81,8 @@ int main(int argc, char *argv[]) {int fd, fl; +tst_parse_opts (argc, argv,NULL ,NULL ); +if ((tst_kvercmp (2 ,6 ,27 )) <0 ) {tst_brkm (TCONF ,NULL ,"This test can only run on kernels that are 2.6.27 and higher" );
Signature · 1 line
2.10.2
PATCH 15/23 syscalls/memcmp01: Small cleanup
In reply to Cyril Hrubis* Get rid of useless comments
* Make use of tst_parse_opts
--- testcases/kernel/syscalls/memcmp/memcmp01.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
testcases/kernel/syscalls/memcmp/memcmp01.c +4 -13
@@ -39,7 +39,6 @@#include <string.h> #include <errno.h> -/***** LTP Port *****/ #include "test.h" char *TCID ="memcmp1" ;
@@ -49,11 +48,9 @@ char *TCID = "memcmp1";#define LEN 100#define FAILED 0#define PASSED 1 -/***** ** ** *****/ char buf[BSIZE ]; -/***** LTP Port *****/ int local_flag =PASSED ;int block_number;FILE *temp;
@@ -64,19 +61,18 @@ int blexit();int instress ();void setup (); -/***** ** ** *****/ void clearit ();void fill (char *str);int checkit (char *str); -/*--------------------------------------------------------------*/ int main (int argc,char *argv[]) {char *p, *q; -setup ();/* temp file is now open */ -/*--------------------------------------------------------------*/ +tst_parse_opts (argc, argv,NULL ,NULL ); + +setup ();blenter ();clearit ();
@@ -186,16 +182,11 @@ int main(int argc, char *argv[]) }blexit (); -/*--------------------------------------------------------------*/ -/* Clean up any files created by test before call to anyfail. */ -anyfail ();/* THIS CALL DOES NOT RETURN - EXITS!! */ +anyfail ();tst_exit (); } -/*--------------------------------------------------------------*/ -/* FUNCTIONS GO HERE */ -void clearit (void ) { registerint i;
Signature · 1 line
2.10.2
PATCH 16/23 syscalls/ipc/msgctl*: Cleanups
In reply to Cyril Hrubis* Get rid of useless comments
* Get rid of UCLINUX ifdefs
* Unify options, make use of tst_parse_opts()
--- testcases/kernel/syscalls/ipc/msgctl/msgctl06.c | 49 ++------ testcases/kernel/syscalls/ipc/msgctl/msgctl07.c | 22 +--- testcases/kernel/syscalls/ipc/msgctl/msgctl08.c | 113 +++++------------- testcases/kernel/syscalls/ipc/msgctl/msgctl09.c | 152 +++++++----------------- testcases/kernel/syscalls/ipc/msgctl/msgctl10.c | 115 ++++++------------ testcases/kernel/syscalls/ipc/msgctl/msgctl11.c | 145 +++++++--------------- 6 files changed, 164 insertions(+), 432 deletions(-)
testcases/kernel/syscalls/ipc/msgctl/msgctl06.c +9 -40
@@ -35,10 +35,10 @@* */ -#include <sys/types.h> /* needed for test */ -#include <sys/ipc.h> /* needed for test */ -#include <sys/msg.h> /* needed for test */ -#include <stdio.h> /* needed by testhead.h */ +#include <sys/types.h> +#include <sys/ipc.h> +#include <sys/msg.h> +#include <stdio.h> #include "test.h" #include "ipcmsg.h"
@@ -61,11 +61,12 @@ extern int local_flag;int msqid, status;struct msqid_ds buf; -/*--------------------------------------------------------------*/ - -int main (void ) +int main (int argc,char *argv[]) {key_t key; + +tst_parse_opts (argc, argv,NULL ,NULL ); +setup (); key =getipckey ();
@@ -110,55 +111,26 @@ int main(void) }tst_resm (TPASS ,"msgctl06 ran successfully!" ); -/*************************************************************** -* cleanup and exit -***************************************************************/ -cleanup (); +cleanup ();tst_exit (); } -/*************************************************************** -* * setup() - performs all ONE TIME setup for this test. -* ****************************************************************/ void setup (void ) {tst_require_root (); -/* You will want to enable some signal handling so you can capture -* unexpected signals like SIGSEGV. -*/ tst_sig (NOFORK ,DEF_HANDLER , cleanup); -/* One cavet that hasn't been fixed yet. TEST_PAUSE contains the code to -* fork the test with the -c option. You want to make sure you do this -* before you create your temporary directory. -*/ TEST_PAUSE ; -/* -* Create a temporary directory and cd into it. -* This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. -*/ tst_tmpdir (); } -/*************************************************************** -* * * cleanup() - performs all ONE TIME cleanup for this test at -* * * completion or premature exit. -* * ***************************************************************/ void cleanup (void ) {int status; -/* -* Remove the message queue from the system -*/ -#ifdef DEBUG -tst_resm (TINFO ,"Remove the message queue" ); -#endif -fflush (stdout); (void )msgctl (msqid,IPC_RMID ,NULL );if ((status =msgctl (msqid,IPC_STAT , &buf)) !=-1 ) { (void )msgctl (msqid,IPC_RMID ,NULL );
@@ -166,8 +138,5 @@ void cleanup(void) } -fflush (stdout); -tst_rmdir (); - }
testcases/kernel/syscalls/ipc/msgctl/msgctl07.c +1 -21
@@ -68,22 +68,15 @@ struct my_msgbuf {char text[BYTES ]; } p1_msgp, p2_msgp, p3_msgp, c1_msgp, c2_msgp, c3_msgp; -int main (void ) +int main (int argc,char *argv[]) {key_t key;int pid, status;int i, j, k;sighandler_t alrm (); -#ifdef UCLINUX -tst_parse_opts (argc, argv,NULL ,NULL ); -maybe_run_child (&do_child_1,"ndd" ,1 , &msqid, &c1_msgp.type); -maybe_run_child (&do_child_2,"ndddd" ,2 , &msqid, &c1_msgp.type, - &c2_msgp.type, &c3_msgp.type); -#endif -setup (); key =getipckey ();
@@ -98,13 +91,7 @@ int main(void)tst_brkm (TFAIL ,NULL ,"\tFork failed (may be OK if under stress)" ); }else if (pid ==0 ) { -#ifdef UCLINUX -if (self_exec (argv[0 ],"ndd" ,1 , msqid, c1_msgp.type) <0 ) { -tst_brkm (TFAIL ,NULL ,"\tself_exec failed" ); - } -#else do_child_1 (); -#endif }else {struct sigaction act;
@@ -144,14 +131,7 @@ int main(void)tst_brkm (TFAIL ,NULL ,"\tFork failed (may be OK if under stress)" ); }else if (pid ==0 ) { -#ifdef UCLINUX -if (self_exec (argv[0 ],"ndddd" ,1 , msqid, c1_msgp.type, - c2_msgp.type, c3_msgp.type) <0 ) { -tst_brkm (TFAIL ,NULL ,"\tself_exec failed" ); - } -#else do_child_2 (); -#endif }else {struct sigaction act;
testcases/kernel/syscalls/ipc/msgctl/msgctl08.c +33 -80
164 lines not on this page · raw message
testcases/kernel/syscalls/ipc/msgctl/msgctl09.c +44 -108
211 lines not on this page · raw message
testcases/kernel/syscalls/ipc/msgctl/msgctl10.c +34 -81
166 lines not on this page · raw message
testcases/kernel/syscalls/ipc/msgctl/msgctl11.c +43 -102
199 lines not on this page · raw message
Signature · 1 line
2.10.2
PATCH 17/23 syscalls/msync02: Make use of tst_parse_opts()
In reply to Cyril Hrubis--- testcases/kernel/syscalls/msync/msync02.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
testcases/kernel/syscalls/msync/msync02.c +1 -3
@@ -87,11 +87,10 @@ void cleanup(); /* cleanup function for the test */int main (int ac,char **av) { +tst_parse_opts (ac, av,NULL ,NULL );setup (); - tst_count =0 ; -TEST (msync (addr, page_sz,MS_INVALIDATE ));if (TEST_RETURN ==-1 )
@@ -102,7 +101,6 @@ int main(int ac, char **av)tst_resm (TPASS ,"Functionality of msync successful" );cleanup (); -tst_exit (); }
Signature · 1 line
2.10.2
PATCH 18/23 syscalls/ptrace04, ptrace05: Small cleanup
In reply to Cyril Hrubis* Move tst_parse_opts() before tst_brkm() in ptrace04
* Get rid of hacked up option parsion in ptrace05
--- testcases/kernel/syscalls/ptrace/ptrace04.c | 4 ++-- testcases/kernel/syscalls/ptrace/ptrace05.c | 27 +-------------------------- 2 files changed, 3 insertions(+), 28 deletions(-)
testcases/kernel/syscalls/ptrace/ptrace04.c +2 -2
@@ -99,11 +99,11 @@ void compare_registers(unsigned char poison)int main (int argc,char *argv[]) { +tst_parse_opts (argc, argv,NULL ,NULL ); +if (ARRAY_SIZE (regs) ==0 )tst_brkm (TCONF ,NULL ,"test not supported for your arch (yet)" ); -tst_parse_opts (argc, argv,NULL ,NULL ); -make_a_baby (argc, argv);/* first compare register states when execl() syscall starts */
testcases/kernel/syscalls/ptrace/ptrace05.c +1 -26
@@ -60,32 +60,7 @@ int main(int argc, char **argv)pid_t child; -/* Parse the CLI args appropriately. */ -switch (argc) { -case 3 : - end_signum = (int )strtol ((const char *)*(argv +2 ),NULL ,10 ); -/* Parse the signal value. */ -if (end_signum ==0 && errno !=0 ) { -tst_brkm (TBROK ,NULL , -"argument (%s) isn't a valid number.\n" , - *(argv +2 )); - } -/* FALLTHROUGH */ -case 2 : - start_signum = (int )strtol ((const char *)*(argv +1 ),NULL ,10 ); -/* Parse the signal value. */ -if (end_signum ==0 && errno !=0 ) { -tst_brkm (TBROK ,NULL , -"argument (%s) isn't a valid number.\n" , - *(argv +1 )); - } -break ; -case 1 : -/* Do nothing. */ -break ; -default : -return usage (basename (*argv)); - } +tst_parse_opts (argc, argv,NULL ,NULL );if (start_signum ==-1 ) { start_signum =0 ;
Signature · 1 line
2.10.2
PATCH 19/23 syscalls/ipc/semctl06: Small cleanup
In reply to Cyril Hrubis* Get rid of UCLINUX ifdefs
* Make use of tst_parse_opts()
--- testcases/kernel/syscalls/ipc/semctl/semctl06.c | 57 +------------------------ 1 file changed, 1 insertion(+), 56 deletions(-)
testcases/kernel/syscalls/ipc/semctl/semctl06.c +1 -56
@@ -90,27 +90,13 @@ static void term(int sig);static void dosemas (int id);static void dotest (key_t key); -#ifdef UCLINUX -static char *argv0; - -void do_child (); -static int id_uclinux; -static char *maxsemstring; -#endif -int main (int argc,char **argv) { registerint i, pid;int count, child, status, nwait; -#ifdef UCLINUX -tst_parse_opts (argc, argv,NULL ,NULL ); - argv0 = argv[0 ]; -maybe_run_child (&do_child,"dS" , &id_uclinux, &maxsemstring); -#endif - prog = argv[0 ]; nwait =0 ;setup ();
@@ -205,25 +191,8 @@ static void dotest(key_t key)if ((pid =FORK_OR_VFORK ()) <0 ) {tst_resm (TFAIL ,"\tfork failed" ); } -if (pid ==0 ) { -#ifdef UCLINUX -int j; - maxsemstring ="" ; -for (j =0 ; j <NSEMS ; j++) { -if (asprintf (&maxsemstring,"%s%s%d" , - maxsemstring, (j ?":" :"" ), - maxsemvals[j]) <0 ) { -tst_brkm (TBROK ,NULL ,"Could not serialize " -"maxsemvals" ); - } - } -if (self_exec (argv0,"dS" , id, maxsemstring) <0 ) { -tst_resm (TFAIL ,"\tself_exec failed" ); - } -#else +if (pid ==0 )dosemas (id); -#endif - }if (pid >0 ) { kidarray[i] = pid; nwait++;
@@ -285,30 +254,6 @@ static void dotest(key_t key)exit (1 ); } -#ifdef UCLINUX -void do_child (void ) -{ -int i; -char *tok; -char *endptr; - - tok =strtok (maxsemstring,":" ); -for (i =0 ; i <NSEMS ; i++) { -if (strlen (tok) ==0 ) { -tst_brkm (TBROK ,NULL ,"Invalid argument to -C option" ); - } - - maxsemvals[i] =strtol (tok, &endptr,10 ); -if (*endptr !='\0' ) { -tst_brkm (TBROK ,NULL ,"Invalid argument to -C option" ); - } - tok =strtok (NULL ,":" ); - } - -dosemas (id_uclinux); -} -#endif -static void dosemas (int id) {int i, j;
Signature · 1 line
2.10.2
PATCH 20/23 syscalls/timerfd01: Make use of tst_parse_opts()
In reply to Cyril Hrubis+ Fix warning
--- testcases/kernel/syscalls/timerfd/timerfd01.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/timerfd/timerfd01.c +4 -1
@@ -132,7 +132,8 @@ int TST_TOTAL = 3;int main (int ac,char **av) { -int i, tfd; +int tfd; +unsigned int i;long ticks;unsigned long long tnow, ttmr;u_int64_t uticks;
@@ -142,6 +143,8 @@ int main(int ac, char **av) {CLOCK_REALTIME, "CLOCK REALTIME"}, }; +tst_parse_opts (ac, av,NULL ,NULL ); +if ((tst_kvercmp (2 ,6 ,25 )) <0 ) {tst_resm (TCONF ,"This test can only run on kernels that are " );tst_resm (TCONF ,"2.6.25 and higher" );
Signature · 1 line
2.10.2
PATCH 21/23 syscalls/tkill02: Small cleanup.
In reply to Cyril Hrubis* Get rid of useless comments
* Make use of tst_parse_opts()
--- testcases/kernel/syscalls/tkill/tkill02.c | 112 ++++++++---------------------- 1 file changed, 30 insertions(+), 82 deletions(-)
testcases/kernel/syscalls/tkill/tkill02.c +30 -82
@@ -1,42 +1,29 @@ -/******************************************************************************/ -/* Copyright (c) Crackerjack Project., 2007 */ -/* */ -/* 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 */ -/* */ -/******************************************************************************/ -/******************************************************************************/ -/* */ -/* File: tkill02.c */ -/* */ -/* Description: This tests the tkill() syscall */ -/* */ -/* Usage: <for command-line> */ -/* tkill02 [-c n] [-e][-i n] [-I x] [-p x] [-t] */ -/* where, -c n : Run n copies concurrently. */ -/* -e : Turn on errno logging. */ -/* -i n : Execute test n times. */ -/* -I x : Execute test for x seconds. */ -/* -P x : Pause for x seconds between iterations. */ -/* -t : Turn on syscall timing. */ -/* */ -/* Total Tests: 1 */ -/* */ -/* Test Name: tkill02 */ -/* History: Porting from Crackerjack to LTP is done by */ -/* Manas Kumar Nayak [email protected]> */ -/******************************************************************************/ +/****************************************************************************** +* Copyright (c) Crackerjack Project., 2007 * +* * +* 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 * +* * +******************************************************************************/ +/* +* File: tkill02.c +* +* Description: This tests the tkill() syscall +* +* History: Porting from Crackerjack to LTP is done by +* Manas Kumar Nayak [email protected]> +*/ #include <stdio.h> #include <stdlib.h>
@@ -54,53 +41,13 @@ int testno;static pid_t inval_tid =-1 ;static pid_t unused_tid; - -/* Extern Global Functions */ -/******************************************************************************/ -/* */ -/* Function: cleanup */ -/* */ -/* Description: Performs all one time clean up for this test on successful */ -/* completion, premature exit or failure. Closes all temporary */ -/* files, removes all temporary directories exits the test with */ -/* appropriate return code by calling tst_exit() function. */ -/* */ -/* Input: None. */ -/* */ -/* Output: None. */ -/* */ -/* Return: On failure - Exits calling tst_exit(). Non '0' return code. */ -/* On success - Exits calling tst_exit(). With '0' return code. */ -/* */ -/******************************************************************************/ void cleanup (void ) { -tst_rmdir (); } -/* Local Functions */ -/******************************************************************************/ -/* */ -/* Function: setup */ -/* */ -/* Description: Performs all one time setup for this test. This function is */ -/* typically used to capture signals, create temporary dirs */ -/* and temporary files that may be used in the course of this */ -/* test. */ -/* */ -/* Input: None. */ -/* */ -/* Output: None. */ -/* */ -/* Return: On failure - Exits by calling cleanup(). */ -/* On success - returns 0. */ -/* */ -/******************************************************************************/ void setup (void ) { -/* Capture signals if any */ -/* Create temporary directories */ TEST_PAUSE ;tst_tmpdir ();
@@ -111,9 +58,8 @@ struct test_case_t {int *tid;int exp_errno; } test_cases[] = { - { - &inval_tid, EINVAL}, { - &unused_tid, ESRCH} + {&inval_tid, EINVAL}, + {&unused_tid, ESRCH} };int TST_TOTAL =sizeof (test_cases) /sizeof (test_cases[0 ]);
@@ -124,6 +70,8 @@ int main(int ac, char **av)setup (); +tst_parse_opts (ac, av,NULL ,NULL ); +for (i =0 ; i <TST_TOTAL ; i++) {TEST (ltp_syscall (__NR_tkill, *(test_cases[i].tid),SIGUSR1 ));
Signature · 1 line
2.10.2
PATCH 22/23 syscalls/string01: Small cleanup
In reply to Cyril Hrubis* Get rid of useless comments
* Make use of tst_parse_opts()
--- testcases/kernel/syscalls/string/string01.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
testcases/kernel/syscalls/string/string01.c +2 -9
@@ -39,7 +39,6 @@#include <sys/types.h> #include <string.h> -/***** LTP Port *****/ #include <errno.h> #include <stdlib.h> #include "test.h"
@@ -72,9 +71,6 @@ char dst0[LONGSTR + 1]; /* place holders for various tests */char dst1[LONGSTR +1 ];char dst2[LONGSTR +1 ]; -/* -* Data structures for testing. -*/ /* Strlen (strlen( s ) == e_res) */ struct t_strlen {
@@ -236,7 +232,6 @@ struct t_strncpy { NULL, NULL, 0, NULL, 0} }; -/***** LTP Port *****/ void setup ();int blenter ();int blexit ();
@@ -266,15 +261,13 @@ int anyfail(void)tst_exit (); } -/***** ** ** *****/ - -/*--------------------------------------------------------------*/ -int main (int argc,char *argv[]) { registerint n, i;char *s, *pr; +tst_parse_opts (argc, argv,NULL ,NULL ); +/* * Init longstr */
Signature · 1 line
2.10.2
PATCH 23/23 syscalls/semctl07: Make use of tst_parse_opts()
In reply to Cyril Hrubis--- testcases/kernel/syscalls/ipc/semctl/semctl07.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/ipc/semctl/semctl07.c +2 -1
@@ -61,9 +61,10 @@ int main(int argc, char *argv[]) {int status;struct semid_ds buf_ds; -union semun arg; +tst_parse_opts (argc, argv,NULL ,NULL ); +setup (); arg.buf = &buf_ds;
Signature · 1 line
2.10.2