diff --git a/appveyor.yml b/appveyor.yml index c558c418b..c6c0c0c59 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3406d0370..e7596540a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -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}) diff --git a/test/cli/testutils.py b/test/cli/testutils.py index 84f791c3e..140fd5e2b 100644 --- a/test/cli/testutils.py +++ b/test/cli/testutils.py @@ -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()