|
1 | | -include(GoogleTest) |
2 | | - |
3 | 1 | add_executable(integration-tests_ program.cpp ../src/testing/main.cpp) |
4 | 2 | target_link_libraries(integration-tests_ PRIVATE python-cpp gtest gtest_main cxxopts project_options project_warnings tsl::ordered_map) |
5 | | -# gtest_add_tests(TARGET integration-tests_) |
| 3 | +# gtest_discover_tests(integration-tests_) |
| 4 | + |
| 5 | +add_test( |
| 6 | + NAME integration-tests |
| 7 | + COMMAND ${PROJECT_SOURCE_DIR}/integration/run_integration_tests.sh $<TARGET_FILE:python> |
| 8 | + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/integration |
| 9 | +) |
| 10 | + |
| 11 | +# Ensure the test only runs after the required targets are built |
| 12 | +set_tests_properties(integration-tests PROPERTIES |
| 13 | + FIXTURES_REQUIRED "python_built" |
| 14 | +) |
6 | 15 |
|
7 | | -# cmake-format: off |
8 | | -add_custom_target( |
9 | | - integration-tests |
10 | | - COMMAND # $<TARGET_FILE:integration-tests_> |
11 | | - echo "------------------------" |
12 | | - && echo "Running python scripts:" |
13 | | - && echo "------------------------" |
14 | | - && echo "" |
15 | | - && $<TARGET_FILE:python> ${PROJECT_SOURCE_DIR}/integration/fibonacci/main.py --gc-frequency 1 |
16 | | - && $<TARGET_FILE:python> ${PROJECT_SOURCE_DIR}/integration/mandelbrot/mandelbrot.py --gc-frequency 1 |
17 | | - && ${PROJECT_SOURCE_DIR}/integration/run_python_tests.sh $<TARGET_FILE:python> |
18 | | - && echo "" |
19 | | - && echo "------------------------" |
20 | | - && echo "Testing LLVM backend:" |
21 | | - && echo "------------------------" |
22 | | - && echo "" |
23 | | - && ${PROJECT_SOURCE_DIR}/integration/run_llvm_python_tests.sh $<TARGET_FILE:python> |
24 | | - DEPENDS integration-tests_ python) |
25 | | -# cmake-format: on |
| 16 | +# Add a setup test that depends on building python |
| 17 | +add_test(NAME setup-python COMMAND ${CMAKE_COMMAND} -E echo "Python built") |
| 18 | +set_tests_properties(setup-python PROPERTIES |
| 19 | + FIXTURES_SETUP "python_built" |
| 20 | + DEPENDS python # This may not work in all CMake versions |
| 21 | +) |
0 commit comments