Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/03-macos-linux-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ jobs:
cmake==3.30.0 \
ninja==1.11.1 \
pytest \
pytest-xdist \
scikit-build-core \
setuptools_scm
shell: bash
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/05-windows-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
cmake==3.30.0 `
ninja==1.11.1 `
pytest `
pytest-xdist `
scikit-build-core `
setuptools_scm
shell: powershell
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/nightly_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
ninja==1.11.1 \
pytest \
pytest-cov \
pytest-xdist \
scikit-build-core \
setuptools_scm
shell: bash
Expand Down
19 changes: 15 additions & 4 deletions cmake/bazel.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,17 @@ if(NOT TARGET unittest)
# iOS: build-only target; tests are run on simulator separately
add_custom_target(unittest)
else()
include(ProcessorCount)
ProcessorCount(NPROC)
if(NPROC EQUAL 0)
set(NPROC 1)
endif()
math(EXPR PARALLEL_JOBS "(${NPROC} + 1) / 2")
add_custom_target(
unittest
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure
--build-config $<CONFIGURATION>
--parallel ${PARALLEL_JOBS}
)
endif()
endif()
Expand Down Expand Up @@ -1110,16 +1117,18 @@ function(cc_test)
"${CC_ARGS_UNPARSED_ARGUMENTS}"
)
add_dependencies(unittest ${CC_ARGS_NAME})
set(TEST_WORKING_DIR "${CMAKE_BINARY_DIR}/test_tmp/${CC_ARGS_NAME}")
file(MAKE_DIRECTORY "${TEST_WORKING_DIR}")
add_custom_target(
unittest.${CC_ARGS_NAME}
COMMAND $<TARGET_FILE:${CC_ARGS_NAME}> "${CC_ARGS_ARGS}"
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
WORKING_DIRECTORY ${TEST_WORKING_DIR}
DEPENDS ${CC_ARGS_NAME}
)
add_test(
NAME ${CC_ARGS_NAME}
COMMAND $<TARGET_FILE:${CC_ARGS_NAME}> "${CC_ARGS_ARGS}"
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
WORKING_DIRECTORY ${TEST_WORKING_DIR}
)
endfunction()

Expand Down Expand Up @@ -1925,16 +1934,18 @@ function(cuda_test)
"${CUDA_ARGS_UNPARSED_ARGUMENTS}"
)
add_dependencies(unittest ${CUDA_ARGS_NAME})
set(TEST_WORKING_DIR "${CMAKE_BINARY_DIR}/test_tmp/${CUDA_ARGS_NAME}")
file(MAKE_DIRECTORY "${TEST_WORKING_DIR}")
add_custom_target(
unittest.${CUDA_ARGS_NAME}
COMMAND $<TARGET_FILE:${CUDA_ARGS_NAME}> "${CUDA_ARGS_ARGS}"
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
WORKING_DIRECTORY ${TEST_WORKING_DIR}
DEPENDS ${CUDA_ARGS_NAME}
)
add_test(
NAME ${CUDA_ARGS_NAME}
COMMAND $<TARGET_FILE:${CUDA_ARGS_NAME}> "${CUDA_ARGS_ARGS}"
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
WORKING_DIRECTORY ${TEST_WORKING_DIR}
)
endfunction()

Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ test = [
"pytest >=8.0",
"pytest-cov >=4.1",
"pytest-mock >=3.12",
"pytest-xdist >=3.5",
"cibuildwheel == 3.4.0",
]
docs = [
Expand Down Expand Up @@ -142,6 +143,7 @@ addopts = [
"--strict-markers",
"--strict-config",
"--tb=short",
"-n=auto",
]
xfail_strict = true
log_cli_level = "INFO"
Expand Down Expand Up @@ -169,7 +171,7 @@ build = [
"cp314-*",
]
build-frontend = "build"
test-requires = ["pytest", "numpy"]
test-requires = ["pytest", "pytest-xdist", "numpy"]
test-command = "cd {project} && pytest python/tests -v --tb=short"
build-verbosity = 1

Expand Down
3 changes: 3 additions & 0 deletions tests/db/crash_recovery/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,8 @@ foreach(CC_SRCS ${ALL_TEST_SRCS})
)
add_dependencies(${CC_TARGET} data_generator)
add_dependencies(${CC_TARGET} collection_optimizer)
set_tests_properties(${CC_TARGET} PROPERTIES
ENVIRONMENT "TEST_BINARY_DIR=${PROJECT_BINARY_DIR}"
)
cc_test_suite(zvec_crash_recovery ${CC_TARGET})
endforeach()
6 changes: 6 additions & 0 deletions tests/db/crash_recovery/optimize_recovery_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ static std::string LocateOptimizeGenerator() {
}
#endif

const char *test_binary_dir = std::getenv("TEST_BINARY_DIR");
if (test_binary_dir != nullptr) {
candidates.push_back(std::string(test_binary_dir) + "/");
candidates.push_back(std::string(test_binary_dir) + "/bin/");
}

for (auto &p : candidates) {
p += base_name;
#ifdef _WIN32
Expand Down
6 changes: 6 additions & 0 deletions tests/db/crash_recovery/write_recovery_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ static std::string LocateDataGenerator() {
}
#endif

const char *test_binary_dir = std::getenv("TEST_BINARY_DIR");
if (test_binary_dir != nullptr) {
candidates.push_back(std::string(test_binary_dir) + "/");
candidates.push_back(std::string(test_binary_dir) + "/bin/");
}


for (auto &p : candidates) {
p += base_name;
Expand Down
Loading