Skip to contentSkip to conversation

cgroups/cgroup_regression_test: fix sporadic failures

PATCH In review Jan Stancek 2 participants 2 messages Jul 19, 2011 – Jul 21, 2011

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cgroups/cgroup_regression_test: fix sporadic failures

This patch fixes some failures caused by missing cleanup, leaving groups behind after some stress tests. Some stress tests failed to complete upon receiving SIGUSR1.

1. dmesg can rotate and number of found bugs can actually go down clear the buffer before test to avoid this

2. test_5: test should mount 2 subsystems, but mount command says "$subsys" instead of "$subsys2"

3. test_6: test may leave groups behind, fix rmdir to match test_6_1.sh

4. test_7_2: mounts whole cgroup not $subsys

5. test_10: can leave cgroups umounted before cleanup make sure cgroups are mounted before doing cleanup

6. test_*.sh scripts use trap in loop, which may cause bash to miss signal, see
https://bugzilla.redhat.com/show_bug.cgi?id=695656
move trap outside loop to avoid it

---
 .../controllers/cgroup/cgroup_regression_test.sh   |   15 ++++++++++-----
 testcases/kernel/controllers/cgroup/test_10_1.sh   |    3 +--
 testcases/kernel/controllers/cgroup/test_10_2.sh   |    3 +--
 testcases/kernel/controllers/cgroup/test_3_1.sh    |    3 +--
 testcases/kernel/controllers/cgroup/test_3_2.sh    |    3 +--
 testcases/kernel/controllers/cgroup/test_6_1.sh    |    3 +--
 testcases/kernel/controllers/cgroup/test_9_1.sh    |    3 +--
 testcases/kernel/controllers/cgroup/test_9_2.sh    |    3 +--
 8 files changed, 17 insertions(+), 19 deletions(-)
testcases/kernel/controllers/cgroup/cgroup_regression_test.sh +10 -5
index 878f91a..577c792 100755
@@ -40,6 +40,7 @@ elif [ "x$(id -ru)" != x0 ]; then
 	exit 0
 fi
 
+dmesg -c > /dev/null
 nr_bug=`dmesg | grep -c "kernel BUG"`
 nr_null=`dmesg | grep -c "kernel NULL pointer dereference"`
 nr_warning=`dmesg | grep -c "^WARNING"`
@@ -78,6 +79,8 @@ check_kernel_bug()
 	nr_warning=$new_warning
 	nr_lockdep=$new_lockdep
 
+	echo "check_kernel_bug found something!"
+	dmesg
 	failed=1
 	return 0
 }
@@ -254,7 +257,7 @@ test_5()
 	subsys1=`tail -n 1 /proc/cgroups | awk '{ print $1 }'`
 	subsys2=`tail -n 2 /proc/cgroups | head -1 | awk '{ print $1 }'`
 
-	mount -t cgroup -o $subsys1,$subsys xxx cgroup/
+	mount -t cgroup -o $subsys1,$subsys2 xxx cgroup/
 	if [ $? -ne 0 ]; then
 		tst_resm TFAIL "mount $subsys1 and $subsys2 failed"
 		failed=1
@@ -325,7 +328,7 @@ test_6()
 
 	# clean up
 	mount -t cgroup -o ns xxx cgroup/ > /dev/null 2>&1
-	rmdir cgroup/[1-9] > /dev/null 2>&1
+	rmdir cgroup/[1-9]* > /dev/null 2>&1
 	umount cgroup/
 }
 
@@ -362,7 +365,7 @@ test_7_2()
 {
 	mount -t cgroup -o none,name=foo cgroup cgroup/
 	if [ $? -ne 0 ]; then
-		tst_resm TFAIL "failed to mount $subsys"
+		tst_resm TFAIL "failed to mount cgroup"
 		failed=1
 		return
 	fi
@@ -499,8 +502,9 @@ test_10()
 	wait $pid1
 	wait $pid2
 
-	rmdir cgroup/0 2> /dev/null
-	umount cgroup/ 2> /dev/null
+	mount -t cgroup none cgroup 2> /dev/null
+	rmdir cgroup/0
+	umount cgroup/
 
 	check_kernel_bug
 	if [ $? -eq 1 ]; then
@@ -510,6 +514,7 @@ test_10()
 
 # main
 
+failed=0
 mkdir cgroup/
 
 for ((cur = 1; cur <= $TST_TOTAL; cur++))
testcases/kernel/controllers/cgroup/test_10_1.sh +1 -2
index 6284722..ffa0d5f 100755
@@ -22,13 +22,12 @@
 ##                                                                            ##
 ################################################################################
 
+trap exit SIGUSR1
 for ((; ;))
 {
 	mount -t cgroup xxx cgroup/ > /dev/null 2>&1
 	mkdir cgroup/0 > /dev/null 2>&1
 	rmdir cgroup/0 > /dev/null 2>&1
 	umount cgroup/ > /dev/null 2>&1
-
-	trap exit SIGUSR1
 }
 
testcases/kernel/controllers/cgroup/test_10_2.sh +1 -2
index 82b91e3..f811bbd 100755
@@ -22,11 +22,10 @@
 ##                                                                            ##
 ################################################################################
 
+trap exit SIGUSR1
 for ((; ;))
 {
 	mount -t cgroup xxx cgroup/ > /dev/null 2>&1
 	umount cgroup/ > /dev/null 2>&1
-
-	trap exit SIGUSR1
 }
 
testcases/kernel/controllers/cgroup/test_3_1.sh +1 -2
index 86627d4..507a2c4 100755
@@ -22,11 +22,10 @@
 ##                                                                            ##
 ################################################################################
 
+trap exit SIGUSR1
 for ((; ;))
 {
 	mkdir cgroup/0
 	rmdir cgroup/0
-
-	trap exit SIGUSR1
 }
 
testcases/kernel/controllers/cgroup/test_3_2.sh +1 -2
index c942969..9f83d9d 100755
@@ -22,10 +22,9 @@
 ##                                                                            ##
 ################################################################################
 
+trap exit SIGUSR1
 for ((; ;))
 {
 	cat /proc/sched_debug > /dev/null
-
-	trap exit SIGUSR1
 }
 
testcases/kernel/controllers/cgroup/test_6_1.sh +1 -2
index ff70677..e91e794 100755
@@ -22,12 +22,11 @@
 ##                                                                            ##
 ################################################################################
 
+trap exit SIGUSR1
 for ((; ;))
 {
 	mount -t cgroup -o ns xxx cgroup/ > /dev/null 2>&1
 	rmdir cgroup/[1-9]* > /dev/null 2>&1
 	umount cgroup/ > /dev/null 2>&1
-
-	trap exit SIGUSR1
 }
 
testcases/kernel/controllers/cgroup/test_9_1.sh +1 -2
index 24a1524..c6e8f6f 100755
@@ -22,13 +22,12 @@
 ##                                                                            ##
 ################################################################################
 
+trap exit SIGUSR1
 for ((; ;))
 {
 #	mount -t cgroup -o debug xxx cgroup/ > /dev/null 2>&1
 	mount -t cgroup xxx cgroup/ > /dev/null 2>&1
 	cat cgroup/release_agent > /dev/null 2>&1
 	umount cgroup/ > /dev/null 2>&1
-
-	trap exit SIGUSR1
 }
 
testcases/kernel/controllers/cgroup/test_9_2.sh +1 -2
index 654df4d..f8e1c61 100755
@@ -22,12 +22,11 @@
 ##                                                                            ##
 ################################################################################
 
+trap exit SIGUSR1
 for ((; ;))
 {
 #	mount -t cgroup -o debug xxx cgroup/ > /dev/null 2>&1
 	mount -t cgroup xxx cgroup/ > /dev/null 2>&1
 	umount cgroup/ > /dev/null 2>&1
-
-	trap exit SIGUSR1
 }
 

------------------------------------------------------------------------------
Magic Quadrant for Content-Aware Data Loss Prevention
Research study explores the data loss prevention market. Includes in-depth analysis on the changes within the DLP market, and the criteria used to evaluate the strengths and weaknesses of these DLP solutions.
http://www.accelacomm.com/jaw/sfnl/114/51385063/

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

#1 lore raw

Hi!

Quoted 15 lines

This patch fixes some failures caused by missing cleanup, leaving groups behind after some stress tests. Some stress tests failed to complete upon receiving SIGUSR1.

1. dmesg can rotate and number of found bugs can actually go down clear the buffer before test to avoid this

2. test_5: test should mount 2 subsystems, but mount command says "$subsys" instead of "$subsys2"

3. test_6: test may leave groups behind, fix rmdir to match test_6_1.sh

4. test_7_2: mounts whole cgroup not $subsys

Quoted 7 lines

5. test_10: can leave cgroups umounted before cleanup make sure cgroups are mounted before doing cleanup

6. test_*.sh scripts use trap in loop, which may cause bash to miss signal, see
https://bugzilla.redhat.com/show_bug.cgi?id=695656
move trap outside loop to avoid it

I know these are mostly trivial changes, but even that could you split them into several patches (they are easier to review, revert if needed...)

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
5 Ways to Improve & Secure Unified Communications
Unified Communications promises greater efficiencies for business. UC can 
improve internal communications as well as offer faster, more efficient ways
to interact with customers and streamline customer service. Learn more!
http://www.accelacomm.com/jaw/sfnl/114/51426253/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list