[selinux-policy: 1370/3172] update test scripts

Daniel J Walsh dwalsh at fedoraproject.org
Thu Oct 7 21:03:53 UTC 2010


commit dd6f8288440a13992cbc3065c47f2d4fddc56f68
Author: Chris PeBenito <cpebenito at tresys.com>
Date:   Tue Apr 18 15:30:53 2006 +0000

    update test scripts

 tools/buildtest.sh  |   52 ++++++++++++++++++++++++++++-----------------
 tools/quicktest.sh  |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/regression.sh |   34 ------------------------------
 3 files changed, 89 insertions(+), 54 deletions(-)
---
diff --git a/tools/buildtest.sh b/tools/buildtest.sh
index 44a011b..2878de3 100755
--- a/tools/buildtest.sh
+++ b/tools/buildtest.sh
@@ -1,46 +1,58 @@
 #!/bin/bash
 
-DISTROS="redhat gentoo debian suse"
-TYPES="strict strict-mls strict-mcs targeted targeted-mls targeted-mcs"
+DISTROS="rhel4 gentoo debian"
+TYPES="strict targeted strict-mcs targeted-mcs strict-mls targeted-mls"
 POLVER="`checkpolicy -V |cut -f 1 -d ' '`"
 SETFILES="/usr/sbin/setfiles"
 SE_LINK="/usr/bin/semodule_link"
 
+die() {
+	if [ "$1" -eq "1" ]; then
+		echo "failed with options: $2"
+	fi
+
+	exit 1
+}
+
+cleanup() {
+	make bare
+	make MONOLITHIC=n bare
+}
+
 do_test() {
 	local OPTS=""
 
+	trap cleanup SIGINT SIGQUIT
+
 	for i in $TYPES; do
 		# Monolithic tests
-		OPTS="TYPE=$i QUIET=@ DIRECT_INITRC=y"
+		OPTS="TYPE=$i MONOLITHIC=y QUIET=y DIRECT_INITRC=y"
 		[ ! -z "$1" ] && OPTS="$OPTS DISTRO=$1"
 		echo "**** Options: $OPTS ****"
 		echo -ne "\33]0;mon $i $1\007"
-		make $OPTS conf || exit 1
-		make $OPTS || exit 1
-		make $OPTS file_contexts || exit 1
-		$SETFILES -q -c policy.$POLVER file_contexts || exit 1
-		make $OPTS bare || exit 1
+		make $OPTS conf || die "$?" "$OPTS"
+		make $OPTS || die "$?" "$OPTS"
+		make $OPTS file_contexts || die "$?" "$OPTS"
+		$SETFILES -q -c policy.$POLVER file_contexts || die "$?" "$OPTS"
+		make $OPTS bare || die "$?" "$OPTS"
 
 		# Loadable module tests
-		OPTS="TYPE=$i MONOLITHIC=n QUIET=@ DIRECT_INITRC=y"
+		OPTS="TYPE=$i MONOLITHIC=n QUIET=y DIRECT_INITRC=y"
 		[ ! -z "$1" ] && OPTS="$OPTS DISTRO=$1"
 		echo "**** Options: $OPTS ****"
 		echo -ne "\33]0;mod $i $1\007"
-		make $OPTS conf || exit 1
-		make $OPTS all || exit 1
+		make $OPTS conf || die "$?" "$OPTS"
+		make $OPTS base || die "$?" "$OPTS"
+		make $OPTS -j2 modules || die "$?" "$OPTS"
 		mv base.pp tmp
-#		$SE_LINK tmp/base.pp *.pp || exit 1
-		make $OPTS bare || exit 1
+		############# FIXME
+		rm dmesg.pp
+		$SE_LINK tmp/base.pp *.pp || die "$?" "$OPTS"
+		make $OPTS bare || die "$?" "$OPTS"
 	done
 }
 
-make bare || exit 1
-make MONOLITHIC=n bare || exit 1
-
+cleanup
 do_test
 
-for i in $DISTROS; do
-	do_test $i
-done
-
 echo "Completed successfully."
diff --git a/tools/quicktest.sh b/tools/quicktest.sh
new file mode 100755
index 0000000..e97f81d
--- /dev/null
+++ b/tools/quicktest.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+TYPES="strict targeted-mcs strict-mls"
+POLVER="`checkpolicy -V |cut -f 1 -d ' '`"
+SETFILES="/usr/sbin/setfiles"
+SE_LINK="/usr/bin/semodule_link"
+
+die() {
+	if [ "$1" -eq "1" ]; then
+		echo "failed with options: $2"
+	fi
+
+	exit 1
+}
+
+cleanup() {
+	make bare
+	make MONOLITHIC=n bare
+}
+
+do_test() {
+	local OPTS=""
+
+	trap cleanup SIGINT SIGQUIT
+
+	for i in $TYPES; do
+		# Monolithic tests
+		OPTS="TYPE=$i MONOLITHIC=y QUIET=y DIRECT_INITRC=y"
+		[ ! -z "$1" ] && OPTS="$OPTS DISTRO=$1"
+		echo "**** Options: $OPTS ****"
+		echo -ne "\33]0;mon $i $1\007"
+		make $OPTS conf || die "$?" "$OPTS"
+		make $OPTS || die "$?" "$OPTS"
+		make $OPTS file_contexts || die "$?" "$OPTS"
+		$SETFILES -q -c policy.$POLVER file_contexts || die "$?" "$OPTS"
+		make $OPTS bare || die "$?" "$OPTS"
+
+		# Loadable module tests
+		OPTS="TYPE=$i MONOLITHIC=n QUIET=y DIRECT_INITRC=y"
+		[ ! -z "$1" ] && OPTS="$OPTS DISTRO=$1"
+		echo "**** Options: $OPTS ****"
+		echo -ne "\33]0;mod $i $1\007"
+		make $OPTS conf || die "$?" "$OPTS"
+		make $OPTS base || die "$?" "$OPTS"
+		make $OPTS -j2 modules || die "$?" "$OPTS"
+		mv base.pp tmp
+		############# FIXME
+		rm dmesg.pp
+		$SE_LINK tmp/base.pp *.pp || die "$?" "$OPTS"
+		make $OPTS bare || die "$?" "$OPTS"
+	done
+}
+
+cleanup
+do_test
+
+echo "Completed successfully."


More information about the scm-commits mailing list