Skip to content

Commit

Permalink
Merge pull request #2095 from jorisv/topic/memory_check_in_jrlcmake
Browse files Browse the repository at this point in the history
Use `ADD_PYTHON_MEMORYCHECK_UNIT_TEST` from jrlcmakemodules
  • Loading branch information
jcarpent authored Nov 23, 2023
2 parents 87c5e50 + 2c121da commit 82b3128
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 58 deletions.
1 change: 1 addition & 0 deletions .github/workflows/check-changelog.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Check-changelog
on:
pull_request:
types: [assigned, opened, synchronize, reopened, labeled, unlabeled]
branches:
- devel
jobs:
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "cmake"]
path = cmake
url = https://github.com/jrl-umi3218/jrl-cmakemodules
url = https://github.com/jorisv/jrl-cmakemodules
[submodule "models/example-robot-data"]
path = models/example-robot-data
url = https://github.com/Gepetto/example-robot-data.git
2 changes: 1 addition & 1 deletion cmake
39 changes: 0 additions & 39 deletions unittest/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,6 @@
# Copyright (c) 2015-2023 CNRS INRIA
#

macro(ADD_PYTHON_MEMORYCHECK_UNIT_TEST NAME SOURCE)
set(TEST_FILE_NAME memorycheck_unit_test_${NAME}.cmake)
set(PYTHON_TEST_SCRIPT "${PROJECT_SOURCE_DIR}/${SOURCE}")
configure_file(memorycheck_unit_test.cmake.in ${TEST_FILE_NAME} @ONLY)

add_test(NAME ${NAME}
COMMAND ${CMAKE_COMMAND} -P ${TEST_FILE_NAME})

set(MODULES "${ARGN}") # ARGN is not a variable
foreach(MODULE_PATH IN LISTS MODULES)
list(APPEND PYTHONPATH "${CMAKE_BINARY_DIR}/${MODULE_PATH}")
endforeach()

if(DEFINED ENV{PYTHONPATH})
list(APPEND PYTHONPATH "$ENV{PYTHONPATH}")
endif()

# get path separator to join those paths
execute_process(
COMMAND "${PYTHON_EXECUTABLE}" "-c" "import os; print(os.pathsep)"
OUTPUT_VARIABLE PATHSEP
OUTPUT_STRIP_TRAILING_WHITESPACE)

list(REMOVE_DUPLICATES PYTHONPATH)
if(WIN32)
# ensure that severals paths stay together as ENV variable PYTHONPATH when
# passed to python test via PROPERTIES
string(REPLACE ";" "\;" PYTHONPATH_STR "${PYTHONPATH}")
else(WIN32)
string(REPLACE ";" "${PATHSEP}" PYTHONPATH_STR "${PYTHONPATH}")
endif(WIN32)
set(ENV_VARIABLES "PYTHONPATH=${PYTHONPATH_STR}")
if(APPLE)
list(APPEND ENV_VARIABLES "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}")
list(APPEND ENV_VARIABLES "DYLD_LIBRARY_PATH=$ENV{DYLD_LIBRARY_PATH}")
endif(APPLE)
set_tests_properties(${NAME} PROPERTIES ENVIRONMENT "${ENV_VARIABLES}")
endmacro()

SET(${PROJECT_NAME}_PYTHON_TESTS
bindings

Expand Down
17 changes: 0 additions & 17 deletions unittest/python/memorycheck_unit_test.cmake.in

This file was deleted.

0 comments on commit 82b3128

Please sign in to comment.