From: Subrata <sub...@us...> - 2009-03-23 14:45:33
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/io_setup In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14647/ltp/testcases/kernel/syscalls/io_setup Modified Files: io_setup01.c Log Message: Coding Syle Cleanups. Signed-Off-By: <mic...@pe...>. Index: io_setup01.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/io_setup/io_setup01.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** io_setup01.c 26 Feb 2009 12:15:43 -0000 1.5 --- io_setup01.c 23 Mar 2009 13:35:45 -0000 1.6 *************** *** 35,40 **** #include <string.h> - - /* * cleanup() --- 35,38 ---- *************** *** 42,47 **** * premature exit */ ! void ! cleanup(void) { /* --- 40,44 ---- * premature exit */ ! void cleanup(void) { /* *************** *** 57,85 **** * setup() - performs all ONE TIME setup for this test. */ ! void ! setup() { ! /* capture signals */ ! tst_sig(NOFORK, DEF_HANDLER, cleanup); ! /* Pause if that option was specified */ ! TEST_PAUSE; ! } /* End setup() */ ! int ! main(int argc, char** argv) { ! int lc; /* loop counter */ ! char *msg; /* parse_opts() return message */ io_context_t ctx; int expected_return; ! ! if ((msg = parse_opts(argc, argv, (option_t *)NULL, NULL)) != (char *)NULL){ tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); ! /*NOTREACHED*/ ! } setup(); --- 54,79 ---- * setup() - performs all ONE TIME setup for this test. */ ! void setup() { ! /* capture signals */ ! tst_sig(NOFORK, DEF_HANDLER, cleanup); ! /* Pause if that option was specified */ ! TEST_PAUSE; ! } /* End setup() */ ! int main(int argc, char **argv) { ! int lc; /* loop counter */ ! char *msg; /* parse_opts() return message */ io_context_t ctx; int expected_return; ! if ((msg = ! parse_opts(argc, argv, (option_t *) NULL, NULL)) != (char *)NULL) { tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg); ! /*NOTREACHED*/} setup(); *************** *** 92,131 **** /* ! DESCRIPTION ! io_setup creates an asynchronous I/O context capable of receiving at ! least nr_events. ctxp must not point to an AIO context that already ! exists, and must be initialized to 0 prior to the call. On successful ! creation of the AIO context, *ctxp is filled in with the resulting ! handle. ! */ ! memset( &ctx, 0, sizeof(io_context_t) ); expected_return = 0; ! TEST(io_setup( 1, &ctx )); if (TEST_RETURN == expected_return) { tst_resm(TPASS, "call succeeded expectedly"); ! io_destroy( ctx ); } else { tst_resm(TFAIL, "unexpected returned value - %d - " ! "expected %d", TEST_RETURN, ! expected_return); } ! /* ! RETURN VALUE ! io_setup returns 0 on success; otherwise, one of the errors listed in ! the "Errors" section is returned. ! ERRORS ! EINVAL ctxp is not initialized, or the specified nr_events exceeds in- ! ternal limits. nr_events should be greater than 0. ! */ ! memset( &ctx, 1, sizeof(io_context_t) ); expected_return = -EINVAL; ! TEST(io_setup( 1, &ctx )); if (TEST_RETURN == 0) { tst_resm(TFAIL, "call succeeded unexpectedly"); ! io_destroy( ctx ); } else if (TEST_RETURN == expected_return) { tst_resm(TPASS, "expected failure - " --- 86,124 ---- /* ! DESCRIPTION ! io_setup creates an asynchronous I/O context capable of receiving at ! least nr_events. ctxp must not point to an AIO context that already ! exists, and must be initialized to 0 prior to the call. On successful ! creation of the AIO context, *ctxp is filled in with the resulting ! handle. ! */ ! memset(&ctx, 0, sizeof(io_context_t)); expected_return = 0; ! TEST(io_setup(1, &ctx)); if (TEST_RETURN == expected_return) { tst_resm(TPASS, "call succeeded expectedly"); ! io_destroy(ctx); } else { tst_resm(TFAIL, "unexpected returned value - %d - " ! "expected %d", TEST_RETURN, expected_return); } ! /* ! RETURN VALUE ! io_setup returns 0 on success; otherwise, one of the errors listed in ! the "Errors" section is returned. ! ERRORS ! EINVAL ctxp is not initialized, or the specified nr_events exceeds in- ! ternal limits. nr_events should be greater than 0. ! */ ! memset(&ctx, 1, sizeof(io_context_t)); expected_return = -EINVAL; ! TEST(io_setup(1, &ctx)); if (TEST_RETURN == 0) { tst_resm(TFAIL, "call succeeded unexpectedly"); ! io_destroy(ctx); } else if (TEST_RETURN == expected_return) { tst_resm(TPASS, "expected failure - " *************** *** 134,148 **** } else { tst_resm(TFAIL, "unexpected returned value - %d - " ! "expected %d", TEST_RETURN, ! expected_return); } ! ! memset( &ctx, 0, sizeof(io_context_t ) ); expected_return = -EINVAL; ! TEST(io_setup( -1, &ctx )); if (TEST_RETURN == 0) { tst_resm(TFAIL, "call succeeded unexpectedly"); ! io_destroy( ctx ); } else if (TEST_RETURN == expected_return) { tst_resm(TPASS, "expected failure - " --- 127,139 ---- } else { tst_resm(TFAIL, "unexpected returned value - %d - " ! "expected %d", TEST_RETURN, expected_return); } ! memset(&ctx, 0, sizeof(io_context_t)); expected_return = -EINVAL; ! TEST(io_setup(-1, &ctx)); if (TEST_RETURN == 0) { tst_resm(TFAIL, "call succeeded unexpectedly"); ! io_destroy(ctx); } else if (TEST_RETURN == expected_return) { tst_resm(TPASS, "expected failure - " *************** *** 151,168 **** } else { tst_resm(TFAIL, "unexpected returned value - %d - " ! "expected %d", TEST_RETURN, ! expected_return); } - /* ! EFAULT An invalid pointer is passed for ctxp. ! */ expected_return = -EFAULT; ! TEST(io_setup( 1, NULL )); if (TEST_RETURN == 0) { tst_resm(TFAIL, "call succeeded unexpectedly"); ! io_destroy( ctx ); } else if (TEST_RETURN == expected_return) { tst_resm(TPASS, "expected failure - " --- 142,157 ---- } else { tst_resm(TFAIL, "unexpected returned value - %d - " ! "expected %d", TEST_RETURN, expected_return); } /* ! EFAULT An invalid pointer is passed for ctxp. ! */ expected_return = -EFAULT; ! TEST(io_setup(1, NULL)); if (TEST_RETURN == 0) { tst_resm(TFAIL, "call succeeded unexpectedly"); ! io_destroy(ctx); } else if (TEST_RETURN == expected_return) { tst_resm(TPASS, "expected failure - " *************** *** 171,188 **** } else { tst_resm(TFAIL, "unexpected returned value - %d - " ! "expected %d", TEST_RETURN, ! expected_return); } - /* ! ENOMEM Insufficient kernel resources are available. ! ! EAGAIN The specified nr_events exceeds the user's limit of available ! events. ! */ /* ! ENOSYS io_setup is not implemented on this architecture. ! */ /* Crackerjack has a test case for ENOSYS. But Testing for ENOSYS is not meaningful for LTP, I think. --- 160,175 ---- } else { tst_resm(TFAIL, "unexpected returned value - %d - " ! "expected %d", TEST_RETURN, expected_return); } /* ! ENOMEM Insufficient kernel resources are available. ! ! EAGAIN The specified nr_events exceeds the user's limit of available ! events. ! */ /* ! ENOSYS io_setup is not implemented on this architecture. ! */ /* Crackerjack has a test case for ENOSYS. But Testing for ENOSYS is not meaningful for LTP, I think. |