Skip to content

Commit 872d4ff

Browse files
tell CTest to print on failure for cmark tests (#59978)
1 parent c9253dc commit 872d4ff

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

utils/swift_build_support/swift_build_support/products/cmake_product.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def build_with_cmake(self, build_targets, build_type, build_args,
8585
+ build_args + build_targets)
8686

8787
def test_with_cmake(self, executable_target, results_targets,
88-
build_type, build_args):
88+
build_type, build_args, test_env=None):
8989
assert self.toolchain.cmake is not None
9090
cmake_build = []
9191

@@ -117,7 +117,9 @@ def target_flag(target):
117117
if test_target.startswith("check-swift") and self.args.test_paths:
118118
test_target = test_target + "-custom"
119119

120-
shell.call(cmake_build + target_flag(test_target))
120+
# note that passing variables via test_env won't affect lit tests -
121+
# lit.cfg will filter environment variables out!
122+
shell.call(cmake_build + target_flag(test_target), env=test_env)
121123

122124
print("--- %s finished ---" % target)
123125

utils/swift_build_support/swift_build_support/products/cmark.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,14 @@ def test(self, host_target):
9494
# Xcode generator uses "RUN_TESTS" instead of "test".
9595
results_targets = ['RUN_TESTS']
9696

97+
test_env = {
98+
"CTEST_OUTPUT_ON_FAILURE": "ON"
99+
}
100+
101+
# see the comment in cmake_product.py if you want to copy this code to pass
102+
# environment variables to tests
97103
self.test_with_cmake(executable_target, results_targets,
98-
self.args.cmark_build_variant, [])
104+
self.args.cmark_build_variant, [], test_env)
99105

100106
def should_install(self, host_target):
101107
"""should_install() -> Bool

0 commit comments

Comments
 (0)