All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH][ppoll01]  fix testcase 1, 5: pass correct value for sigset_t for mips
@ 2009-10-28  1:32 Henry Yei
  2009-10-28  2:57 ` Garrett Cooper
  2009-10-28  9:18 ` [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct value for " Nicolas Joly
  0 siblings, 2 replies; 16+ messages in thread
From: Henry Yei @ 2009-10-28  1:32 UTC (permalink / raw)
  To: LTP Mailing List


[-- Attachment #1.1: Type: text/plain, Size: 431 bytes --]

All,

 

The patch attached  for ppoll01:

cleans up spacing and code style

removes unneeded/broken debug option parsing

if test fails, it prints out the last failed errno, rather than just the last errno(which may have been successful)

passes in correct size of sigset_t for mips

 

Signed-off by: Henry Yei <hyei@mvista.com>

 

This patch was tested/passed on x86, mips(little endian), and ppc_82xx .


[-- Attachment #1.2: Type: text/html, Size: 2403 bytes --]

[-- Attachment #2: ppoll01.patch --]
[-- Type: application/octet-stream, Size: 19151 bytes --]

--- ltp/testcases/kernel/syscalls/ppoll/ppoll01.c	2009-10-26 17:13:55.503000000 -0700
+++ ltp-wdir/testcases/kernel/syscalls/ppoll/ppoll01.c	2009-10-27 17:56:02.341095390 -0700
@@ -61,7 +61,6 @@
 #include <signal.h>
 #include "asm/poll.h"
 
-
 #include "../utils/include_j_h.h"
 #include "../utils/common_j_h.c"
 
@@ -71,13 +70,14 @@
 #include "linux_syscall_numbers.h"
 
 /* Extern Global Variables */
-extern int Tst_count;           /* counter for tst_xxx routines.         */
-extern char *TESTDIR;           /* temporary dir created by tst_tmpdir() */
+extern int Tst_count; /* counter for tst_xxx routines.         */
+extern char *TESTDIR; /* temporary dir created by tst_tmpdir() */
 
 /* Global Variables */
-char *TCID = "ppoll01";  /* Test program identifier.*/
-int  testno;
-int  TST_TOTAL = 1;                   /* total number of tests in this file.   */
+char *TCID = "ppoll01"; /* Test program identifier.*/
+int testno;
+int TST_TOTAL = 1; /* total number of tests in this file.   */
+int last_failed_errno;
 
 /* Extern Global Functions */
 /******************************************************************************/
@@ -98,15 +98,15 @@ int  TST_TOTAL = 1;                   /*
 /*                                                                            */
 /******************************************************************************/
 extern void cleanup() {
-        /* Remove tmp dir and all files in it */
-        TEST_CLEANUP;
-        tst_rmdir();
+	/* Remove tmp dir and all files in it */
+	TEST_CLEANUP;
+	tst_rmdir();
 
-        /* Exit with appropriate return code. */
-        tst_exit();
+	/* Exit with appropriate return code. */
+	tst_exit();
 }
 
-void sighandler(int sig);       /* signals handler function for the test */
+void sighandler(int sig); /* signals handler function for the test */
 
 /* Local  Functions */
 /******************************************************************************/
@@ -127,58 +127,52 @@ void sighandler(int sig);       /* signa
 /*                                                                            */
 /******************************************************************************/
 void setup() {
-        /* Capture signals if any */
+	/* Capture signals if any */
 	signal(SIGINT, &sighandler);
 
-        /* Create temporary directories */
-        TEST_PAUSE;
-        tst_tmpdir();
+	/* Create temporary directories */
+	TEST_PAUSE;
+	tst_tmpdir();
 }
 
-
 /*
  * Macros
  */
 #define SYSCALL_NAME    "ppoll"
 
 #ifndef POLLRDHUP
-#  define POLLRDHUP     0x2000
+#define POLLRDHUP     0x2000
 #endif
 
-
 /*
  * Global variables
  */
-static int opt_debug;
-static char *progname;
 static char *progdir;
 
 enum test_type {
 	NORMAL,
-        MASK_SIGNAL,
-        TIMEOUT,
-        FD_ALREADY_CLOSED,
-        SEND_SIGINT,
-        SEND_SIGINT_RACE_TEST,
-        INVALID_NFDS,
-        INVALID_FDS,
-        MINUS_NSEC,
-        TOO_LARGE_NSEC,
+	MASK_SIGNAL,
+	TIMEOUT,
+	FD_ALREADY_CLOSED,
+	SEND_SIGINT,
+	SEND_SIGINT_RACE_TEST,
+	INVALID_NFDS,
+	INVALID_FDS,
+	MINUS_NSEC,
+	TOO_LARGE_NSEC,
 
 };
 
-
 /*
  * Data Structure
  */
 struct test_case {
 	short expect_revents;
-        int ttype;
-        int ret;
-        int err;
+	int ttype;
+	int ret;
+	int err;
 };
 
-
 /* Test cases
  *
  *   test status of errors on man page
@@ -192,65 +186,62 @@ struct test_case {
  *   ENOMEM             can't check because it's difficult to create no-memory
  */
 
-
 static struct test_case tcase[] = {
-	{ // case00
-                .ttype          = NORMAL,
-                .expect_revents = POLLIN | POLLOUT,
-                .ret            = 0,
-                .err            = 0,
-        },
-        { // case01
-                .ttype          = MASK_SIGNAL,
-                .expect_revents = 0, // don't care
-                .ret            = 0,
-                .err            = 0,
-        },
-        { // case02
-                .ttype          = TIMEOUT,
-                .expect_revents = 0, // don't care
-                .ret            = 0,
-                .err            = 0,
-        },
-        { // case03
-                .ttype          = FD_ALREADY_CLOSED,
-                .expect_revents = POLLNVAL,
-                .ret            = 0,
-                .err            = 0,
-        },
-        { // case04
-                .ttype          = SEND_SIGINT,
-                .ret            = -1,
-                .err            = EINTR,
-        },
-        { // case05
-                .ttype          = SEND_SIGINT_RACE_TEST,
-                .ret            = -1,
-                .err            = EINTR,
-        },
-        { // case06
-                .ttype          = INVALID_NFDS,
-                .ret            = -1,
-                .err            = EINVAL,
-        },
-        { // case07
-                .ttype          = INVALID_FDS,
-                .ret            = -1,
-                .err            = EFAULT,
-        },
+		{ // case00
+			.ttype = NORMAL,
+			.expect_revents = POLLIN | POLLOUT,
+			.ret = 0,
+			.err = 0,
+		},
+		{ // case01
+			.ttype = MASK_SIGNAL,
+			.expect_revents = 0, // don't care
+			.ret = 0,
+			.err = 0,
+		},
+		{ // case02
+			.ttype = TIMEOUT,
+			.expect_revents = 0, // don't care
+			.ret = 0,
+			.err = 0,
+		},
+		{ // case03
+			.ttype = FD_ALREADY_CLOSED,
+			.expect_revents = POLLNVAL,
+			.ret = 0, .err = 0,
+		},
+		{ // case04
+			.ttype = SEND_SIGINT,
+			.ret = -1,
+			.err = EINTR,
+		},
+		{ // case05
+			.ttype = SEND_SIGINT_RACE_TEST,
+			.ret = -1,
+			.err = EINTR,
+		},
+		{ // case06
+			.ttype = INVALID_NFDS,
+			.ret = -1,
+			.err = EINVAL,
+		},
+		{ // case07
+			.ttype = INVALID_FDS,
+			.ret = -1,
+			.err = EFAULT, },
 #if 0
-        { // case08
-                .ttype          = MINUS_NSEC,
-                .ret            = -1,
-                .err            = EINVAL, // RHEL4U1 + 2.6.18 returns SUCCESS
-        },
-        { // case09
-                .ttype          = TOO_LARGE_NSEC,
-                .ret            = -1,
-                .err            = EINVAL, // RHEL4U1 + 2.6.18 returns SUCCESS
-        },
+		{ // case08
+			.ttype = MINUS_NSEC,
+			.ret = -1,
+			.err = EINVAL, // RHEL4U1 + 2.6.18 returns SUCCESS
+		},
+		{ // case09
+			.ttype = TOO_LARGE_NSEC,
+			.ret = -1,
+			.err = EINVAL, // RHEL4U1 + 2.6.18 returns SUCCESS
+		},
 #endif
-};
+		};
 
 #define NUM_TEST_FDS    1
 
@@ -262,266 +253,226 @@ static struct test_case tcase[] = {
  *
  */
 
-static int do_test(struct test_case *tc)
-{
-        int sys_ret;
-        int sys_errno;
-        int result = RESULT_OK;
-	int fd = -1 , cmp_ok = 1;
+static int do_test(struct test_case *tc) {
+	int sys_ret;
+	int sys_errno;
+	int failed;
+	int result = RESULT_OK;
+	int fd = -1, cmp_ok = 1;
 	char fpath[PATH_MAX];
 	struct pollfd *p_fds, fds[NUM_TEST_FDS];
-        unsigned int nfds = NUM_TEST_FDS;
-        struct timespec *p_ts, ts;
-        sigset_t *p_sigmask, sigmask;
-        size_t sigsetsize = 0;
-        pid_t pid = 0;
+	unsigned int nfds = NUM_TEST_FDS;
+	struct timespec *p_ts, ts;
+	sigset_t *p_sigmask, sigmask;
+	size_t sigsetsize = 0;
+	pid_t pid = 0;
 
 	TEST(fd = setup_file(progdir, "test.file", fpath));
-        if (fd < 0)
-                return 1;
-        fds[0].fd = fd;
-        fds[0].events = POLLIN | POLLPRI | POLLOUT | POLLRDHUP;
-        fds[0].revents = 0;
-        p_fds = fds;
-        p_ts = NULL;
-        p_sigmask = NULL;
+	if (fd < 0)
+		return 1;
+	fds[0].fd = fd;
+	fds[0].events = POLLIN | POLLPRI | POLLOUT | POLLRDHUP;
+	fds[0].revents = 0;
+	p_fds = fds;
+	p_ts = NULL;
+	p_sigmask = NULL;
 
 	switch (tc->ttype) {
-        case TIMEOUT:
-                nfds = 0;
-                ts.tv_sec = 0;
-                ts.tv_nsec = 50000000;  // 50msec
-                p_ts = &ts;
-                break;
+	case TIMEOUT:
+		nfds = 0;
+		ts.tv_sec = 0;
+		ts.tv_nsec = 50000000; // 50msec
+		p_ts = &ts;
+		break;
 	case FD_ALREADY_CLOSED:
-                TEST(close(fd));
-                fd = -1;
-                TEST(cleanup_file(fpath));
-                break;
-        case MASK_SIGNAL:
-                TEST(sigemptyset(&sigmask));
-                TEST(sigaddset(&sigmask, SIGINT));
-                p_sigmask = &sigmask;
-                //sigsetsize = sizeof(sigmask);
-                sigsetsize = 8;
-                nfds = 0;
-                ts.tv_sec = 0;
-                ts.tv_nsec = 300000000; // 300msec => need to be enough for
-                                        //   waiting the signal
-                p_ts = &ts;
-                // fallthrough
+		TEST(close(fd));
+		fd = -1;
+		TEST(cleanup_file(fpath));
+		break;
+	case MASK_SIGNAL:
+		TEST(sigemptyset(&sigmask));
+		TEST(sigaddset(&sigmask, SIGINT));
+		p_sigmask = &sigmask;
+		//sigsetsize = sizeof(sigmask);
+#if defined __mips__
+		sigsetsize = 16;
+#else
+		sigsetsize = 8;
+#endif
+		nfds = 0;
+		ts.tv_sec = 0;
+		ts.tv_nsec = 300000000; // 300msec => need to be enough for
+		//   waiting the signal
+		p_ts = &ts;
+		// fallthrough
 	case SEND_SIGINT:
-                nfds = 0;
-                pid = create_sig_proc(100000, SIGINT, UINT_MAX); // 100msec
-                if (pid < 0)
-                        return 1;
-                break;
-  case SEND_SIGINT_RACE_TEST:
-    /* block the INT signal */
-                sigemptyset(&sigmask);
-                sigaddset(&sigmask, SIGINT);
-                sigprocmask(SIG_SETMASK, &sigmask, NULL);
-
-                /* and let it be unblocked when the syscall runs */
-                sigemptyset(&sigmask);
-                p_sigmask = &sigmask;
-                //sigsetsize = sizeof(sigmask);
-                sigsetsize = 8;
-                nfds = 0;
-                ts.tv_sec = 0;
-                ts.tv_nsec = 300000000; // 300msec => need to be enough for
-                                        //   waiting the signal
-                p_ts = &ts;
-                nfds = 0;
-                pid = create_sig_proc(0, SIGINT, 1);
-                if (pid < 0) {
-                  result=1;
-                  goto cleanup;
-                }
-                break;
-        case INVALID_NFDS:
-                //nfds = RLIMIT_NOFILE + 1; ==> RHEL4U1 + 2.6.18 returns SUCCESS
-                nfds = -1;
-                break;
-        case INVALID_FDS:
-                p_fds = (void*)0xc0000000;
-                break;
-        case MINUS_NSEC:
-                ts.tv_sec = 0;
-                ts.tv_nsec = -1;
-                p_ts = &ts;
-                break;
+		nfds = 0;
+		pid = create_sig_proc(100000, SIGINT, UINT_MAX); // 100msec
+		if (pid < 0)
+			return 1;
+		break;
+	case SEND_SIGINT_RACE_TEST:
+		/* block the INT signal */
+		sigemptyset(&sigmask);
+		sigaddset(&sigmask, SIGINT);
+		sigprocmask(SIG_SETMASK, &sigmask, NULL);
+
+		/* and let it be unblocked when the syscall runs */
+		sigemptyset(&sigmask);
+		p_sigmask = &sigmask;
+		//sigsetsize = sizeof(sigmask);
+#if defined __mips__
+		sigsetsize = 16;
+#else
+		sigsetsize = 8;
+#endif
+		nfds = 0;
+		ts.tv_sec = 0;
+		ts.tv_nsec = 300000000; // 300msec => need to be enough for
+		//   waiting the signal
+		p_ts = &ts;
+		nfds = 0;
+		pid = create_sig_proc(0, SIGINT, 1);
+		if (pid < 0) {
+			result = 1;
+			goto cleanup;
+		}
+		break;
+	case INVALID_NFDS:
+		//nfds = RLIMIT_NOFILE + 1; //==> RHEL4U1 + 2.6.18 returns SUCCESS
+		nfds = -1;
+		break;
+	case INVALID_FDS:
+		p_fds = (void*) 0xc0000000;
+		break;
+	case MINUS_NSEC:
+		ts.tv_sec = 0;
+		ts.tv_nsec = -1;
+		p_ts = &ts;
+		break;
 	case TOO_LARGE_NSEC:
-                ts.tv_sec = 0;
-                ts.tv_nsec = 1000000000;
-                p_ts = &ts;
-                break;
-        }
+		ts.tv_sec = 0;
+		ts.tv_nsec = 1000000000;
+		p_ts = &ts;
+		break;
+	}
 
 	/*
-	   * Execute system call
-         */
-        errno = 0;
-        TEST(sys_ret = syscall(__NR_ppoll, p_fds, nfds, p_ts, p_sigmask, sigsetsize));
-        sys_errno = errno;
-        if (sys_ret <= 0 || tc->ret < 0)
-                goto TEST_END;
-
-        cmp_ok = fds[0].revents == tc->expect_revents;
-        if (opt_debug) {
-                tst_resm(TINFO,"EXPECT: revents=0x%04x", tc->expect_revents);
-                tst_resm(TINFO,"RESULT: revents=0x%04x", fds[0].revents);
-        }
-
-TEST_END:
-        /*
-         * Check results
-         */
-        if(tc->ttype == SEND_SIGINT_RACE_TEST) {
-          int sig;
-          sigprocmask(SIG_SETMASK, NULL, &sigmask);
-          for(sig=1; sig < SIGRTMAX; sig++) {
-              TEST(sigismember(&sigmask, sig));
-              if(TEST_RETURN < 0 && TEST_ERRNO == EINVAL && sig != SIGINT)
-                continue; /* let's ignore errors if they are for other signal than SIGINT that we set */
-              if((sig==SIGINT) != (TEST_RETURN!=0)) {
-                tst_resm(TFAIL, "Bad value of signal mask, signal %d is %s", sig, TEST_RETURN ? "on" : "off");
-                cmp_ok |=1;
-              }
-            }
-        }
-        result |= (sys_errno != tc->err) || !cmp_ok;
-        PRINT_RESULT_CMP(sys_ret >= 0, tc->ret, tc->err, sys_ret, sys_errno,
-                         cmp_ok);
- cleanup:
-        if (fd >= 0)
-                cleanup_file(fpath);
-
-        sigemptyset(&sigmask);
-        sigprocmask(SIG_SETMASK, &sigmask, NULL);
-        if (pid > 0) {
-                int st;
-                kill(pid, SIGTERM);
-                wait(&st);
-        }
+	 * Execute system call
+	 */
+	errno = 0;
+	TEST(sys_ret
+			= syscall(__NR_ppoll, p_fds, nfds, p_ts, p_sigmask, sigsetsize));
+	sys_errno = errno;
+	if (sys_ret <= 0 || tc->ret < 0)
+		goto TEST_END;
+
+	cmp_ok = fds[0].revents == tc->expect_revents;
+	tst_resm(TINFO, "EXPECT: revents=0x%04x", tc->expect_revents);
+	tst_resm(TINFO, "RESULT: revents=0x%04x", fds[0].revents);
+
+	TEST_END:
+	/*
+	 * Check results
+	 */
+	if (tc->ttype == SEND_SIGINT_RACE_TEST) {
+		int sig;
+		sigprocmask(SIG_SETMASK, NULL, &sigmask);
+		for (sig = 1; sig < SIGRTMAX; sig++) {
+			TEST(sigismember(&sigmask, sig));
+			if (TEST_RETURN < 0 && TEST_ERRNO == EINVAL && sig != SIGINT)
+				continue; /* let's ignore errors if they are for other signal than SIGINT that we set */
+			if ((sig == SIGINT) != (TEST_RETURN != 0)) {
+				tst_resm(TFAIL, "Bad value of signal mask, signal %d is %s",
+						sig, TEST_RETURN ? "on" : "off");
+				cmp_ok |= 1;
+			}
+		}
+	}
+	failed = sys_errno != tc->err;
+	result |= failed || !cmp_ok;
+	if (failed)
+		last_failed_errno = sys_errno;
+	PRINT_RESULT_CMP(sys_ret >= 0, tc->ret, tc->err, sys_ret, sys_errno, cmp_ok);
+	cleanup: if (fd >= 0)
+		cleanup_file(fpath);
+
+	sigemptyset(&sigmask);
+	sigprocmask(SIG_SETMASK, &sigmask, NULL);
+	if (pid > 0) {
+		int st;
+		kill(pid, SIGTERM);
+		wait(&st);
+	}
 	return result;
 }
 
-
 /*
  * sighandler()
  */
-void sighandler(int sig)
-{
-        if (sig == SIGINT)
-                return;
-        // NOTREACHED
-        return;
+void sighandler(int sig) {
+	if (sig == SIGINT)
+		return;
+	// NOTREACHED
+	return;
 }
 
-
-/*
- * usage()
- */
-
-static void usage(const char *progname)
-{
-        tst_resm(TINFO,"usage: %s [options]", progname);
-        tst_resm(TINFO,"This is a regression test program of %s system call.",SYSCALL_NAME);
-        tst_resm(TINFO,"options:");
-        tst_resm(TINFO,"    -d --debug           Show debug messages");
-        tst_resm(TINFO,"    -h --help            Show this message");
-        tst_resm(TINFO,"NG");
-        exit(1);
-}
-
-
 /*
  * main()
  */
 
-
-
 int main(int ac, char **av) {
 	int result = RESULT_OK;
-        int c;
-        int i;
-        int lc;                 /* loop counter */
-        char *msg;              /* message returned from parse_opts */
-
-	struct option long_options[] = {
-                { "debug", no_argument, 0, 'd' },
-                { "help",  no_argument, 0, 'h' },
-                { NULL, 0, NULL, 0 }
-        };
-
-	progname = strchr(av[0], '/');
-        progname = progname ? progname + 1 : av[0];	
+	int i;
+	int lc; /* loop counter */
+	char *msg; /* message returned from parse_opts */
 
 	progdir = strdup(av[0]);
-        progdir = dirname(progdir);
-	
-        /* parse standard options */
-        if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
-             tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-             tst_exit();
-           }
-
-        setup();
-
-        /* Check looping state if -i option given */
-        for (lc = 0; TEST_LOOPING(lc); ++lc) {
-                Tst_count = 0;
-                for (testno = 0; testno < TST_TOTAL; ++testno) {
-			 TEST(c = getopt_long(ac, av, "dh", long_options, NULL));
-			 while(TEST_RETURN != -1) {
-		                switch (c) {
-                		case 'd':
-		                        opt_debug = 1;
-                		        break;
-		                default:
-                		        usage(progname);
-                        		// NOTREACHED
-                		}
-		        }
-
-
-		if (ac != optind) {
-        	        tst_resm(TINFO,"Options are not match.");
-                	usage(progname);
-                	// NOTREACHED
-	        }
-
-		/*
-		* Execute test
-         	*/
-	        for (i = 0; i < (int)(sizeof(tcase) / sizeof(tcase[0])); i++) {
-        	        int ret;
-	                tst_resm(TINFO,"(case%02d) START", i);
-	                ret = do_test(&tcase[i]);
-	                tst_resm(TINFO,"(case%02d) END => %s", i, (ret == 0) ? "OK" : "NG");
-	                result |= ret;
-        	}
-		
-		/*
-        	 * Check results
-         	*/
-        	switch(result) {
-	        case RESULT_OK:
-        			tst_resm(TPASS, "ppoll01 call succeeded ");
-		                break;
-
-	        default:
-                 	   	tst_resm(TFAIL, "%s failed - errno = %d : %s", TCID, TEST_ERRNO, strerror(TEST_ERRNO));
-        		        RPRINTF("NG");
+	progdir = dirname(progdir);
+
+	/* parse standard options */
+	if ((msg = parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL) {
+		tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
+		tst_exit();
+	}
+
+	setup();
+
+	/* Check looping state if -i option given */
+	for (lc = 0; TEST_LOOPING(lc); ++lc) {
+		Tst_count = 0;
+		for (testno = 0; testno < TST_TOTAL; ++testno) {
+			/*
+			 * Execute test
+			 */
+			for (i = 0; i < (int) (sizeof(tcase) / sizeof(tcase[0])); i++) {
+				int ret;
+				tst_resm(TINFO, "(case%02d) START", i);
+				ret = do_test(&tcase[i]);
+				tst_resm(TINFO, "(case%02d) END => %s", i, (ret == 0) ? "OK"
+						: "NG");
+				result |= ret;
+			}
+
+			/*
+			 * Check results
+			 */
+			switch (result) {
+			case RESULT_OK:
+				tst_resm(TPASS, "ppoll01 call succeeded ");
+				break;
+
+			default:
+				tst_resm(TFAIL, "%s failed - errno = %d : %s", TCID,
+						last_failed_errno, strerror(last_failed_errno));
+				RPRINTF("NG");
 				cleanup();
-				tst_exit();
-		                break;
-        	}
-
-                }
-        }	
-        cleanup();
-	tst_exit();
+				break;
+			}
+
+		}
+	}
+	cleanup();
+	return 0;
 }
 

[-- Attachment #3: Type: text/plain, Size: 399 bytes --]

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct value for  sigset_t for mips
  2009-10-28  1:32 [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct value for sigset_t for mips Henry Yei
@ 2009-10-28  2:57 ` Garrett Cooper
  2009-10-28 19:08   ` Henry Yei
  2009-10-28  9:18 ` [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct value for " Nicolas Joly
  1 sibling, 1 reply; 16+ messages in thread
From: Garrett Cooper @ 2009-10-28  2:57 UTC (permalink / raw)
  To: Henry Yei; +Cc: LTP Mailing List

On Tue, Oct 27, 2009 at 6:32 PM, Henry Yei <hyei@mvista.com> wrote:
> All,
>
>
>
> The patch attached  for ppoll01:
>
> cleans up spacing and code style
>
> removes unneeded/broken debug option parsing
>
> if test fails, it prints out the last failed errno, rather than just the
> last errno(which may have been successful)
>
> passes in correct size of sigset_t for mips
>
>
>
> Signed-off by: Henry Yei <hyei@mvista.com>
>
>
>
> This patch was tested/passed on x86, mips(little endian), and ppc_82xx .

1. Please keep tst_exit() at the bottom.
2. Why can't we do sizeof(sigsetmask) ?

Thanks,
-Garrett

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [LTP] [PATCH][ppoll01]  fix testcase 1, 5: pass correct value for sigset_t for mips
  2009-10-28  1:32 [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct value for sigset_t for mips Henry Yei
  2009-10-28  2:57 ` Garrett Cooper
@ 2009-10-28  9:18 ` Nicolas Joly
  1 sibling, 0 replies; 16+ messages in thread
From: Nicolas Joly @ 2009-10-28  9:18 UTC (permalink / raw)
  To: Henry Yei; +Cc: LTP Mailing List

On Tue, Oct 27, 2009 at 06:32:34PM -0700, Henry Yei wrote:
> All,
> 
> The patch attached  for ppoll01:
> 
> cleans up spacing and code style
> 
> removes unneeded/broken debug option parsing
> 
> if test fails, it prints out the last failed errno, rather than just the last errno(which may have been successful)
> 
> passes in correct size of sigset_t for mips

Hi,

While you are on this one, can you cleanup the test file creation. It
currently tries to create test files in the diretory where the ppoll
executable comes from, instead of the test tmp dir ... which is just
wrong.

	static char *progdir;

        progdir = strdup(av[0]);
        progdir = dirname(progdir);

        TEST(fd = setup_file(progdir, "test.file", fpath));
        if (fd < 0)
                return 1;

progdir should be removed, and "." used instead.

Thanks.

-- 
Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct value for sigset_t for mips
  2009-10-28  2:57 ` Garrett Cooper
@ 2009-10-28 19:08   ` Henry Yei
  2009-11-02 13:59     ` Subrata Modak
  0 siblings, 1 reply; 16+ messages in thread
From: Henry Yei @ 2009-10-28 19:08 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: LTP Mailing List

> -----Original Message-----
> From: Garrett Cooper [mailto:yanegomi@gmail.com]
> Sent: Tuesday, October 27, 2009 7:57 PM
> To: Henry Yei
> Cc: LTP Mailing List
> Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct
> value for sigset_t for mips
> 
> On Tue, Oct 27, 2009 at 6:32 PM, Henry Yei <hyei@mvista.com> wrote:
> > All,
> >
> >
> >
> > The patch attached  for ppoll01:
> >
> > cleans up spacing and code style
> >
> > removes unneeded/broken debug option parsing
> >
> > if test fails, it prints out the last failed errno, rather than just
> the
> > last errno(which may have been successful)
> >
> > passes in correct size of sigset_t for mips
> >
> >
> >
> > Signed-off by: Henry Yei <hyei@mvista.com>
> >
> >
> >
> > This patch was tested/passed on x86, mips(little endian), and
> ppc_82xx .
> 
> 1. Please keep tst_exit() at the bottom.
> 2. Why can't we do sizeof(sigsetmask) ?
> 
> Thanks,
> -Garrett

Garrett,

You want me to put tst_exit() at the bottom, even though it is called within cleanup()?
You mean sizeof(sigmask) ~ sizeof(sigset_t), right? That code was commented out since version 1.1 which I thought was odd too, so I did check sizeof(sigmask).
However, sizeof(sigmask) on mips returns 128 which does not seem correct. I haven't checked the other architectures, but I suspect some might have a similar mismatch. Apparently sigset_t may have different values when returned from glibc vs kernel space. More information from this post:

http://lists.uclibc.org/pipermail/uclibc/2009-January/041850.html







------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct value for sigset_t for mips
  2009-10-28 19:08   ` Henry Yei
@ 2009-11-02 13:59     ` Subrata Modak
  2009-11-02 22:09       ` Henry Yei
  0 siblings, 1 reply; 16+ messages in thread
From: Subrata Modak @ 2009-11-02 13:59 UTC (permalink / raw)
  To: Henry Yei; +Cc: LTP Mailing List

Any further work on this patch ?

Regards--
Subrata

On Wed, 2009-10-28 at 12:08 -0700, Henry Yei wrote: 
> > -----Original Message-----
> > From: Garrett Cooper [mailto:yanegomi@gmail.com]
> > Sent: Tuesday, October 27, 2009 7:57 PM
> > To: Henry Yei
> > Cc: LTP Mailing List
> > Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct
> > value for sigset_t for mips
> > 
> > On Tue, Oct 27, 2009 at 6:32 PM, Henry Yei <hyei@mvista.com> wrote:
> > > All,
> > >
> > >
> > >
> > > The patch attached  for ppoll01:
> > >
> > > cleans up spacing and code style
> > >
> > > removes unneeded/broken debug option parsing
> > >
> > > if test fails, it prints out the last failed errno, rather than just
> > the
> > > last errno(which may have been successful)
> > >
> > > passes in correct size of sigset_t for mips
> > >
> > >
> > >
> > > Signed-off by: Henry Yei <hyei@mvista.com>
> > >
> > >
> > >
> > > This patch was tested/passed on x86, mips(little endian), and
> > ppc_82xx .
> > 
> > 1. Please keep tst_exit() at the bottom.
> > 2. Why can't we do sizeof(sigsetmask) ?
> > 
> > Thanks,
> > -Garrett
> 
> Garrett,
> 
> You want me to put tst_exit() at the bottom, even though it is called within cleanup()?
> You mean sizeof(sigmask) ~ sizeof(sigset_t), right? That code was commented out since version 1.1 which I thought was odd too, so I did check sizeof(sigmask).
> However, sizeof(sigmask) on mips returns 128 which does not seem correct. I haven't checked the other architectures, but I suspect some might have a similar mismatch. Apparently sigset_t may have different values when returned from glibc vs kernel space. More information from this post:
> 
> http://lists.uclibc.org/pipermail/uclibc/2009-January/041850.html
> 
> 
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay 
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct value for sigset_t for mips
  2009-11-02 13:59     ` Subrata Modak
@ 2009-11-02 22:09       ` Henry Yei
  2009-11-09 17:39         ` Subrata Modak
  0 siblings, 1 reply; 16+ messages in thread
From: Henry Yei @ 2009-11-02 22:09 UTC (permalink / raw)
  To: subrata; +Cc: LTP Mailing List

[-- Attachment #1: Type: text/plain, Size: 3297 bytes --]

Subrata, 

I've included Nicolas Joly's suggested removal of progdir to force the test to create all test files in the temp directory in the attached patch.

I'm not sure why tst_exit() is needed when calling cleanup(), as it would be called by cleanup(). I can add it back, if needed. Any other comments on the the appropriateness of "sizeof(sigmask)" would also be welcomed. There are a few other tests with similar issues.

> -----Original Message-----
> From: Subrata Modak [mailto:subrata@linux.vnet.ibm.com]
> Sent: Monday, November 02, 2009 5:59 AM
> To: Henry Yei
> Cc: Garrett Cooper; LTP Mailing List
> Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct
> valuefor sigset_t for mips
> 
> Any further work on this patch ?
> 
> Regards--
> Subrata
> 
> On Wed, 2009-10-28 at 12:08 -0700, Henry Yei wrote:
> > > -----Original Message-----
> > > From: Garrett Cooper [mailto:yanegomi@gmail.com]
> > > Sent: Tuesday, October 27, 2009 7:57 PM
> > > To: Henry Yei
> > > Cc: LTP Mailing List
> > > Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct
> > > value for sigset_t for mips
> > >
> > > On Tue, Oct 27, 2009 at 6:32 PM, Henry Yei <hyei@mvista.com> wrote:
> > > > All,
> > > >
> > > >
> > > >
> > > > The patch attached  for ppoll01:
> > > >
> > > > cleans up spacing and code style
> > > >
> > > > removes unneeded/broken debug option parsing
> > > >
> > > > if test fails, it prints out the last failed errno, rather than
> just
> > > the
> > > > last errno(which may have been successful)
> > > >
> > > > passes in correct size of sigset_t for mips
> > > >
> > > >
> > > >
> > > > Signed-off by: Henry Yei <hyei@mvista.com>
> > > >
> > > >
> > > >
> > > > This patch was tested/passed on x86, mips(little endian), and
> > > ppc_82xx .
> > >
> > > 1. Please keep tst_exit() at the bottom.
> > > 2. Why can't we do sizeof(sigsetmask) ?
> > >
> > > Thanks,
> > > -Garrett
> >
> > Garrett,
> >
> > You want me to put tst_exit() at the bottom, even though it is called
> within cleanup()?
> > You mean sizeof(sigmask) ~ sizeof(sigset_t), right? That code was
> commented out since version 1.1 which I thought was odd too, so I did
> check sizeof(sigmask).
> > However, sizeof(sigmask) on mips returns 128 which does not seem
> correct. I haven't checked the other architectures, but I suspect some
> might have a similar mismatch. Apparently sigset_t may have different
> values when returned from glibc vs kernel space. More information from
> this post:
> >
> > http://lists.uclibc.org/pipermail/uclibc/2009-January/041850.html
> >
> >
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> ---------
> > Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> > is the only developer event you need to attend this year. Jumpstart
> your
> > developing skills, take BlackBerry mobile applications to market and
> stay
> > ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> > http://p.sf.net/sfu/devconference
> > _______________________________________________
> > Ltp-list mailing list
> > Ltp-list@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/ltp-list


[-- Attachment #2: ppoll01.patch --]
[-- Type: application/octet-stream, Size: 17364 bytes --]

--- ltp-20090531/testcases/kernel/syscalls/ppoll/ppoll01.c	2009-05-29 05:09:54.000000000 -0700
+++ ltp-wdir/testcases/kernel/syscalls/ppoll/ppoll01.c	2009-11-02 14:03:35.856593838 -0800
@@ -61,7 +61,6 @@
 #include <signal.h>
 #include "asm/poll.h"
 
-
 #include "../utils/include_j_h.h"
 #include "../utils/common_j_h.c"
 
@@ -71,13 +70,14 @@
 #include "linux_syscall_numbers.h"
 
 /* Extern Global Variables */
-extern int Tst_count;           /* counter for tst_xxx routines.         */
-extern char *TESTDIR;           /* temporary dir created by tst_tmpdir() */
+extern int Tst_count; /* counter for tst_xxx routines.         */
+extern char *TESTDIR; /* temporary dir created by tst_tmpdir() */
 
 /* Global Variables */
-char *TCID = "ppoll01";  /* Test program identifier.*/
-int  testno;
-int  TST_TOTAL = 1;                   /* total number of tests in this file.   */
+char *TCID = "ppoll01"; /* Test program identifier.*/
+int testno;
+int TST_TOTAL = 1; /* total number of tests in this file.   */
+int last_failed_errno;
 
 /* Extern Global Functions */
 /******************************************************************************/
@@ -98,14 +98,16 @@ int  TST_TOTAL = 1;                   /*
 /*                                                                            */
 /******************************************************************************/
 extern void cleanup() {
-        /* Remove tmp dir and all files in it */
-        TEST_CLEANUP;
-        tst_rmdir();
+	/* Remove tmp dir and all files in it */
+	TEST_CLEANUP;
+	tst_rmdir();
 
-        /* Exit with appropriate return code. */
-        tst_exit();
+	/* Exit with appropriate return code. */
+	tst_exit();
 }
 
+void sighandler(int sig); /* signals handler function for the test */
+
 /* Local  Functions */
 /******************************************************************************/
 /*                                                                            */
@@ -125,59 +127,51 @@ extern void cleanup() {
 /*                                                                            */
 /******************************************************************************/
 void setup() {
-        /* Capture signals if any */
-        /* Create temporary directories */
-        TEST_PAUSE;
-        tst_tmpdir();
-}
+	/* Capture signals if any */
+	signal(SIGINT, &sighandler);
 
+	/* Create temporary directories */
+	TEST_PAUSE;
+	tst_tmpdir();
+}
 
 /*
  * Macros
  */
 #define SYSCALL_NAME    "ppoll"
 
-#ifndef __NR_ppoll
-#  define __NR_ppoll    309
-#endif
-
 #ifndef POLLRDHUP
-#  define POLLRDHUP     0x2000
+#define POLLRDHUP     0x2000
 #endif
 
-
 /*
  * Global variables
  */
-static int opt_debug;
-static char *progname;
-static char *progdir;
 
 enum test_type {
 	NORMAL,
-        MASK_SIGNAL,
-        TIMEOUT,
-        FD_ALREADY_CLOSED,
-        SEND_SIGINT,
-        INVALID_NFDS,
-        INVALID_FDS,
-        MINUS_NSEC,
-        TOO_LARGE_NSEC,
+	MASK_SIGNAL,
+	TIMEOUT,
+	FD_ALREADY_CLOSED,
+	SEND_SIGINT,
+	SEND_SIGINT_RACE_TEST,
+	INVALID_NFDS,
+	INVALID_FDS,
+	MINUS_NSEC,
+	TOO_LARGE_NSEC,
 
 };
 
-
 /*
  * Data Structure
  */
 struct test_case {
 	short expect_revents;
-        int ttype;
-        int ret;
-        int err;
+	int ttype;
+	int ret;
+	int err;
 };
 
-
 /* Test cases
  *
  *   test status of errors on man page
@@ -191,60 +185,62 @@ struct test_case {
  *   ENOMEM             can't check because it's difficult to create no-memory
  */
 
-
 static struct test_case tcase[] = {
-	{ // case00
-                .ttype          = NORMAL,
-                .expect_revents = POLLOUT,
-                .ret            = 0,
-                .err            = 0,
-        },
-        { // case01
-                .ttype          = MASK_SIGNAL,
-                .expect_revents = 0, // don't care
-                .ret            = 0,
-                .err            = 0,
-        },
-        { // case02
-                .ttype          = TIMEOUT,
-                .expect_revents = 0, // don't care
-                .ret            = 0,
-                .err            = 0,
-        },
-        { // case03
-                .ttype          = FD_ALREADY_CLOSED,
-                .expect_revents = POLLNVAL,
-                .ret            = 0,
-                .err            = 0,
-        },
-        { // case04
-                .ttype          = SEND_SIGINT,
-                .ret            = -1,
-                .err            = EINTR,
-        },
-        { // case05
-                .ttype          = INVALID_NFDS,
-                .ret            = -1,
-                .err            = EINVAL,
-        },
-        { // case06
-                .ttype          = INVALID_FDS,
-                .ret            = -1,
-                .err            = EFAULT,
-        },
+		{ // case00
+			.ttype = NORMAL,
+			.expect_revents = POLLIN | POLLOUT,
+			.ret = 0,
+			.err = 0,
+		},
+		{ // case01
+			.ttype = MASK_SIGNAL,
+			.expect_revents = 0, // don't care
+			.ret = 0,
+			.err = 0,
+		},
+		{ // case02
+			.ttype = TIMEOUT,
+			.expect_revents = 0, // don't care
+			.ret = 0,
+			.err = 0,
+		},
+		{ // case03
+			.ttype = FD_ALREADY_CLOSED,
+			.expect_revents = POLLNVAL,
+			.ret = 0, .err = 0,
+		},
+		{ // case04
+			.ttype = SEND_SIGINT,
+			.ret = -1,
+			.err = EINTR,
+		},
+		{ // case05
+			.ttype = SEND_SIGINT_RACE_TEST,
+			.ret = -1,
+			.err = EINTR,
+		},
+		{ // case06
+			.ttype = INVALID_NFDS,
+			.ret = -1,
+			.err = EINVAL,
+		},
+		{ // case07
+			.ttype = INVALID_FDS,
+			.ret = -1,
+			.err = EFAULT, },
 #if 0
-        { // case07
-                .ttype          = MINUS_NSEC,
-                .ret            = -1,
-                .err            = EINVAL, // RHEL4U1 + 2.6.18 returns SUCCESS
-        },
-        { // case08
-                .ttype          = TOO_LARGE_NSEC,
-                .ret            = -1,
-                .err            = EINVAL, // RHEL4U1 + 2.6.18 returns SUCCESS
-        },
+		{ // case08
+			.ttype = MINUS_NSEC,
+			.ret = -1,
+			.err = EINVAL, // RHEL4U1 + 2.6.18 returns SUCCESS
+		},
+		{ // case09
+			.ttype = TOO_LARGE_NSEC,
+			.ret = -1,
+			.err = EINVAL, // RHEL4U1 + 2.6.18 returns SUCCESS
+		},
 #endif
-};
+		};
 
 #define NUM_TEST_FDS    1
 
@@ -256,227 +252,221 @@ static struct test_case tcase[] = {
  *
  */
 
-static int do_test(struct test_case *tc)
-{
-        int sys_ret;
-        int sys_errno;
-        int result = RESULT_OK;
-	int fd = -1 , cmp_ok = 1;
+static int do_test(struct test_case *tc) {
+	int sys_ret;
+	int sys_errno;
+	int failed;
+	int result = RESULT_OK;
+	int fd = -1, cmp_ok = 1;
 	char fpath[PATH_MAX];
 	struct pollfd *p_fds, fds[NUM_TEST_FDS];
-        unsigned int nfds = NUM_TEST_FDS;
-        struct timespec *p_ts, ts;
-        sigset_t *p_sigmask, sigmask;
-        size_t sigsetsize = 0;
-        pid_t pid = 0;
-
-	TEST(fd = setup_file(progdir, "test.file", fpath));
-        if (fd < 0)
-                return 1;
-        fds[0].fd = fd;
-        fds[0].events = POLLIN | POLLPRI | POLLOUT | POLLRDHUP;
-        fds[0].revents = 0;
-        p_fds = fds;
-        p_ts = NULL;
-        p_sigmask = NULL;
+	unsigned int nfds = NUM_TEST_FDS;
+	struct timespec *p_ts, ts;
+	sigset_t *p_sigmask, sigmask;
+	size_t sigsetsize = 0;
+	pid_t pid = 0;
+
+	TEST(fd = setup_file(".", "test.file", fpath));
+	if (fd < 0)
+		return 1;
+	fds[0].fd = fd;
+	fds[0].events = POLLIN | POLLPRI | POLLOUT | POLLRDHUP;
+	fds[0].revents = 0;
+	p_fds = fds;
+	p_ts = NULL;
+	p_sigmask = NULL;
 
 	switch (tc->ttype) {
-        case TIMEOUT:
-                nfds = 0;
-                ts.tv_sec = 0;
-                ts.tv_nsec = 50000000;  // 50msec
-                p_ts = &ts;
-                break;
+	case TIMEOUT:
+		nfds = 0;
+		ts.tv_sec = 0;
+		ts.tv_nsec = 50000000; // 50msec
+		p_ts = &ts;
+		break;
 	case FD_ALREADY_CLOSED:
-                TEST(close(fd));
-                fd = -1;
-                TEST(cleanup_file(fpath));
-                break;
-        case MASK_SIGNAL:
-                TEST(sigemptyset(&sigmask));
-                TEST(sigaddset(&sigmask, SIGINT));
-                p_sigmask = &sigmask;
-                //sigsetsize = sizeof(sigmask);
-                sigsetsize = 8;
-                nfds = 0;
-                ts.tv_sec = 0;
-                ts.tv_nsec = 300000000; // 300msec => need to be enough for
-                                        //   waiting the signal
-                p_ts = &ts;
-                // fallthrough
+		TEST(close(fd));
+		fd = -1;
+		TEST(cleanup_file(fpath));
+		break;
+	case MASK_SIGNAL:
+		TEST(sigemptyset(&sigmask));
+		TEST(sigaddset(&sigmask, SIGINT));
+		p_sigmask = &sigmask;
+		//sigsetsize = sizeof(sigmask);
+#if defined __mips__
+		sigsetsize = 16;
+#else
+		sigsetsize = 8;
+#endif
+		nfds = 0;
+		ts.tv_sec = 0;
+		ts.tv_nsec = 300000000; // 300msec => need to be enough for
+		//   waiting the signal
+		p_ts = &ts;
+		// fallthrough
 	case SEND_SIGINT:
-                nfds = 0;
-                TEST(pid = create_sig_proc(100000, SIGINT)); // 100msec
-                if (pid < 0)
-                        return 1;
-                break;
-        case INVALID_NFDS:
-                //nfds = RLIMIT_NOFILE + 1; ==> RHEL4U1 + 2.6.18 returns SUCCESS
-                nfds = -1;
-                break;
-        case INVALID_FDS:
-                p_fds = (void*)0xc0000000;
-                break;
-        case MINUS_NSEC:
-                ts.tv_sec = 0;
-                ts.tv_nsec = -1;
-                p_ts = &ts;
-                break;
+		nfds = 0;
+		pid = create_sig_proc(100000, SIGINT, UINT_MAX); // 100msec
+		if (pid < 0)
+			return 1;
+		break;
+	case SEND_SIGINT_RACE_TEST:
+		/* block the INT signal */
+		sigemptyset(&sigmask);
+		sigaddset(&sigmask, SIGINT);
+		sigprocmask(SIG_SETMASK, &sigmask, NULL);
+
+		/* and let it be unblocked when the syscall runs */
+		sigemptyset(&sigmask);
+		p_sigmask = &sigmask;
+		//sigsetsize = sizeof(sigmask);
+#if defined __mips__
+		sigsetsize = 16;
+#else
+		sigsetsize = 8;
+#endif
+		nfds = 0;
+		ts.tv_sec = 0;
+		ts.tv_nsec = 300000000; // 300msec => need to be enough for
+		//   waiting the signal
+		p_ts = &ts;
+		nfds = 0;
+		pid = create_sig_proc(0, SIGINT, 1);
+		if (pid < 0) {
+			result = 1;
+			goto cleanup;
+		}
+		break;
+	case INVALID_NFDS:
+		//nfds = RLIMIT_NOFILE + 1; //==> RHEL4U1 + 2.6.18 returns SUCCESS
+		nfds = -1;
+		break;
+	case INVALID_FDS:
+		p_fds = (void*) 0xc0000000;
+		break;
+	case MINUS_NSEC:
+		ts.tv_sec = 0;
+		ts.tv_nsec = -1;
+		p_ts = &ts;
+		break;
 	case TOO_LARGE_NSEC:
-                ts.tv_sec = 0;
-                ts.tv_nsec = 1000000000;
-                p_ts = &ts;
-                break;
-        }
+		ts.tv_sec = 0;
+		ts.tv_nsec = 1000000000;
+		p_ts = &ts;
+		break;
+	}
 
 	/*
-	   * Execute system call
-         */
-        errno = 0;
-        TEST(sys_ret = syscall(__NR_ppoll, p_fds, nfds, p_ts, p_sigmask, sigsetsize));
-        sys_errno = errno;
-        if (sys_ret <= 0 || tc->ret < 0)
-                goto TEST_END;
-
-        cmp_ok = fds[0].revents == tc->expect_revents;
-        if (opt_debug) {
-                tst_resm(TINFO,"EXPECT: revents=0x%04x", tc->expect_revents);
-                tst_resm(TINFO,"RESULT: revents=0x%04x", fds[0].revents);
-        }
-
-TEST_END:
-        /*
-         * Check results
-         */
-        result |= (sys_errno != tc->err) || !cmp_ok;
-        PRINT_RESULT_CMP(sys_ret >= 0, tc->ret, tc->err, sys_ret, sys_errno,
-                         cmp_ok);
-
-        if (fd >= 0)
-                cleanup_file(fpath);
-        if (pid > 0) {
-                int st;
-                kill(pid, SIGTERM);
-                wait(&st);
-        }
+	 * Execute system call
+	 */
+	errno = 0;
+	TEST(sys_ret
+			= syscall(__NR_ppoll, p_fds, nfds, p_ts, p_sigmask, sigsetsize));
+	sys_errno = errno;
+	if (sys_ret <= 0 || tc->ret < 0)
+		goto TEST_END;
+
+	cmp_ok = fds[0].revents == tc->expect_revents;
+	tst_resm(TINFO, "EXPECT: revents=0x%04x", tc->expect_revents);
+	tst_resm(TINFO, "RESULT: revents=0x%04x", fds[0].revents);
+
+	TEST_END:
+	/*
+	 * Check results
+	 */
+	if (tc->ttype == SEND_SIGINT_RACE_TEST) {
+		int sig;
+		sigprocmask(SIG_SETMASK, NULL, &sigmask);
+		for (sig = 1; sig < SIGRTMAX; sig++) {
+			TEST(sigismember(&sigmask, sig));
+			if (TEST_RETURN < 0 && TEST_ERRNO == EINVAL && sig != SIGINT)
+				continue; /* let's ignore errors if they are for other signal than SIGINT that we set */
+			if ((sig == SIGINT) != (TEST_RETURN != 0)) {
+				tst_resm(TFAIL, "Bad value of signal mask, signal %d is %s",
+						sig, TEST_RETURN ? "on" : "off");
+				cmp_ok |= 1;
+			}
+		}
+	}
+	failed = sys_errno != tc->err;
+	result |= failed || !cmp_ok;
+	if (failed)
+		last_failed_errno = sys_errno;
+	PRINT_RESULT_CMP(sys_ret >= 0, tc->ret, tc->err, sys_ret, sys_errno, cmp_ok);
+	cleanup: if (fd >= 0)
+		cleanup_file(fpath);
+
+	sigemptyset(&sigmask);
+	sigprocmask(SIG_SETMASK, &sigmask, NULL);
+	if (pid > 0) {
+		int st;
+		kill(pid, SIGTERM);
+		wait(&st);
+	}
 	return result;
 }
 
-
 /*
  * sighandler()
  */
-void sighandler(int sig)
-{
-        if (sig == SIGINT)
-                return;
-        // NOTREACHED
-        return;
-}
-
-
-/*
- * usage()
- */
-
-static void usage(const char *progname)
-{
-        tst_resm(TINFO,"usage: %s [options]", progname);
-        tst_resm(TINFO,"This is a regression test program of %s system call.",SYSCALL_NAME);
-        tst_resm(TINFO,"options:");
-        tst_resm(TINFO,"    -d --debug           Show debug messages");
-        tst_resm(TINFO,"    -h --help            Show this message");
-        tst_resm(TINFO,"NG");
-        exit(1);
+void sighandler(int sig) {
+	if (sig == SIGINT)
+		return;
+	// NOTREACHED
+	return;
 }
 
-
 /*
  * main()
  */
 
-
-
 int main(int ac, char **av) {
 	int result = RESULT_OK;
-        int c;
-        int i;
-        int lc;                 /* loop counter */
-        char *msg;              /* message returned from parse_opts */
-
-	struct option long_options[] = {
-                { "debug", no_argument, 0, 'd' },
-                { "help",  no_argument, 0, 'h' },
-                { NULL, 0, NULL, 0 }
-        };
-
-	progname = strchr(av[0], '/');
-        progname = progname ? progname + 1 : av[0];	
-
-	progdir = strdup(av[0]);
-        progdir = dirname(progdir);
-	
-        /* parse standard options */
-        if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
-             tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-             tst_exit();
-           }
-
-        setup();
-
-        /* Check looping state if -i option given */
-        for (lc = 0; TEST_LOOPING(lc); ++lc) {
-                Tst_count = 0;
-                for (testno = 0; testno < TST_TOTAL; ++testno) {
-			 TEST(c = getopt_long(ac, av, "dh", long_options, NULL));
-			 while(TEST_RETURN != -1) {
-		                switch (c) {
-                		case 'd':
-		                        opt_debug = 1;
-                		        break;
-		                default:
-                		        usage(progname);
-                        		// NOTREACHED
-                		}
-		        }
-
-
-		if (ac != optind) {
-        	        tst_resm(TINFO,"Options are not match.");
-                	usage(progname);
-                	// NOTREACHED
-	        }
-
-		/*
-		* Execute test
-         	*/
-	        for (i = 0; i < (int)(sizeof(tcase) / sizeof(tcase[0])); i++) {
-        	        int ret;
-	                tst_resm(TINFO,"(case%02d) START", i);
-	                ret = do_test(&tcase[i]);
-	                tst_resm(TINFO,"(case%02d) END => %s", i, (ret == 0) ? "OK" : "NG");
-	                result |= ret;
-        	}
-		
-		/*
-        	 * Check results
-         	*/
-        	switch(result) {
-	        case RESULT_OK:
-        			tst_resm(TPASS, "ppoll01 call succeeded ");
-		                break;
-
-	        default:
-                 	   	tst_resm(TFAIL, "%s failed - errno = %d : %s", TCID, TEST_ERRNO, strerror(TEST_ERRNO));
-        		        RPRINTF("NG");
+	int i;
+	int lc; /* loop counter */
+	char *msg; /* message returned from parse_opts */
+
+	/* parse standard options */
+	if ((msg = parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL) {
+		tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
+	}
+
+	setup();
+
+	/* Check looping state if -i option given */
+	for (lc = 0; TEST_LOOPING(lc); ++lc) {
+		Tst_count = 0;
+		for (testno = 0; testno < TST_TOTAL; ++testno) {
+			/*
+			 * Execute test
+			 */
+			for (i = 0; i < (int) (sizeof(tcase) / sizeof(tcase[0])); i++) {
+				int ret;
+				tst_resm(TINFO, "(case%02d) START", i);
+				ret = do_test(&tcase[i]);
+				tst_resm(TINFO, "(case%02d) END => %s", i, (ret == 0) ? "OK"
+						: "NG");
+				result |= ret;
+			}
+
+			/*
+			 * Check results
+			 */
+			switch (result) {
+			case RESULT_OK:
+				tst_resm(TPASS, "ppoll01 call succeeded ");
+				break;
+
+			default:
+				tst_resm(TFAIL, "%s failed - errno = %d : %s", TCID,
+						last_failed_errno, strerror(last_failed_errno));
+				RPRINTF("NG");
 				cleanup();
-				tst_exit();
-		                break;
-        	}
-
-                }
-        }	
-        cleanup();
-	tst_exit();
+				break;
+			}
+
+		}
+	}
+	cleanup();
 }
 

[-- Attachment #3: Type: text/plain, Size: 399 bytes --]

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct value for sigset_t for mips
  2009-11-02 22:09       ` Henry Yei
@ 2009-11-09 17:39         ` Subrata Modak
  2009-11-09 22:12           ` [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct valuefor " Henry Yei
  0 siblings, 1 reply; 16+ messages in thread
From: Subrata Modak @ 2009-11-09 17:39 UTC (permalink / raw)
  To: Henry Yei; +Cc: LTP Mailing List

On Mon, 2009-11-02 at 14:09 -0800, Henry Yei wrote: 
> Subrata, 
> 
> I've included Nicolas Joly's suggested removal of progdir to force the test to create all test files in the temp directory in the attached patch.
> 
> I'm not sure why tst_exit() is needed when calling cleanup(), as it would be called by cleanup(). I can add it back, if needed. Any other comments on the the appropriateness of "sizeof(sigmask)" would also be welcomed. There are a few other tests with similar issues.
> 

Henry,

Probably because of heavy changes recently, this patch is not applying
properly. Can you please rebase your changes:

patching file testcases/kernel/syscalls/ppoll/ppoll01.c
Hunk #3 FAILED at 98.
Hunk #4 FAILED at 127.
Hunk #5 FAILED at 185.
Hunk #6 FAILED at 252.
4 out of 6 hunks FAILED -- saving rejects to file
testcases/kernel/syscalls/ppoll/ppoll01.c.rej

Regards--
Subrata

> > -----Original Message-----
> > From: Subrata Modak [mailto:subrata@linux.vnet.ibm.com]
> > Sent: Monday, November 02, 2009 5:59 AM
> > To: Henry Yei
> > Cc: Garrett Cooper; LTP Mailing List
> > Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct
> > valuefor sigset_t for mips
> > 
> > Any further work on this patch ?
> > 
> > Regards--
> > Subrata
> > 
> > On Wed, 2009-10-28 at 12:08 -0700, Henry Yei wrote:
> > > > -----Original Message-----
> > > > From: Garrett Cooper [mailto:yanegomi@gmail.com]
> > > > Sent: Tuesday, October 27, 2009 7:57 PM
> > > > To: Henry Yei
> > > > Cc: LTP Mailing List
> > > > Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct
> > > > value for sigset_t for mips
> > > >
> > > > On Tue, Oct 27, 2009 at 6:32 PM, Henry Yei <hyei@mvista.com> wrote:
> > > > > All,
> > > > >
> > > > >
> > > > >
> > > > > The patch attached  for ppoll01:
> > > > >
> > > > > cleans up spacing and code style
> > > > >
> > > > > removes unneeded/broken debug option parsing
> > > > >
> > > > > if test fails, it prints out the last failed errno, rather than
> > just
> > > > the
> > > > > last errno(which may have been successful)
> > > > >
> > > > > passes in correct size of sigset_t for mips
> > > > >
> > > > >
> > > > >
> > > > > Signed-off by: Henry Yei <hyei@mvista.com>
> > > > >
> > > > >
> > > > >
> > > > > This patch was tested/passed on x86, mips(little endian), and
> > > > ppc_82xx .
> > > >
> > > > 1. Please keep tst_exit() at the bottom.
> > > > 2. Why can't we do sizeof(sigsetmask) ?
> > > >
> > > > Thanks,
> > > > -Garrett
> > >
> > > Garrett,
> > >
> > > You want me to put tst_exit() at the bottom, even though it is called
> > within cleanup()?
> > > You mean sizeof(sigmask) ~ sizeof(sigset_t), right? That code was
> > commented out since version 1.1 which I thought was odd too, so I did
> > check sizeof(sigmask).
> > > However, sizeof(sigmask) on mips returns 128 which does not seem
> > correct. I haven't checked the other architectures, but I suspect some
> > might have a similar mismatch. Apparently sigset_t may have different
> > values when returned from glibc vs kernel space. More information from
> > this post:
> > >
> > > http://lists.uclibc.org/pipermail/uclibc/2009-January/041850.html
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > ---------
> > > Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> > > is the only developer event you need to attend this year. Jumpstart
> > your
> > > developing skills, take BlackBerry mobile applications to market and
> > stay
> > > ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> > > http://p.sf.net/sfu/devconference
> > > _______________________________________________
> > > Ltp-list mailing list
> > > Ltp-list@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/ltp-list
> 


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct valuefor sigset_t for mips
  2009-11-09 17:39         ` Subrata Modak
@ 2009-11-09 22:12           ` Henry Yei
  2009-11-10  7:16             ` Garrett Cooper
  0 siblings, 1 reply; 16+ messages in thread
From: Henry Yei @ 2009-11-09 22:12 UTC (permalink / raw)
  To: subrata; +Cc: LTP Mailing List

[-- Attachment #1: Type: text/plain, Size: 3866 bytes --]

> -----Original Message-----
> From: Subrata Modak [mailto:subrata@linux.vnet.ibm.com]
> Sent: Monday, November 09, 2009 9:40 AM
> To: Henry Yei
> Cc: Garrett Cooper; LTP Mailing List
> Subject: RE: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct
> valuefor sigset_t for mips
> 
> On Mon, 2009-11-02 at 14:09 -0800, Henry Yei wrote:
> > Subrata,
> >
> > I've included Nicolas Joly's suggested removal of progdir to force
> the test to create all test files in the temp directory in the attached
> patch.
> >
> > I'm not sure why tst_exit() is needed when calling cleanup(), as it
> would be called by cleanup(). I can add it back, if needed. Any other
> comments on the the appropriateness of "sizeof(sigmask)" would also be
> welcomed. There are a few other tests with similar issues.
> >
> 
> Henry,
> 
> Probably because of heavy changes recently, this patch is not applying
> properly. Can you please rebase your changes:
> 
> patching file testcases/kernel/syscalls/ppoll/ppoll01.c
> Hunk #3 FAILED at 98.
> Hunk #4 FAILED at 127.
> Hunk #5 FAILED at 185.
> Hunk #6 FAILED at 252.
> 4 out of 6 hunks FAILED -- saving rejects to file
> testcases/kernel/syscalls/ppoll/ppoll01.c.rej
> 
> Regards--
> Subrata
> 
> > > -----Original Message-----
> > > From: Subrata Modak [mailto:subrata@linux.vnet.ibm.com]
> > > Sent: Monday, November 02, 2009 5:59 AM
> > > To: Henry Yei
> > > Cc: Garrett Cooper; LTP Mailing List
> > > Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct
> > > valuefor sigset_t for mips
> > >
> > > Any further work on this patch ?
> > >
> > > Regards--
> > > Subrata
> > >
> > > On Wed, 2009-10-28 at 12:08 -0700, Henry Yei wrote:
> > > > > -----Original Message-----
> > > > > From: Garrett Cooper [mailto:yanegomi@gmail.com]
> > > > > Sent: Tuesday, October 27, 2009 7:57 PM
> > > > > To: Henry Yei
> > > > > Cc: LTP Mailing List
> > > > > Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass
> correct
> > > > > value for sigset_t for mips
> > > > >
> > > > > On Tue, Oct 27, 2009 at 6:32 PM, Henry Yei <hyei@mvista.com>
> wrote:
> > > > > > All,
> > > > > >
> > > > > >
> > > > > >
> > > > > > The patch attached  for ppoll01:
> > > > > >
> > > > > > cleans up spacing and code style
> > > > > >
> > > > > > removes unneeded/broken debug option parsing
> > > > > >
> > > > > > if test fails, it prints out the last failed errno, rather
> than
> > > just
> > > > > the
> > > > > > last errno(which may have been successful)
> > > > > >
> > > > > > passes in correct size of sigset_t for mips
> > > > > >
> > > > > >
> > > > > >
> > > > > > Signed-off by: Henry Yei <hyei@mvista.com>
> > > > > >
> > > > > >
> > > > > >
> > > > > > This patch was tested/passed on x86, mips(little endian), and
> > > > > ppc_82xx .
> > > > >
> > > > > 1. Please keep tst_exit() at the bottom.
> > > > > 2. Why can't we do sizeof(sigsetmask) ?
> > > > >
> > > > > Thanks,
> > > > > -Garrett
> > > >
> > > > Garrett,
> > > >
> > > > You want me to put tst_exit() at the bottom, even though it is
> called
> > > within cleanup()?
> > > > You mean sizeof(sigmask) ~ sizeof(sigset_t), right? That code was
> > > commented out since version 1.1 which I thought was odd too, so I
> did
> > > check sizeof(sigmask).
> > > > However, sizeof(sigmask) on mips returns 128 which does not seem
> > > correct. I haven't checked the other architectures, but I suspect
> some
> > > might have a similar mismatch. Apparently sigset_t may have
> different
> > > values when returned from glibc vs kernel space. More information
> from
> > > this post:
> > > >
> > > > http://lists.uclibc.org/pipermail/uclibc/2009-January/041850.html


Subrata,

I've included the ppoll01 patch which should apply cleanly to the latest in CVS.

[-- Attachment #2: ppoll01.patch --]
[-- Type: application/octet-stream, Size: 18983 bytes --]

--- ltp/testcases/kernel/syscalls/ppoll/ppoll01.c	2009-10-26 17:13:55.503000000 -0700
+++ ltp-wdir/testcases/kernel/syscalls/ppoll/ppoll01.c	2009-11-09 13:42:22.785101887 -0800
@@ -61,7 +61,6 @@
 #include <signal.h>
 #include "asm/poll.h"
 
-
 #include "../utils/include_j_h.h"
 #include "../utils/common_j_h.c"
 
@@ -71,13 +70,14 @@
 #include "linux_syscall_numbers.h"
 
 /* Extern Global Variables */
-extern int Tst_count;           /* counter for tst_xxx routines.         */
-extern char *TESTDIR;           /* temporary dir created by tst_tmpdir() */
+extern int Tst_count; /* counter for tst_xxx routines.         */
+extern char *TESTDIR; /* temporary dir created by tst_tmpdir() */
 
 /* Global Variables */
-char *TCID = "ppoll01";  /* Test program identifier.*/
-int  testno;
-int  TST_TOTAL = 1;                   /* total number of tests in this file.   */
+char *TCID = "ppoll01"; /* Test program identifier.*/
+int testno;
+int TST_TOTAL = 1; /* total number of tests in this file.   */
+int last_failed_errno;
 
 /* Extern Global Functions */
 /******************************************************************************/
@@ -98,15 +98,15 @@ int  TST_TOTAL = 1;                   /*
 /*                                                                            */
 /******************************************************************************/
 extern void cleanup() {
-        /* Remove tmp dir and all files in it */
-        TEST_CLEANUP;
-        tst_rmdir();
+	/* Remove tmp dir and all files in it */
+	TEST_CLEANUP;
+	tst_rmdir();
 
-        /* Exit with appropriate return code. */
-        tst_exit();
+	/* Exit with appropriate return code. */
+	tst_exit();
 }
 
-void sighandler(int sig);       /* signals handler function for the test */
+void sighandler(int sig); /* signals handler function for the test */
 
 /* Local  Functions */
 /******************************************************************************/
@@ -127,58 +127,57 @@ void sighandler(int sig);       /* signa
 /*                                                                            */
 /******************************************************************************/
 void setup() {
-        /* Capture signals if any */
+	/* Capture signals if any */
 	signal(SIGINT, &sighandler);
 
-        /* Create temporary directories */
-        TEST_PAUSE;
-        tst_tmpdir();
+	/* Create temporary directories */
+	TEST_PAUSE;
+	tst_tmpdir();
 }
 
-
 /*
  * Macros
  */
 #define SYSCALL_NAME    "ppoll"
 
 #ifndef POLLRDHUP
-#  define POLLRDHUP     0x2000
+#define POLLRDHUP     0x2000
 #endif
 
+#if defined (__mips__)
+#define SIGSETSIZE 16
+#else
+#define SIGSETSIZE 8
+#endif
 
 /*
  * Global variables
  */
-static int opt_debug;
-static char *progname;
-static char *progdir;
 
 enum test_type {
 	NORMAL,
-        MASK_SIGNAL,
-        TIMEOUT,
-        FD_ALREADY_CLOSED,
-        SEND_SIGINT,
-        SEND_SIGINT_RACE_TEST,
-        INVALID_NFDS,
-        INVALID_FDS,
-        MINUS_NSEC,
-        TOO_LARGE_NSEC,
+	MASK_SIGNAL,
+	TIMEOUT,
+	FD_ALREADY_CLOSED,
+	SEND_SIGINT,
+	SEND_SIGINT_RACE_TEST,
+	INVALID_NFDS,
+	INVALID_FDS,
+	MINUS_NSEC,
+	TOO_LARGE_NSEC,
 
 };
 
-
 /*
  * Data Structure
  */
 struct test_case {
 	short expect_revents;
-        int ttype;
-        int ret;
-        int err;
+	int ttype;
+	int ret;
+	int err;
 };
 
-
 /* Test cases
  *
  *   test status of errors on man page
@@ -192,65 +191,62 @@ struct test_case {
  *   ENOMEM             can't check because it's difficult to create no-memory
  */
 
-
 static struct test_case tcase[] = {
-	{ // case00
-                .ttype          = NORMAL,
-                .expect_revents = POLLIN | POLLOUT,
-                .ret            = 0,
-                .err            = 0,
-        },
-        { // case01
-                .ttype          = MASK_SIGNAL,
-                .expect_revents = 0, // don't care
-                .ret            = 0,
-                .err            = 0,
-        },
-        { // case02
-                .ttype          = TIMEOUT,
-                .expect_revents = 0, // don't care
-                .ret            = 0,
-                .err            = 0,
-        },
-        { // case03
-                .ttype          = FD_ALREADY_CLOSED,
-                .expect_revents = POLLNVAL,
-                .ret            = 0,
-                .err            = 0,
-        },
-        { // case04
-                .ttype          = SEND_SIGINT,
-                .ret            = -1,
-                .err            = EINTR,
-        },
-        { // case05
-                .ttype          = SEND_SIGINT_RACE_TEST,
-                .ret            = -1,
-                .err            = EINTR,
-        },
-        { // case06
-                .ttype          = INVALID_NFDS,
-                .ret            = -1,
-                .err            = EINVAL,
-        },
-        { // case07
-                .ttype          = INVALID_FDS,
-                .ret            = -1,
-                .err            = EFAULT,
-        },
+		{ // case00
+			.ttype = NORMAL,
+			.expect_revents = POLLIN | POLLOUT,
+			.ret = 0,
+			.err = 0,
+		},
+		{ // case01
+			.ttype = MASK_SIGNAL,
+			.expect_revents = 0, // don't care
+			.ret = 0,
+			.err = 0,
+		},
+		{ // case02
+			.ttype = TIMEOUT,
+			.expect_revents = 0, // don't care
+			.ret = 0,
+			.err = 0,
+		},
+		{ // case03
+			.ttype = FD_ALREADY_CLOSED,
+			.expect_revents = POLLNVAL,
+			.ret = 0, .err = 0,
+		},
+		{ // case04
+			.ttype = SEND_SIGINT,
+			.ret = -1,
+			.err = EINTR,
+		},
+		{ // case05
+			.ttype = SEND_SIGINT_RACE_TEST,
+			.ret = -1,
+			.err = EINTR,
+		},
+		{ // case06
+			.ttype = INVALID_NFDS,
+			.ret = -1,
+			.err = EINVAL,
+		},
+		{ // case07
+			.ttype = INVALID_FDS,
+			.ret = -1,
+			.err = EFAULT, },
 #if 0
-        { // case08
-                .ttype          = MINUS_NSEC,
-                .ret            = -1,
-                .err            = EINVAL, // RHEL4U1 + 2.6.18 returns SUCCESS
-        },
-        { // case09
-                .ttype          = TOO_LARGE_NSEC,
-                .ret            = -1,
-                .err            = EINVAL, // RHEL4U1 + 2.6.18 returns SUCCESS
-        },
+		{ // case08
+			.ttype = MINUS_NSEC,
+			.ret = -1,
+			.err = EINVAL, // RHEL4U1 + 2.6.18 returns SUCCESS
+		},
+		{ // case09
+			.ttype = TOO_LARGE_NSEC,
+			.ret = -1,
+			.err = EINVAL, // RHEL4U1 + 2.6.18 returns SUCCESS
+		},
 #endif
-};
+		};
 
 #define NUM_TEST_FDS    1
 
@@ -262,266 +258,208 @@ static struct test_case tcase[] = {
  *
  */
 
-static int do_test(struct test_case *tc)
-{
-        int sys_ret;
-        int sys_errno;
-        int result = RESULT_OK;
-	int fd = -1 , cmp_ok = 1;
+static int do_test(struct test_case *tc) {
+	int sys_ret;
+	int sys_errno;
+	int failed;
+	int result = RESULT_OK;
+	int fd = -1, cmp_ok = 1;
 	char fpath[PATH_MAX];
 	struct pollfd *p_fds, fds[NUM_TEST_FDS];
-        unsigned int nfds = NUM_TEST_FDS;
-        struct timespec *p_ts, ts;
-        sigset_t *p_sigmask, sigmask;
-        size_t sigsetsize = 0;
-        pid_t pid = 0;
-
-	TEST(fd = setup_file(progdir, "test.file", fpath));
-        if (fd < 0)
-                return 1;
-        fds[0].fd = fd;
-        fds[0].events = POLLIN | POLLPRI | POLLOUT | POLLRDHUP;
-        fds[0].revents = 0;
-        p_fds = fds;
-        p_ts = NULL;
-        p_sigmask = NULL;
+	unsigned int nfds = NUM_TEST_FDS;
+	struct timespec *p_ts, ts;
+	sigset_t *p_sigmask, sigmask;
+	pid_t pid = 0;
+
+	TEST(fd = setup_file(".", "test.file", fpath));
+	if (fd < 0)
+		return 1;
+	fds[0].fd = fd;
+	fds[0].events = POLLIN | POLLPRI | POLLOUT | POLLRDHUP;
+	fds[0].revents = 0;
+	p_fds = fds;
+	p_ts = NULL;
+	p_sigmask = NULL;
 
 	switch (tc->ttype) {
-        case TIMEOUT:
-                nfds = 0;
-                ts.tv_sec = 0;
-                ts.tv_nsec = 50000000;  // 50msec
-                p_ts = &ts;
-                break;
+	case TIMEOUT:
+		nfds = 0;
+		ts.tv_sec = 0;
+		ts.tv_nsec = 50000000; // 50msec
+		p_ts = &ts;
+		break;
 	case FD_ALREADY_CLOSED:
-                TEST(close(fd));
-                fd = -1;
-                TEST(cleanup_file(fpath));
-                break;
-        case MASK_SIGNAL:
-                TEST(sigemptyset(&sigmask));
-                TEST(sigaddset(&sigmask, SIGINT));
-                p_sigmask = &sigmask;
-                //sigsetsize = sizeof(sigmask);
-                sigsetsize = 8;
-                nfds = 0;
-                ts.tv_sec = 0;
-                ts.tv_nsec = 300000000; // 300msec => need to be enough for
-                                        //   waiting the signal
-                p_ts = &ts;
-                // fallthrough
+		TEST(close(fd));
+		fd = -1;
+		TEST(cleanup_file(fpath));
+		break;
+	case MASK_SIGNAL:
+		TEST(sigemptyset(&sigmask));
+		TEST(sigaddset(&sigmask, SIGINT));
+		p_sigmask = &sigmask;
+		nfds = 0;
+		ts.tv_sec = 0;
+		ts.tv_nsec = 300000000; // 300msec => need to be enough for
+		//   waiting the signal
+		p_ts = &ts;
+		// fallthrough
 	case SEND_SIGINT:
-                nfds = 0;
-                pid = create_sig_proc(100000, SIGINT, UINT_MAX); // 100msec
-                if (pid < 0)
-                        return 1;
-                break;
-  case SEND_SIGINT_RACE_TEST:
-    /* block the INT signal */
-                sigemptyset(&sigmask);
-                sigaddset(&sigmask, SIGINT);
-                sigprocmask(SIG_SETMASK, &sigmask, NULL);
-
-                /* and let it be unblocked when the syscall runs */
-                sigemptyset(&sigmask);
-                p_sigmask = &sigmask;
-                //sigsetsize = sizeof(sigmask);
-                sigsetsize = 8;
-                nfds = 0;
-                ts.tv_sec = 0;
-                ts.tv_nsec = 300000000; // 300msec => need to be enough for
-                                        //   waiting the signal
-                p_ts = &ts;
-                nfds = 0;
-                pid = create_sig_proc(0, SIGINT, 1);
-                if (pid < 0) {
-                  result=1;
-                  goto cleanup;
-                }
-                break;
-        case INVALID_NFDS:
-                //nfds = RLIMIT_NOFILE + 1; ==> RHEL4U1 + 2.6.18 returns SUCCESS
-                nfds = -1;
-                break;
-        case INVALID_FDS:
-                p_fds = (void*)0xc0000000;
-                break;
-        case MINUS_NSEC:
-                ts.tv_sec = 0;
-                ts.tv_nsec = -1;
-                p_ts = &ts;
-                break;
+		nfds = 0;
+		pid = create_sig_proc(100000, SIGINT, UINT_MAX); // 100msec
+		if (pid < 0)
+			return 1;
+		break;
+	case SEND_SIGINT_RACE_TEST:
+		/* block the INT signal */
+		sigemptyset(&sigmask);
+		sigaddset(&sigmask, SIGINT);
+		sigprocmask(SIG_SETMASK, &sigmask, NULL);
+
+		/* and let it be unblocked when the syscall runs */
+		sigemptyset(&sigmask);
+		p_sigmask = &sigmask;
+		nfds = 0;
+		ts.tv_sec = 0;
+		ts.tv_nsec = 300000000; // 300msec => need to be enough for
+		//   waiting the signal
+		p_ts = &ts;
+		nfds = 0;
+		pid = create_sig_proc(0, SIGINT, 1);
+		if (pid < 0) {
+			result = 1;
+			goto cleanup;
+		}
+		break;
+	case INVALID_NFDS:
+		//nfds = RLIMIT_NOFILE + 1; //==> RHEL4U1 + 2.6.18 returns SUCCESS
+		nfds = -1;
+		break;
+	case INVALID_FDS:
+		p_fds = (void*) 0xc0000000;
+		break;
+	case MINUS_NSEC:
+		ts.tv_sec = 0;
+		ts.tv_nsec = -1;
+		p_ts = &ts;
+		break;
 	case TOO_LARGE_NSEC:
-                ts.tv_sec = 0;
-                ts.tv_nsec = 1000000000;
-                p_ts = &ts;
-                break;
-        }
+		ts.tv_sec = 0;
+		ts.tv_nsec = 1000000000;
+		p_ts = &ts;
+		break;
+	}
 
 	/*
-	   * Execute system call
-         */
-        errno = 0;
-        TEST(sys_ret = syscall(__NR_ppoll, p_fds, nfds, p_ts, p_sigmask, sigsetsize));
-        sys_errno = errno;
-        if (sys_ret <= 0 || tc->ret < 0)
-                goto TEST_END;
-
-        cmp_ok = fds[0].revents == tc->expect_revents;
-        if (opt_debug) {
-                tst_resm(TINFO,"EXPECT: revents=0x%04x", tc->expect_revents);
-                tst_resm(TINFO,"RESULT: revents=0x%04x", fds[0].revents);
-        }
-
-TEST_END:
-        /*
-         * Check results
-         */
-        if(tc->ttype == SEND_SIGINT_RACE_TEST) {
-          int sig;
-          sigprocmask(SIG_SETMASK, NULL, &sigmask);
-          for(sig=1; sig < SIGRTMAX; sig++) {
-              TEST(sigismember(&sigmask, sig));
-              if(TEST_RETURN < 0 && TEST_ERRNO == EINVAL && sig != SIGINT)
-                continue; /* let's ignore errors if they are for other signal than SIGINT that we set */
-              if((sig==SIGINT) != (TEST_RETURN!=0)) {
-                tst_resm(TFAIL, "Bad value of signal mask, signal %d is %s", sig, TEST_RETURN ? "on" : "off");
-                cmp_ok |=1;
-              }
-            }
-        }
-        result |= (sys_errno != tc->err) || !cmp_ok;
-        PRINT_RESULT_CMP(sys_ret >= 0, tc->ret, tc->err, sys_ret, sys_errno,
-                         cmp_ok);
- cleanup:
-        if (fd >= 0)
-                cleanup_file(fpath);
-
-        sigemptyset(&sigmask);
-        sigprocmask(SIG_SETMASK, &sigmask, NULL);
-        if (pid > 0) {
-                int st;
-                kill(pid, SIGTERM);
-                wait(&st);
-        }
+	 * Execute system call
+	 */
+	errno = 0;
+	TEST(sys_ret
+			= syscall(__NR_ppoll, p_fds, nfds, p_ts, p_sigmask, SIGSETSIZE));
+	sys_errno = errno;
+	if (sys_ret <= 0 || tc->ret < 0)
+		goto TEST_END;
+
+	cmp_ok = fds[0].revents == tc->expect_revents;
+	tst_resm(TINFO, "EXPECT: revents=0x%04x", tc->expect_revents);
+	tst_resm(TINFO, "RESULT: revents=0x%04x", fds[0].revents);
+
+	TEST_END:
+	/*
+	 * Check results
+	 */
+	if (tc->ttype == SEND_SIGINT_RACE_TEST) {
+		int sig;
+		sigprocmask(SIG_SETMASK, NULL, &sigmask);
+		for (sig = 1; sig < SIGRTMAX; sig++) {
+			TEST(sigismember(&sigmask, sig));
+			if (TEST_RETURN < 0 && TEST_ERRNO == EINVAL && sig != SIGINT)
+				continue; /* let's ignore errors if they are for other signal than SIGINT that we set */
+			if ((sig == SIGINT) != (TEST_RETURN != 0)) {
+				tst_resm(TFAIL, "Bad value of signal mask, signal %d is %s",
+						sig, TEST_RETURN ? "on" : "off");
+				cmp_ok |= 1;
+			}
+		}
+	}
+	failed = sys_errno != tc->err;
+	result |= failed || !cmp_ok;
+	if (failed)
+		last_failed_errno = sys_errno;
+	PRINT_RESULT_CMP(sys_ret >= 0, tc->ret, tc->err, sys_ret, sys_errno, cmp_ok);
+	cleanup: if (fd >= 0)
+		cleanup_file(fpath);
+
+	sigemptyset(&sigmask);
+	sigprocmask(SIG_SETMASK, &sigmask, NULL);
+	if (pid > 0) {
+		int st;
+		kill(pid, SIGTERM);
+		wait(&st);
+	}
 	return result;
 }
 
-
 /*
  * sighandler()
  */
-void sighandler(int sig)
-{
-        if (sig == SIGINT)
-                return;
-        // NOTREACHED
-        return;
+void sighandler(int sig) {
+	if (sig == SIGINT)
+		return;
+	// NOTREACHED
+	return;
 }
 
-
-/*
- * usage()
- */
-
-static void usage(const char *progname)
-{
-        tst_resm(TINFO,"usage: %s [options]", progname);
-        tst_resm(TINFO,"This is a regression test program of %s system call.",SYSCALL_NAME);
-        tst_resm(TINFO,"options:");
-        tst_resm(TINFO,"    -d --debug           Show debug messages");
-        tst_resm(TINFO,"    -h --help            Show this message");
-        tst_resm(TINFO,"NG");
-        exit(1);
-}
-
-
 /*
  * main()
  */
 
-
-
 int main(int ac, char **av) {
 	int result = RESULT_OK;
-        int c;
-        int i;
-        int lc;                 /* loop counter */
-        char *msg;              /* message returned from parse_opts */
-
-	struct option long_options[] = {
-                { "debug", no_argument, 0, 'd' },
-                { "help",  no_argument, 0, 'h' },
-                { NULL, 0, NULL, 0 }
-        };
-
-	progname = strchr(av[0], '/');
-        progname = progname ? progname + 1 : av[0];	
-
-	progdir = strdup(av[0]);
-        progdir = dirname(progdir);
-	
-        /* parse standard options */
-        if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
-             tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-             tst_exit();
-           }
-
-        setup();
-
-        /* Check looping state if -i option given */
-        for (lc = 0; TEST_LOOPING(lc); ++lc) {
-                Tst_count = 0;
-                for (testno = 0; testno < TST_TOTAL; ++testno) {
-			 TEST(c = getopt_long(ac, av, "dh", long_options, NULL));
-			 while(TEST_RETURN != -1) {
-		                switch (c) {
-                		case 'd':
-		                        opt_debug = 1;
-                		        break;
-		                default:
-                		        usage(progname);
-                        		// NOTREACHED
-                		}
-		        }
-
-
-		if (ac != optind) {
-        	        tst_resm(TINFO,"Options are not match.");
-                	usage(progname);
-                	// NOTREACHED
-	        }
-
-		/*
-		* Execute test
-         	*/
-	        for (i = 0; i < (int)(sizeof(tcase) / sizeof(tcase[0])); i++) {
-        	        int ret;
-	                tst_resm(TINFO,"(case%02d) START", i);
-	                ret = do_test(&tcase[i]);
-	                tst_resm(TINFO,"(case%02d) END => %s", i, (ret == 0) ? "OK" : "NG");
-	                result |= ret;
-        	}
-		
-		/*
-        	 * Check results
-         	*/
-        	switch(result) {
-	        case RESULT_OK:
-        			tst_resm(TPASS, "ppoll01 call succeeded ");
-		                break;
-
-	        default:
-                 	   	tst_resm(TFAIL, "%s failed - errno = %d : %s", TCID, TEST_ERRNO, strerror(TEST_ERRNO));
-        		        RPRINTF("NG");
+	int i;
+	int lc; /* loop counter */
+	char *msg; /* message returned from parse_opts */
+
+	/* parse standard options */
+	if ((msg = parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL) {
+		tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
+	}
+
+	setup();
+
+	/* Check looping state if -i option given */
+	for (lc = 0; TEST_LOOPING(lc); ++lc) {
+		Tst_count = 0;
+		for (testno = 0; testno < TST_TOTAL; ++testno) {
+			/*
+			 * Execute test
+			 */
+			for (i = 0; i < (int) (sizeof(tcase) / sizeof(tcase[0])); i++) {
+				int ret;
+				tst_resm(TINFO, "(case%02d) START", i);
+				ret = do_test(&tcase[i]);
+				tst_resm(TINFO, "(case%02d) END => %s", i, (ret == 0) ? "OK"
+						: "NG");
+				result |= ret;
+			}
+
+			/*
+			 * Check results
+			 */
+			switch (result) {
+			case RESULT_OK:
+				tst_resm(TPASS, "ppoll01 call succeeded ");
+				break;
+
+			default:
+				tst_resm(TFAIL, "%s failed - errno = %d : %s", TCID,
+						last_failed_errno, strerror(last_failed_errno));
+				RPRINTF("NG");
 				cleanup();
-				tst_exit();
-		                break;
-        	}
-
-                }
-        }	
-        cleanup();
-	tst_exit();
+				break;
+			}
+
+		}
+	}
+	cleanup();
 }
 

[-- Attachment #3: Type: text/plain, Size: 354 bytes --]

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct valuefor  sigset_t for mips
  2009-11-09 22:12           ` [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct valuefor " Henry Yei
@ 2009-11-10  7:16             ` Garrett Cooper
  2009-11-11  1:14               ` Henry Yei
  0 siblings, 1 reply; 16+ messages in thread
From: Garrett Cooper @ 2009-11-10  7:16 UTC (permalink / raw)
  To: Henry Yei; +Cc: LTP Mailing List

On Mon, Nov 9, 2009 at 2:12 PM, Henry Yei <hyei@mvista.com> wrote:
>> -----Original Message-----
>> From: Subrata Modak [mailto:subrata@linux.vnet.ibm.com]
>> Sent: Monday, November 09, 2009 9:40 AM
>> To: Henry Yei
>> Cc: Garrett Cooper; LTP Mailing List
>> Subject: RE: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct
>> valuefor sigset_t for mips
>>
>> On Mon, 2009-11-02 at 14:09 -0800, Henry Yei wrote:
>> > Subrata,
>> >
>> > I've included Nicolas Joly's suggested removal of progdir to force
>> the test to create all test files in the temp directory in the attached
>> patch.
>> >
>> > I'm not sure why tst_exit() is needed when calling cleanup(), as it
>> would be called by cleanup(). I can add it back, if needed. Any other
>> comments on the the appropriateness of "sizeof(sigmask)" would also be
>> welcomed. There are a few other tests with similar issues.
>> >
>>
>> Henry,
>>
>> Probably because of heavy changes recently, this patch is not applying
>> properly. Can you please rebase your changes:
>>
>> patching file testcases/kernel/syscalls/ppoll/ppoll01.c
>> Hunk #3 FAILED at 98.
>> Hunk #4 FAILED at 127.
>> Hunk #5 FAILED at 185.
>> Hunk #6 FAILED at 252.
>> 4 out of 6 hunks FAILED -- saving rejects to file
>> testcases/kernel/syscalls/ppoll/ppoll01.c.rej
>>
>> Regards--
>> Subrata
>>
>> > > -----Original Message-----
>> > > From: Subrata Modak [mailto:subrata@linux.vnet.ibm.com]
>> > > Sent: Monday, November 02, 2009 5:59 AM
>> > > To: Henry Yei
>> > > Cc: Garrett Cooper; LTP Mailing List
>> > > Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct
>> > > valuefor sigset_t for mips
>> > >
>> > > Any further work on this patch ?
>> > >
>> > > Regards--
>> > > Subrata
>> > >
>> > > On Wed, 2009-10-28 at 12:08 -0700, Henry Yei wrote:
>> > > > > -----Original Message-----
>> > > > > From: Garrett Cooper [mailto:yanegomi@gmail.com]
>> > > > > Sent: Tuesday, October 27, 2009 7:57 PM
>> > > > > To: Henry Yei
>> > > > > Cc: LTP Mailing List
>> > > > > Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass
>> correct
>> > > > > value for sigset_t for mips
>> > > > >
>> > > > > On Tue, Oct 27, 2009 at 6:32 PM, Henry Yei <hyei@mvista.com>
>> wrote:
>> > > > > > All,
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > The patch attached  for ppoll01:
>> > > > > >
>> > > > > > cleans up spacing and code style
>> > > > > >
>> > > > > > removes unneeded/broken debug option parsing
>> > > > > >
>> > > > > > if test fails, it prints out the last failed errno, rather
>> than
>> > > just
>> > > > > the
>> > > > > > last errno(which may have been successful)
>> > > > > >
>> > > > > > passes in correct size of sigset_t for mips
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > Signed-off by: Henry Yei <hyei@mvista.com>
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > This patch was tested/passed on x86, mips(little endian), and
>> > > > > ppc_82xx .
>> > > > >
>> > > > > 1. Please keep tst_exit() at the bottom.
>> > > > > 2. Why can't we do sizeof(sigsetmask) ?
>> > > > >
>> > > > > Thanks,
>> > > > > -Garrett
>> > > >
>> > > > Garrett,
>> > > >
>> > > > You want me to put tst_exit() at the bottom, even though it is
>> called
>> > > within cleanup()?
>> > > > You mean sizeof(sigmask) ~ sizeof(sigset_t), right? That code was
>> > > commented out since version 1.1 which I thought was odd too, so I
>> did
>> > > check sizeof(sigmask).
>> > > > However, sizeof(sigmask) on mips returns 128 which does not seem
>> > > correct. I haven't checked the other architectures, but I suspect
>> some
>> > > might have a similar mismatch. Apparently sigset_t may have
>> different
>> > > values when returned from glibc vs kernel space. More information
>> from
>> > > this post:
>> > > >
>> > > > http://lists.uclibc.org/pipermail/uclibc/2009-January/041850.html
>
>
> Subrata,
>
> I've included the ppoll01 patch which should apply cleanly to the latest in CVS.
>

Hi Henry,
    Could you change this line:

+				tst_resm(TFAIL, "%s failed - errno = %d : %s", TCID,
+						last_failed_errno, strerror(last_failed_errno));

    to this please?

+				tst_resm(TFAIL | TTERRNO, "%s failed", TCID);

    last_failed_errno should become TEST_ERRNO if this change is done, IIRC.

Thanks!
-Garrett

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct valuefor sigset_t for mips
  2009-11-10  7:16             ` Garrett Cooper
@ 2009-11-11  1:14               ` Henry Yei
  2009-11-11  6:12                 ` Garrett Cooper
  0 siblings, 1 reply; 16+ messages in thread
From: Henry Yei @ 2009-11-11  1:14 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: LTP Mailing List

[-- Attachment #1: Type: text/plain, Size: 5086 bytes --]

> -----Original Message-----
> From: Garrett Cooper [mailto:yanegomi@gmail.com]
> Sent: Monday, November 09, 2009 11:17 PM
> To: Henry Yei
> Cc: subrata@linux.vnet.ibm.com; LTP Mailing List
> Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct
> valuefor sigset_t for mips
> 
> On Mon, Nov 9, 2009 at 2:12 PM, Henry Yei <hyei@mvista.com> wrote:
> >> -----Original Message-----
> >> From: Subrata Modak [mailto:subrata@linux.vnet.ibm.com]
> >> Sent: Monday, November 09, 2009 9:40 AM
> >> To: Henry Yei
> >> Cc: Garrett Cooper; LTP Mailing List
> >> Subject: RE: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct
> >> valuefor sigset_t for mips
> >>
> >> On Mon, 2009-11-02 at 14:09 -0800, Henry Yei wrote:
> >> > Subrata,
> >> >
> >> > I've included Nicolas Joly's suggested removal of progdir to force
> >> the test to create all test files in the temp directory in the
> attached
> >> patch.
> >> >
> >> > I'm not sure why tst_exit() is needed when calling cleanup(), as
> it
> >> would be called by cleanup(). I can add it back, if needed. Any
> other
> >> comments on the the appropriateness of "sizeof(sigmask)" would also
> be
> >> welcomed. There are a few other tests with similar issues.
> >> >
> >>
> >> Henry,
> >>
> >> Probably because of heavy changes recently, this patch is not
> applying
> >> properly. Can you please rebase your changes:
> >>
> >> patching file testcases/kernel/syscalls/ppoll/ppoll01.c
> >> Hunk #3 FAILED at 98.
> >> Hunk #4 FAILED at 127.
> >> Hunk #5 FAILED at 185.
> >> Hunk #6 FAILED at 252.
> >> 4 out of 6 hunks FAILED -- saving rejects to file
> >> testcases/kernel/syscalls/ppoll/ppoll01.c.rej
> >>
> >> Regards--
> >> Subrata
> >>
> >> > > -----Original Message-----
> >> > > From: Subrata Modak [mailto:subrata@linux.vnet.ibm.com]
> >> > > Sent: Monday, November 02, 2009 5:59 AM
> >> > > To: Henry Yei
> >> > > Cc: Garrett Cooper; LTP Mailing List
> >> > > Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass
> correct
> >> > > valuefor sigset_t for mips
> >> > >
> >> > > Any further work on this patch ?
> >> > >
> >> > > Regards--
> >> > > Subrata
> >> > >
> >> > > On Wed, 2009-10-28 at 12:08 -0700, Henry Yei wrote:
> >> > > > > -----Original Message-----
> >> > > > > From: Garrett Cooper [mailto:yanegomi@gmail.com]
> >> > > > > Sent: Tuesday, October 27, 2009 7:57 PM
> >> > > > > To: Henry Yei
> >> > > > > Cc: LTP Mailing List
> >> > > > > Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass
> >> correct
> >> > > > > value for sigset_t for mips
> >> > > > >
> >> > > > > On Tue, Oct 27, 2009 at 6:32 PM, Henry Yei <hyei@mvista.com>
> >> wrote:
> >> > > > > > All,
> >> > > > > >
> >> > > > > >
> >> > > > > >
> >> > > > > > The patch attached  for ppoll01:
> >> > > > > >
> >> > > > > > cleans up spacing and code style
> >> > > > > >
> >> > > > > > removes unneeded/broken debug option parsing
> >> > > > > >
> >> > > > > > if test fails, it prints out the last failed errno, rather
> >> than
> >> > > just
> >> > > > > the
> >> > > > > > last errno(which may have been successful)
> >> > > > > >
> >> > > > > > passes in correct size of sigset_t for mips
> >> > > > > >
> >> > > > > >
> >> > > > > >
> >> > > > > > Signed-off by: Henry Yei <hyei@mvista.com>
> >> > > > > >
> >> > > > > >
> >> > > > > >
> >> > > > > > This patch was tested/passed on x86, mips(little endian),
> and
> >> > > > > ppc_82xx .
> >> > > > >
> >> > > > > 1. Please keep tst_exit() at the bottom.
> >> > > > > 2. Why can't we do sizeof(sigsetmask) ?
> >> > > > >
> >> > > > > Thanks,
> >> > > > > -Garrett
> >> > > >
> >> > > > Garrett,
> >> > > >
> >> > > > You want me to put tst_exit() at the bottom, even though it is
> >> called
> >> > > within cleanup()?
> >> > > > You mean sizeof(sigmask) ~ sizeof(sigset_t), right? That code
> was
> >> > > commented out since version 1.1 which I thought was odd too, so
> I
> >> did
> >> > > check sizeof(sigmask).
> >> > > > However, sizeof(sigmask) on mips returns 128 which does not
> seem
> >> > > correct. I haven't checked the other architectures, but I
> suspect
> >> some
> >> > > might have a similar mismatch. Apparently sigset_t may have
> >> different
> >> > > values when returned from glibc vs kernel space. More
> information
> >> from
> >> > > this post:
> >> > > >
> >> > > > http://lists.uclibc.org/pipermail/uclibc/2009-
> January/041850.html
> >
> >
> > Subrata,
> >
> > I've included the ppoll01 patch which should apply cleanly to the
> latest in CVS.
> >
> 
> Hi Henry,
>     Could you change this line:
> 
> +				tst_resm(TFAIL, "%s failed - errno = %d : %s",
> TCID,
> +						last_failed_errno,
> strerror(last_failed_errno));
> 
>     to this please?
> 
> +				tst_resm(TFAIL | TTERRNO, "%s failed", TCID);
> 
>     last_failed_errno should become TEST_ERRNO if this change is done,
> IIRC.
> 

I've attached the ppoll01 patch with Garrett's suggested changes to use TEST_ERRNO.



[-- Attachment #2: ppoll01.patch --]
[-- Type: application/octet-stream, Size: 18987 bytes --]

--- ltp/testcases/kernel/syscalls/ppoll/ppoll01.c	2009-10-14 13:22:42.000000000 -0700
+++ ltp-wdir/testcases/kernel/syscalls/ppoll/ppoll01.c	2009-11-10 17:07:55.808788923 -0800
@@ -61,7 +61,6 @@
 #include <signal.h>
 #include "asm/poll.h"
 
-
 #include "../utils/include_j_h.h"
 #include "../utils/common_j_h.c"
 
@@ -71,13 +70,14 @@
 #include "linux_syscall_numbers.h"
 
 /* Extern Global Variables */
-extern int Tst_count;           /* counter for tst_xxx routines.         */
-extern char *TESTDIR;           /* temporary dir created by tst_tmpdir() */
+extern int Tst_count; /* counter for tst_xxx routines.         */
+extern char *TESTDIR; /* temporary dir created by tst_tmpdir() */
 
 /* Global Variables */
-char *TCID = "ppoll01";  /* Test program identifier.*/
-int  testno;
-int  TST_TOTAL = 1;                   /* total number of tests in this file.   */
+char *TCID = "ppoll01"; /* Test program identifier.*/
+int testno;
+int TST_TOTAL = 1; /* total number of tests in this file.   */
+int last_failed_errno;
 
 /* Extern Global Functions */
 /******************************************************************************/
@@ -98,15 +98,15 @@ int  TST_TOTAL = 1;                   /*
 /*                                                                            */
 /******************************************************************************/
 extern void cleanup() {
-        /* Remove tmp dir and all files in it */
-        TEST_CLEANUP;
-        tst_rmdir();
+	/* Remove tmp dir and all files in it */
+	TEST_CLEANUP;
+	tst_rmdir();
 
-        /* Exit with appropriate return code. */
-        tst_exit();
+	/* Exit with appropriate return code. */
+	tst_exit();
 }
 
-void sighandler(int sig);       /* signals handler function for the test */
+void sighandler(int sig); /* signals handler function for the test */
 
 /* Local  Functions */
 /******************************************************************************/
@@ -127,58 +127,57 @@ void sighandler(int sig);       /* signa
 /*                                                                            */
 /******************************************************************************/
 void setup() {
-        /* Capture signals if any */
+	/* Capture signals if any */
 	signal(SIGINT, &sighandler);
 
-        /* Create temporary directories */
-        TEST_PAUSE;
-        tst_tmpdir();
+	/* Create temporary directories */
+	TEST_PAUSE;
+	tst_tmpdir();
 }
 
-
 /*
  * Macros
  */
 #define SYSCALL_NAME    "ppoll"
 
 #ifndef POLLRDHUP
-#  define POLLRDHUP     0x2000
+#define POLLRDHUP     0x2000
 #endif
 
+#if defined (__mips__)
+#define SIGSETSIZE 16
+#else
+#define SIGSETSIZE 8
+#endif
 
 /*
  * Global variables
  */
-static int opt_debug;
-static char *progname;
-static char *progdir;
 
 enum test_type {
 	NORMAL,
-        MASK_SIGNAL,
-        TIMEOUT,
-        FD_ALREADY_CLOSED,
-        SEND_SIGINT,
-        SEND_SIGINT_RACE_TEST,
-        INVALID_NFDS,
-        INVALID_FDS,
-        MINUS_NSEC,
-        TOO_LARGE_NSEC,
+	MASK_SIGNAL,
+	TIMEOUT,
+	FD_ALREADY_CLOSED,
+	SEND_SIGINT,
+	SEND_SIGINT_RACE_TEST,
+	INVALID_NFDS,
+	INVALID_FDS,
+	MINUS_NSEC,
+	TOO_LARGE_NSEC,
 
 };
 
-
 /*
  * Data Structure
  */
 struct test_case {
 	short expect_revents;
-        int ttype;
-        int ret;
-        int err;
+	int ttype;
+	int ret;
+	int err;
 };
 
-
 /* Test cases
  *
  *   test status of errors on man page
@@ -192,65 +191,62 @@ struct test_case {
  *   ENOMEM             can't check because it's difficult to create no-memory
  */
 
-
 static struct test_case tcase[] = {
-	{ // case00
-                .ttype          = NORMAL,
-                .expect_revents = POLLIN | POLLOUT,
-                .ret            = 0,
-                .err            = 0,
-        },
-        { // case01
-                .ttype          = MASK_SIGNAL,
-                .expect_revents = 0, // don't care
-                .ret            = 0,
-                .err            = 0,
-        },
-        { // case02
-                .ttype          = TIMEOUT,
-                .expect_revents = 0, // don't care
-                .ret            = 0,
-                .err            = 0,
-        },
-        { // case03
-                .ttype          = FD_ALREADY_CLOSED,
-                .expect_revents = POLLNVAL,
-                .ret            = 0,
-                .err            = 0,
-        },
-        { // case04
-                .ttype          = SEND_SIGINT,
-                .ret            = -1,
-                .err            = EINTR,
-        },
-        { // case05
-                .ttype          = SEND_SIGINT_RACE_TEST,
-                .ret            = -1,
-                .err            = EINTR,
-        },
-        { // case06
-                .ttype          = INVALID_NFDS,
-                .ret            = -1,
-                .err            = EINVAL,
-        },
-        { // case07
-                .ttype          = INVALID_FDS,
-                .ret            = -1,
-                .err            = EFAULT,
-        },
+		{ // case00
+			.ttype = NORMAL,
+			.expect_revents = POLLIN | POLLOUT,
+			.ret = 0,
+			.err = 0,
+		},
+		{ // case01
+			.ttype = MASK_SIGNAL,
+			.expect_revents = 0, // don't care
+			.ret = 0,
+			.err = 0,
+		},
+		{ // case02
+			.ttype = TIMEOUT,
+			.expect_revents = 0, // don't care
+			.ret = 0,
+			.err = 0,
+		},
+		{ // case03
+			.ttype = FD_ALREADY_CLOSED,
+			.expect_revents = POLLNVAL,
+			.ret = 0, .err = 0,
+		},
+		{ // case04
+			.ttype = SEND_SIGINT,
+			.ret = -1,
+			.err = EINTR,
+		},
+		{ // case05
+			.ttype = SEND_SIGINT_RACE_TEST,
+			.ret = -1,
+			.err = EINTR,
+		},
+		{ // case06
+			.ttype = INVALID_NFDS,
+			.ret = -1,
+			.err = EINVAL,
+		},
+		{ // case07
+			.ttype = INVALID_FDS,
+			.ret = -1,
+			.err = EFAULT, },
 #if 0
-        { // case08
-                .ttype          = MINUS_NSEC,
-                .ret            = -1,
-                .err            = EINVAL, // RHEL4U1 + 2.6.18 returns SUCCESS
-        },
-        { // case09
-                .ttype          = TOO_LARGE_NSEC,
-                .ret            = -1,
-                .err            = EINVAL, // RHEL4U1 + 2.6.18 returns SUCCESS
-        },
+		{ // case08
+			.ttype = MINUS_NSEC,
+			.ret = -1,
+			.err = EINVAL, // RHEL4U1 + 2.6.18 returns SUCCESS
+		},
+		{ // case09
+			.ttype = TOO_LARGE_NSEC,
+			.ret = -1,
+			.err = EINVAL, // RHEL4U1 + 2.6.18 returns SUCCESS
+		},
 #endif
-};
+		};
 
 #define NUM_TEST_FDS    1
 
@@ -262,266 +258,207 @@ static struct test_case tcase[] = {
  *
  */
 
-static int do_test(struct test_case *tc)
-{
-        int sys_ret;
-        int sys_errno;
-        int result = RESULT_OK;
-	int fd = -1 , cmp_ok = 1;
+static int do_test(struct test_case *tc) {
+	int sys_ret, sys_errno, failed;
+	int result = RESULT_OK;
+	int fd = -1, cmp_ok = 1;
 	char fpath[PATH_MAX];
 	struct pollfd *p_fds, fds[NUM_TEST_FDS];
-        unsigned int nfds = NUM_TEST_FDS;
-        struct timespec *p_ts, ts;
-        sigset_t *p_sigmask, sigmask;
-        size_t sigsetsize = 0;
-        pid_t pid = 0;
-
-	TEST(fd = setup_file(progdir, "test.file", fpath));
-        if (fd < 0)
-                return 1;
-        fds[0].fd = fd;
-        fds[0].events = POLLIN | POLLPRI | POLLOUT | POLLRDHUP;
-        fds[0].revents = 0;
-        p_fds = fds;
-        p_ts = NULL;
-        p_sigmask = NULL;
+	unsigned int nfds = NUM_TEST_FDS;
+	struct timespec *p_ts, ts;
+	sigset_t *p_sigmask, sigmask;
+	pid_t pid = 0;
+
+	TEST(fd = setup_file(".", "test.file", fpath));
+	if (fd < 0)
+		return 1;
+	fds[0].fd = fd;
+	fds[0].events = POLLIN | POLLPRI | POLLOUT | POLLRDHUP;
+	fds[0].revents = 0;
+	p_fds = fds;
+	p_ts = NULL;
+	p_sigmask = NULL;
 
 	switch (tc->ttype) {
-        case TIMEOUT:
-                nfds = 0;
-                ts.tv_sec = 0;
-                ts.tv_nsec = 50000000;  // 50msec
-                p_ts = &ts;
-                break;
+	case TIMEOUT:
+		nfds = 0;
+		ts.tv_sec = 0;
+		ts.tv_nsec = 50000000; // 50msec
+		p_ts = &ts;
+		break;
 	case FD_ALREADY_CLOSED:
-                TEST(close(fd));
-                fd = -1;
-                TEST(cleanup_file(fpath));
-                break;
-        case MASK_SIGNAL:
-                TEST(sigemptyset(&sigmask));
-                TEST(sigaddset(&sigmask, SIGINT));
-                p_sigmask = &sigmask;
-                //sigsetsize = sizeof(sigmask);
-                sigsetsize = 8;
-                nfds = 0;
-                ts.tv_sec = 0;
-                ts.tv_nsec = 300000000; // 300msec => need to be enough for
-                                        //   waiting the signal
-                p_ts = &ts;
-                // fallthrough
+		TEST(close(fd));
+		fd = -1;
+		TEST(cleanup_file(fpath));
+		break;
+	case MASK_SIGNAL:
+		TEST(sigemptyset(&sigmask));
+		TEST(sigaddset(&sigmask, SIGINT));
+		p_sigmask = &sigmask;
+		nfds = 0;
+		ts.tv_sec = 0;
+		ts.tv_nsec = 300000000; // 300msec => need to be enough for
+		//   waiting the signal
+		p_ts = &ts;
+		// fallthrough
 	case SEND_SIGINT:
-                nfds = 0;
-                pid = create_sig_proc(100000, SIGINT, UINT_MAX); // 100msec
-                if (pid < 0)
-                        return 1;
-                break;
-  case SEND_SIGINT_RACE_TEST:
-    /* block the INT signal */
-                sigemptyset(&sigmask);
-                sigaddset(&sigmask, SIGINT);
-                sigprocmask(SIG_SETMASK, &sigmask, NULL);
-
-                /* and let it be unblocked when the syscall runs */
-                sigemptyset(&sigmask);
-                p_sigmask = &sigmask;
-                //sigsetsize = sizeof(sigmask);
-                sigsetsize = 8;
-                nfds = 0;
-                ts.tv_sec = 0;
-                ts.tv_nsec = 300000000; // 300msec => need to be enough for
-                                        //   waiting the signal
-                p_ts = &ts;
-                nfds = 0;
-                pid = create_sig_proc(0, SIGINT, 1);
-                if (pid < 0) {
-                  result=1;
-                  goto cleanup;
-                }
-                break;
-        case INVALID_NFDS:
-                //nfds = RLIMIT_NOFILE + 1; ==> RHEL4U1 + 2.6.18 returns SUCCESS
-                nfds = -1;
-                break;
-        case INVALID_FDS:
-                p_fds = (void*)0xc0000000;
-                break;
-        case MINUS_NSEC:
-                ts.tv_sec = 0;
-                ts.tv_nsec = -1;
-                p_ts = &ts;
-                break;
+		nfds = 0;
+		pid = create_sig_proc(100000, SIGINT, UINT_MAX); // 100msec
+		if (pid < 0)
+			return 1;
+		break;
+	case SEND_SIGINT_RACE_TEST:
+		/* block the INT signal */
+		sigemptyset(&sigmask);
+		sigaddset(&sigmask, SIGINT);
+		sigprocmask(SIG_SETMASK, &sigmask, NULL);
+
+		/* and let it be unblocked when the syscall runs */
+		sigemptyset(&sigmask);
+		p_sigmask = &sigmask;
+		nfds = 0;
+		ts.tv_sec = 0;
+		ts.tv_nsec = 300000000; // 300msec => need to be enough for
+		//   waiting the signal
+		p_ts = &ts;
+		nfds = 0;
+		pid = create_sig_proc(0, SIGINT, 1);
+		if (pid < 0) {
+			result = 1;
+			goto cleanup;
+		}
+		break;
+	case INVALID_NFDS:
+		//nfds = RLIMIT_NOFILE + 1; //==> RHEL4U1 + 2.6.18 returns SUCCESS
+		nfds = -1;
+		break;
+	case INVALID_FDS:
+		p_fds = (void*) 0xc0000000;
+		break;
+	case MINUS_NSEC:
+		ts.tv_sec = 0;
+		ts.tv_nsec = -1;
+		p_ts = &ts;
+		break;
 	case TOO_LARGE_NSEC:
-                ts.tv_sec = 0;
-                ts.tv_nsec = 1000000000;
-                p_ts = &ts;
-                break;
-        }
+		ts.tv_sec = 0;
+		ts.tv_nsec = 1000000000;
+		p_ts = &ts;
+		break;
+	}
 
 	/*
-	   * Execute system call
-         */
-        errno = 0;
-        TEST(sys_ret = syscall(__NR_ppoll, p_fds, nfds, p_ts, p_sigmask, sigsetsize));
-        sys_errno = errno;
-        if (sys_ret <= 0 || tc->ret < 0)
-                goto TEST_END;
-
-        cmp_ok = fds[0].revents == tc->expect_revents;
-        if (opt_debug) {
-                tst_resm(TINFO,"EXPECT: revents=0x%04x", tc->expect_revents);
-                tst_resm(TINFO,"RESULT: revents=0x%04x", fds[0].revents);
-        }
-
-TEST_END:
-        /*
-         * Check results
-         */
-        if(tc->ttype == SEND_SIGINT_RACE_TEST) {
-          int sig;
-          sigprocmask(SIG_SETMASK, NULL, &sigmask);
-          for(sig=1; sig < SIGRTMAX; sig++) {
-              TEST(sigismember(&sigmask, sig));
-              if(TEST_RETURN < 0 && TEST_ERRNO == EINVAL && sig != SIGINT)
-                continue; /* let's ignore errors if they are for other signal than SIGINT that we set */
-              if((sig==SIGINT) != (TEST_RETURN!=0)) {
-                tst_resm(TFAIL, "Bad value of signal mask, signal %d is %s", sig, TEST_RETURN ? "on" : "off");
-                cmp_ok |=1;
-              }
-            }
-        }
-        result |= (sys_errno != tc->err) || !cmp_ok;
-        PRINT_RESULT_CMP(sys_ret >= 0, tc->ret, tc->err, sys_ret, sys_errno,
-                         cmp_ok);
- cleanup:
-        if (fd >= 0)
-                cleanup_file(fpath);
-
-        sigemptyset(&sigmask);
-        sigprocmask(SIG_SETMASK, &sigmask, NULL);
-        if (pid > 0) {
-                int st;
-                kill(pid, SIGTERM);
-                wait(&st);
-        }
+	 * Execute system call
+	 */
+	errno = 0;
+	TEST(sys_ret = syscall(__NR_ppoll, p_fds, nfds, p_ts, p_sigmask, SIGSETSIZE));
+		sys_errno = errno;
+	if (sys_ret <= 0 || tc->ret < 0)
+		goto TEST_END;
+
+	cmp_ok = fds[0].revents == tc->expect_revents;
+	tst_resm(TINFO, "EXPECT: revents=0x%04x", tc->expect_revents);
+	tst_resm(TINFO, "RESULT: revents=0x%04x", fds[0].revents);
+
+	TEST_END:
+	/*
+	 * Check results
+	 */
+	if (tc->ttype == SEND_SIGINT_RACE_TEST) {
+		int sig;
+		sigprocmask(SIG_SETMASK, NULL, &sigmask);
+		for (sig = 1; sig < SIGRTMAX; sig++) {
+			TEST(sigismember(&sigmask, sig));
+			if (TEST_RETURN < 0 && TEST_ERRNO == EINVAL && sig != SIGINT)
+				continue; /* let's ignore errors if they are for other signal than SIGINT that we set */
+			if ((sig == SIGINT) != (TEST_RETURN != 0)) {
+				tst_resm(TFAIL, "Bad value of signal mask, signal %d is %s",
+						sig, TEST_RETURN ? "on" : "off");
+				cmp_ok |= 1;
+			}
+		}
+	}
+	failed = sys_errno != tc->err;
+	result |= failed || !cmp_ok;
+	if (failed)
+		last_failed_errno = sys_errno;
+	PRINT_RESULT_CMP(sys_ret >= 0, tc->ret, tc->err, sys_ret, sys_errno, cmp_ok);
+	cleanup: if (fd >= 0)
+		cleanup_file(fpath);
+
+	sigemptyset(&sigmask);
+	sigprocmask(SIG_SETMASK, &sigmask, NULL);
+	if (pid > 0) {
+		int st;
+		kill(pid, SIGTERM);
+		wait(&st);
+	}
 	return result;
 }
 
-
 /*
  * sighandler()
  */
-void sighandler(int sig)
-{
-        if (sig == SIGINT)
-                return;
-        // NOTREACHED
-        return;
+void sighandler(int sig) {
+	if (sig == SIGINT)
+		return;
+	// NOTREACHED
+	return;
 }
 
-
-/*
- * usage()
- */
-
-static void usage(const char *progname)
-{
-        tst_resm(TINFO,"usage: %s [options]", progname);
-        tst_resm(TINFO,"This is a regression test program of %s system call.",SYSCALL_NAME);
-        tst_resm(TINFO,"options:");
-        tst_resm(TINFO,"    -d --debug           Show debug messages");
-        tst_resm(TINFO,"    -h --help            Show this message");
-        tst_resm(TINFO,"NG");
-        exit(1);
-}
-
-
 /*
  * main()
  */
 
-
-
 int main(int ac, char **av) {
 	int result = RESULT_OK;
-        int c;
-        int i;
-        int lc;                 /* loop counter */
-        char *msg;              /* message returned from parse_opts */
-
-	struct option long_options[] = {
-                { "debug", no_argument, 0, 'd' },
-                { "help",  no_argument, 0, 'h' },
-                { NULL, 0, NULL, 0 }
-        };
-
-	progname = strchr(av[0], '/');
-        progname = progname ? progname + 1 : av[0];	
-
-	progdir = strdup(av[0]);
-        progdir = dirname(progdir);
-	
-        /* parse standard options */
-        if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
-             tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-             tst_exit();
-           }
-
-        setup();
-
-        /* Check looping state if -i option given */
-        for (lc = 0; TEST_LOOPING(lc); ++lc) {
-                Tst_count = 0;
-                for (testno = 0; testno < TST_TOTAL; ++testno) {
-			 TEST(c = getopt_long(ac, av, "dh", long_options, NULL));
-			 while(TEST_RETURN != -1) {
-		                switch (c) {
-                		case 'd':
-		                        opt_debug = 1;
-                		        break;
-		                default:
-                		        usage(progname);
-                        		// NOTREACHED
-                		}
-		        }
-
-
-		if (ac != optind) {
-        	        tst_resm(TINFO,"Options are not match.");
-                	usage(progname);
-                	// NOTREACHED
-	        }
-
-		/*
-		* Execute test
-         	*/
-	        for (i = 0; i < (int)(sizeof(tcase) / sizeof(tcase[0])); i++) {
-        	        int ret;
-	                tst_resm(TINFO,"(case%02d) START", i);
-	                ret = do_test(&tcase[i]);
-	                tst_resm(TINFO,"(case%02d) END => %s", i, (ret == 0) ? "OK" : "NG");
-	                result |= ret;
-        	}
-		
-		/*
-        	 * Check results
-         	*/
-        	switch(result) {
-	        case RESULT_OK:
-        			tst_resm(TPASS, "ppoll01 call succeeded ");
-		                break;
-
-	        default:
-                 	   	tst_resm(TFAIL, "%s failed - errno = %d : %s", TCID, TEST_ERRNO, strerror(TEST_ERRNO));
-        		        RPRINTF("NG");
+	int i;
+	int lc; /* loop counter */
+	char *msg; /* message returned from parse_opts */
+
+	/* parse standard options */
+	if ((msg = parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL) {
+		tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
+	}
+
+	setup();
+
+	/* Check looping state if -i option given */
+	for (lc = 0; TEST_LOOPING(lc); ++lc) {
+		Tst_count = 0;
+		for (testno = 0; testno < TST_TOTAL; ++testno) {
+			/*
+			 * Execute test
+			 */
+			for (i = 0; i < (int) (sizeof(tcase) / sizeof(tcase[0])); i++) {
+				int ret;
+				tst_resm(TINFO, "(case%02d) START", i);
+				ret = do_test(&tcase[i]);
+				tst_resm(TINFO, "(case%02d) END => %s", i, (ret == 0) ? "OK"
+						: "NG");
+				TEST_ERROR_LOG(TEST_ERRNO);
+				result |= ret;
+			}
+
+			/*
+			 * Check results
+			 */
+			switch (result) {
+			case RESULT_OK:
+				tst_resm(TPASS, "ppoll01 call succeeded ");
+				break;
+
+			default:
+				TEST_ERRNO = last_failed_errno;
+				tst_resm(TFAIL | TTERRNO, "%s failed", TCID);
+				RPRINTF("NG");
 				cleanup();
-				tst_exit();
-		                break;
-        	}
-
-                }
-        }	
-        cleanup();
-	tst_exit();
+				break;
+			}
+
+		}
+	}
+	cleanup();
+	return 0;
 }
 

[-- Attachment #3: Type: text/plain, Size: 354 bytes --]

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct valuefor  sigset_t for mips
  2009-11-11  1:14               ` Henry Yei
@ 2009-11-11  6:12                 ` Garrett Cooper
  2009-11-11 19:25                   ` Henry Yei
  0 siblings, 1 reply; 16+ messages in thread
From: Garrett Cooper @ 2009-11-11  6:12 UTC (permalink / raw)
  To: Henry Yei; +Cc: LTP Mailing List

On Tue, Nov 10, 2009 at 5:14 PM, Henry Yei <hyei@mvista.com> wrote:
>> -----Original Message-----
>> From: Garrett Cooper [mailto:yanegomi@gmail.com]
>> Sent: Monday, November 09, 2009 11:17 PM
>> To: Henry Yei
>> Cc: subrata@linux.vnet.ibm.com; LTP Mailing List
>> Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct
>> valuefor sigset_t for mips
>>
>> On Mon, Nov 9, 2009 at 2:12 PM, Henry Yei <hyei@mvista.com> wrote:
>> >> -----Original Message-----
>> >> From: Subrata Modak [mailto:subrata@linux.vnet.ibm.com]
>> >> Sent: Monday, November 09, 2009 9:40 AM
>> >> To: Henry Yei
>> >> Cc: Garrett Cooper; LTP Mailing List
>> >> Subject: RE: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct
>> >> valuefor sigset_t for mips
>> >>
>> >> On Mon, 2009-11-02 at 14:09 -0800, Henry Yei wrote:
>> >> > Subrata,
>> >> >
>> >> > I've included Nicolas Joly's suggested removal of progdir to force
>> >> the test to create all test files in the temp directory in the
>> attached
>> >> patch.
>> >> >
>> >> > I'm not sure why tst_exit() is needed when calling cleanup(), as
>> it
>> >> would be called by cleanup(). I can add it back, if needed. Any
>> other
>> >> comments on the the appropriateness of "sizeof(sigmask)" would also
>> be
>> >> welcomed. There are a few other tests with similar issues.
>> >> >
>> >>
>> >> Henry,
>> >>
>> >> Probably because of heavy changes recently, this patch is not
>> applying
>> >> properly. Can you please rebase your changes:
>> >>
>> >> patching file testcases/kernel/syscalls/ppoll/ppoll01.c
>> >> Hunk #3 FAILED at 98.
>> >> Hunk #4 FAILED at 127.
>> >> Hunk #5 FAILED at 185.
>> >> Hunk #6 FAILED at 252.
>> >> 4 out of 6 hunks FAILED -- saving rejects to file
>> >> testcases/kernel/syscalls/ppoll/ppoll01.c.rej
>> >>
>> >> Regards--
>> >> Subrata
>> >>
>> >> > > -----Original Message-----
>> >> > > From: Subrata Modak [mailto:subrata@linux.vnet.ibm.com]
>> >> > > Sent: Monday, November 02, 2009 5:59 AM
>> >> > > To: Henry Yei
>> >> > > Cc: Garrett Cooper; LTP Mailing List
>> >> > > Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass
>> correct
>> >> > > valuefor sigset_t for mips
>> >> > >
>> >> > > Any further work on this patch ?
>> >> > >
>> >> > > Regards--
>> >> > > Subrata
>> >> > >
>> >> > > On Wed, 2009-10-28 at 12:08 -0700, Henry Yei wrote:
>> >> > > > > -----Original Message-----
>> >> > > > > From: Garrett Cooper [mailto:yanegomi@gmail.com]
>> >> > > > > Sent: Tuesday, October 27, 2009 7:57 PM
>> >> > > > > To: Henry Yei
>> >> > > > > Cc: LTP Mailing List
>> >> > > > > Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass
>> >> correct
>> >> > > > > value for sigset_t for mips
>> >> > > > >
>> >> > > > > On Tue, Oct 27, 2009 at 6:32 PM, Henry Yei <hyei@mvista.com>
>> >> wrote:
>> >> > > > > > All,
>> >> > > > > >
>> >> > > > > >
>> >> > > > > >
>> >> > > > > > The patch attached  for ppoll01:
>> >> > > > > >
>> >> > > > > > cleans up spacing and code style
>> >> > > > > >
>> >> > > > > > removes unneeded/broken debug option parsing
>> >> > > > > >
>> >> > > > > > if test fails, it prints out the last failed errno, rather
>> >> than
>> >> > > just
>> >> > > > > the
>> >> > > > > > last errno(which may have been successful)
>> >> > > > > >
>> >> > > > > > passes in correct size of sigset_t for mips
>> >> > > > > >
>> >> > > > > >
>> >> > > > > >
>> >> > > > > > Signed-off by: Henry Yei <hyei@mvista.com>
>> >> > > > > >
>> >> > > > > >
>> >> > > > > >
>> >> > > > > > This patch was tested/passed on x86, mips(little endian),
>> and
>> >> > > > > ppc_82xx .
>> >> > > > >
>> >> > > > > 1. Please keep tst_exit() at the bottom.
>> >> > > > > 2. Why can't we do sizeof(sigsetmask) ?
>> >> > > > >
>> >> > > > > Thanks,
>> >> > > > > -Garrett
>> >> > > >
>> >> > > > Garrett,
>> >> > > >
>> >> > > > You want me to put tst_exit() at the bottom, even though it is
>> >> called
>> >> > > within cleanup()?
>> >> > > > You mean sizeof(sigmask) ~ sizeof(sigset_t), right? That code
>> was
>> >> > > commented out since version 1.1 which I thought was odd too, so
>> I
>> >> did
>> >> > > check sizeof(sigmask).
>> >> > > > However, sizeof(sigmask) on mips returns 128 which does not
>> seem
>> >> > > correct. I haven't checked the other architectures, but I
>> suspect
>> >> some
>> >> > > might have a similar mismatch. Apparently sigset_t may have
>> >> different
>> >> > > values when returned from glibc vs kernel space. More
>> information
>> >> from
>> >> > > this post:
>> >> > > >
>> >> > > > http://lists.uclibc.org/pipermail/uclibc/2009-
>> January/041850.html
>> >
>> >
>> > Subrata,
>> >
>> > I've included the ppoll01 patch which should apply cleanly to the
>> latest in CVS.
>> >
>>
>> Hi Henry,
>>     Could you change this line:
>>
>> +                             tst_resm(TFAIL, "%s failed - errno = %d : %s",
>> TCID,
>> +                                             last_failed_errno,
>> strerror(last_failed_errno));
>>
>>     to this please?
>>
>> +                             tst_resm(TFAIL | TTERRNO, "%s failed", TCID);
>>
>>     last_failed_errno should become TEST_ERRNO if this change is done,
>> IIRC.
>>
>
> I've attached the ppoll01 patch with Garrett's suggested changes to use TEST_ERRNO.

You could just completely zap last_failed_errno and make it test_errno
instead. That's what I was suggesting with the previous reply.
Thanks!
-Garrett

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct valuefor sigset_t for mips
  2009-11-11  6:12                 ` Garrett Cooper
@ 2009-11-11 19:25                   ` Henry Yei
  2009-11-12  9:42                     ` Garrett Cooper
  0 siblings, 1 reply; 16+ messages in thread
From: Henry Yei @ 2009-11-11 19:25 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: LTP Mailing List

Wouldn't TEST_ERRNO be the errno of the last TEST() that was run, rather than the last failed one?



> -----Original Message-----
> From: Garrett Cooper [mailto:yanegomi@gmail.com]
> Sent: Tuesday, November 10, 2009 10:13 PM
> To: Henry Yei
> Cc: subrata@linux.vnet.ibm.com; LTP Mailing List
> Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct
> valuefor sigset_t for mips
> 
> On Tue, Nov 10, 2009 at 5:14 PM, Henry Yei <hyei@mvista.com> wrote:
> >> -----Original Message-----
> >> From: Garrett Cooper [mailto:yanegomi@gmail.com]
> >> Sent: Monday, November 09, 2009 11:17 PM
> >> To: Henry Yei
> >> Cc: subrata@linux.vnet.ibm.com; LTP Mailing List
> >> Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct
> >> valuefor sigset_t for mips
> >>
> >> On Mon, Nov 9, 2009 at 2:12 PM, Henry Yei <hyei@mvista.com> wrote:
> >> >> -----Original Message-----
> >> >> From: Subrata Modak [mailto:subrata@linux.vnet.ibm.com]
> >> >> Sent: Monday, November 09, 2009 9:40 AM
> >> >> To: Henry Yei
> >> >> Cc: Garrett Cooper; LTP Mailing List
> >> >> Subject: RE: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass
> correct
> >> >> valuefor sigset_t for mips
> >> >>
> >> >> On Mon, 2009-11-02 at 14:09 -0800, Henry Yei wrote:
> >> >> > Subrata,
> >> >> >
> >> >> > I've included Nicolas Joly's suggested removal of progdir to
> force
> >> >> the test to create all test files in the temp directory in the
> >> attached
> >> >> patch.
> >> >> >
> >> >> > I'm not sure why tst_exit() is needed when calling cleanup(),
> as
> >> it
> >> >> would be called by cleanup(). I can add it back, if needed. Any
> >> other
> >> >> comments on the the appropriateness of "sizeof(sigmask)" would
> also
> >> be
> >> >> welcomed. There are a few other tests with similar issues.
> >> >> >
> >> >>
> >> >> Henry,
> >> >>
> >> >> Probably because of heavy changes recently, this patch is not
> >> applying
> >> >> properly. Can you please rebase your changes:
> >> >>
> >> >> patching file testcases/kernel/syscalls/ppoll/ppoll01.c
> >> >> Hunk #3 FAILED at 98.
> >> >> Hunk #4 FAILED at 127.
> >> >> Hunk #5 FAILED at 185.
> >> >> Hunk #6 FAILED at 252.
> >> >> 4 out of 6 hunks FAILED -- saving rejects to file
> >> >> testcases/kernel/syscalls/ppoll/ppoll01.c.rej
> >> >>
> >> >> Regards--
> >> >> Subrata
> >> >>
> >> >> > > -----Original Message-----
> >> >> > > From: Subrata Modak [mailto:subrata@linux.vnet.ibm.com]
> >> >> > > Sent: Monday, November 02, 2009 5:59 AM
> >> >> > > To: Henry Yei
> >> >> > > Cc: Garrett Cooper; LTP Mailing List
> >> >> > > Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass
> >> correct
> >> >> > > valuefor sigset_t for mips
> >> >> > >
> >> >> > > Any further work on this patch ?
> >> >> > >
> >> >> > > Regards--
> >> >> > > Subrata
> >> >> > >
> >> >> > > On Wed, 2009-10-28 at 12:08 -0700, Henry Yei wrote:
> >> >> > > > > -----Original Message-----
> >> >> > > > > From: Garrett Cooper [mailto:yanegomi@gmail.com]
> >> >> > > > > Sent: Tuesday, October 27, 2009 7:57 PM
> >> >> > > > > To: Henry Yei
> >> >> > > > > Cc: LTP Mailing List
> >> >> > > > > Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5:
> pass
> >> >> correct
> >> >> > > > > value for sigset_t for mips
> >> >> > > > >
> >> >> > > > > On Tue, Oct 27, 2009 at 6:32 PM, Henry Yei
> <hyei@mvista.com>
> >> >> wrote:
> >> >> > > > > > All,
> >> >> > > > > >
> >> >> > > > > >
> >> >> > > > > >
> >> >> > > > > > The patch attached  for ppoll01:
> >> >> > > > > >
> >> >> > > > > > cleans up spacing and code style
> >> >> > > > > >
> >> >> > > > > > removes unneeded/broken debug option parsing
> >> >> > > > > >
> >> >> > > > > > if test fails, it prints out the last failed errno,
> rather
> >> >> than
> >> >> > > just
> >> >> > > > > the
> >> >> > > > > > last errno(which may have been successful)
> >> >> > > > > >
> >> >> > > > > > passes in correct size of sigset_t for mips
> >> >> > > > > >
> >> >> > > > > >
> >> >> > > > > >
> >> >> > > > > > Signed-off by: Henry Yei <hyei@mvista.com>
> >> >> > > > > >
> >> >> > > > > >
> >> >> > > > > >
> >> >> > > > > > This patch was tested/passed on x86, mips(little
> endian),
> >> and
> >> >> > > > > ppc_82xx .
> >> >> > > > >
> >> >> > > > > 1. Please keep tst_exit() at the bottom.
> >> >> > > > > 2. Why can't we do sizeof(sigsetmask) ?
> >> >> > > > >
> >> >> > > > > Thanks,
> >> >> > > > > -Garrett
> >> >> > > >
> >> >> > > > Garrett,
> >> >> > > >
> >> >> > > > You want me to put tst_exit() at the bottom, even though it
> is
> >> >> called
> >> >> > > within cleanup()?
> >> >> > > > You mean sizeof(sigmask) ~ sizeof(sigset_t), right? That
> code
> >> was
> >> >> > > commented out since version 1.1 which I thought was odd too,
> so
> >> I
> >> >> did
> >> >> > > check sizeof(sigmask).
> >> >> > > > However, sizeof(sigmask) on mips returns 128 which does not
> >> seem
> >> >> > > correct. I haven't checked the other architectures, but I
> >> suspect
> >> >> some
> >> >> > > might have a similar mismatch. Apparently sigset_t may have
> >> >> different
> >> >> > > values when returned from glibc vs kernel space. More
> >> information
> >> >> from
> >> >> > > this post:
> >> >> > > >
> >> >> > > > http://lists.uclibc.org/pipermail/uclibc/2009-
> >> January/041850.html
> >> >
> >> >
> >> > Subrata,
> >> >
> >> > I've included the ppoll01 patch which should apply cleanly to the
> >> latest in CVS.
> >> >
> >>
> >> Hi Henry,
> >>     Could you change this line:
> >>
> >> +                             tst_resm(TFAIL, "%s failed - errno =
> %d : %s",
> >> TCID,
> >> +                                             last_failed_errno,
> >> strerror(last_failed_errno));
> >>
> >>     to this please?
> >>
> >> +                             tst_resm(TFAIL | TTERRNO, "%s failed",
> TCID);
> >>
> >>     last_failed_errno should become TEST_ERRNO if this change is
> done,
> >> IIRC.
> >>
> >
> > I've attached the ppoll01 patch with Garrett's suggested changes to
> use TEST_ERRNO.
> 
> You could just completely zap last_failed_errno and make it test_errno
> instead. That's what I was suggesting with the previous reply.
> Thanks!
> -Garrett

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct valuefor  sigset_t for mips
  2009-11-11 19:25                   ` Henry Yei
@ 2009-11-12  9:42                     ` Garrett Cooper
  2009-11-13  1:57                       ` Henry Yei
  0 siblings, 1 reply; 16+ messages in thread
From: Garrett Cooper @ 2009-11-12  9:42 UTC (permalink / raw)
  To: Henry Yei; +Cc: LTP Mailing List

On Wed, Nov 11, 2009 at 11:25 AM, Henry Yei <hyei@mvista.com> wrote:
> Wouldn't TEST_ERRNO be the errno of the last TEST() that was run, rather than the last failed one?
>
>
>
>> -----Original Message-----
>> From: Garrett Cooper [mailto:yanegomi@gmail.com]
>> Sent: Tuesday, November 10, 2009 10:13 PM
>> To: Henry Yei
>> Cc: subrata@linux.vnet.ibm.com; LTP Mailing List
>> Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct
>> valuefor sigset_t for mips
>>
>> On Tue, Nov 10, 2009 at 5:14 PM, Henry Yei <hyei@mvista.com> wrote:
>> >> -----Original Message-----
>> >> From: Garrett Cooper [mailto:yanegomi@gmail.com]
>> >> Sent: Monday, November 09, 2009 11:17 PM
>> >> To: Henry Yei
>> >> Cc: subrata@linux.vnet.ibm.com; LTP Mailing List
>> >> Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct
>> >> valuefor sigset_t for mips
>> >>
>> >> On Mon, Nov 9, 2009 at 2:12 PM, Henry Yei <hyei@mvista.com> wrote:
>> >> >> -----Original Message-----
>> >> >> From: Subrata Modak [mailto:subrata@linux.vnet.ibm.com]
>> >> >> Sent: Monday, November 09, 2009 9:40 AM
>> >> >> To: Henry Yei
>> >> >> Cc: Garrett Cooper; LTP Mailing List
>> >> >> Subject: RE: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass
>> correct
>> >> >> valuefor sigset_t for mips
>> >> >>
>> >> >> On Mon, 2009-11-02 at 14:09 -0800, Henry Yei wrote:
>> >> >> > Subrata,
>> >> >> >
>> >> >> > I've included Nicolas Joly's suggested removal of progdir to
>> force
>> >> >> the test to create all test files in the temp directory in the
>> >> attached
>> >> >> patch.
>> >> >> >
>> >> >> > I'm not sure why tst_exit() is needed when calling cleanup(),
>> as
>> >> it
>> >> >> would be called by cleanup(). I can add it back, if needed. Any
>> >> other
>> >> >> comments on the the appropriateness of "sizeof(sigmask)" would
>> also
>> >> be
>> >> >> welcomed. There are a few other tests with similar issues.
>> >> >> >
>> >> >>
>> >> >> Henry,
>> >> >>
>> >> >> Probably because of heavy changes recently, this patch is not
>> >> applying
>> >> >> properly. Can you please rebase your changes:
>> >> >>
>> >> >> patching file testcases/kernel/syscalls/ppoll/ppoll01.c
>> >> >> Hunk #3 FAILED at 98.
>> >> >> Hunk #4 FAILED at 127.
>> >> >> Hunk #5 FAILED at 185.
>> >> >> Hunk #6 FAILED at 252.
>> >> >> 4 out of 6 hunks FAILED -- saving rejects to file
>> >> >> testcases/kernel/syscalls/ppoll/ppoll01.c.rej
>> >> >>
>> >> >> Regards--
>> >> >> Subrata
>> >> >>
>> >> >> > > -----Original Message-----
>> >> >> > > From: Subrata Modak [mailto:subrata@linux.vnet.ibm.com]
>> >> >> > > Sent: Monday, November 02, 2009 5:59 AM
>> >> >> > > To: Henry Yei
>> >> >> > > Cc: Garrett Cooper; LTP Mailing List
>> >> >> > > Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass
>> >> correct
>> >> >> > > valuefor sigset_t for mips
>> >> >> > >
>> >> >> > > Any further work on this patch ?
>> >> >> > >
>> >> >> > > Regards--
>> >> >> > > Subrata
>> >> >> > >
>> >> >> > > On Wed, 2009-10-28 at 12:08 -0700, Henry Yei wrote:
>> >> >> > > > > -----Original Message-----
>> >> >> > > > > From: Garrett Cooper [mailto:yanegomi@gmail.com]
>> >> >> > > > > Sent: Tuesday, October 27, 2009 7:57 PM
>> >> >> > > > > To: Henry Yei
>> >> >> > > > > Cc: LTP Mailing List
>> >> >> > > > > Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5:
>> pass
>> >> >> correct
>> >> >> > > > > value for sigset_t for mips
>> >> >> > > > >
>> >> >> > > > > On Tue, Oct 27, 2009 at 6:32 PM, Henry Yei
>> <hyei@mvista.com>
>> >> >> wrote:
>> >> >> > > > > > All,
>> >> >> > > > > >
>> >> >> > > > > >
>> >> >> > > > > >
>> >> >> > > > > > The patch attached  for ppoll01:
>> >> >> > > > > >
>> >> >> > > > > > cleans up spacing and code style
>> >> >> > > > > >
>> >> >> > > > > > removes unneeded/broken debug option parsing
>> >> >> > > > > >
>> >> >> > > > > > if test fails, it prints out the last failed errno,
>> rather
>> >> >> than
>> >> >> > > just
>> >> >> > > > > the
>> >> >> > > > > > last errno(which may have been successful)
>> >> >> > > > > >
>> >> >> > > > > > passes in correct size of sigset_t for mips
>> >> >> > > > > >
>> >> >> > > > > >
>> >> >> > > > > >
>> >> >> > > > > > Signed-off by: Henry Yei <hyei@mvista.com>
>> >> >> > > > > >
>> >> >> > > > > >
>> >> >> > > > > >
>> >> >> > > > > > This patch was tested/passed on x86, mips(little
>> endian),
>> >> and
>> >> >> > > > > ppc_82xx .
>> >> >> > > > >
>> >> >> > > > > 1. Please keep tst_exit() at the bottom.
>> >> >> > > > > 2. Why can't we do sizeof(sigsetmask) ?
>> >> >> > > > >
>> >> >> > > > > Thanks,
>> >> >> > > > > -Garrett
>> >> >> > > >
>> >> >> > > > Garrett,
>> >> >> > > >
>> >> >> > > > You want me to put tst_exit() at the bottom, even though it
>> is
>> >> >> called
>> >> >> > > within cleanup()?
>> >> >> > > > You mean sizeof(sigmask) ~ sizeof(sigset_t), right? That
>> code
>> >> was
>> >> >> > > commented out since version 1.1 which I thought was odd too,
>> so
>> >> I
>> >> >> did
>> >> >> > > check sizeof(sigmask).
>> >> >> > > > However, sizeof(sigmask) on mips returns 128 which does not
>> >> seem
>> >> >> > > correct. I haven't checked the other architectures, but I
>> >> suspect
>> >> >> some
>> >> >> > > might have a similar mismatch. Apparently sigset_t may have
>> >> >> different
>> >> >> > > values when returned from glibc vs kernel space. More
>> >> information
>> >> >> from
>> >> >> > > this post:
>> >> >> > > >
>> >> >> > > > http://lists.uclibc.org/pipermail/uclibc/2009-
>> >> January/041850.html
>> >> >
>> >> >
>> >> > Subrata,
>> >> >
>> >> > I've included the ppoll01 patch which should apply cleanly to the
>> >> latest in CVS.
>> >> >
>> >>
>> >> Hi Henry,
>> >>     Could you change this line:
>> >>
>> >> +                             tst_resm(TFAIL, "%s failed - errno =
>> %d : %s",
>> >> TCID,
>> >> +                                             last_failed_errno,
>> >> strerror(last_failed_errno));
>> >>
>> >>     to this please?
>> >>
>> >> +                             tst_resm(TFAIL | TTERRNO, "%s failed",
>> TCID);
>> >>
>> >>     last_failed_errno should become TEST_ERRNO if this change is
>> done,
>> >> IIRC.
>> >>
>> >
>> > I've attached the ppoll01 patch with Garrett's suggested changes to
>> use TEST_ERRNO.
>>
>> You could just completely zap last_failed_errno and make it test_errno
>> instead. That's what I was suggesting with the previous reply.

    Yup! The goal is to drop the additional variable
(last_failed_errno) so that only TEST_ERRNO is required and then all
you need to do is use TTERRNO and you're golden :).
Thanks,
-Garrett

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct valuefor sigset_t for mips
  2009-11-12  9:42                     ` Garrett Cooper
@ 2009-11-13  1:57                       ` Henry Yei
  2009-11-15  0:19                         ` Garrett Cooper
  0 siblings, 1 reply; 16+ messages in thread
From: Henry Yei @ 2009-11-13  1:57 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: LTP Mailing List

[-- Attachment #1: Type: text/plain, Size: 7604 bytes --]

> -----Original Message-----
> From: Garrett Cooper [mailto:yanegomi@gmail.com]
> Sent: Thursday, November 12, 2009 1:43 AM
> To: Henry Yei
> Cc: subrata@linux.vnet.ibm.com; LTP Mailing List
> Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct
> valuefor sigset_t for mips
> 
> >> -----Original Message-----
> >> From: Garrett Cooper [mailto:yanegomi@gmail.com]
> >> Sent: Tuesday, November 10, 2009 10:13 PM
> >> To: Henry Yei
> >> Cc: subrata@linux.vnet.ibm.com; LTP Mailing List
> >> Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct
> >> valuefor sigset_t for mips
> >>
> >> On Tue, Nov 10, 2009 at 5:14 PM, Henry Yei <hyei@mvista.com> wrote:
> >> >> -----Original Message-----
> >> >> From: Garrett Cooper [mailto:yanegomi@gmail.com]
> >> >> Sent: Monday, November 09, 2009 11:17 PM
> >> >> To: Henry Yei
> >> >> Cc: subrata@linux.vnet.ibm.com; LTP Mailing List
> >> >> Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass
> correct
> >> >> valuefor sigset_t for mips
> >> >>
> >> >> On Mon, Nov 9, 2009 at 2:12 PM, Henry Yei <hyei@mvista.com>
> wrote:
> >> >> >> -----Original Message-----
> >> >> >> From: Subrata Modak [mailto:subrata@linux.vnet.ibm.com]
> >> >> >> Sent: Monday, November 09, 2009 9:40 AM
> >> >> >> To: Henry Yei
> >> >> >> Cc: Garrett Cooper; LTP Mailing List
> >> >> >> Subject: RE: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass
> >> correct
> >> >> >> valuefor sigset_t for mips
> >> >> >>
> >> >> >> On Mon, 2009-11-02 at 14:09 -0800, Henry Yei wrote:
> >> >> >> > Subrata,
> >> >> >> >
> >> >> >> > I've included Nicolas Joly's suggested removal of progdir to
> >> force
> >> >> >> the test to create all test files in the temp directory in the
> >> >> attached
> >> >> >> patch.
> >> >> >> >
> >> >> >> > I'm not sure why tst_exit() is needed when calling
> cleanup(),
> >> as
> >> >> it
> >> >> >> would be called by cleanup(). I can add it back, if needed.
> Any
> >> >> other
> >> >> >> comments on the the appropriateness of "sizeof(sigmask)" would
> >> also
> >> >> be
> >> >> >> welcomed. There are a few other tests with similar issues.
> >> >> >> >
> >> >> >>
> >> >> >> Henry,
> >> >> >>
> >> >> >> Probably because of heavy changes recently, this patch is not
> >> >> applying
> >> >> >> properly. Can you please rebase your changes:
> >> >> >>
> >> >> >> patching file testcases/kernel/syscalls/ppoll/ppoll01.c
> >> >> >> Hunk #3 FAILED at 98.
> >> >> >> Hunk #4 FAILED at 127.
> >> >> >> Hunk #5 FAILED at 185.
> >> >> >> Hunk #6 FAILED at 252.
> >> >> >> 4 out of 6 hunks FAILED -- saving rejects to file
> >> >> >> testcases/kernel/syscalls/ppoll/ppoll01.c.rej
> >> >> >>
> >> >> >> Regards--
> >> >> >> Subrata
> >> >> >>
> >> >> >> > > -----Original Message-----
> >> >> >> > > From: Subrata Modak [mailto:subrata@linux.vnet.ibm.com]
> >> >> >> > > Sent: Monday, November 02, 2009 5:59 AM
> >> >> >> > > To: Henry Yei
> >> >> >> > > Cc: Garrett Cooper; LTP Mailing List
> >> >> >> > > Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5:
> pass
> >> >> correct
> >> >> >> > > valuefor sigset_t for mips
> >> >> >> > >
> >> >> >> > > Any further work on this patch ?
> >> >> >> > >
> >> >> >> > > Regards--
> >> >> >> > > Subrata
> >> >> >> > >
> >> >> >> > > On Wed, 2009-10-28 at 12:08 -0700, Henry Yei wrote:
> >> >> >> > > > > -----Original Message-----
> >> >> >> > > > > From: Garrett Cooper [mailto:yanegomi@gmail.com]
> >> >> >> > > > > Sent: Tuesday, October 27, 2009 7:57 PM
> >> >> >> > > > > To: Henry Yei
> >> >> >> > > > > Cc: LTP Mailing List
> >> >> >> > > > > Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5:
> >> pass
> >> >> >> correct
> >> >> >> > > > > value for sigset_t for mips
> >> >> >> > > > >
> >> >> >> > > > > On Tue, Oct 27, 2009 at 6:32 PM, Henry Yei
> >> <hyei@mvista.com>
> >> >> >> wrote:
> >> >> >> > > > > > All,
> >> >> >> > > > > >
> >> >> >> > > > > >
> >> >> >> > > > > >
> >> >> >> > > > > > The patch attached  for ppoll01:
> >> >> >> > > > > >
> >> >> >> > > > > > cleans up spacing and code style
> >> >> >> > > > > >
> >> >> >> > > > > > removes unneeded/broken debug option parsing
> >> >> >> > > > > >
> >> >> >> > > > > > if test fails, it prints out the last failed errno,
> >> rather
> >> >> >> than
> >> >> >> > > just
> >> >> >> > > > > the
> >> >> >> > > > > > last errno(which may have been successful)
> >> >> >> > > > > >
> >> >> >> > > > > > passes in correct size of sigset_t for mips
> >> >> >> > > > > >
> >> >> >> > > > > >
> >> >> >> > > > > >
> >> >> >> > > > > > Signed-off by: Henry Yei <hyei@mvista.com>
> >> >> >> > > > > >
> >> >> >> > > > > >
> >> >> >> > > > > >
> >> >> >> > > > > > This patch was tested/passed on x86, mips(little
> >> endian),
> >> >> and
> >> >> >> > > > > ppc_82xx .
> >> >> >> > > > >
> >> >> >> > > > > 1. Please keep tst_exit() at the bottom.
> >> >> >> > > > > 2. Why can't we do sizeof(sigsetmask) ?
> >> >> >> > > > >
> >> >> >> > > > > Thanks,
> >> >> >> > > > > -Garrett
> >> >> >> > > >
> >> >> >> > > > Garrett,
> >> >> >> > > >
> >> >> >> > > > You want me to put tst_exit() at the bottom, even though
> it
> >> is
> >> >> >> called
> >> >> >> > > within cleanup()?
> >> >> >> > > > You mean sizeof(sigmask) ~ sizeof(sigset_t), right? That
> >> code
> >> >> was
> >> >> >> > > commented out since version 1.1 which I thought was odd
> too,
> >> so
> >> >> I
> >> >> >> did
> >> >> >> > > check sizeof(sigmask).
> >> >> >> > > > However, sizeof(sigmask) on mips returns 128 which does
> not
> >> >> seem
> >> >> >> > > correct. I haven't checked the other architectures, but I
> >> >> suspect
> >> >> >> some
> >> >> >> > > might have a similar mismatch. Apparently sigset_t may
> have
> >> >> >> different
> >> >> >> > > values when returned from glibc vs kernel space. More
> >> >> information
> >> >> >> from
> >> >> >> > > this post:
> >> >> >> > > >
> >> >> >> > > > http://lists.uclibc.org/pipermail/uclibc/2009-
> >> >> January/041850.html
> >> >> >
> >> >> >
> >> >> > Subrata,
> >> >> >
> >> >> > I've included the ppoll01 patch which should apply cleanly to
> the
> >> >> latest in CVS.
> >> >> >
> >> >>
> >> >> Hi Henry,
> >> >>     Could you change this line:
> >> >>
> >> >> +                             tst_resm(TFAIL, "%s failed - errno
> =
> >> %d : %s",
> >> >> TCID,
> >> >> +                                             last_failed_errno,
> >> >> strerror(last_failed_errno));
> >> >>
> >> >>     to this please?
> >> >>
> >> >> +                             tst_resm(TFAIL | TTERRNO, "%s
> failed",
> >> TCID);
> >> >>
> >> >>     last_failed_errno should become TEST_ERRNO if this change is
> >> done,
> >> >> IIRC.
> >> >>
> >> >
> >> > I've attached the ppoll01 patch with Garrett's suggested changes
> to
> >> use TEST_ERRNO.
> >>
> >> You could just completely zap last_failed_errno and make it
> test_errno
> >> instead. That's what I was suggesting with the previous reply.
> 
> On Wed, Nov 11, 2009 at 11:25 AM, Henry Yei <hyei@mvista.com> wrote:
> > Wouldn't TEST_ERRNO be the errno of the last TEST() that was run,
> rather than the last failed one?
> >
> >
> >
>     Yup! The goal is to drop the additional variable
> (last_failed_errno) so that only TEST_ERRNO is required and then all
> you need to do is use TTERRNO and you're golden :).
> Thanks,
> -Garrett

Attached is the poll01 patch with last_failed_errno and associated code removed.


[-- Attachment #2: ppoll01.patch --]
[-- Type: application/octet-stream, Size: 18853 bytes --]

--- ltp/testcases/kernel/syscalls/ppoll/ppoll01.c	2009-10-14 13:22:42.000000000 -0700
+++ ltp-wdir/testcases/kernel/syscalls/ppoll/ppoll01.c	2009-11-12 15:38:16.516389573 -0800
@@ -61,7 +61,6 @@
 #include <signal.h>
 #include "asm/poll.h"
 
-
 #include "../utils/include_j_h.h"
 #include "../utils/common_j_h.c"
 
@@ -71,13 +70,13 @@
 #include "linux_syscall_numbers.h"
 
 /* Extern Global Variables */
-extern int Tst_count;           /* counter for tst_xxx routines.         */
-extern char *TESTDIR;           /* temporary dir created by tst_tmpdir() */
+extern int Tst_count; /* counter for tst_xxx routines.         */
+extern char *TESTDIR; /* temporary dir created by tst_tmpdir() */
 
 /* Global Variables */
-char *TCID = "ppoll01";  /* Test program identifier.*/
-int  testno;
-int  TST_TOTAL = 1;                   /* total number of tests in this file.   */
+char *TCID = "ppoll01"; /* Test program identifier.*/
+int testno;
+int TST_TOTAL = 1; /* total number of tests in this file.   */
 
 /* Extern Global Functions */
 /******************************************************************************/
@@ -98,15 +97,15 @@ int  TST_TOTAL = 1;                   /*
 /*                                                                            */
 /******************************************************************************/
 extern void cleanup() {
-        /* Remove tmp dir and all files in it */
-        TEST_CLEANUP;
-        tst_rmdir();
+	/* Remove tmp dir and all files in it */
+	TEST_CLEANUP;
+	tst_rmdir();
 
-        /* Exit with appropriate return code. */
-        tst_exit();
+	/* Exit with appropriate return code. */
+	tst_exit();
 }
 
-void sighandler(int sig);       /* signals handler function for the test */
+void sighandler(int sig); /* signals handler function for the test */
 
 /* Local  Functions */
 /******************************************************************************/
@@ -127,58 +126,57 @@ void sighandler(int sig);       /* signa
 /*                                                                            */
 /******************************************************************************/
 void setup() {
-        /* Capture signals if any */
+	/* Capture signals if any */
 	signal(SIGINT, &sighandler);
 
-        /* Create temporary directories */
-        TEST_PAUSE;
-        tst_tmpdir();
+	/* Create temporary directories */
+	TEST_PAUSE;
+	tst_tmpdir();
 }
 
-
 /*
  * Macros
  */
 #define SYSCALL_NAME    "ppoll"
 
 #ifndef POLLRDHUP
-#  define POLLRDHUP     0x2000
+#define POLLRDHUP     0x2000
 #endif
 
+#if defined (__mips__)
+#define SIGSETSIZE 16
+#else
+#define SIGSETSIZE 8
+#endif
 
 /*
  * Global variables
  */
-static int opt_debug;
-static char *progname;
-static char *progdir;
 
 enum test_type {
 	NORMAL,
-        MASK_SIGNAL,
-        TIMEOUT,
-        FD_ALREADY_CLOSED,
-        SEND_SIGINT,
-        SEND_SIGINT_RACE_TEST,
-        INVALID_NFDS,
-        INVALID_FDS,
-        MINUS_NSEC,
-        TOO_LARGE_NSEC,
+	MASK_SIGNAL,
+	TIMEOUT,
+	FD_ALREADY_CLOSED,
+	SEND_SIGINT,
+	SEND_SIGINT_RACE_TEST,
+	INVALID_NFDS,
+	INVALID_FDS,
+	MINUS_NSEC,
+	TOO_LARGE_NSEC,
 
 };
 
-
 /*
  * Data Structure
  */
 struct test_case {
 	short expect_revents;
-        int ttype;
-        int ret;
-        int err;
+	int ttype;
+	int ret;
+	int err;
 };
 
-
 /* Test cases
  *
  *   test status of errors on man page
@@ -192,65 +190,62 @@ struct test_case {
  *   ENOMEM             can't check because it's difficult to create no-memory
  */
 
-
 static struct test_case tcase[] = {
-	{ // case00
-                .ttype          = NORMAL,
-                .expect_revents = POLLIN | POLLOUT,
-                .ret            = 0,
-                .err            = 0,
-        },
-        { // case01
-                .ttype          = MASK_SIGNAL,
-                .expect_revents = 0, // don't care
-                .ret            = 0,
-                .err            = 0,
-        },
-        { // case02
-                .ttype          = TIMEOUT,
-                .expect_revents = 0, // don't care
-                .ret            = 0,
-                .err            = 0,
-        },
-        { // case03
-                .ttype          = FD_ALREADY_CLOSED,
-                .expect_revents = POLLNVAL,
-                .ret            = 0,
-                .err            = 0,
-        },
-        { // case04
-                .ttype          = SEND_SIGINT,
-                .ret            = -1,
-                .err            = EINTR,
-        },
-        { // case05
-                .ttype          = SEND_SIGINT_RACE_TEST,
-                .ret            = -1,
-                .err            = EINTR,
-        },
-        { // case06
-                .ttype          = INVALID_NFDS,
-                .ret            = -1,
-                .err            = EINVAL,
-        },
-        { // case07
-                .ttype          = INVALID_FDS,
-                .ret            = -1,
-                .err            = EFAULT,
-        },
+		{ // case00
+			.ttype = NORMAL,
+			.expect_revents = POLLIN | POLLOUT,
+			.ret = 0,
+			.err = 0,
+		},
+		{ // case01
+			.ttype = MASK_SIGNAL,
+			.expect_revents = 0, // don't care
+			.ret = 0,
+			.err = 0,
+		},
+		{ // case02
+			.ttype = TIMEOUT,
+			.expect_revents = 0, // don't care
+			.ret = 0,
+			.err = 0,
+		},
+		{ // case03
+			.ttype = FD_ALREADY_CLOSED,
+			.expect_revents = POLLNVAL,
+			.ret = 0, .err = 0,
+		},
+		{ // case04
+			.ttype = SEND_SIGINT,
+			.ret = -1,
+			.err = EINTR,
+		},
+		{ // case05
+			.ttype = SEND_SIGINT_RACE_TEST,
+			.ret = -1,
+			.err = EINTR,
+		},
+		{ // case06
+			.ttype = INVALID_NFDS,
+			.ret = -1,
+			.err = EINVAL,
+		},
+		{ // case07
+			.ttype = INVALID_FDS,
+			.ret = -1,
+			.err = EFAULT, },
 #if 0
-        { // case08
-                .ttype          = MINUS_NSEC,
-                .ret            = -1,
-                .err            = EINVAL, // RHEL4U1 + 2.6.18 returns SUCCESS
-        },
-        { // case09
-                .ttype          = TOO_LARGE_NSEC,
-                .ret            = -1,
-                .err            = EINVAL, // RHEL4U1 + 2.6.18 returns SUCCESS
-        },
+		{ // case08
+			.ttype = MINUS_NSEC,
+			.ret = -1,
+			.err = EINVAL, // RHEL4U1 + 2.6.18 returns SUCCESS
+		},
+		{ // case09
+			.ttype = TOO_LARGE_NSEC,
+			.ret = -1,
+			.err = EINVAL, // RHEL4U1 + 2.6.18 returns SUCCESS
+		},
 #endif
-};
+		};
 
 #define NUM_TEST_FDS    1
 
@@ -262,266 +257,203 @@ static struct test_case tcase[] = {
  *
  */
 
-static int do_test(struct test_case *tc)
-{
-        int sys_ret;
-        int sys_errno;
-        int result = RESULT_OK;
-	int fd = -1 , cmp_ok = 1;
+static int do_test(struct test_case *tc) {
+	int sys_ret, sys_errno;
+	int result = RESULT_OK;
+	int fd = -1, cmp_ok = 1;
 	char fpath[PATH_MAX];
 	struct pollfd *p_fds, fds[NUM_TEST_FDS];
-        unsigned int nfds = NUM_TEST_FDS;
-        struct timespec *p_ts, ts;
-        sigset_t *p_sigmask, sigmask;
-        size_t sigsetsize = 0;
-        pid_t pid = 0;
-
-	TEST(fd = setup_file(progdir, "test.file", fpath));
-        if (fd < 0)
-                return 1;
-        fds[0].fd = fd;
-        fds[0].events = POLLIN | POLLPRI | POLLOUT | POLLRDHUP;
-        fds[0].revents = 0;
-        p_fds = fds;
-        p_ts = NULL;
-        p_sigmask = NULL;
+	unsigned int nfds = NUM_TEST_FDS;
+	struct timespec *p_ts, ts;
+	sigset_t *p_sigmask, sigmask;
+	pid_t pid = 0;
+
+	TEST(fd = setup_file(".", "test.file", fpath));
+	if (fd < 0)
+		return 1;
+	fds[0].fd = fd;
+	fds[0].events = POLLIN | POLLPRI | POLLOUT | POLLRDHUP;
+	fds[0].revents = 0;
+	p_fds = fds;
+	p_ts = NULL;
+	p_sigmask = NULL;
 
 	switch (tc->ttype) {
-        case TIMEOUT:
-                nfds = 0;
-                ts.tv_sec = 0;
-                ts.tv_nsec = 50000000;  // 50msec
-                p_ts = &ts;
-                break;
+	case TIMEOUT:
+		nfds = 0;
+		ts.tv_sec = 0;
+		ts.tv_nsec = 50000000; // 50msec
+		p_ts = &ts;
+		break;
 	case FD_ALREADY_CLOSED:
-                TEST(close(fd));
-                fd = -1;
-                TEST(cleanup_file(fpath));
-                break;
-        case MASK_SIGNAL:
-                TEST(sigemptyset(&sigmask));
-                TEST(sigaddset(&sigmask, SIGINT));
-                p_sigmask = &sigmask;
-                //sigsetsize = sizeof(sigmask);
-                sigsetsize = 8;
-                nfds = 0;
-                ts.tv_sec = 0;
-                ts.tv_nsec = 300000000; // 300msec => need to be enough for
-                                        //   waiting the signal
-                p_ts = &ts;
-                // fallthrough
+		TEST(close(fd));
+		fd = -1;
+		TEST(cleanup_file(fpath));
+		break;
+	case MASK_SIGNAL:
+		TEST(sigemptyset(&sigmask));
+		TEST(sigaddset(&sigmask, SIGINT));
+		p_sigmask = &sigmask;
+		nfds = 0;
+		ts.tv_sec = 0;
+		ts.tv_nsec = 300000000; // 300msec => need to be enough for
+		//   waiting the signal
+		p_ts = &ts;
+		// fallthrough
 	case SEND_SIGINT:
-                nfds = 0;
-                pid = create_sig_proc(100000, SIGINT, UINT_MAX); // 100msec
-                if (pid < 0)
-                        return 1;
-                break;
-  case SEND_SIGINT_RACE_TEST:
-    /* block the INT signal */
-                sigemptyset(&sigmask);
-                sigaddset(&sigmask, SIGINT);
-                sigprocmask(SIG_SETMASK, &sigmask, NULL);
-
-                /* and let it be unblocked when the syscall runs */
-                sigemptyset(&sigmask);
-                p_sigmask = &sigmask;
-                //sigsetsize = sizeof(sigmask);
-                sigsetsize = 8;
-                nfds = 0;
-                ts.tv_sec = 0;
-                ts.tv_nsec = 300000000; // 300msec => need to be enough for
-                                        //   waiting the signal
-                p_ts = &ts;
-                nfds = 0;
-                pid = create_sig_proc(0, SIGINT, 1);
-                if (pid < 0) {
-                  result=1;
-                  goto cleanup;
-                }
-                break;
-        case INVALID_NFDS:
-                //nfds = RLIMIT_NOFILE + 1; ==> RHEL4U1 + 2.6.18 returns SUCCESS
-                nfds = -1;
-                break;
-        case INVALID_FDS:
-                p_fds = (void*)0xc0000000;
-                break;
-        case MINUS_NSEC:
-                ts.tv_sec = 0;
-                ts.tv_nsec = -1;
-                p_ts = &ts;
-                break;
+		nfds = 0;
+		pid = create_sig_proc(100000, SIGINT, UINT_MAX); // 100msec
+		if (pid < 0)
+			return 1;
+		break;
+	case SEND_SIGINT_RACE_TEST:
+		/* block the INT signal */
+		sigemptyset(&sigmask);
+		sigaddset(&sigmask, SIGINT);
+		sigprocmask(SIG_SETMASK, &sigmask, NULL);
+
+		/* and let it be unblocked when the syscall runs */
+		sigemptyset(&sigmask);
+		p_sigmask = &sigmask;
+		nfds = 0;
+		ts.tv_sec = 0;
+		ts.tv_nsec = 300000000; // 300msec => need to be enough for
+		//   waiting the signal
+		p_ts = &ts;
+		nfds = 0;
+		pid = create_sig_proc(0, SIGINT, 1);
+		if (pid < 0) {
+			result = 1;
+			goto cleanup;
+		}
+		break;
+	case INVALID_NFDS:
+		//nfds = RLIMIT_NOFILE + 1; //==> RHEL4U1 + 2.6.18 returns SUCCESS
+		nfds = -1;
+		break;
+	case INVALID_FDS:
+		p_fds = (void*) 0xc0000000;
+		break;
+	case MINUS_NSEC:
+		ts.tv_sec = 0;
+		ts.tv_nsec = -1;
+		p_ts = &ts;
+		break;
 	case TOO_LARGE_NSEC:
-                ts.tv_sec = 0;
-                ts.tv_nsec = 1000000000;
-                p_ts = &ts;
-                break;
-        }
+		ts.tv_sec = 0;
+		ts.tv_nsec = 1000000000;
+		p_ts = &ts;
+		break;
+	}
 
 	/*
-	   * Execute system call
-         */
-        errno = 0;
-        TEST(sys_ret = syscall(__NR_ppoll, p_fds, nfds, p_ts, p_sigmask, sigsetsize));
-        sys_errno = errno;
-        if (sys_ret <= 0 || tc->ret < 0)
-                goto TEST_END;
-
-        cmp_ok = fds[0].revents == tc->expect_revents;
-        if (opt_debug) {
-                tst_resm(TINFO,"EXPECT: revents=0x%04x", tc->expect_revents);
-                tst_resm(TINFO,"RESULT: revents=0x%04x", fds[0].revents);
-        }
-
-TEST_END:
-        /*
-         * Check results
-         */
-        if(tc->ttype == SEND_SIGINT_RACE_TEST) {
-          int sig;
-          sigprocmask(SIG_SETMASK, NULL, &sigmask);
-          for(sig=1; sig < SIGRTMAX; sig++) {
-              TEST(sigismember(&sigmask, sig));
-              if(TEST_RETURN < 0 && TEST_ERRNO == EINVAL && sig != SIGINT)
-                continue; /* let's ignore errors if they are for other signal than SIGINT that we set */
-              if((sig==SIGINT) != (TEST_RETURN!=0)) {
-                tst_resm(TFAIL, "Bad value of signal mask, signal %d is %s", sig, TEST_RETURN ? "on" : "off");
-                cmp_ok |=1;
-              }
-            }
-        }
-        result |= (sys_errno != tc->err) || !cmp_ok;
-        PRINT_RESULT_CMP(sys_ret >= 0, tc->ret, tc->err, sys_ret, sys_errno,
-                         cmp_ok);
- cleanup:
-        if (fd >= 0)
-                cleanup_file(fpath);
-
-        sigemptyset(&sigmask);
-        sigprocmask(SIG_SETMASK, &sigmask, NULL);
-        if (pid > 0) {
-                int st;
-                kill(pid, SIGTERM);
-                wait(&st);
-        }
+	 * Execute system call
+	 */
+	errno = 0;
+	TEST(sys_ret = syscall(__NR_ppoll, p_fds, nfds, p_ts, p_sigmask, SIGSETSIZE));
+		sys_errno = errno;
+	if (sys_ret <= 0 || tc->ret < 0)
+		goto TEST_END;
+
+	cmp_ok = fds[0].revents == tc->expect_revents;
+	tst_resm(TINFO, "EXPECT: revents=0x%04x", tc->expect_revents);
+	tst_resm(TINFO, "RESULT: revents=0x%04x", fds[0].revents);
+
+	TEST_END:
+	/*
+	 * Check results
+	 */
+	if (tc->ttype == SEND_SIGINT_RACE_TEST) {
+		int sig;
+		sigprocmask(SIG_SETMASK, NULL, &sigmask);
+		for (sig = 1; sig < SIGRTMAX; sig++) {
+			TEST(sigismember(&sigmask, sig));
+			if (TEST_RETURN < 0 && TEST_ERRNO == EINVAL && sig != SIGINT)
+				continue; /* let's ignore errors if they are for other signal than SIGINT that we set */
+			if ((sig == SIGINT) != (TEST_RETURN != 0)) {
+				tst_resm(TFAIL, "Bad value of signal mask, signal %d is %s",
+						sig, TEST_RETURN ? "on" : "off");
+				cmp_ok |= 1;
+			}
+		}
+	}
+	result |= (sys_errno != tc->err) || !cmp_ok;
+	PRINT_RESULT_CMP(sys_ret >= 0, tc->ret, tc->err, sys_ret, sys_errno, cmp_ok);
+	cleanup: if (fd >= 0)
+		cleanup_file(fpath);
+
+	sigemptyset(&sigmask);
+	sigprocmask(SIG_SETMASK, &sigmask, NULL);
+	if (pid > 0) {
+		int st;
+		kill(pid, SIGTERM);
+		wait(&st);
+	}
 	return result;
 }
 
-
 /*
  * sighandler()
  */
-void sighandler(int sig)
-{
-        if (sig == SIGINT)
-                return;
-        // NOTREACHED
-        return;
+void sighandler(int sig) {
+	if (sig == SIGINT)
+		return;
+	// NOTREACHED
+	return;
 }
 
-
-/*
- * usage()
- */
-
-static void usage(const char *progname)
-{
-        tst_resm(TINFO,"usage: %s [options]", progname);
-        tst_resm(TINFO,"This is a regression test program of %s system call.",SYSCALL_NAME);
-        tst_resm(TINFO,"options:");
-        tst_resm(TINFO,"    -d --debug           Show debug messages");
-        tst_resm(TINFO,"    -h --help            Show this message");
-        tst_resm(TINFO,"NG");
-        exit(1);
-}
-
-
 /*
  * main()
  */
 
-
-
 int main(int ac, char **av) {
 	int result = RESULT_OK;
-        int c;
-        int i;
-        int lc;                 /* loop counter */
-        char *msg;              /* message returned from parse_opts */
-
-	struct option long_options[] = {
-                { "debug", no_argument, 0, 'd' },
-                { "help",  no_argument, 0, 'h' },
-                { NULL, 0, NULL, 0 }
-        };
-
-	progname = strchr(av[0], '/');
-        progname = progname ? progname + 1 : av[0];	
-
-	progdir = strdup(av[0]);
-        progdir = dirname(progdir);
-	
-        /* parse standard options */
-        if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
-             tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
-             tst_exit();
-           }
-
-        setup();
-
-        /* Check looping state if -i option given */
-        for (lc = 0; TEST_LOOPING(lc); ++lc) {
-                Tst_count = 0;
-                for (testno = 0; testno < TST_TOTAL; ++testno) {
-			 TEST(c = getopt_long(ac, av, "dh", long_options, NULL));
-			 while(TEST_RETURN != -1) {
-		                switch (c) {
-                		case 'd':
-		                        opt_debug = 1;
-                		        break;
-		                default:
-                		        usage(progname);
-                        		// NOTREACHED
-                		}
-		        }
-
-
-		if (ac != optind) {
-        	        tst_resm(TINFO,"Options are not match.");
-                	usage(progname);
-                	// NOTREACHED
-	        }
-
-		/*
-		* Execute test
-         	*/
-	        for (i = 0; i < (int)(sizeof(tcase) / sizeof(tcase[0])); i++) {
-        	        int ret;
-	                tst_resm(TINFO,"(case%02d) START", i);
-	                ret = do_test(&tcase[i]);
-	                tst_resm(TINFO,"(case%02d) END => %s", i, (ret == 0) ? "OK" : "NG");
-	                result |= ret;
-        	}
-		
-		/*
-        	 * Check results
-         	*/
-        	switch(result) {
-	        case RESULT_OK:
-        			tst_resm(TPASS, "ppoll01 call succeeded ");
-		                break;
-
-	        default:
-                 	   	tst_resm(TFAIL, "%s failed - errno = %d : %s", TCID, TEST_ERRNO, strerror(TEST_ERRNO));
-        		        RPRINTF("NG");
+	int i;
+	int lc; /* loop counter */
+	char *msg; /* message returned from parse_opts */
+
+	/* parse standard options */
+	if ((msg = parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *) NULL) {
+		tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
+	}
+
+	setup();
+
+	/* Check looping state if -i option given */
+	for (lc = 0; TEST_LOOPING(lc); ++lc) {
+		Tst_count = 0;
+		for (testno = 0; testno < TST_TOTAL; ++testno) {
+			/*
+			 * Execute test
+			 */
+			for (i = 0; i < (int) (sizeof(tcase) / sizeof(tcase[0])); i++) {
+				int ret;
+				tst_resm(TINFO, "(case%02d) START", i);
+				ret = do_test(&tcase[i]);
+				tst_resm(TINFO, "(case%02d) END => %s", i, (ret == 0) ? "OK"
+						: "NG");
+				TEST_ERROR_LOG(TEST_ERRNO);
+				result |= ret;
+			}
+
+			/*
+			 * Check results
+			 */
+			switch (result) {
+			case RESULT_OK:
+				tst_resm(TPASS, "ppoll01 call succeeded ");
+				break;
+
+			default:
+				tst_resm(TFAIL | TTERRNO, "%s failed", TCID);
+				RPRINTF("NG");
 				cleanup();
-				tst_exit();
-		                break;
-        	}
-
-                }
-        }	
-        cleanup();
-	tst_exit();
+				break;
+			}
+
+		}
+	}
+	cleanup();
+	return 0;
 }
 

[-- Attachment #3: Type: text/plain, Size: 354 bytes --]

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct valuefor  sigset_t for mips
  2009-11-13  1:57                       ` Henry Yei
@ 2009-11-15  0:19                         ` Garrett Cooper
  2009-11-15  1:18                           ` Garrett Cooper
  0 siblings, 1 reply; 16+ messages in thread
From: Garrett Cooper @ 2009-11-15  0:19 UTC (permalink / raw)
  To: Henry Yei; +Cc: LTP Mailing List

On Thu, Nov 12, 2009 at 5:57 PM, Henry Yei <hyei@mvista.com> wrote:
>> -----Original Message-----
>> From: Garrett Cooper [mailto:yanegomi@gmail.com]
>> Sent: Thursday, November 12, 2009 1:43 AM
>> To: Henry Yei
>> Cc: subrata@linux.vnet.ibm.com; LTP Mailing List
>> Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct
>> valuefor sigset_t for mips
>>
>> >> -----Original Message-----
>> >> From: Garrett Cooper [mailto:yanegomi@gmail.com]
>> >> Sent: Tuesday, November 10, 2009 10:13 PM
>> >> To: Henry Yei
>> >> Cc: subrata@linux.vnet.ibm.com; LTP Mailing List
>> >> Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct
>> >> valuefor sigset_t for mips
>> >>
>> >> On Tue, Nov 10, 2009 at 5:14 PM, Henry Yei <hyei@mvista.com> wrote:
>> >> >> -----Original Message-----
>> >> >> From: Garrett Cooper [mailto:yanegomi@gmail.com]
>> >> >> Sent: Monday, November 09, 2009 11:17 PM
>> >> >> To: Henry Yei
>> >> >> Cc: subrata@linux.vnet.ibm.com; LTP Mailing List
>> >> >> Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass
>> correct
>> >> >> valuefor sigset_t for mips
>> >> >>
>> >> >> On Mon, Nov 9, 2009 at 2:12 PM, Henry Yei <hyei@mvista.com>
>> wrote:
>> >> >> >> -----Original Message-----
>> >> >> >> From: Subrata Modak [mailto:subrata@linux.vnet.ibm.com]
>> >> >> >> Sent: Monday, November 09, 2009 9:40 AM
>> >> >> >> To: Henry Yei
>> >> >> >> Cc: Garrett Cooper; LTP Mailing List
>> >> >> >> Subject: RE: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass
>> >> correct
>> >> >> >> valuefor sigset_t for mips
>> >> >> >>
>> >> >> >> On Mon, 2009-11-02 at 14:09 -0800, Henry Yei wrote:
>> >> >> >> > Subrata,
>> >> >> >> >
>> >> >> >> > I've included Nicolas Joly's suggested removal of progdir to
>> >> force
>> >> >> >> the test to create all test files in the temp directory in the
>> >> >> attached
>> >> >> >> patch.
>> >> >> >> >
>> >> >> >> > I'm not sure why tst_exit() is needed when calling
>> cleanup(),
>> >> as
>> >> >> it
>> >> >> >> would be called by cleanup(). I can add it back, if needed.
>> Any
>> >> >> other
>> >> >> >> comments on the the appropriateness of "sizeof(sigmask)" would
>> >> also
>> >> >> be
>> >> >> >> welcomed. There are a few other tests with similar issues.
>> >> >> >> >
>> >> >> >>
>> >> >> >> Henry,
>> >> >> >>
>> >> >> >> Probably because of heavy changes recently, this patch is not
>> >> >> applying
>> >> >> >> properly. Can you please rebase your changes:
>> >> >> >>
>> >> >> >> patching file testcases/kernel/syscalls/ppoll/ppoll01.c
>> >> >> >> Hunk #3 FAILED at 98.
>> >> >> >> Hunk #4 FAILED at 127.
>> >> >> >> Hunk #5 FAILED at 185.
>> >> >> >> Hunk #6 FAILED at 252.
>> >> >> >> 4 out of 6 hunks FAILED -- saving rejects to file
>> >> >> >> testcases/kernel/syscalls/ppoll/ppoll01.c.rej
>> >> >> >>
>> >> >> >> Regards--
>> >> >> >> Subrata
>> >> >> >>
>> >> >> >> > > -----Original Message-----
>> >> >> >> > > From: Subrata Modak [mailto:subrata@linux.vnet.ibm.com]
>> >> >> >> > > Sent: Monday, November 02, 2009 5:59 AM
>> >> >> >> > > To: Henry Yei
>> >> >> >> > > Cc: Garrett Cooper; LTP Mailing List
>> >> >> >> > > Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5:
>> pass
>> >> >> correct
>> >> >> >> > > valuefor sigset_t for mips
>> >> >> >> > >
>> >> >> >> > > Any further work on this patch ?
>> >> >> >> > >
>> >> >> >> > > Regards--
>> >> >> >> > > Subrata
>> >> >> >> > >
>> >> >> >> > > On Wed, 2009-10-28 at 12:08 -0700, Henry Yei wrote:
>> >> >> >> > > > > -----Original Message-----
>> >> >> >> > > > > From: Garrett Cooper [mailto:yanegomi@gmail.com]
>> >> >> >> > > > > Sent: Tuesday, October 27, 2009 7:57 PM
>> >> >> >> > > > > To: Henry Yei
>> >> >> >> > > > > Cc: LTP Mailing List
>> >> >> >> > > > > Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5:
>> >> pass
>> >> >> >> correct
>> >> >> >> > > > > value for sigset_t for mips
>> >> >> >> > > > >
>> >> >> >> > > > > On Tue, Oct 27, 2009 at 6:32 PM, Henry Yei
>> >> <hyei@mvista.com>
>> >> >> >> wrote:
>> >> >> >> > > > > > All,
>> >> >> >> > > > > >
>> >> >> >> > > > > >
>> >> >> >> > > > > >
>> >> >> >> > > > > > The patch attached  for ppoll01:
>> >> >> >> > > > > >
>> >> >> >> > > > > > cleans up spacing and code style
>> >> >> >> > > > > >
>> >> >> >> > > > > > removes unneeded/broken debug option parsing
>> >> >> >> > > > > >
>> >> >> >> > > > > > if test fails, it prints out the last failed errno,
>> >> rather
>> >> >> >> than
>> >> >> >> > > just
>> >> >> >> > > > > the
>> >> >> >> > > > > > last errno(which may have been successful)
>> >> >> >> > > > > >
>> >> >> >> > > > > > passes in correct size of sigset_t for mips
>> >> >> >> > > > > >
>> >> >> >> > > > > >
>> >> >> >> > > > > >
>> >> >> >> > > > > > Signed-off by: Henry Yei <hyei@mvista.com>
>> >> >> >> > > > > >
>> >> >> >> > > > > >
>> >> >> >> > > > > >
>> >> >> >> > > > > > This patch was tested/passed on x86, mips(little
>> >> endian),
>> >> >> and
>> >> >> >> > > > > ppc_82xx .
>> >> >> >> > > > >
>> >> >> >> > > > > 1. Please keep tst_exit() at the bottom.
>> >> >> >> > > > > 2. Why can't we do sizeof(sigsetmask) ?
>> >> >> >> > > > >
>> >> >> >> > > > > Thanks,
>> >> >> >> > > > > -Garrett
>> >> >> >> > > >
>> >> >> >> > > > Garrett,
>> >> >> >> > > >
>> >> >> >> > > > You want me to put tst_exit() at the bottom, even though
>> it
>> >> is
>> >> >> >> called
>> >> >> >> > > within cleanup()?
>> >> >> >> > > > You mean sizeof(sigmask) ~ sizeof(sigset_t), right? That
>> >> code
>> >> >> was
>> >> >> >> > > commented out since version 1.1 which I thought was odd
>> too,
>> >> so
>> >> >> I
>> >> >> >> did
>> >> >> >> > > check sizeof(sigmask).
>> >> >> >> > > > However, sizeof(sigmask) on mips returns 128 which does
>> not
>> >> >> seem
>> >> >> >> > > correct. I haven't checked the other architectures, but I
>> >> >> suspect
>> >> >> >> some
>> >> >> >> > > might have a similar mismatch. Apparently sigset_t may
>> have
>> >> >> >> different
>> >> >> >> > > values when returned from glibc vs kernel space. More
>> >> >> information
>> >> >> >> from
>> >> >> >> > > this post:
>> >> >> >> > > >
>> >> >> >> > > > http://lists.uclibc.org/pipermail/uclibc/2009-
>> >> >> January/041850.html
>> >> >> >
>> >> >> >
>> >> >> > Subrata,
>> >> >> >
>> >> >> > I've included the ppoll01 patch which should apply cleanly to
>> the
>> >> >> latest in CVS.
>> >> >> >
>> >> >>
>> >> >> Hi Henry,
>> >> >>     Could you change this line:
>> >> >>
>> >> >> +                             tst_resm(TFAIL, "%s failed - errno
>> =
>> >> %d : %s",
>> >> >> TCID,
>> >> >> +                                             last_failed_errno,
>> >> >> strerror(last_failed_errno));
>> >> >>
>> >> >>     to this please?
>> >> >>
>> >> >> +                             tst_resm(TFAIL | TTERRNO, "%s
>> failed",
>> >> TCID);
>> >> >>
>> >> >>     last_failed_errno should become TEST_ERRNO if this change is
>> >> done,
>> >> >> IIRC.
>> >> >>
>> >> >
>> >> > I've attached the ppoll01 patch with Garrett's suggested changes
>> to
>> >> use TEST_ERRNO.
>> >>
>> >> You could just completely zap last_failed_errno and make it
>> test_errno
>> >> instead. That's what I was suggesting with the previous reply.
>>
>> On Wed, Nov 11, 2009 at 11:25 AM, Henry Yei <hyei@mvista.com> wrote:
>> > Wouldn't TEST_ERRNO be the errno of the last TEST() that was run,
>> rather than the last failed one?
>> >
>> >
>> >
>>     Yup! The goal is to drop the additional variable
>> (last_failed_errno) so that only TEST_ERRNO is required and then all
>> you need to do is use TTERRNO and you're golden :).
>> Thanks,
>> -Garrett
>
> Attached is the poll01 patch with last_failed_errno and associated code removed.

AHA! I figured out why sigset is sized differently on mips32 for you,
compared to other architectures.

Just like there's a compat_caddr_t datatype (which is explicitly set
to char *), there's also a compat_sigset_t as well.

Let me see if I can figure out this mystery, but my guess is that
you're using n32 based mips, most likely on an Octeon model ;) ;)...
which would account for what you're seeing here and possibly account
for why the test consistently hangs on our Cavium boards at work (our
version of Linux has been hacked so bad though to take shortcuts in
the design process instead of following proper design procedure that
it makes me cry inside...).

Thanks,
-Garrett

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct valuefor  sigset_t for mips
  2009-11-15  0:19                         ` Garrett Cooper
@ 2009-11-15  1:18                           ` Garrett Cooper
  0 siblings, 0 replies; 16+ messages in thread
From: Garrett Cooper @ 2009-11-15  1:18 UTC (permalink / raw)
  To: Henry Yei; +Cc: LTP Mailing List

On Sat, Nov 14, 2009 at 4:19 PM, Garrett Cooper <yanegomi@gmail.com> wrote:
> On Thu, Nov 12, 2009 at 5:57 PM, Henry Yei <hyei@mvista.com> wrote:
>>> -----Original Message-----
>>> From: Garrett Cooper [mailto:yanegomi@gmail.com]
>>> Sent: Thursday, November 12, 2009 1:43 AM
>>> To: Henry Yei
>>> Cc: subrata@linux.vnet.ibm.com; LTP Mailing List
>>> Subject: Re: [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct
>>> valuefor sigset_t for mips

[...]

>>
>> Attached is the poll01 patch with last_failed_errno and associated code removed.
>
> AHA! I figured out why sigset is sized differently on mips32 for you,
> compared to other architectures.
>
> Just like there's a compat_caddr_t datatype (which is explicitly set
> to char *), there's also a compat_sigset_t as well.
>
> Let me see if I can figure out this mystery, but my guess is that
> you're using n32 based mips, most likely on an Octeon model ;) ;)...
> which would account for what you're seeing here and possibly account
> for why the test consistently hangs on our Cavium boards at work (our
> version of Linux has been hacked so bad though to take shortcuts in
> the design process instead of following proper design procedure that
> it makes me cry inside...).

    Checked in the intermediate solution until we can figure out
whether or not compat_sigset_t is required for mips32.
Thanks!
-Garrett

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2009-11-15  1:25 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-28  1:32 [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct value for sigset_t for mips Henry Yei
2009-10-28  2:57 ` Garrett Cooper
2009-10-28 19:08   ` Henry Yei
2009-11-02 13:59     ` Subrata Modak
2009-11-02 22:09       ` Henry Yei
2009-11-09 17:39         ` Subrata Modak
2009-11-09 22:12           ` [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct valuefor " Henry Yei
2009-11-10  7:16             ` Garrett Cooper
2009-11-11  1:14               ` Henry Yei
2009-11-11  6:12                 ` Garrett Cooper
2009-11-11 19:25                   ` Henry Yei
2009-11-12  9:42                     ` Garrett Cooper
2009-11-13  1:57                       ` Henry Yei
2009-11-15  0:19                         ` Garrett Cooper
2009-11-15  1:18                           ` Garrett Cooper
2009-10-28  9:18 ` [LTP] [PATCH][ppoll01] fix testcase 1, 5: pass correct value for " Nicolas Joly

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.