* [LTP] [ltp] [PATCH] shmctl01.c: fix error of the case need sighandler()
@ 2011-03-12 9:00 Peng Haitao
2011-03-13 12:26 ` Caspar Zhang
2011-03-15 12:21 ` Garrett Cooper
0 siblings, 2 replies; 3+ messages in thread
From: Peng Haitao @ 2011-03-12 9:00 UTC (permalink / raw)
To: Garrett Cooper; +Cc: ltp-list
The case expect the signal "SIGUSR1" to wake up child process, so should add
sighandler().
Signed-off-by: Peng Haitao <penght@cn.fujitsu.com>
---
testcases/kernel/syscalls/ipc/shmctl/shmctl01.c | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
index 693bf97..f72487b 100644
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
+++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
@@ -138,9 +138,9 @@ int main(int ac, char **av)
void check_functionality(void);
/* parse standard options */
- if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL) {
+ if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL)
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
- }
+
#ifdef UCLINUX
argv0 = av[0];
maybe_run_child(do_child, "ddd", &stat_i, &stat_time, &shm_id_1);
@@ -231,8 +231,7 @@ void *set_shmat()
* print a message to that effect.
*/
if (rval == (void *)-1) {
- tst_resm(TBROK, "shmat() failed - %s", strerror(errno));
- cleanup();
+ tst_brkm(TBROK, cleanup, "shmat() failed - %s", strerror(errno));
}
return rval;
@@ -485,10 +484,19 @@ void func_rmid()
shm_id_1 = -1;
}
+/*
+ * sighandler() - handle signals, in this case SIGUSR1 is the only one expected
+ */
+void sighandler(sig)
+{
+ if (sig != SIGUSR1)
+ tst_resm(TINFO, "received unexpected signal %d", sig);
+}
+
void setup(void)
{
- tst_sig(FORK, DEF_HANDLER, cleanup);
+ tst_sig(FORK, sighandler, cleanup);
TEST_PAUSE;
--
1.7.1
--
Best Regards,
Peng Haitao
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [LTP] [ltp] [PATCH] shmctl01.c: fix error of the case need sighandler()
2011-03-12 9:00 [LTP] [ltp] [PATCH] shmctl01.c: fix error of the case need sighandler() Peng Haitao
@ 2011-03-13 12:26 ` Caspar Zhang
2011-03-15 12:21 ` Garrett Cooper
1 sibling, 0 replies; 3+ messages in thread
From: Caspar Zhang @ 2011-03-13 12:26 UTC (permalink / raw)
To: Peng Haitao; +Cc: ltp-list
On 03/12/2011 05:00 PM, Peng Haitao wrote:
>
> The case expect the signal "SIGUSR1" to wake up child process, so should add
> sighandler().
>
> Signed-off-by: Peng Haitao <penght@cn.fujitsu.com>
Confirmed the patch works in RHEL6.
Tested-by: Caspar Zhang <czhang@redhat.com>
> ---
> testcases/kernel/syscalls/ipc/shmctl/shmctl01.c | 18 +++++++++++++-----
> 1 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
> index 693bf97..f72487b 100644
> --- a/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
> +++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl01.c
> @@ -138,9 +138,9 @@ int main(int ac, char **av)
> void check_functionality(void);
>
> /* parse standard options */
> - if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL) {
> + if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL)
> tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
> - }
> +
> #ifdef UCLINUX
> argv0 = av[0];
> maybe_run_child(do_child, "ddd", &stat_i, &stat_time, &shm_id_1);
> @@ -231,8 +231,7 @@ void *set_shmat()
> * print a message to that effect.
> */
> if (rval == (void *)-1) {
> - tst_resm(TBROK, "shmat() failed - %s", strerror(errno));
> - cleanup();
> + tst_brkm(TBROK, cleanup, "shmat() failed - %s", strerror(errno));
> }
>
> return rval;
> @@ -485,10 +484,19 @@ void func_rmid()
> shm_id_1 = -1;
> }
>
> +/*
> + * sighandler() - handle signals, in this case SIGUSR1 is the only one expected
> + */
> +void sighandler(sig)
> +{
> + if (sig != SIGUSR1)
> + tst_resm(TINFO, "received unexpected signal %d", sig);
> +}
> +
> void setup(void)
> {
>
> - tst_sig(FORK, DEF_HANDLER, cleanup);
> + tst_sig(FORK, sighandler, cleanup);
>
> TEST_PAUSE;
>
--
Quality Engineer (Kernel) in
Red Hat Software (Beijing) Co., R&D Branch
http://www.cn.redhat.com/
TEL: +86-10-62608150
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LTP] [ltp] [PATCH] shmctl01.c: fix error of the case need sighandler()
2011-03-12 9:00 [LTP] [ltp] [PATCH] shmctl01.c: fix error of the case need sighandler() Peng Haitao
2011-03-13 12:26 ` Caspar Zhang
@ 2011-03-15 12:21 ` Garrett Cooper
1 sibling, 0 replies; 3+ messages in thread
From: Garrett Cooper @ 2011-03-15 12:21 UTC (permalink / raw)
To: Peng Haitao; +Cc: ltp-list
On Sat, Mar 12, 2011 at 1:00 AM, Peng Haitao <penght@cn.fujitsu.com> wrote:
>
> The case expect the signal "SIGUSR1" to wake up child process, so should add
> sighandler().
Committed a modified patch that calls tst_resm(TBROK, ...) in the
signal handler as it's an unexpected signal.
Thanks,
-Garrett
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-03-15 12:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-12 9:00 [LTP] [ltp] [PATCH] shmctl01.c: fix error of the case need sighandler() Peng Haitao
2011-03-13 12:26 ` Caspar Zhang
2011-03-15 12:21 ` Garrett Cooper
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox