Skip to contentSkip to conversation

fork13 output too large

PATCH Superseded Caspar Zhang 2 participants 4 messages Mar 3, 2011 – Mar 4, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fork13 output too large

Hi all, fork13 is a test program back-ported from upstream mainline:
5fdee8c4a5e1800489ce61963208f8cc55e42ea1, however, this test produces too many outputs that may cause syscall output log too large (10GB+!!). Also 10e7 times fork is too time-consuming, 10e6 forking is valid enough to reproduce the issue and it takes less time (~5min).

---
 runtest/syscalls                        |    2 +-
 testcases/kernel/syscalls/fork/fork13.c |    2 --
 2 files changed, 1 insertions(+), 3 deletions(-)
runtest/syscalls +1 -1
index d402531..3bd9c50 100644
@@ -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
 
(quoted diff) +0 -0

b/testcases/kernel/syscalls/fork/fork13.c
index 7c72352..e7dd192 100644

testcases/kernel/syscalls/fork/fork13.c +0 -2
@@ -103,8 +103,6 @@ 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)
 					tst_resm(TFAIL,
Signature · 8 lines
1.7.4.1


-- 
Quality Engineer (Kernel) in
Red Hat Software (Beijing) Co., R&D Branch
http://www.cn.redhat.com/
TEL: +86-10-62608150

From c0a48a4c347ee7a7534f9695e7bc66a6649cb753 Mon Sep 17 00:00:00 2001
From: Caspar Zhang <[email protected]>
Date: Thu, 3 Mar 2011 14:47:55 +0800
Subject: [PATCH 2/2] fork13 output too large

Hi all, fork13 is a test program ported from upstream mainline:
5fdee8c4a5e1800489ce61963208f8cc55e42ea1, however, this test produces too many outputs that may cause syscall output log too large (10GB+!!). Also 10e7 times fork is too time-consuming, 10e6 forking is valid enough to reproduce the issue and it takes less time (~5min).

---
 runtest/syscalls                        |    2 +-
 testcases/kernel/syscalls/fork/fork13.c |    2 --
 2 files changed, 1 insertions(+), 3 deletions(-)
runtest/syscalls +1 -1
index d402531..3bd9c50 100644
@@ -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
 
testcases/kernel/syscalls/fork/fork13.c +0 -2
index 7c72352..e7dd192 100644
@@ -103,8 +103,6 @@ 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)
 					tst_resm(TFAIL,
Signature · 1 line
1.7.4.1

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

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw

PATCH v2 1/1 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 break the iteration when a failure occurs.

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

---
 runtest/syscalls                        |    2 +-
 testcases/kernel/syscalls/fork/fork13.c |   38
++++++++++++++++++++----------
 2 files changed, 26 insertions(+), 14 deletions(-)
runtest/syscalls +1 -1
index d402531..3bd9c50 100644
@@ -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
 
(quoted diff) +0 -0

b/testcases/kernel/syscalls/fork/fork13.c
index 7c72352..d9dc8b8 100644

testcases/kernel/syscalls/fork/fork13.c +25 -13
@@ -86,15 +86,14 @@ int main(int argc, char* argv[])
 
 void check(void)
 {
-	int lc;
+	long lc;
+	int fail = 0;
 	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 +102,44 @@ void check(void)
 			exit(child_exit_code);
 		default:
 			if (lc > 0) {
-				tst_resm(TINFO, "last_pid = %d pid = %d",
-					last_pid, pid);
+				if (lc % PIDMAX == 0)
+					tst_resm(TINFO, "Iter: %ld", lc/PIDMAX);
 				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);
+					fail++;
+					break;
+				}
 			}
 			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)
+				fail++;
+				break;
+			}
+			else if (WEXITSTATUS(status) != child_exit_code) {
 				tst_resm(TFAIL, "Unexpected exit status %x, "
-					"iteration %d.", WEXITSTATUS(status),
+					"iteration %ld.", WEXITSTATUS(status),
 					lc);
+				fail++;
+				break;
+			}
 		}
 	}
+	if (fail)
+		tst_resm(TFAIL, "%ld pids forked, failure occured", lc);
+	else
+		tst_resm(TPASS, "%ld pids forked, all passed", lc);
 }
 
 void setup(void)
@@ -171,9 +183,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;
 }
Signature · 1 line
1.7.4.1

From b30f6f184e293405ffdf0f7b8a2d293afcd2f853 Mon Sep 17 00:00:00 2001
From: Caspar Zhang <[email protected]>
Date: Thu, 3 Mar 2011 21:45:25 +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 break the iteration when a failure occurs.

---
 runtest/syscalls                        |    2 +-
 testcases/kernel/syscalls/fork/fork13.c |   38 ++++++++++++++++++++----------
 2 files changed, 26 insertions(+), 14 deletions(-)
runtest/syscalls +1 -1
index d402531..3bd9c50 100644
@@ -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
 
testcases/kernel/syscalls/fork/fork13.c +25 -13
index 7c72352..d9dc8b8 100644
@@ -86,15 +86,14 @@ int main(int argc, char* argv[])
 
 void check(void)
 {
-	int lc;
+	long lc;
+	int fail = 0;
 	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 +102,44 @@ void check(void)
 			exit(child_exit_code);
 		default:
 			if (lc > 0) {
-				tst_resm(TINFO, "last_pid = %d pid = %d",
-					last_pid, pid);
+				if (lc % PIDMAX == 0)
+					tst_resm(TINFO, "Iter: %ld", lc/PIDMAX);
 				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);
+					fail++;
+					break;
+				}
 			}
 			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)
+				fail++;
+				break;
+			}
+			else if (WEXITSTATUS(status) != child_exit_code) {
 				tst_resm(TFAIL, "Unexpected exit status %x, "
-					"iteration %d.", WEXITSTATUS(status),
+					"iteration %ld.", WEXITSTATUS(status),
 					lc);
+				fail++;
+				break;
+			}
 		}
 	}
+	if (fail)
+		tst_resm(TFAIL, "%ld pids forked, failure occured", lc);
+	else
+		tst_resm(TPASS, "%ld pids forked, all passed", lc);
 }
 
 void setup(void)
@@ -171,9 +183,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;
 }
Signature · 1 line
1.7.4.1

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

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#2 lore raw

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

Quoted 2 lines · Caspar Zhang

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.

---
 runtest/syscalls                        |    2 +-
 testcases/kernel/syscalls/fork/fork13.c |   29
++++++++++++++++-------------
 2 files changed, 17 insertions(+), 14 deletions(-)
runtest/syscalls +1 -1
index d402531..3bd9c50 100644
@@ -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
 
(quoted diff) +0 -0

b/testcases/kernel/syscalls/fork/fork13.c
index 7c72352..4804ea1 100644

testcases/kernel/syscalls/fork/fork13.c +16 -13
@@ -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;
 }
Signature · 1 line
1.7.4.1

From 4c1f6db5f41df2b4c9c55423f05ff37d48559f85 Mon Sep 17 00:00:00 2001
From: Caspar Zhang <[email protected]>
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.

---
 runtest/syscalls                        |    2 +-
 testcases/kernel/syscalls/fork/fork13.c |   29 ++++++++++++++++-------------
 2 files changed, 17 insertions(+), 14 deletions(-)
runtest/syscalls +1 -1
index d402531..3bd9c50 100644
@@ -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
 
testcases/kernel/syscalls/fork/fork13.c +16 -13
index 7c72352..4804ea1 100644
@@ -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;
 }
Signature · 1 line
1.7.4.1

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

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#3 lore raw
Quoted 2 lines · Caspar Zhang

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

Seems sane -- thanks!
-Garrett

------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You This paper provides an overview of data connectivity, details its effect on application quality, and explores various alternative solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list