[apparmor] [PATCH] make sure failures actually fail in regression test runner

Kees Cook kees at ubuntu.com
Mon Jul 26 07:34:08 BST 2010


The "make tests" rules would not actually fail in the individual tests
failed. This patch retains the overall failure state and dies if any
regression tests fail.


=== modified file 'tests/regression/apparmor/Makefile'
--- tests/regression/apparmor/Makefile	2009-08-21 20:39:45 +0000
+++ tests/regression/apparmor/Makefile	2010-07-24 15:58:19 +0000
@@ -158,27 +158,39 @@
 tests: all
 	@if [ `whoami` = "root" ] ;\
 	then \
+		rc=0; \
 		for i in $(TESTS) ;\
 		do \
 			echo ;\
 			echo "running $$i" ;\
 			bash $$i.sh ;\
+			if [ $$? -ne 0 ] ; then \
+				rc=1;\
+			fi;\
 		done ;\
+		exit $$rc;\
 	else \
 		echo "must be root to run tests" ;\
+		exit 1;\
 	fi
 
 alltests: all
 	@if [ `whoami` = "root" ] ;\
 	then \
+		rc=0; \
 		for i in $(TESTS) $(RISKY_TESTS) ;\
 		do \
 			echo ;\
 			echo "running $$i" ;\
 			bash $$i.sh ;\
+			if [ $$? -ne 0 ] ; then \
+				rc=1;\
+			fi;\
 		done ;\
+		exit $$rc;\
 	else \
 		echo "must be root to run tests" ;\
+		exit 1;\
 	fi
 
 clean:


-- 
Kees Cook
Ubuntu Security Team



More information about the AppArmor mailing list