public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Caspar Zhang <czhang@redhat.com>
To: LTP list <ltp-list@lists.sourceforge.net>
Subject: Re: [LTP] [PATCH v2] fork13 output too large
Date: Thu, 03 Mar 2011 23:48:17 +0800	[thread overview]
Message-ID: <4D6FB841.1060401@redhat.com> (raw)
In-Reply-To: <4D6FA7E9.5070200@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 3358 bytes --]

Oh... I sent the wrong v2 patch. here is the correct PATCH v2. Sorry for
noise...

On 03/03/2011 10:38 PM, Caspar Zhang wrote:

> 
> v2: removed more flooding outputs, return immediately when failure occurs.

fork13 is a test prog backported from upstream mainline:
5fdee8c4a5e1800489ce61963208f8cc55e42ea1. However, it produces flooding
outputs that may cause syscall output log too large (30GB+!!); also
10e+7 times fork is too time consuming, 10e+6 should be valid enough
to reproduce the issue and it takes less time (~3min); if the test
fails, it would put an error msg, this might cause flood error msg in
output log as well, so I make it return immediately when a failure
occurs.

Signed-off-by: Caspar Zhang <czhang@redhat.com>
---
 runtest/syscalls                        |    2 +-
 testcases/kernel/syscalls/fork/fork13.c |   29
++++++++++++++++-------------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/runtest/syscalls b/runtest/syscalls
index d402531..3bd9c50 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -274,7 +274,7 @@ fork08 fork08
 fork09 fork09
 fork10 fork10
 fork11 fork11
-fork13 fork13 -c 2 -i 10000000
+fork13 fork13 -c 2 -i 1000000

 fpathconf01 fpathconf01

diff --git a/testcases/kernel/syscalls/fork/fork13.c
b/testcases/kernel/syscalls/fork/fork13.c
index 7c72352..4804ea1 100644
--- a/testcases/kernel/syscalls/fork/fork13.c
+++ b/testcases/kernel/syscalls/fork/fork13.c
@@ -86,15 +86,13 @@ int main(int argc, char* argv[])

 void check(void)
 {
-	int lc;
+	long lc;
 	pid_t last_pid = 0;
 	pid_t pid;
 	int child_exit_code, distance, reaped, status;

 	for (lc = 0; TEST_LOOPING(lc); lc++) {
 		Tst_count = 0;
-		if (lc % PIDMAX == 0)
-			tst_resm(TINFO, "Iter: %d", lc/PIDMAX);
 		child_exit_code = lc % RETURN;
 		switch (pid = fork()) {
 		case -1:
@@ -103,31 +101,36 @@ void check(void)
 			exit(child_exit_code);
 		default:
 			if (lc > 0) {
-				tst_resm(TINFO, "last_pid = %d pid = %d",
-					last_pid, pid);
 				distance = pid_distance(last_pid, pid);
-				if (distance == 0)
+				if (distance == 0) {
 					tst_resm(TFAIL,
 						"Unexpected pid sequence: "
 						"previous fork: pid=%d, "
 						"current fork: pid=%d for "
-						"iteration=%d.", last_pid, pid,
+						"iteration=%ld.", last_pid, pid,
 						lc);
+					return;
+				}
 			}
 			last_pid = pid;

 			reaped = wait(&status);
-			if (reaped != pid)
+			if (reaped != pid) {
 				tst_resm(TFAIL,
 					"Wait return value: expected pid=%d, "
-					"got %d, iteration %d.", pid, reaped,
+					"got %d, iteration %ld.", pid, reaped,
 					lc);
-			else if (WEXITSTATUS(status) != child_exit_code)
+				return;
+			}
+			else if (WEXITSTATUS(status) != child_exit_code) {
 				tst_resm(TFAIL, "Unexpected exit status %x, "
-					"iteration %d.", WEXITSTATUS(status),
+					"iteration %ld.", WEXITSTATUS(status),
 					lc);
+				return;
+			}
 		}
 	}
+	tst_resm(TPASS, "%ld pids forked, all passed", lc);
 }

 void setup(void)
@@ -171,9 +174,9 @@ void cleanup(void)
 	TEST_CLEANUP;
 }

-/* The distance mod 32768 between two pids, where the first pid is
+/* The distance mod PIDMAX between two pids, where the first pid is
    expected to be smaller than the second. */
 int pid_distance(pid_t first, pid_t second)
 {
-	return (second + 32768 - first) % 32768;
+	return (second + PIDMAX - first) % PIDMAX;
 }
-- 
1.7.4.1


[-- Attachment #2: 0001-fork13-output-too-large.patch --]
[-- Type: text/plain, Size: 3345 bytes --]

From 4c1f6db5f41df2b4c9c55423f05ff37d48559f85 Mon Sep 17 00:00:00 2001
From: Caspar Zhang <czhang@redhat.com>
Date: Thu, 3 Mar 2011 22:25:24 +0800
Subject: [PATCH] fork13 output too large

fork13 is a test prog backported from upstream mainline:
5fdee8c4a5e1800489ce61963208f8cc55e42ea1. However, it produces flooding
outputs that may cause syscall output log too large (30GB+!!); also
10e+7 times fork is too time consuming, 10e+6 should be valid enough
to reproduce the issue and it takes less time (~3min); if the test
fails, it would put an error msg, this might cause flood error msg in
output log as well, so I make it return immediately when a failure
occurs.

Signed-off-by: Caspar Zhang <czhang@redhat.com>
---
 runtest/syscalls                        |    2 +-
 testcases/kernel/syscalls/fork/fork13.c |   29 ++++++++++++++++-------------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/runtest/syscalls b/runtest/syscalls
index d402531..3bd9c50 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -274,7 +274,7 @@ fork08 fork08
 fork09 fork09
 fork10 fork10
 fork11 fork11
-fork13 fork13 -c 2 -i 10000000
+fork13 fork13 -c 2 -i 1000000
 
 fpathconf01 fpathconf01
 
diff --git a/testcases/kernel/syscalls/fork/fork13.c b/testcases/kernel/syscalls/fork/fork13.c
index 7c72352..4804ea1 100644
--- a/testcases/kernel/syscalls/fork/fork13.c
+++ b/testcases/kernel/syscalls/fork/fork13.c
@@ -86,15 +86,13 @@ int main(int argc, char* argv[])
 
 void check(void)
 {
-	int lc;
+	long lc;
 	pid_t last_pid = 0;
 	pid_t pid;
 	int child_exit_code, distance, reaped, status;
 
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
 		Tst_count = 0;
-		if (lc % PIDMAX == 0)
-			tst_resm(TINFO, "Iter: %d", lc/PIDMAX);
 		child_exit_code = lc % RETURN;
 		switch (pid = fork()) {
 		case -1:
@@ -103,31 +101,36 @@ void check(void)
 			exit(child_exit_code);
 		default:
 			if (lc > 0) {
-				tst_resm(TINFO, "last_pid = %d pid = %d",
-					last_pid, pid);
 				distance = pid_distance(last_pid, pid);
-				if (distance == 0)
+				if (distance == 0) {
 					tst_resm(TFAIL,
 						"Unexpected pid sequence: "
 						"previous fork: pid=%d, "
 						"current fork: pid=%d for "
-						"iteration=%d.", last_pid, pid,
+						"iteration=%ld.", last_pid, pid,
 						lc);
+					return;
+				}
 			}
 			last_pid = pid;
 
 			reaped = wait(&status);
-			if (reaped != pid)
+			if (reaped != pid) {
 				tst_resm(TFAIL,
 					"Wait return value: expected pid=%d, "
-					"got %d, iteration %d.", pid, reaped,
+					"got %d, iteration %ld.", pid, reaped,
 					lc);
-			else if (WEXITSTATUS(status) != child_exit_code)
+				return;
+			}
+			else if (WEXITSTATUS(status) != child_exit_code) {
 				tst_resm(TFAIL, "Unexpected exit status %x, "
-					"iteration %d.", WEXITSTATUS(status),
+					"iteration %ld.", WEXITSTATUS(status),
 					lc);
+				return;
+			}
 		}
 	}
+	tst_resm(TPASS, "%ld pids forked, all passed", lc);
 }
 
 void setup(void)
@@ -171,9 +174,9 @@ void cleanup(void)
 	TEST_CLEANUP;
 }
 
-/* The distance mod 32768 between two pids, where the first pid is
+/* The distance mod PIDMAX between two pids, where the first pid is
    expected to be smaller than the second. */
 int pid_distance(pid_t first, pid_t second)
 {
-	return (second + 32768 - first) % 32768;
+	return (second + PIDMAX - first) % PIDMAX;
 }
-- 
1.7.4.1


[-- Attachment #3: Type: text/plain, Size: 429 bytes --]

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 

[-- 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

  reply	other threads:[~2011-03-03 15:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-03  6:52 [LTP] [PATCH] fork13 output too large Caspar Zhang
2011-03-03 14:38 ` [LTP] [PATCH v2] " Caspar Zhang
2011-03-03 15:48   ` Caspar Zhang [this message]
2011-03-04  9:30     ` 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=4D6FB841.1060401@redhat.com \
    --to=czhang@redhat.com \
    --cc=ltp-list@lists.sourceforge.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