Tests: Improve RunCMake.GetPrerequisites sample executable selection

Get the runtime dependencies of an executable just built by the
toolchain with which tests are running.  Previously we used the `cmake`
binary itself, but that might have been built for a different ABI than
the tested binutils support.
This commit is contained in:
Brad King
2022-10-24 17:51:08 -04:00
parent bf9d3fddcc
commit 82c990e9be
3 changed files with 5 additions and 3 deletions

View File

@@ -361,7 +361,7 @@ if(XCODE_VERSION)
set(GeneratorToolset_ARGS -DXCODE_VERSION=${XCODE_VERSION})
endif()
add_RunCMake_test(GeneratorToolset)
add_RunCMake_test(GetPrerequisites)
add_RunCMake_test(GetPrerequisites -DSAMPLE_EXE=$<TARGET_FILE:exit_code>)
add_RunCMake_test(GNUInstallDirs -DSYSTEM_NAME=${CMAKE_SYSTEM_NAME})
add_RunCMake_test(GoogleTest) # Note: does not actually depend on Google Test
add_RunCMake_test(Graphviz)

View File

@@ -10,7 +10,9 @@ endfunction()
# Should not throw any errors
# Regular executable
get_prerequisites(${CMAKE_COMMAND} cmake_prereqs 1 1 "" "")
if(SAMPLE_EXE)
get_prerequisites("${SAMPLE_EXE}" cmake_prereqs 1 1 "" "")
endif()
# Shell script
check_script(${CMAKE_CURRENT_LIST_DIR}/script.sh)
# Batch script

View File

@@ -1,4 +1,4 @@
include(RunCMake)
run_cmake_command(TargetMissing ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TargetMissing.cmake)
run_cmake_command(ExecutableScripts ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/ExecutableScripts.cmake)
run_cmake_command(ExecutableScripts ${CMAKE_COMMAND} -DSAMPLE_EXE=${SAMPLE_EXE} -P ${RunCMake_SOURCE_DIR}/ExecutableScripts.cmake)