Squashed 'libs/loguru/' content from commit 644f60d
git-subtree-dir: libs/loguru git-subtree-split: 644f60dca77de3b0f718a03d370c8ebdf5f97968
This commit is contained in:
24
test/fail_test_wrapper.cmake
Normal file
24
test/fail_test_wrapper.cmake
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env cmake -P
|
||||
cmake_minimum_required(VERSION 2.8.7)
|
||||
|
||||
get_filename_component(CurrentFile ${CMAKE_CURRENT_LIST_FILE} NAME)
|
||||
|
||||
# The script is invoked as cmake -P <script name> <loguru_test> <arg(s)>
|
||||
# the following loop extracts the arguments after the one matching the script name
|
||||
foreach(i RANGE 0 ${CMAKE_ARGC})
|
||||
if(CollectArgs)
|
||||
list(APPEND TestArgs ${CMAKE_ARGV${i}})
|
||||
elseif(CMAKE_ARGV${i} MATCHES "${CurrentFile}$")
|
||||
set(CollectArgs true)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# TestArgs contains <loguru_test> <arg(s)>
|
||||
execute_process(COMMAND ${TestArgs}
|
||||
RESULT_VARIABLE CmdResult)
|
||||
|
||||
# To invert the failure logic
|
||||
if(NOT CmdResult)
|
||||
# the wrapper must fail if the child process returned success
|
||||
message(FATAL_ERROR "${TestArgs} passed.")
|
||||
endif()
|
||||
Reference in New Issue
Block a user