make testing

This commit is contained in:
netblue30 2016-04-23 16:16:51 -04:00
parent 2169eadad8
commit 7e1c057aed
14 changed files with 52 additions and 211 deletions

View file

@ -243,6 +243,8 @@ dist:
cd $(NAME)-$(VERSION); mkdir -p test; cp -a ../test/profiles test/.; cd ..
cd $(NAME)-$(VERSION); mkdir -p test; cp -a ../test/apps test/.; cd ..
cd $(NAME)-$(VERSION); mkdir -p test; cp -a ../test/utils test/.; cd ..
cd $(NAME)-$(VERSION); mkdir -p test; cp -a ../test/apps-x11 test/.; cd ..
cd $(NAME)-$(VERSION); mkdir -p test; cp -a ../test/firemon test/.; cd ..
cd $(NAME)-$(VERSION); rm -fr `find . -name .svn`; rm -fr $(NAME)-$(VERSION); cd ..
tar -cjvf $(NAME)-$(VERSION).tar.bz2 $(NAME)-$(VERSION)
rm -fr $(NAME)-$(VERSION)
@ -271,8 +273,14 @@ test-profiles:
test-apps:
cd test/apps; ./apps.sh | grep TESTING
test-apps-x11:
cd test/apps-x11; ./apps-x11.sh | grep TESTING
test-firemon:
cd test/firemon; ./firemon.sh | grep TESTING
test-utils:
cd test/utils; ./utils.sh | grep TESTING
test: test-profiles test-utils test-apps
test: test-profiles test-utils test-apps test-apps-x11 test-firemon
echo "TEST COMPLETE"

View file

@ -1,10 +1,16 @@
#!/bin/bash
# This file is part of Firejail project
# Copyright (C) 2014-2016 Firejail Authors
# License GPL v2
export MALLOC_CHECK_=3
export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
which xterm
if [ "$?" -eq 0 ];
then
echo "TESTING: xterm x11"
./xterm-x11.exp
./xterm.exp
else
echo "TESTING: xterm not found"
fi
@ -13,7 +19,7 @@ which firefox
if [ "$?" -eq 0 ];
then
echo "TESTING: firefox x11"
./firefox-x11.exp
./firefox.exp
else
echo "TESTING: firefox not found"
fi
@ -22,7 +28,7 @@ which chromium
if [ "$?" -eq 0 ];
then
echo "TESTING: chromium x11"
./chromium-x11.exp
./chromium.exp
else
echo "TESTING: chromium not found"
fi
@ -31,7 +37,7 @@ which transmission-gtk
if [ "$?" -eq 0 ];
then
echo "TESTING: transmission-gtk x11"
./transmission-gtk-x11.exp
./transmission-gtk.exp
else
echo "TESTING: transmission-gtk not found"
fi
@ -40,8 +46,8 @@ which icedove
if [ "$?" -eq 0 ];
then
echo "TESTING: icedove x11"
./icedove-x11.exp
./icedove.exp
else
echo "TESTING: chromium not found"
echo "TESTING: icedovenot found"
fi

View file

@ -1,4 +1,7 @@
#!/usr/bin/expect -f
# This file is part of Firejail project
# Copyright (C) 2014-2016 Firejail Authors
# License GPL v2
set timeout 10
spawn $env(SHELL)

View file

@ -1,4 +1,7 @@
#!/usr/bin/expect -f
# This file is part of Firejail project
# Copyright (C) 2014-2016 Firejail Authors
# License GPL v2
set timeout 10
spawn $env(SHELL)

View file

@ -1,4 +1,7 @@
#!/usr/bin/expect -f
# This file is part of Firejail project
# Copyright (C) 2014-2016 Firejail Authors
# License GPL v2
set timeout 10
spawn $env(SHELL)

View file

@ -1,4 +1,7 @@
#!/usr/bin/expect -f
# This file is part of Firejail project
# Copyright (C) 2014-2016 Firejail Authors
# License GPL v2
set timeout 10
spawn $env(SHELL)

View file

@ -1,4 +1,7 @@
#!/usr/bin/expect -f
# This file is part of Firejail project
# Copyright (C) 2014-2016 Firejail Authors
# License GPL v2
set timeout 10
spawn $env(SHELL)

View file

@ -1,202 +0,0 @@
#!/bin/bash
arr[1]="TEST 1: svn and standard compilation"
arr[2]="TEST 2: cppcheck"
arr[3]="TEST 3: compile seccomp disabled, chroot disabled, bind disabled"
arr[4]="TEST 4: rvtest"
arr[5]="TEST 5: expect test as root, no malloc perturb"
arr[6]="TEST 6: expect test as user, no malloc perturb"
arr[7]="TEST 7: expect test as root, malloc perturb"
arr[8]="TEST 8: expect test as user, malloc perturb"
# remove previous reports and output file
cleanup() {
rm -f out-test
rm -f output*
rm -f report*
rm -fr firejail-trunk
}
print_title() {
echo
echo
echo
echo "**************************************************"
echo $1
echo "**************************************************"
}
while [ $# -gt 0 ]; do # Until you run out of parameters . . .
case "$1" in
--clean)
cleanup
exit
;;
--help)
echo "./autotest.sh [--clean|--help]"
exit
;;
esac
shift # Check next set of parameters.
done
cleanup
# enable sudo
sudo ls -al
#*****************************************************************
# TEST 1
#*****************************************************************
# - checkout source code
# - check compilation
# - install
#*****************************************************************
print_title "${arr[1]}"
svn checkout svn://svn.code.sf.net/p/firejail/code-0/trunk firejail-trunk
cd firejail-trunk
./configure --prefix=/usr 2>&1 | tee ../output-configure
make -j4 2>&1 | tee ../output-make
sudo make install 2>&1 | tee ../output-install
cd src/tools
gcc -o rvtest rvtest.c
cd ../..
cd test
sudo ./configure > /dev/null
cd ../..
grep warning output-configure output-make output-install > ./report-test1
grep error output-configure output-make output-install >> ./report-test1
cat report-test1 > out-test1
#*****************************************************************
# TEST 2
#*****************************************************************
# - run cppcheck
#*****************************************************************
print_title "${arr[2]}"
cd firejail-trunk
cp /home/netblue/bin/cfg/std.cfg .
cppcheck --force . 2>&1 | tee ../output-cppcheck
cd ..
grep error output-cppcheck > report-test2
cat report-test2 > out-test2
#*****************************************************************
# TEST 3
#*****************************************************************
# - disable seccomp configuration
# - check compilation
#*****************************************************************
print_title "${arr[3]}"
# seccomp
cd firejail-trunk
make distclean
./configure --prefix=/usr --disable-seccomp 2>&1 | tee ../output-configure-noseccomp
make -j4 2>&1 | tee ../output-make-noseccomp
cd ..
grep warning output-configure-noseccomp output-make-noseccomp > ./report-test3
grep error output-configure-noseccomp output-make-noseccomp >> ./report-test3
# chroot
cd firejail-trunk
make distclean
./configure --prefix=/usr --disable-chroot 2>&1 | tee ../output-configure-nochroot
make -j4 2>&1 | tee ../output-make-nochroot
cd ..
grep warning output-configure-nochroot output-make-nochroot >> ./report-test3
grep error output-configure-nochroot output-make-nochroot >> ./report-test3
# bind
cd firejail-trunk
make distclean
./configure --prefix=/usr --disable-bind 2>&1 | tee ../output-configure-nobind
make -j4 2>&1 | tee ../output-make-nobind
cd ..
grep warning output-configure-nobind output-make-nobind >> ./report-test3
grep error output-configure-nobind output-make-nobind >> ./report-test3
# save result
cat report-test3 > out-test3
#*****************************************************************
# TEST 4
#*****************************************************************
# - rvtest
#*****************************************************************
print_title "${arr[4]}"
cd firejail-trunk
cd test
../src/tools/rvtest test.rv 2>/dev/null | tee ../../output-test4 | grep TESTING
cd ../..
grep TESTING output-test4 > ./report-test4
grep ERROR report-test4 > out-test4
#*****************************************************************
# TEST 5
#*****************************************************************
# - expect test as root, no malloc perturb
#*****************************************************************
print_title "${arr[5]}"
cd firejail-trunk/test
sudo ./test-root.sh 2>&1 | tee ../../output-test5 | grep TESTING
cd ../..
grep TESTING output-test5 > ./report-test5
grep ERROR report-test5 > out-test5
#*****************************************************************
# TEST 6
#*****************************************************************
# - expect test as user, no malloc perturb
#*****************************************************************
print_title "${arr[6]}"
cd firejail-trunk/test
./test.sh 2>&1 | tee ../../output-test6 | grep TESTING
cd ../..
grep TESTING output-test6 > ./report-test6
grep ERROR report-test6 > out-test6
#*****************************************************************
# TEST 7
#*****************************************************************
# - expect test as root, malloc perturb
#*****************************************************************
print_title "${arr[7]}"
export MALLOC_CHECK_=3
export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
cd firejail-trunk/test
sudo ./test-root.sh 2>&1 | tee ../../output-test7 | grep TESTING
cd ../..
grep TESTING output-test7 > ./report-test7
grep ERROR report-test7 > out-test7
#*****************************************************************
# TEST 8
#*****************************************************************
# - expect test as user, malloc perturb
#*****************************************************************
print_title "${arr[8]}"
cd firejail-trunk/test
./test.sh 2>&1 | tee ../../output-test8| grep TESTING
cd ../..
grep TESTING output-test8 > ./report-test8
grep ERROR report-test8 > out-test8
#*****************************************************************
# PRINT REPORTS
#*****************************************************************
echo
echo
echo
echo
echo "**********************************************************"
echo "TEST RESULTS"
echo "**********************************************************"
wc -l out-test*
rm out-test*
echo
exit

View file

@ -1,4 +1,7 @@
#!/usr/bin/expect -f
# This file is part of Firejail project
# Copyright (C) 2014-2016 Firejail Authors
# License GPL v2
set timeout 10
spawn $env(SHELL)

10
test/firemon/firemon.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/bash
# This file is part of Firejail project
# Copyright (C) 2014-2016 Firejail Authors
# License GPL v2
echo "TESTING: firemon --seccomp (test/firemon/seccomp.exp)"
./seccomp.exp
echo "TESTING: firemon --caps (test/firemon/caps.exp)"
./caps.exp

View file

@ -1,4 +1,7 @@
#!/usr/bin/expect -f
# This file is part of Firejail project
# Copyright (C) 2014-2016 Firejail Authors
# License GPL v2
set timeout 10
spawn $env(SHELL)

View file

@ -171,8 +171,6 @@ else
echo "TESTING: dash not found"
fi
./test-apps-x11.sh
echo "TESTING: PID (pid.exp)"
./pid.exp