From dd6f8288440a13992cbc3065c47f2d4fddc56f68 Mon Sep 17 00:00:00 2001 From: Chris PeBenito Date: Tue, 18 Apr 2006 15:30:53 +0000 Subject: [PATCH] update test scripts --- tools/buildtest.sh | 52 +++++++++++++++++++++++++---------------- tools/quicktest.sh | 57 +++++++++++++++++++++++++++++++++++++++++++++ tools/regression.sh | 34 --------------------------- 3 files changed, 89 insertions(+), 54 deletions(-) create mode 100755 tools/quicktest.sh delete mode 100755 tools/regression.sh diff --git a/tools/buildtest.sh b/tools/buildtest.sh index 44a011ba..2878de35 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 00000000..e97f81d4 --- /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." diff --git a/tools/regression.sh b/tools/regression.sh deleted file mode 100755 index 6f861c1f..00000000 --- a/tools/regression.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -DISTROS="redhat gentoo debian suse" -TYPES="strict strict-mls strict-mcs targeted targeted-mls targeted-mcs" -POLVER="`checkpolicy -V |cut -f 1 -d ' '`" -SETFILES="/usr/sbin/setfiles" - -do_test() { - local OPTS="" - - for i in $TYPES; do - OPTS="TYPE=$i QUIET=@ DIRECT_INITRC=y" - [ ! -z "$1" ] && OPTS="$OPTS DISTRO=$1" - make bare || exit 1 - echo "**** Options: $OPTS ****" - echo -ne "\33]0;$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 - done -} - -# first to generic test -do_test - -# now distro-specitic test -for i in $DISTROS; do - do_test $i -done - -# clean up -make bare -echo "Completed successfully."