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

2. clean any groups left behind, if test_4.sh gets killed by OOM

3. failed mount should be treated as error and return non-zero

Signed-off-by: Jan Stancek <[email protected]>
---
 .../memcg/regression/memcg_regression_test.sh      |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/controllers/memcg/regression/memcg_regression_test.sh b/testcases/kernel/controllers/memcg/regression/memcg_regression_test.sh
index b564ece..d59369c 100755
--- a/testcases/kernel/controllers/memcg/regression/memcg_regression_test.sh
+++ b/testcases/kernel/controllers/memcg/regression/memcg_regression_test.sh
@@ -47,6 +47,7 @@ if [ $? -eq 0 ]; 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"`
@@ -85,6 +86,8 @@ check_kernel_bug()
 	nr_warning=$new_warning
 	nr_lockdep=$new_lockdep
 
+	echo "check_kernel_bug found something!"
+	dmesg
 	failed=1
 	return 0
 }
@@ -206,11 +209,13 @@ test_4()
 	# test_4.sh might be killed by oom, so do clean up here
 	killall -9 memcg_test_4 2> /dev/null
 	killall -9 memcg_test_4.sh 2> /dev/null
+	# if test_4.sh gets killed, we still need to cleanup any groups
+	rmdir memcg/0 2> /dev/null
 	swapon -a
 }
 
 # main
-
+failed=0
 mkdir memcg/
 
 for cur in $(seq 1 $TST_TOTAL); do
@@ -219,11 +224,11 @@ for cur in $(seq 1 $TST_TOTAL); do
 	mount -t cgroup -o memory xxx memcg/
 	if [ $? -ne 0 ]; then
 		tst_resm TFAIL "failed to mount memory subsytem"
+		failed=1
 		continue
 	fi
 
 	test_$cur
-
 	umount memcg/
 done
 
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to