public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/shmat01: avoid dumping corefile for expected crash
@ 2017-09-11 11:32 Jan Stancek
  2017-09-11 11:53 ` Cyril Hrubis
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Stancek @ 2017-09-11 11:32 UTC (permalink / raw)
  To: ltp

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/kernel/syscalls/ipc/shmat/shmat01.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/ipc/shmat/shmat01.c b/testcases/kernel/syscalls/ipc/shmat/shmat01.c
index 0ea407530462..ad0410aac127 100644
--- a/testcases/kernel/syscalls/ipc/shmat/shmat01.c
+++ b/testcases/kernel/syscalls/ipc/shmat/shmat01.c
@@ -69,8 +69,16 @@ static void *expected_addr(void *in_addr, void *out_addr)
 	return ALIGN_DOWN(in_addr);
 }
 
-static void do_child(int *in_addr)
+static void do_child(int *in_addr, int expect_crash)
 {
+	if (expect_crash) {
+		/* crash is expected, avoid dumping corefile */
+		struct rlimit r;
+
+		r.rlim_cur = 1;
+		r.rlim_max = 1;
+		SAFE_SETRLIMIT(RLIMIT_CORE, &r);
+	}
 	*in_addr = 10;
 
 	exit(0);
@@ -121,7 +129,7 @@ static void verify_shmat(unsigned int n)
 
 	pid = SAFE_FORK();
 	if (!pid)
-		do_child(addr);
+		do_child(addr, tc->exp_status == SIGSEGV);
 	else
 		SAFE_WAITPID(pid, &status, 0);
 
-- 
1.8.3.1


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

end of thread, other threads:[~2017-09-12 12:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-11 11:32 [LTP] [PATCH] syscalls/shmat01: avoid dumping corefile for expected crash Jan Stancek
2017-09-11 11:53 ` Cyril Hrubis
2017-09-11 12:08   ` Jan Stancek
2017-09-11 12:21     ` Cyril Hrubis
2017-09-12  9:15       ` Cyril Hrubis
2017-09-12 12:46         ` Jan Stancek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox