| 1 | #!/bin/bash |
| 2 | set -e |
| 3 | |
| 4 | CPPDAP_SRC_DIR=${PWD}/src |
| 5 | CPPDAP_GOOGLETEST_DIR=/usr/src/googletest |
| 6 | |
| 7 | cat > "${AUTOPKGTEST_TMP}/CMakeLists.txt" << EOF |
| 8 | cmake_minimum_required(VERSION 3.13) |
| 9 | project(cppdap_autopkgtest) |
| 10 | |
| 11 | find_package(cppdap REQUIRED) |
| 12 | |
| 13 | set(DAP_TEST_LIST |
| 14 | ${CPPDAP_SRC_DIR}/any_test.cpp |
| 15 | ${CPPDAP_SRC_DIR}/chan_test.cpp |
| 16 | ${CPPDAP_SRC_DIR}/content_stream_test.cpp |
| 17 | ${CPPDAP_SRC_DIR}/dap_test.cpp |
| 18 | ${CPPDAP_SRC_DIR}/json_serializer_test.cpp |
| 19 | ${CPPDAP_SRC_DIR}/network_test.cpp |
| 20 | ${CPPDAP_SRC_DIR}/optional_test.cpp |
| 21 | ${CPPDAP_SRC_DIR}/rwmutex_test.cpp |
| 22 | ${CPPDAP_SRC_DIR}/session_test.cpp |
| 23 | ${CPPDAP_SRC_DIR}/socket_test.cpp |
| 24 | ${CPPDAP_SRC_DIR}/traits_test.cpp |
| 25 | ${CPPDAP_SRC_DIR}/typeinfo_test.cpp |
| 26 | ${CPPDAP_SRC_DIR}/variant_test.cpp |
| 27 | ${CPPDAP_GOOGLETEST_DIR}/googletest/src/gtest-all.cc |
| 28 | ) |
| 29 | |
| 30 | set(DAP_TEST_INCLUDE_DIR |
| 31 | ${CPPDAP_GOOGLETEST_DIR}/googlemock/include/ |
| 32 | ${CPPDAP_GOOGLETEST_DIR}/googletest/ |
| 33 | ${CPPDAP_GOOGLETEST_DIR}/googletest/include/ |
| 34 | ) |
| 35 | |
| 36 | add_executable(cppdap-unittests \${DAP_TEST_LIST}) |
| 37 | target_compile_definitions(cppdap-unittests PRIVATE CPPDAP_JSON_JSONCPP=1) |
| 38 | target_include_directories(cppdap-unittests PRIVATE \${DAP_TEST_INCLUDE_DIR}) |
| 39 | target_link_libraries(cppdap-unittests PRIVATE cppdap::cppdap JsonCpp::JsonCpp) |
| 40 | EOF |
| 41 | |
| 42 | cd "$AUTOPKGTEST_TMP" |
| 43 | |
| 44 | cmake . -DCMAKE_CXX_FLAGS=-Wno-psabi |
| 45 | cmake --build . --verbose |
| 46 | ./cppdap-unittests |
| 47 |