Skip to content

Commit c920730

Browse files
authored
Verify wasmkit is a universal binary (#163)
* In lit.cfg, add wasmkit_path and substitution; check that path exists * New test-universal-darwin.py verifies wasmkit executable is universal - Test runs only on Darwin - Check compares output of 'file' tool (exists on macOS and Linux) - Similar test could verify other executables (but need BOM list?)
1 parent dd9218f commit c920730

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

lit.cfg

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,11 @@ docc_path = lit_config.params.get(
207207
os.path.join(package_path, "usr", "bin", "docc"))
208208
lit_config.note("testing using 'docc': {}".format(docc_path))
209209

210+
wasmkit_path = lit_config.params.get(
211+
"wasmkit",
212+
os.path.join(package_path, "usr", "bin", "wasmkit"))
213+
lit_config.note("testing using 'wasmkit': {}".format(wasmkit_path))
214+
210215
# Verify they exist.
211216
if not os.path.exists(swift_path):
212217
lit_config.fatal("swift does not exist!")
@@ -231,6 +236,8 @@ else:
231236

232237
if not os.path.exists(docc_path):
233238
lit_config.fatal("docc does not exist!")
239+
if not os.path.exists(wasmkit_path):
240+
lit_config.fatal("wasmkit does not exist!")
234241

235242
# Define our supported substitutions.
236243
config.substitutions.append( ('%{package_path}', package_path) )
@@ -246,6 +253,7 @@ config.substitutions.append( ('%{readelf}', readelf_path) )
246253
config.substitutions.append( ('%{readobj}', readobj_path) )
247254
config.substitutions.append( ('%{sourcekit-lsp}', sourcekit_lsp_path) )
248255
config.substitutions.append( ('%{docc}', docc_path) )
256+
config.substitutions.append( ('%{wasmkit}', wasmkit_path) )
249257

250258
# Add substitutions for swiftpm executables.
251259
swiftpm_build = lit_config.params.get("swiftpm-build")
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Tests that executables are universal binaries on MacOS
2+
# REQUIRES: platform=Darwin
3+
#
4+
# RUN: file %{wasmkit} | %{FileCheck} --check-prefix CHECK-WASMKIT %s
5+
# CHECK-WASMKIT: {{.*}} Mach-O universal binary {{.*}}
6+
#
7+

0 commit comments

Comments
 (0)