ソースを参照

Tests: Teach pseudo_emulator helper to pass by default

Brad King 1 年間 前
コミット
10f906106e

+ 2 - 0
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

+ 11 - 1
Tests/RunCMake/pseudo_emulator.c

@@ -1,8 +1,14 @@
+#ifndef _CRT_SECURE_NO_WARNINGS
+#  define _CRT_SECURE_NO_WARNINGS
+#endif
+
 #include <stdio.h>
+#include <stdlib.h>
 
 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;
 }