Skip to content
Merged
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/test_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,6 @@ jobs:
CXX: g++-${{ matrix.gcc }}
TENSORFLOW_VERSION: ${{ matrix.tf }}
SETUPTOOLS_ENABLE_FEATURES: "legacy-editable"
DP_BUILD_TESTING: 1
- run: dp --version
- run: pytest --cov=deepmd source/tests && codecov
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
else:
raise RuntimeError("Unsupported DP_VARIANT option: %s" % dp_variant)

if os.environ.get("DP_BUILD_TESTING", "0") == "1":
cmake_args.append("-DBUILD_TESTING:BOOL=TRUE")

# get tensorflow spec
tf_spec = find_spec("tensorflow")

Expand Down
6 changes: 6 additions & 0 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
cmake_minimum_required(VERSION 3.12)
project(DeePMD)

option(BUILD_TESTING "Enable converage" OFF)
if(BUILD_TESTING)
enable_testing()
add_subdirectory(${CMAKE_SOURCE_DIR}/cmake/coverage_config coverage_config)
endif()

# build cpp or python interfaces
if (NOT DEFINED BUILD_CPP_IF)
set(BUILD_CPP_IF TRUE)
Expand Down
4 changes: 4 additions & 0 deletions source/op/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ if (BUILD_PY_IF)
INSTALL_RPATH $ORIGIN
)
endif ()
if (CMAKE_TESTING_ENABLED)
target_link_libraries(op_abi PRIVATE coverage_config)
target_link_libraries(op_grads PRIVATE coverage_config)
endif()
endif (BUILD_PY_IF)

if (BUILD_CPP_IF)
Expand Down