mmap11 testcase couldn't run correctly as it should be. The purpose of
this test program was that, on some old kernels, program received
SIGABRT unexpected when large amount munmap happens, in new kernels,
this wouldn't happen, despite some ENOMEM/EAGAIN might occur during
testing. So the correct PASS/FAIL criteria is: the test passes when the
program finishes running and exits normally; the test fails when the
program exits abnormally, e.g. a SIGABRT received. My patch fetches the
newest version of reproducer from kernel commit log to make the testcase
work again.

Signed-off-by: Caspar Zhang <[email protected]>
---
 runtest/syscalls                        |    2 +-
 testcases/kernel/syscalls/mmap/mmap11.c |   14 ++++++++------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/runtest/syscalls b/runtest/syscalls
index 4294d07..930b207 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -554,7 +554,7 @@ mmap06 mmap06
 mmap07 mmap07
 mmap08 mmap08
 mmap09 mmap09
-mmap11 mmap11 -i 30000
+mmap11 mmap11 -i 50000
 
 modify_ldt01 modify_ldt01
 modify_ldt02 modify_ldt02
diff --git a/testcases/kernel/syscalls/mmap/mmap11.c b/testcases/kernel/syscalls/mmap/mmap11.c
index 786724b..4cbad58 100644
--- a/testcases/kernel/syscalls/mmap/mmap11.c
+++ b/testcases/kernel/syscalls/mmap/mmap11.c
@@ -58,7 +58,7 @@
 char *TCID = "mmap11";
 int TST_TOTAL = 1;
 
-#define MAL_SIZE (100*1024)
+#define MAL_SIZE (8*1024*1024)
 
 static void *wait_thread(void *args);
 static void *wait_thread2(void *args);
@@ -112,13 +112,15 @@ void check(void)
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
 		Tst_count = 0;
 		ret = pthread_create(&th, &attr, wait_thread, NULL);
-		if (ret) {
+		if (ret && errno != ENOMEM && errno != EAGAIN) {
 			tst_resm(TINFO, "[%d] ", count);
 			tst_brkm(TBROK|TERRNO, cleanup, "pthread_create");
 		}
+		if (count % 100 == 0)
+			usleep(10000);
 		count++;
 		ret = pthread_create(&thread[lc], &attr, wait_thread2, NULL);
-		if (ret) {
+		if (ret && errno != ENOMEM && errno != EAGAIN) {
 			tst_resm(TINFO, "[%d] ", count);
 			tst_brkm(TBROK|TERRNO, cleanup, "pthread_create");
 		}
@@ -133,13 +135,13 @@ void *wait_thread(void *args)
 	void *addr;
 
 	addr = malloc(MAL_SIZE);
-	if (addr)
-		memset(addr, 1, MAL_SIZE);
-	sleep(1);
+	sleep(10);
+
 	return NULL;
 }
 
 void *wait_thread2(void *args)
 {
+	sleep(60);
 	return NULL;
 }
------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to