msgctl/msgctl13.c: add EIDRM test
PATCH 2/2 msgctl/msgctl13.c: add EIDRM test
Add EIDRM test for msgctl(2)
--- runtest/syscalls | 1 + runtest/syscalls-ipc | 1 + testcases/kernel/syscalls/.gitignore | 1 + testcases/kernel/syscalls/ipc/msgctl/msgctl13.c | 107 ++++++++++++++++++++++++ 4 files changed, 110 insertions(+) create mode 100644 testcases/kernel/syscalls/ipc/msgctl/msgctl13.c
runtest/syscalls +1 -0
@@ -628,6 +628,7 @@ msgctl09 msgctl09 msgctl10 msgctl10 msgctl11 msgctl11 msgctl12 msgctl12 +msgctl13 msgctl13 msgget01 msgget01 msgget02 msgget02
runtest/syscalls-ipc +1 -0
@@ -10,6 +10,7 @@ msgctl09 msgctl09 msgctl10 msgctl10 msgctl11 msgctl11 msgctl12 msgctl12 +msgctl13 msgctl13 msgget01 msgget01 msgget02 msgget02
testcases/kernel/syscalls/.gitignore +1 -0
@@ -374,6 +374,7 @@ /ipc/msgctl/msgctl10 /ipc/msgctl/msgctl11 /ipc/msgctl/msgctl12 +/ipc/msgctl/msgctl13 /ipc/msgget/msgget01 /ipc/msgget/msgget02 /ipc/msgget/msgget03
testcases/kernel/syscalls/ipc/msgctl/msgctl13.c new file +107 -0
107 lines not on this page · raw message
Signature · 15 lines
1.8.2.1 ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Hi!
Quoted 13 lines
testcases/kernel/syscalls/ipc/msgctl/msgctl13.c new file +7
-0@@ -0,0 +1,107 @@ +/* +* Copyright (c) 2013 Fujitsu Ltd. +* Author: Zeng Linggang <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of version 2 of the GNU General Public License as +* published by the Free Software Foundation.
testcases/kernel/syscalls/ipc/msgctl/msgctl13.c line 17
Quoted 10 lines
testcases/kernel/syscalls/ipc/msgctl/msgctl13.c new file +10
-0+* +* This program is distributed in the hope that it would be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +* +* You should have received a copy of the GNU General Public License along +* with this program. +*/ + +#define _GNU_SOURCE
This shouldn't be needed, IPC_RMDIR is not Linux specific, or do I miss something?
Quoted 14 lines
testcases/kernel/syscalls/ipc/msgctl/msgctl13.c new file +14
-0+#include <sys/types.h> +#include <sys/ipc.h> +#include <sys/msg.h> +#include <errno.h> + +#include "test.h" +#include "usctest.h" +#include "ipcmsg.h" + +static int msg_q; + +static void setup1 (void ); + +static struct test_case_t {
testcases/kernel/syscalls/ipc/msgctl/msgctl13.c line 41
Quoted 10 lines
testcases/kernel/syscalls/ipc/msgctl/msgctl13.c new file +10
-0+int *queue_id; +int ipc_cmd; +char *name; +void (*setup)(void ); +} test_cases[] = { + {&msg_q, IPC_RMID, "IPC_RMID", setup1}, +}; + +char *TCID = "acct13"; +int TST_TOTAL = ARRAY_SIZE(test_cases);
It does not make much sense to create test case structure for single testcase. Do you plan to add more testcases here?
Quoted 16 lines
testcases/kernel/syscalls/ipc/msgctl/msgctl13.c new file +16
-0+int main (int argc,char *argv[]) +{ +int lc; +char *msg; +int i; +struct msqid_ds qs_buf; + + msg =parse_opts (argc, argv,NULL ,NULL ); +if (msg !=NULL ) +tst_brkm (TBROK ,NULL ,"OPTION PARSING ERROR - %s" , msg); + +setup (); + +for (lc =0 ;TEST_LOOPING (lc); lc++) { + + tst_count =0 ;
testcases/kernel/syscalls/ipc/msgctl/msgctl13.c line 68
Quoted 10 lines
testcases/kernel/syscalls/ipc/msgctl/msgctl13.c new file +10
-0+ +for (i =0 ; i <TST_TOTAL ; i++) { + +if (test_cases[i].setup !=NULL ) + test_cases[i].setup (); + +TEST (msgctl (*test_cases[i].queue_id, + test_cases[i].ipc_cmd, &qs_buf)); + +if (TEST_RETURN !=0 ||TEST_ERRNO !=IPC_RMID ) {
TEST_ERRNO != IPC_RMID looks like a typo to me. (it does not make any sense)
testcases/kernel/syscalls/ipc/msgctl/msgctl13.c line 75
Quoted 7 lines
testcases/kernel/syscalls/ipc/msgctl/msgctl13.c new file +7
-0+tst_resm (TFAIL , +"msgctl() test %s failed with errno: " +"%d" , test_cases[i].name,TEST_ERRNO ); + }else { +tst_resm (TPASS ,"msgctl() test %s succeeded" , + test_cases[i].name); + }
Also what about checking that the queue was really removed (msgget() without CREAT fails with ENOENT)?
Quoted 5 lines
testcases/kernel/syscalls/ipc/msgctl/msgctl13.c new file +5
-0+ } + } + +cleanup (); +
testcases/kernel/syscalls/ipc/msgctl/msgctl13.c line 90
Quoted 10 lines
testcases/kernel/syscalls/ipc/msgctl/msgctl13.c new file +10
-0+tst_exit (); +} + +void setup (void ) +{ +tst_sig (NOFORK ,DEF_HANDLER , cleanup); + +TEST_PAUSE ; + +tst_tmpdir ();
Again, no need to create temporary directory.
Quoted 16 lines
testcases/kernel/syscalls/ipc/msgctl/msgctl13.c new file +16
-0+ msgkey =getipckey (); +} + +static void setup1 (void ) +{ + msg_q =msgget (msgkey,IPC_CREAT |IPC_EXCL |MSG_RW ); +if (msg_q ==-1 ) +tst_brkm (TBROK , cleanup,"Can't create message queue" ); +} + +void cleanup (void ) +{ +tst_rmdir (); + +TEST_CLEANUP ; +}
Signature · 12 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
A message that is not in the archive (sent off-list or not yet received): 1391688594.4999.5.camel@G08JYZSD130126
Re: [LTP] [PATCH v2 2/2] msgctl/msgctl13.c: add IPC_RMID test
Hi!
Review
Quoted 2 lines
(quoted diff) +2
-0+ +char *TCID = "acct13";
I've fixned this to be msgct rather than acct (in both testcases).
Quoted 32 lines
testcases/kernel/syscalls/ipc/msgctl/msgctl13.c new file +32
-0+int TST_TOTAL =1 ; +static void msgctl_verify (void ); + +int main (int argc,char *argv[]) +{ +int lc; +char *msg; + + msg =parse_opts (argc, argv,NULL ,NULL ); +if (msg !=NULL ) +tst_brkm (TBROK ,NULL ,"OPTION PARSING ERROR - %s" , msg); + +setup (); + +for (lc =0 ;TEST_LOOPING (lc); lc++) { + + tst_count =0 ; + +msgctl_verify (); + } + +cleanup (); +tst_exit (); +} + +void setup (void ) +{ +tst_sig (NOFORK ,DEF_HANDLER , cleanup); + +TEST_PAUSE ; +} +
testcases/kernel/syscalls/ipc/msgctl/msgctl13.c
Quoted 10 lines
testcases/kernel/syscalls/ipc/msgctl/msgctl13.c new file +10
-0+static void msgctl_verify (void ) +{ +int msg_q; +struct msqid_ds qs_buf; + + msg_q =msgget (IPC_PRIVATE ,MSG_RW ); +if (msg_q ==-1 ) +tst_brkm (TBROK , cleanup,"Can't create message queue" ); + +TEST (msgctl (msg_q,IPC_RMID , &qs_buf));
And passed NULL here instead of the msqid_ds buf here, the third parameter is ignored fro IPC_RMID operation.
Both pushed, thanks.
Signature · 12 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Re: [LTP] [PATCH v2 2/2] msgctl/msgctl13.c: add IPC_RMID test
Hi!
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ +char *TCID = "acct13";I've fixned this to be msgct rather than acct (in both testcases).
Should be msgctl (I got it right in the source code...).
Signature · 12 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list