From: Nicolas Joly <njoly@pasteur.fr>
To: LTP list <ltp-list@lists.sf.net>
Subject: [LTP] abort01 testcase cleanup
Date: Fri, 23 Jul 2010 19:17:17 +0200 [thread overview]
Message-ID: <20100723171717.GA54890@medusa.sis.pasteur.fr> (raw)
[-- Attachment #1: Type: text/plain, Size: 672 bytes --]
Hi,
The attached patch do some cleanup in the abort01 testcase ...
1) The attempt to remove the generated core is wrong. The hard-coded
`core' name is bad and the test temporary directory removal already
take care of this.
2) Make the test fail gracefully if the running environment does not
allow generating core files.
njoly@lanfeust [syscalls/abort]> ./abort01
abort01 1 TPASS : Test passed
njoly@lanfeust [syscalls/abort]> (ulimit -c 0 && ./abort01)
abort01 1 TCONF : core file size limit must be greater than 0.
Signed-off-by: Nicolas Joly <njoly@pasteur.fr>
--
Nicolas Joly
Biological Software and Databanks.
Institut Pasteur, Paris.
[-- Attachment #2: ltp-abort01.diff --]
[-- Type: text/plain, Size: 1071 bytes --]
diff --git a/testcases/kernel/syscalls/abort/abort01.c b/testcases/kernel/syscalls/abort/abort01.c
index 28ef9d6..c836f3a 100644
--- a/testcases/kernel/syscalls/abort/abort01.c
+++ b/testcases/kernel/syscalls/abort/abort01.c
@@ -43,6 +43,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
+#include <sys/resource.h>
#include <sys/types.h>
#include <sys/wait.h>
@@ -157,7 +158,6 @@ int main(int argc, char *argv[])
/*--------------------------------------------------------------*/
/* Clean up any files created by test before call to anyfail. */
- unlink("core");
anyfail(); /* THIS CALL DOES NOT RETURN - EXITS!! */
return 0;
}
@@ -183,6 +183,18 @@ int anyfail()
void setup()
{
+ struct rlimit lim;
+
+ /* Ensure that core file size limit is greater than 0. */
+ if (getrlimit(RLIMIT_CORE, &lim) == -1) {
+ tst_resm(TFAIL|TERRNO, "getrlimit RLIMIT_CORE failed");
+ tst_exit();
+ }
+ if (lim.rlim_cur == 0) {
+ tst_resm(TCONF, "core file size limit must be greater than 0.");
+ tst_exit();
+ }
+
temp = stderr;
tst_tmpdir();
}
[-- Attachment #3: Type: text/plain, Size: 235 bytes --]
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
[-- 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
next reply other threads:[~2010-07-23 17:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-23 17:17 Nicolas Joly [this message]
2010-07-23 17:56 ` [LTP] abort01 testcase cleanup Garrett Cooper
2010-07-23 18:48 ` Nicolas Joly
2010-07-23 22:03 ` Garrett Cooper
2010-07-23 23:20 ` Nicolas Joly
2010-07-24 0:56 ` Garrett Cooper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100723171717.GA54890@medusa.sis.pasteur.fr \
--to=njoly@pasteur.fr \
--cc=ltp-list@lists.sf.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox