diff --git a/.travis.yml b/.travis.yml index f12426d..7e81701 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,9 +21,12 @@ before_script: script: - make - - make pawncc_tests + - make test - make package +after_failure: + - cat Testing/Temporary/LastTest.log + deploy: provider: releases api_key: diff --git a/appveyor.yml b/appveyor.yml index bffa5e9..85529fa 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,7 +13,10 @@ build_script: - cmake --build . --config %CONFIGURATION% --target package test_script: - - cmake --build . --config %CONFIGURATION% --target pawncc_tests + - ctest --build-config %CONFIGURATION% + +on_failure: + - type Testing\Temporary\LastTest.log artifacts: - path: build/pawnc-*-windows.zip diff --git a/source/compiler/CMakeLists.txt b/source/compiler/CMakeLists.txt index 018c03e..236ca68 100644 --- a/source/compiler/CMakeLists.txt +++ b/source/compiler/CMakeLists.txt @@ -164,28 +164,31 @@ if(MSVC) endif() # Generate targets for running compiler tests -set(PAWNRUNS_SRCS - pawnruns.c - ../amx/amx.c - ../amx/amx.h - ../amx/amxaux.c - ../amx/amxaux.h - ../amx/amxcons.c - ../amx/amxcore.c -) -if(UNIX) +include(CTest) +if(BUILD_TESTING) set(PAWNRUNS_SRCS - ${PAWNRUNS_SRCS} - ../linux/getch.c - ../linux/getch.h - ../linux/binreloc.c + pawnruns.c + ../amx/amx.c + ../amx/amx.h + ../amx/amxaux.c + ../amx/amxaux.h + ../amx/amxcons.c + ../amx/amxcore.c ) + if(UNIX) + set(PAWNRUNS_SRCS + ${PAWNRUNS_SRCS} + ../linux/getch.c + ../linux/getch.h + ../linux/binreloc.c + ) + endif() + add_executable(pawnruns ${PAWNRUNS_SRCS}) + if(UNIX) + target_link_libraries(pawnruns dl) + endif() + add_subdirectory(tests) endif() -add_executable(pawnruns ${PAWNRUNS_SRCS}) -if(UNIX) - target_link_libraries(pawnruns dl) -endif() -add_subdirectory(tests) # Generate a binary package with CPack set(CPACK_PACKAGE_NAME pawnc) diff --git a/source/compiler/tests/CMakeLists.txt b/source/compiler/tests/CMakeLists.txt index e49e05e..282f668 100644 --- a/source/compiler/tests/CMakeLists.txt +++ b/source/compiler/tests/CMakeLists.txt @@ -1,7 +1,7 @@ find_package(PythonInterp 2.7) if(PYTHONINTERP_FOUND) - add_custom_target(pawncc_tests COMMAND + add_custom_target(pawncc_tests COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/run_tests.py -c $ @@ -10,6 +10,20 @@ if(PYTHONINTERP_FOUND) -i ../../../include DEPENDS pawncc WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + + file(GLOB_RECURSE meta_files "*.meta") + foreach(meta_file IN LISTS meta_files) + get_filename_component(test_name ${meta_file} NAME_WE) + add_test(NAME ${test_name} + COMMAND ${PYTHON_EXECUTABLE} + ${CMAKE_CURRENT_SOURCE_DIR}/run_tests.py + -c $ + -d $ + -r $ + -i ../../../include + ${test_name} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + endforeach() else() - message("Python was not found, you will not be able to run the compiler tests") + message("Python was not found, you will not be able to run the tests") endif()