From e4aa862449cbb87fc7007b06a87e4cecef5630a7 Mon Sep 17 00:00:00 2001 From: wti Date: Mon, 23 Jun 2025 12:07:55 -0700 Subject: [PATCH 1/2] In lit.cfg, add wasmkit_path and substitution; check that path exists --- lit.cfg | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lit.cfg b/lit.cfg index b1b5210..afb28f2 100644 --- a/lit.cfg +++ b/lit.cfg @@ -207,6 +207,11 @@ docc_path = lit_config.params.get( os.path.join(package_path, "usr", "bin", "docc")) lit_config.note("testing using 'docc': {}".format(docc_path)) +wasmkit_path = lit_config.params.get( + "wasmkit", + os.path.join(package_path, "usr", "bin", "wasmkit")) +lit_config.note("testing using 'wasmkit': {}".format(wasmkit_path)) + # Verify they exist. if not os.path.exists(swift_path): lit_config.fatal("swift does not exist!") @@ -231,6 +236,8 @@ else: if not os.path.exists(docc_path): lit_config.fatal("docc does not exist!") +if not os.path.exists(wasmkit_path): + lit_config.fatal("wasmkit does not exist!") # Define our supported substitutions. config.substitutions.append( ('%{package_path}', package_path) ) @@ -246,6 +253,7 @@ config.substitutions.append( ('%{readelf}', readelf_path) ) config.substitutions.append( ('%{readobj}', readobj_path) ) config.substitutions.append( ('%{sourcekit-lsp}', sourcekit_lsp_path) ) config.substitutions.append( ('%{docc}', docc_path) ) +config.substitutions.append( ('%{wasmkit}', wasmkit_path) ) # Add substitutions for swiftpm executables. swiftpm_build = lit_config.params.get("swiftpm-build") From 23009aa19dde5f4c0be733a351e30732e4dc4d53 Mon Sep 17 00:00:00 2001 From: wti Date: Mon, 23 Jun 2025 12:13:30 -0700 Subject: [PATCH 2/2] 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?) --- test-snapshot-binaries/test-universal-darwin.py | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 test-snapshot-binaries/test-universal-darwin.py diff --git a/test-snapshot-binaries/test-universal-darwin.py b/test-snapshot-binaries/test-universal-darwin.py new file mode 100644 index 0000000..e1ddf1a --- /dev/null +++ b/test-snapshot-binaries/test-universal-darwin.py @@ -0,0 +1,7 @@ +# Tests that executables are universal binaries on MacOS +# REQUIRES: platform=Darwin +# +# RUN: file %{wasmkit} | %{FileCheck} --check-prefix CHECK-WASMKIT %s +# CHECK-WASMKIT: {{.*}} Mach-O universal binary {{.*}} +# +