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
37 SET PATH=%PYTHONBIN%;%PYTHONTOOLS%;%PATH%
39 REM This script is located in test/jenkins but needs to be run from test.
40 REM Find out the script's directory and then go to the dir one level above.
43 REM Clean up leftovers from a former run
45 IF %COVERAGE% == COVERAGE DEL coverage.xml
46 IF %COVERAGE% == COVERAGE DEL .coverage
48 REM Now run a list of test files in a loop. Abort the loop if a test failed.
49 REM If this is a simple functional test, abort the loop if a test failed.
50 REM For a run with coverage, execute them all.
51 FOR /F "eol=# tokens=1" %%f in (%TESTLIST%) DO (
53 IF %COVERAGE% == NOCOVERAGE IF %PYLINT% == NOPYLINT IF ERRORLEVEL 1 GOTO FAIL
56 IF %COVERAGE% == COVERAGE CALL :DOCOVERAGE
58 IF %PYLINT% == PYLINT CALL :DOPYLINT
63 ECHO One of the tests failed, so i give up.
67 %PYTHONTOOLS%\coverage xml --omit=/usr/lib
68 IF NOT ERRORLEVEL 0 ECHO COVERAGE HAD A PROBLEM
69 GOTO :EOF [Return to Main]
72 CALL %PYTHONTOOLS%\pylint --rcfile test\jenkins\pylint.rc shinken > pylint.txt
73 IF NOT ERRORLEVEL 0 ECHO PYLINT HAD A PROBLEM
74 GOTO :EOF [Return to Main]
76 REM Here is where the tests actually run
79 IF %COVERAGE% == NOCOVERAGE IF %PYLINT% == NOPYLINT %PYTHONTOOLS%\nosetests -v -s --with-xunit %1
80 IF %COVERAGE% == COVERAGE %PYTHONTOOLS%\nosetests -v -s --with-xunit --with-coverage %1
81 IF ERRORLEVEL 1 GOTO :EOF
82 ECHO successfully ran %1
83 GOTO :EOF [Return to Main]