appveyor: check that cmake builds work also. run test/cli tests.

This commit is contained in:
Daniel Marjamäki 2019-07-09 07:46:53 +02:00
parent 862c4ef87b
commit b68f50ea25
3 changed files with 28 additions and 6 deletions

View File

@ -54,10 +54,22 @@ environment:
# PlatformToolset: v140
# MYQTDIR: C:\Qt\5.11\msvc2015_64
install:
- pip install pytest
build_script:
- ECHO Building %configuration% %platform% with MSVC %VisualStudioVersion% using %PlatformToolset% PlatformToolset
- 'CALL "C:\Program Files (x86)\Microsoft Visual Studio %VisualStudioVersion%\VC\vcvarsall.bat" %vcvarsall_platform%'
# Visual studio project..
- msbuild "cppcheck.sln" /consoleloggerparameters:Verbosity=minimal /target:Build /property:Configuration="%configuration%";Platform=%platform% /p:PlatformToolset=%PlatformToolset% /maxcpucount /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
# cmake..
- mkdir build
- cd build
- cmake -DBUILD_TESTS=ON -G"NMake Makefiles" ..
- nmake
- copy bin\cppcheck.exe ..
- cd ..
# build gui..
- ECHO MYQTDIR=%MYQTDIR%
- 'IF defined MYQTDIR cd gui'
- 'IF defined MYQTDIR set QTDIR=%MYQTDIR%'
@ -66,8 +78,13 @@ build_script:
- 'IF defined MYQTDIR cd ..'
test_script:
- IF "%CONFIGURATION%" == "Debug" bin\debug\testrunner.exe
- IF "%CONFIGURATION%" == "Release" bin\testrunner.exe
- build\bin\testrunner.exe -q
- IF EXIST bin\debug\testrunner.exe bin\debug\testrunner.exe
- IF EXIST bin\testrunner.exe bin\testrunner.exe
- cd test\cli
- python -m pytest test-helloworld.py
- python -m pytest test-inline-suppress.py
- python -m pytest test-suppress-syntaxError.py
artifacts:
- path: bin

View File

@ -19,6 +19,10 @@ if (BUILD_TESTS)
COMMAND ${CMAKE_COMMAND} -E copy_directory "${PROJECT_SOURCE_DIR}/cfg"
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/cfg")
if (WIN32 AND NOT BORLAND)
target_link_libraries(testrunner Shlwapi.lib)
endif()
add_dependencies(testrunner copy_cfg)
add_test(NAME testrunner COMMAND testrunner WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})

View File

@ -43,14 +43,15 @@ def create_gui_project_file(project_file, root_path=None, import_project=None, p
# Run Cppcheck with args
def cppcheck(args):
exe = None
if os.path.isfile('../../bin/debug/cppcheck.exe'):
exe = '../../bin/debug/cppcheck.exe'
elif os.path.isfile('../../../bin/debug/cppcheck.exe'):
exe = '../../../bin/debug/cppcheck.exe'
if os.path.isfile('../../cppcheck.exe'):
exe = '../../cppcheck.exe'
elif os.path.isfile('../../../cppcheck.exe'):
exe = '../../../cppcheck.exe'
elif os.path.isfile('../../cppcheck'):
exe = '../../cppcheck'
else:
exe = '../../../cppcheck'
logging.info(exe + ' ' + ' '.join(args))
p = subprocess.Popen([exe] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
comm = p.communicate()