Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix CTest #2828

Merged
merged 2 commits into from
Sep 18, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion source/api_c/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ target_link_libraries(runUnitTests_c PRIVATE GTest::gtest_main ${LIB_DEEPMD_C}
rt coverage_config)
target_link_libraries(runUnitTests_c PRIVATE ${LIB_DEEPMD} ${LIB_DEEPMD_CC})
target_precompile_headers(runUnitTests_c PRIVATE test_utils.h [["deepmd.hpp"]])
add_test(runUnitTests_c runUnitTests_c)
add_test(
NAME runUnitTests_c
COMMAND runUnitTests_c
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(runUnitTests_c PROPERTIES INSTALL_RPATH "$ORIGIN/../lib")
install(TARGETS runUnitTests_c DESTINATION bin/)
3 changes: 2 additions & 1 deletion source/api_cc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ if(Protobuf_LIBRARY)
endif()

set_target_properties(
${libname} PROPERTIES INSTALL_RPATH "$ORIGIN;${TensorFlow_LIBRARY_PATH}")
${libname} PROPERTIES INSTALL_RPATH "$ORIGIN;${TensorFlow_LIBRARY_PATH}"
BUILD_RPATH "$ORIGIN/../op")
target_compile_definitions(${libname} PRIVATE TF_PRIVATE)
if(CMAKE_TESTING_ENABLED)
target_link_libraries(${libname} PRIVATE coverage_config)
Expand Down
5 changes: 4 additions & 1 deletion source/api_cc/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ add_executable(runUnitTests_cc ${TEST_SRC})
target_link_libraries(runUnitTests_cc GTest::gtest_main ${LIB_DEEPMD_CC} rt
coverage_config)
target_precompile_headers(runUnitTests_cc PRIVATE test_utils.h)
add_test(runUnitTest_cc runUnitTests_cc)
add_test(
NAME runUnitTest_cc
COMMAND runUnitTests_cc
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(runUnitTests_cc PROPERTIES INSTALL_RPATH "$ORIGIN/../lib")
target_compile_definitions(runUnitTests_cc PUBLIC ${prec_def})
install(TARGETS runUnitTests_cc DESTINATION bin/)
11 changes: 1 addition & 10 deletions source/install/test_cc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,4 @@ cd ${BUILD_TMP_DIR}
cmake -DINSTALL_TENSORFLOW=TRUE -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DTENSORFLOW_ROOT=${INSTALL_PREFIX} -DBUILD_TESTING:BOOL=TRUE -DLAMMPS_VERSION=stable_2Aug2023 ..
cmake --build . -j${NPROC}
cmake --install .

#------------------
# go to a subdirectory...
# TODO: detect directory of graph files
mkdir -p ${BUILD_TMP_DIR}/exec_tests
cd ${BUILD_TMP_DIR}/exec_tests

${INSTALL_PREFIX}/bin/runUnitTests_lib
${INSTALL_PREFIX}/bin/runUnitTests_cc
${INSTALL_PREFIX}/bin/runUnitTests_c
ctest --output-on-failure
11 changes: 1 addition & 10 deletions source/install/test_cc_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,4 @@ cd ${BUILD_TMP_DIR}
cmake -DINSTALL_TENSORFLOW=FALSE -DUSE_TF_PYTHON_LIBS=TRUE -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DBUILD_TESTING:BOOL=TRUE -DLAMMPS_VERSION=stable_2Aug2023 ..
cmake --build . -j${NPROC}
cmake --install .

#------------------
# go to a subdirectory...
# TODO: detect directory of graph files
mkdir -p ${BUILD_TMP_DIR}/exec_tests
cd ${BUILD_TMP_DIR}/exec_tests

${INSTALL_PREFIX}/bin/runUnitTests_lib
${INSTALL_PREFIX}/bin/runUnitTests_cc
${INSTALL_PREFIX}/bin/runUnitTests_c
ctest --output-on-failure