*Change the jenkins/hudson test scripts
[shinken.git] / test / jenkins / runtests
blobcb0cc8720b1cf4985f87cf21c097cf784c3ddcb4
1 #!/bin/bash
2 #Copyright (C) 2009-2010 :
3 # Gabes Jean, naparuba@gmail.com
4 # Gerhard Lausser, Gerhard.Lausser@consol.de
6 #This file is part of Shinken.
8 #Shinken is free software: you can redistribute it and/or modify
9 #it under the terms of the GNU Affero General Public License as published by
10 #the Free Software Foundation, either version 3 of the License, or
11 #(at your option) any later version.
13 #Shinken is distributed in the hope that it will be useful,
14 #but WITHOUT ANY WARRANTY; without even the implied warranty of
15 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 #GNU Affero General Public License for more details.
18 #You should have received a copy of the GNU Affero General Public License
19 #along with Shinken. If not, see <http://www.gnu.org/licenses/>.
21 TESTLIST=$1
22 COVERAGE=$2
23 PYLINT=$2
24 TESTLIST=$(readlink -f $TESTLIST)
25 test "$COVERAGE" == "COVERAGE" || COVERAGE="NOCOVERAGE"
26 test "$PYLINT" == "PYLINT" || PYLINT="NOPYLINT"
28 DIR=$(cd $(dirname "$0"); pwd)
29 cd ${DIR}/..
30 echo `pwd`
32 # Cleanup leftover files from former runs
33 rm -f nosetests.xml
34 test $COVERAGE == "COVERAGE" && rm -f coverage.xml
35 test $COVERAGE == "COVERAGE" && rm -f .coverage
37 function launch_and_assert {
38 SCRIPT=$1
39 if test $COVERAGE == "NOCOVERAGE"; then
40 nosetests -v -s --with-xunit ./$SCRIPT
41 else
42 nosetests -v -s --with-xunit --with-coverage ./$SCRIPT
44 if [ $? != 0 ]
45 then
46 echo "Error : the test $SCRIPT failed"
47 exit 2
51 while read tfile
53 case ${tfile:0:1} in
54 "#")
56 *) launch_and_assert $tfile
58 esac
59 done < $TESTLIST
61 # Create the coverage file
62 test $COVERAGE == "COVERAGE" && coverage xml --omit=/usr/lib