Skip to content

Commit

Permalink
Let CartesianProductJoinLazyTest run a single ctest instance (#1648)
Browse files Browse the repository at this point in the history
The `CartesianProductJoin` test contains a parametrized test suite which automatically creates more than 1000 test cases, each of which run very fast.  This PR merges these test cases s.t. ctest only runs them as a single test case `CartesianProductJoinTest`.
This increases the runtime of the GitHub actions by about 10%.
  • Loading branch information
RobinTF authored Nov 29, 2024
1 parent 0d537b0 commit 9c41750
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@ function(addLinkAndDiscoverTest basename)

endfunction()

# Add a GTest/GMock test case that is called `basename` and compiled from a file called
# `basename.cpp`. All tests are linked against `gmock_main` and the threading library.
# In contrast to `addLinkAndDiscoverTest` this doesn't let ctest run all subtests individually,
# but all at once to reduce overhead in the CI pipeline.
function(addLinkAndRunAsSingleTest basename)
if (SINGLE_TEST_BINARY)
target_sources(QLeverAllUnitTestsMain PUBLIC ${basename}.cpp)
qlever_target_link_libraries(QLeverAllUnitTestsMain ${ARGN})
else ()
addTest(${basename})
linkTest(${basename} ${ARGN})
add_test(NAME ${basename} COMMAND ${basename})
endif ()

endfunction()

# Usage: `addAndLinkTestSerial(basename, [additionalLibraries...]`
# Similar to `addAndLinkTest` but also requires that the test is run serially
# (without any of the other test cases running in parallel). This can be
Expand Down
2 changes: 1 addition & 1 deletion test/engine/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
add_subdirectory(idTable)
addLinkAndDiscoverTest(IndexScanTest engine)
addLinkAndDiscoverTest(CartesianProductJoinTest engine)
addLinkAndRunAsSingleTest(CartesianProductJoinTest engine)
addLinkAndDiscoverTest(TextIndexScanForWordTest engine)
addLinkAndDiscoverTest(TextIndexScanForEntityTest engine)
addLinkAndDiscoverTest(SpatialJoinTest engine)
Expand Down

0 comments on commit 9c41750

Please sign in to comment.