1 :: Copyright (C) 2009-2011 :
2 :: Gabes Jean, naparuba@gmail.com
3 :: Gerhard Lausser, Gerhard.Lausser@consol.de
5 :: This file is part of Shinken.
7 :: Shinken is free software: you can redistribute it and/or modify
8 :: it under the terms of the GNU Affero General Public License as published by
9 :: the Free Software Foundation, either version 3 of the License, or
10 :: (at your option) any later version.
12 :: Shinken is distributed in the hope that it will be useful,
13 :: but WITHOUT ANY WARRANTY; without even the implied warranty of
14 :: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 :: GNU Affero General Public License for more details.
17 :: You should have received a copy of the GNU Affero General Public License
18 :: along with Shinken. If not, see <http://www.gnu.org/licenses/>.
20 REM USAGE: RUNTESTS LIST_WITH_TESTS.txt [NO]COVERAGE [NO]PYLINT
23 ECHO RUNNING SHORT TESTS
29 IF NOT (%COVERAGE%) == (COVERAGE) SET COVERAGE=NOCOVERAGE
30 IF NOT (%PYLINT%) == (PYLINT) SET PYLINT=NOPYLINT
31 IF (%PYTHONVERS%) == (%PYTHONVERS%) SET PYTHONVERS=27
32 IF (%PYTHONVERS%) == (271) SET PYTHONVERS=27
33 IF (%PYTHONVERS%) == (266) SET PYTHONVERS=26
34 IF (%PYTHONVERS%) == (246) SET PYTHONVERS=24
35 SET PYTHONBIN=C:\Python%PYTHONVERS%
36 SET PYTHONTOOLS=C:\Python%PYTHONVERS%\Scripts
38 REM This script is located in test/jenkins but needs to be run from test.
39 REM Find out the script's directory and then go to the dir one level above.
42 REM Clean up leftovers from a former run
44 IF %COVERAGE% == COVERAGE DEL coverage.xml
45 IF %COVERAGE% == COVERAGE DEL .coverage
47 REM Now run a list of test files in a loop. Abort the loop if a test failed.
48 REM If this is a simple functional test, abort the loop if a test failed.
49 REM For a run with coverage, execute them all.
50 FOR /F "eol=# tokens=1" %%f in (%TESTLIST%) DO (
52 IF %COVERAGE% == NOCOVERAGE IF %PYLINT% == NOPYLINT IF ERRORLEVEL 1 GOTO FAIL
55 REM Merge the single coverage files
56 IF %COVERAGE% == COVERAGE %PYTHONTOOLS%\coverage xml --omit=/usr/lib
59 IF %PYLINT% == PYLINT %PYTHONTOOLS%\pylint -f parseable --disable=C0111,C0103,W0201,E1101 shinken shinken\modules shinken\modules\* > $DIR\pylint.txt
63 ECHO One of the tests failed, so i give up.
66 REM Here is where the tests actually run
69 IF %COVERAGE% == NOCOVERAGE IF %PYLINT% == NOPYLINT %PYTHONTOOLS%\nosetests -v -s --with-xunit %1
70 IF %COVERAGE% == COVERAGE %PYTHONTOOLS%\nosetests -v -s --with-xunit --with-coverage %1
71 IF ERRORLEVEL 1 goto :EOF
72 ECHO successfully ran %1
73 GOTO :EOF [Return to Main]