MemoryCheckCommand 在 DartConfiguration.tcl 中设置,但 CTest 没有看到它
当我尝试执行 CTest 脚本时,它抱怨“内存检查器 (MemoryCheckCommand) 未设置,或找不到指定的程序”,但已创建 DartConfiguration.tcl
且 MemoryCheckCommand
已正确设置为 /usr/bin/valgrind
。
这是我的项目的简化布局:
.
├── SOURCES
│ ├── build
│ │ ├── CMakeCache.txt
│ │ [...]
│ ├── CMakeLists.txt
│ └── src
│ ├── CMakeLists.txt
│ [..]
├── gcc.cmake
└── TESTS
├── build
│ ├── x86
│ │ ├── CMakeCache.txt
│ │ ├── DartConfiguration.tcl
│ │ [...]
│ └── x86_64
│ ├── CMakeCache.txt
│ ├── DartConfiguration.tcl
│ [...]
├── CMakeLists.txt
├── CTestConfig.cmake
├── ctest_scripts
│ ├── TestValgrindJob64.cmake
│ └── TestValgrindJob.cmake
├── fakes
│ ├── CMakeLists.txt
│ [..]
├── libs
│ ├── googletest
│ │ ├── CMakeLists.txt
│ │ [..]
│ └── linux-9.3.0
│ ├── gmock
│ │ │
│ │ [..]
│ ├── gtest
│ │ │
│ │ [..]
│ ├── x86
│ │ ├── libgmock.a
│ │ └── libgtest.a
│ └── x86_64
│ ├── libgmock.a
│ └── libgtest.a
├── mocks
│ ├── CMakeLists.txt
│ [..]
├── stubs
│ ├── CMakeLists.txt
│ [..]
├── unittests
│ ├── CMakeLists.txt
│ [..]
├── x86_64.cmake
└── x86.cmake
TESTS/CMakeLists.txt
的相关位:
include(CTestConfig.cmake)
include(CTest)
#include(CTestUseLaunchers)
#enable_testing()
add_test(NAME Test1 COMMAND ${PROJECT_NAME})
CTestConfig.cmake
:
set(CTEST_PROJECT_NAME "ProjectTest1")
set(CTEST_USE_LAUNCHERS YES)
CTest 脚本 TestValgrindJob64.cmake
-- 注意4 条消息打印出MEMORYCHECK_COMMAND
、CTEST_SCRIPT_DIRECTORY
、 CTEST_SOURCE_DIRECTORY
和 CTEST_BINARY_DIRECTORY
:
include(${CTEST_SCRIPT_DIRECTORY}/../CTestConfig.cmake)
message("MEMORYCHECK_COMMAND ${MEMORYCHECK_COMMAND}")
message("CTEST_SCRIPT_DIRECTORY ${CTEST_SCRIPT_DIRECTORY}")
site_name(CTEST_SITE)
set(CTEST_BUILD_CONFIGURATION "Valgrind64")
set(CTEST_BUILD_NAME "${CMAKE_HOST_SYSTEM_NAME}-Val64")
set(CTEST_SOURCE_DIRECTORY "${CTEST_SCRIPT_DIRECTORY}/..")
message("CTEST_SOURCE_DIRECTORY ${CTEST_SOURCE_DIRECTORY}")
set(CTEST_BINARY_DIRECTORY "${CTEST_SCRIPT_DIRECTORY}/../build/x86_64")
message("CTEST_BINARY_DIRECTORY ${CTEST_BINARY_DIRECTORY}")
set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
set(CTEST_CONFIGURATION_TYPE RelWithDebInfo)
#set(CTEST_MEMORYCHECK_COMMAND "/usr/bin/valgrind")
set(CTEST_MEMORYCHECK_COMMAND_OPTIONS "--tool=memcheck --leak-check=full --show-reachable=yes --num-callers=20 --track-fds=yes --track-origins=yes --error-exitcode=1")
set(configureOpts "-DCXXFLAGS=-m64")
ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
ctest_start(Experimental)
ctest_configure(OPTIONS "${configureOpts}")
ctest_build()
ctest_memcheck()
如果我尝试使用 ctest -S TestValgrindJob64.cmake
从 TESTS/ctest_scripts
执行脚本,我得到以下输出:
MEMORYCHECK_COMMAND
CTEST_SCRIPT_DIRECTORY /home/user1/project/TESTS/ctest_scripts
CTEST_SOURCE_DIRECTORY /home/user1/project/TESTS/ctest_scripts/..
CTEST_BINARY_DIRECTORY /home/user1/project/TESTS/ctest_scrips/../build/x86_64
Each . represents 1024 bytes of output
. Size of output: 0K
Each symbol represents 1024 bytes of output.
.. Size of output: 1K
Error(s) when building project
Memory checker (MemoryCheckCommand) not set, or cannot find the specified program.
DartConfiguration.tcl
文件在脚本执行之前和之后都存在,并且如前所述, MemoryCheckCommand
已设置:
MemoryCheckCommand: /usr/bin/valgrind
whereis
在 /usr/bin/valgrind
中查找 valgrind
。
知道我在这里做错了什么吗? CMake 是否仍然忽略 DartConfiguration.tcl
文件?
When I attempt to execute my CTest script it complains that "Memory checker (MemoryCheckCommand) not set, or cannot find the specified program" but DartConfiguration.tcl
has been created and MemoryCheckCommand
is correctly set to /usr/bin/valgrind
.
This is simplified layout of my project:
.
├── SOURCES
│ ├── build
│ │ ├── CMakeCache.txt
│ │ [...]
│ ├── CMakeLists.txt
│ └── src
│ ├── CMakeLists.txt
│ [..]
├── gcc.cmake
└── TESTS
├── build
│ ├── x86
│ │ ├── CMakeCache.txt
│ │ ├── DartConfiguration.tcl
│ │ [...]
│ └── x86_64
│ ├── CMakeCache.txt
│ ├── DartConfiguration.tcl
│ [...]
├── CMakeLists.txt
├── CTestConfig.cmake
├── ctest_scripts
│ ├── TestValgrindJob64.cmake
│ └── TestValgrindJob.cmake
├── fakes
│ ├── CMakeLists.txt
│ [..]
├── libs
│ ├── googletest
│ │ ├── CMakeLists.txt
│ │ [..]
│ └── linux-9.3.0
│ ├── gmock
│ │ │
│ │ [..]
│ ├── gtest
│ │ │
│ │ [..]
│ ├── x86
│ │ ├── libgmock.a
│ │ └── libgtest.a
│ └── x86_64
│ ├── libgmock.a
│ └── libgtest.a
├── mocks
│ ├── CMakeLists.txt
│ [..]
├── stubs
│ ├── CMakeLists.txt
│ [..]
├── unittests
│ ├── CMakeLists.txt
│ [..]
├── x86_64.cmake
└── x86.cmake
Relevant bits of TESTS/CMakeLists.txt
:
include(CTestConfig.cmake)
include(CTest)
#include(CTestUseLaunchers)
#enable_testing()
add_test(NAME Test1 COMMAND ${PROJECT_NAME})
CTestConfig.cmake
:
set(CTEST_PROJECT_NAME "ProjectTest1")
set(CTEST_USE_LAUNCHERS YES)
CTest script TestValgrindJob64.cmake
-- note 4 messages printing out MEMORYCHECK_COMMAND
, CTEST_SCRIPT_DIRECTORY
, CTEST_SOURCE_DIRECTORY
and CTEST_BINARY_DIRECTORY
:
include(${CTEST_SCRIPT_DIRECTORY}/../CTestConfig.cmake)
message("MEMORYCHECK_COMMAND ${MEMORYCHECK_COMMAND}")
message("CTEST_SCRIPT_DIRECTORY ${CTEST_SCRIPT_DIRECTORY}")
site_name(CTEST_SITE)
set(CTEST_BUILD_CONFIGURATION "Valgrind64")
set(CTEST_BUILD_NAME "${CMAKE_HOST_SYSTEM_NAME}-Val64")
set(CTEST_SOURCE_DIRECTORY "${CTEST_SCRIPT_DIRECTORY}/..")
message("CTEST_SOURCE_DIRECTORY ${CTEST_SOURCE_DIRECTORY}")
set(CTEST_BINARY_DIRECTORY "${CTEST_SCRIPT_DIRECTORY}/../build/x86_64")
message("CTEST_BINARY_DIRECTORY ${CTEST_BINARY_DIRECTORY}")
set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
set(CTEST_CONFIGURATION_TYPE RelWithDebInfo)
#set(CTEST_MEMORYCHECK_COMMAND "/usr/bin/valgrind")
set(CTEST_MEMORYCHECK_COMMAND_OPTIONS "--tool=memcheck --leak-check=full --show-reachable=yes --num-callers=20 --track-fds=yes --track-origins=yes --error-exitcode=1")
set(configureOpts "-DCXXFLAGS=-m64")
ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
ctest_start(Experimental)
ctest_configure(OPTIONS "${configureOpts}")
ctest_build()
ctest_memcheck()
If I attempt to execute script from TESTS/ctest_scripts
with ctest -S TestValgrindJob64.cmake
I get the following output:
MEMORYCHECK_COMMAND
CTEST_SCRIPT_DIRECTORY /home/user1/project/TESTS/ctest_scripts
CTEST_SOURCE_DIRECTORY /home/user1/project/TESTS/ctest_scripts/..
CTEST_BINARY_DIRECTORY /home/user1/project/TESTS/ctest_scrips/../build/x86_64
Each . represents 1024 bytes of output
. Size of output: 0K
Each symbol represents 1024 bytes of output.
.. Size of output: 1K
Error(s) when building project
Memory checker (MemoryCheckCommand) not set, or cannot find the specified program.
DartConfiguration.tcl
file exists before and after script is executed and, as previously mentioned, MemoryCheckCommand
is set:
MemoryCheckCommand: /usr/bin/valgrind
whereis
finds valgrind
in /usr/bin/valgrind
.
Any idea what I'm doing wrong here? Is CMake still ignoring DartConfiguration.tcl
file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论