|
Chris PeBenito |
dd6f82 |
#!/bin/bash
|
|
Chris PeBenito |
dd6f82 |
|
|
Chris PeBenito |
dd6f82 |
TYPES="strict targeted-mcs strict-mls"
|
|
Chris PeBenito |
dd6f82 |
POLVER="`checkpolicy -V |cut -f 1 -d ' '`"
|
|
Chris PeBenito |
dd6f82 |
SETFILES="/usr/sbin/setfiles"
|
|
Chris PeBenito |
6c5614 |
SE_LINK="time -p /usr/bin/semodule_link"
|
|
Chris PeBenito |
dd6f82 |
|
|
Chris PeBenito |
dd6f82 |
die() {
|
|
Chris PeBenito |
dd6f82 |
if [ "$1" -eq "1" ]; then
|
|
Chris PeBenito |
dd6f82 |
echo "failed with options: $2"
|
|
Chris PeBenito |
dd6f82 |
fi
|
|
Chris PeBenito |
dd6f82 |
|
|
Chris PeBenito |
dd6f82 |
exit 1
|
|
Chris PeBenito |
dd6f82 |
}
|
|
Chris PeBenito |
dd6f82 |
|
|
Chris PeBenito |
6c5614 |
cleanup_mon() {
|
|
Chris PeBenito |
6c5614 |
make MONOLITHIC=y bare
|
|
Chris PeBenito |
6c5614 |
}
|
|
Chris PeBenito |
6c5614 |
|
|
Chris PeBenito |
6c5614 |
cleanup_mod() {
|
|
Chris PeBenito |
dd6f82 |
make MONOLITHIC=n bare
|
|
Chris PeBenito |
dd6f82 |
}
|
|
Chris PeBenito |
dd6f82 |
|
|
Chris PeBenito |
dd6f82 |
do_test() {
|
|
Chris PeBenito |
dd6f82 |
local OPTS=""
|
|
Chris PeBenito |
dd6f82 |
|
|
Chris PeBenito |
dd6f82 |
for i in $TYPES; do
|
|
Chris PeBenito |
dd6f82 |
# Monolithic tests
|
|
Chris PeBenito |
6c5614 |
trap cleanup_mon SIGINT SIGQUIT
|
|
Chris PeBenito |
dd6f82 |
OPTS="TYPE=$i MONOLITHIC=y QUIET=y DIRECT_INITRC=y"
|
|
Chris PeBenito |
dd6f82 |
[ ! -z "$1" ] && OPTS="$OPTS DISTRO=$1"
|
|
Chris PeBenito |
dd6f82 |
echo "**** Options: $OPTS ****"
|
|
Chris PeBenito |
dd6f82 |
echo -ne "\33]0;mon $i $1\007"
|
|
Chris PeBenito |
dd6f82 |
make $OPTS conf || die "$?" "$OPTS"
|
|
Chris PeBenito |
dd6f82 |
make $OPTS || die "$?" "$OPTS"
|
|
Chris PeBenito |
dd6f82 |
make $OPTS file_contexts || die "$?" "$OPTS"
|
|
Chris PeBenito |
dd6f82 |
$SETFILES -q -c policy.$POLVER file_contexts || die "$?" "$OPTS"
|
|
Chris PeBenito |
6c5614 |
cleanup_mon
|
|
Chris PeBenito |
dd6f82 |
|
|
Chris PeBenito |
dd6f82 |
# Loadable module tests
|
|
Chris PeBenito |
6c5614 |
trap cleanup_mod SIGINT SIGQUIT
|
|
Chris PeBenito |
dd6f82 |
OPTS="TYPE=$i MONOLITHIC=n QUIET=y DIRECT_INITRC=y"
|
|
Chris PeBenito |
dd6f82 |
[ ! -z "$1" ] && OPTS="$OPTS DISTRO=$1"
|
|
Chris PeBenito |
dd6f82 |
echo "**** Options: $OPTS ****"
|
|
Chris PeBenito |
dd6f82 |
echo -ne "\33]0;mod $i $1\007"
|
|
Chris PeBenito |
dd6f82 |
make $OPTS conf || die "$?" "$OPTS"
|
|
Chris PeBenito |
dd6f82 |
make $OPTS base || die "$?" "$OPTS"
|
|
Chris PeBenito |
dd6f82 |
make $OPTS -j2 modules || die "$?" "$OPTS"
|
|
Chris PeBenito |
0950ee |
make $OPTS validate || die "$?" "$OPTS"
|
|
Chris PeBenito |
6c5614 |
cleanup_mod
|
|
Chris PeBenito |
dd6f82 |
done
|
|
Chris PeBenito |
dd6f82 |
}
|
|
Chris PeBenito |
dd6f82 |
|
|
Chris PeBenito |
6c5614 |
cleanup_mon
|
|
Chris PeBenito |
6c5614 |
cleanup_mod
|
|
Chris PeBenito |
dd6f82 |
do_test
|
|
Chris PeBenito |
dd6f82 |
|
|
Chris PeBenito |
dd6f82 |
echo "Completed successfully."
|