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.
nj...@lanfeust [syscalls/abort]> ./abort01
abort01 1 TPASS : Test passed
nj...@lanfeust [syscalls/abort]> (ulimit -c 0 && ./abort01)
abort01 1 TCONF : core file size limit must be greater than 0.
Signed-off-by: Nicolas Joly <[email protected]>
--
Nicolas Joly
Biological Software and Databanks.
Institut Pasteur, Paris.
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();
}
------------------------------------------------------------------------------
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
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list