From 10f906106e7d05cfe7f4c0ea871ad8462df2f89c Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 26 Jan 2024 14:08:02 -0500 Subject: Tests: Teach pseudo_emulator helper to pass by default --- Tests/RunCMake/CrosscompilingEmulator/TryRun.cmake | 2 ++ Tests/RunCMake/pseudo_emulator.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Tests/RunCMake/CrosscompilingEmulator/TryRun.cmake b/Tests/RunCMake/CrosscompilingEmulator/TryRun.cmake index af3712c..8cd5a02 100644 --- a/Tests/RunCMake/CrosscompilingEmulator/TryRun.cmake +++ b/Tests/RunCMake/CrosscompilingEmulator/TryRun.cmake @@ -1,5 +1,7 @@ set(CMAKE_CROSSCOMPILING 1) +set(ENV{PSEUDO_EMULATOR_FAIL} 1) + try_run(run_result compile_result ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/simple_src_exiterror.cxx diff --git a/Tests/RunCMake/pseudo_emulator.c b/Tests/RunCMake/pseudo_emulator.c index 15f64dc..cc921f0 100644 --- a/Tests/RunCMake/pseudo_emulator.c +++ b/Tests/RunCMake/pseudo_emulator.c @@ -1,8 +1,14 @@ +#ifndef _CRT_SECURE_NO_WARNINGS +# define _CRT_SECURE_NO_WARNINGS +#endif + #include +#include int main(int argc, char* argv[]) { int ii; + const char* fail = getenv("PSEUDO_EMULATOR_FAIL"); printf("Command:"); for (ii = 1; ii < argc; ++ii) { @@ -10,5 +16,9 @@ int main(int argc, char* argv[]) } printf("\n"); - return 42; + if (fail && *fail) { + return 42; + } + + return 0; } -- cgit v0.12