Skip to content

Commit

Permalink
Merge pull request #41 from naviqore/feature/add-ctest-options
Browse files Browse the repository at this point in the history
Feature/add ctest options
  • Loading branch information
Brunner246 authored Sep 24, 2024
2 parents 20288f4 + 58adb60 commit 1159d79
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 33 deletions.
38 changes: 15 additions & 23 deletions .github/workflows/build-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ jobs:
include:
- os: windows-latest
compiler: msvc
triplet: x64-windows-release
- os: ubuntu-latest
compiler: gcc-linux
triplet: x64-linux

steps:
- name: Checkout code
Expand All @@ -31,39 +33,29 @@ jobs:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 60
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 60
- name: vcpkg installation
shell: bash
run: |
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
if [[ "${{ runner.os }}" == "Windows" ]]; then
./bootstrap-vcpkg.bat
else
./bootstrap-vcpkg.sh
fi
./vcpkg integrate install
./vcpkg install
- name: Cache vcpkg packages
uses: actions/[email protected]
- name: Set up vcpkg
uses: johnwason/vcpkg-action@v6
with:
path: |
${{ github.workspace }}/vcpkg/installed
${{ github.workspace }}/vcpkg/vcpkg
key: ${{ runner.os }}-vcpkg-${{ hashFiles('vcpkg.json') }}
restore-keys: |
${{ runner.os }}-vcpkg-
manifest-dir: ${{ github.workspace }}
triplet: ${{ matrix.triplet }}
token: ${{ github.token }}
github-binarycache: true

- name: Configure CMake
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake -B cmake-build-release -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
- name: Build
run: |
cmake --build build --config Release
cmake --build cmake-build-release --config Release
- name: List contents of output directory
run: |
echo "Contents of output directory:"
ls -R ${{ github.workspace }}/output/bin/release
- name: Run tests
continue-on-error: true
run: |
cd cmake-build-release
ctest -C Release --output-on-failure
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ set(CPM_DOWNLOAD_LOCATION "${CMAKE_SOURCE_DIR}/cmake/CPM.cmake")

# Download GTFS Switzerland
include(${CMAKE_SOURCE_DIR}/CMake/DownloadAndUnzip.cmake)
set(ZIP_URL "https://opentransportdata.swiss/en/dataset/timetable-2024-gtfs2020/permalink/gtfs_fp2024_2024-09-23.zip")
set(ZIP_URL "https://opentransportdata.swiss/dataset/7cc000ea-0973-40c1-a557-7971a4939da3/resource/756b62d2-3b63-4e74-8693-03212eeb0fac/download/gtfs_fp2024_2024-09-23.zip")
set(UNZIP_DIR "${CMAKE_SOURCE_DIR}/resources/gtfs_switzerland")

download_and_unzip(${ZIP_URL} ${UNZIP_DIR})
Expand Down Expand Up @@ -67,3 +67,10 @@ add_subdirectory(test/test_gtfsRaptorConfig)
# BECHMARKS
add_subdirectory(benchmark/benchmark_schedule)
add_subdirectory(benchmark/benchmark_gtfsRaptor)

# TEST COMMANDS
add_test(NAME GtfsRaptorConfigTest COMMAND "gtfsRaptorConfig_tests")
add_test(NAME ScheduleTest COMMAND "schedule_tests")
add_test(NAME RaptorTest COMMAND "raptor_tests")
add_test(NAME geomety COMMAND "geometry_tests")
add_test(NAME TestK2dTree COMMAND "geometry_tests")
6 changes: 2 additions & 4 deletions test/test_geometry/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ target_link_libraries(${PROJECT_NAME} PRIVATE
logging
)

set(BINARY ${PROJECT_NAME})

add_test(NAME geomety COMMAND ${BINARY})
add_test(NAME TestK2dTree COMMAND ${BINARY})
include(GoogleTest)
gtest_discover_tests(${PROJECT_NAME})

target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/src/geometry/utils)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_BINARY_DIR}/src)
Expand Down
5 changes: 0 additions & 5 deletions test/test_raptor/src/test_routeBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,3 @@ TEST_F(RouteBuilderTest, ShouldBuildRoute) {
builder->addStopTime(TRIP_1, 2, STOP_3, raptor::StopTime(500, 600));
EXPECT_NO_THROW(builder->build());
}

TEST_F(RouteBuilderTest, ShouldNotBuildRouteWithUnsetStopTimes) {
builder->addStopTime(TRIP_1, 0, STOP_1, raptor::StopTime(100, 200));
EXPECT_THROW(builder->build(), std::runtime_error);
}

0 comments on commit 1159d79

Please sign in to comment.