diff --git a/utils/swift_build_support/swift_build_support/products/cmake_product.py b/utils/swift_build_support/swift_build_support/products/cmake_product.py index 6e4e633078636..39ac9dd026e52 100644 --- a/utils/swift_build_support/swift_build_support/products/cmake_product.py +++ b/utils/swift_build_support/swift_build_support/products/cmake_product.py @@ -85,7 +85,7 @@ def build_with_cmake(self, build_targets, build_type, build_args, + build_args + build_targets) def test_with_cmake(self, executable_target, results_targets, - build_type, build_args): + build_type, build_args, test_env=None): assert self.toolchain.cmake is not None cmake_build = [] @@ -117,7 +117,9 @@ def target_flag(target): if test_target.startswith("check-swift") and self.args.test_paths: test_target = test_target + "-custom" - shell.call(cmake_build + target_flag(test_target)) + # note that passing variables via test_env won't affect lit tests - + # lit.cfg will filter environment variables out! + shell.call(cmake_build + target_flag(test_target), env=test_env) print("--- %s finished ---" % target) diff --git a/utils/swift_build_support/swift_build_support/products/cmark.py b/utils/swift_build_support/swift_build_support/products/cmark.py index bde199b37e0de..97198ca064523 100644 --- a/utils/swift_build_support/swift_build_support/products/cmark.py +++ b/utils/swift_build_support/swift_build_support/products/cmark.py @@ -94,8 +94,14 @@ def test(self, host_target): # Xcode generator uses "RUN_TESTS" instead of "test". results_targets = ['RUN_TESTS'] + test_env = { + "CTEST_OUTPUT_ON_FAILURE": "ON" + } + + # see the comment in cmake_product.py if you want to copy this code to pass + # environment variables to tests self.test_with_cmake(executable_target, results_targets, - self.args.cmark_build_variant, []) + self.args.cmark_build_variant, [], test_env) def should_install(self, host_target): """should_install() -> Bool