build: Run executable tests with WasmKit when available

This patch allows running executable tests with WasmKit. If WasmKit is
not built, fall back to running only non-executable tests. Also add
stdlib and Concurrency executable tests to run.
This commit is contained in:
Yuta Saito
2024-02-01 13:34:04 +00:00
parent 2b1160475f
commit 581ee4ebcc
2 changed files with 14 additions and 3 deletions

View File

@@ -16,6 +16,7 @@ from . import cmake_product
from . import llvm
from . import swift
from . import wasisysroot
from . import wasmkit
class WasmStdlib(cmake_product.CMakeProduct):
@@ -100,7 +101,7 @@ class WasmStdlib(cmake_product.CMakeProduct):
# Test configuration
self.cmake_options.define('SWIFT_INCLUDE_TESTS:BOOL', 'TRUE')
self.cmake_options.define('SWIFT_ENABLE_SOURCEKIT_TESTS:BOOL', 'FALSE')
lit_test_paths = ['IRGen']
lit_test_paths = ['IRGen', 'stdlib', 'Concurrency/Runtime']
lit_test_paths = [os.path.join(
self.build_dir, 'test-wasi-wasm32', path) for path in lit_test_paths]
self.cmake_options.define('SWIFT_LIT_TEST_PATHS:STRING',
@@ -119,13 +120,22 @@ class WasmStdlib(cmake_product.CMakeProduct):
prefer_just_built_toolchain=True)
def test(self, host_target):
build_root = os.path.dirname(self.build_dir)
bin_paths = [
os.path.join(self._host_swift_build_dir(host_target), 'bin'),
os.path.join(self._host_llvm_build_dir(host_target), 'bin'),
os.environ['PATH']
]
wasmkit_build_path = os.path.join(
build_root, '%s-%s' % ('wasmkit', host_target))
wasmkit_bin_path = wasmkit.WasmKit.cli_file_path(wasmkit_build_path)
if not os.path.exists(wasmkit_bin_path):
test_target = "check-swift-only_non_executable-wasi-wasm32-custom"
else:
test_target = "check-swift-wasi-wasm32-custom"
bin_paths = [os.path.dirname(wasmkit_bin_path)] + bin_paths
env = {'PATH': os.path.pathsep.join(bin_paths)}
test_target = "check-swift-only_non_executable-wasi-wasm32-custom"
self.test_with_cmake(None, [test_target], self._build_variant, [], test_env=env)
@property
@@ -153,4 +163,5 @@ class WasmStdlib(cmake_product.CMakeProduct):
return [llvm.LLVM,
wasisysroot.WASILibc,
wasisysroot.WasmLLVMRuntimeLibs,
wasmkit.WasmKit,
swift.Swift]

View File

@@ -24,7 +24,7 @@ class WasmtimeRunner(object):
subprocess.check_call(command)
def invocation(self, args):
command = ["wasmtime", "run"]
command = ["wasmkit-cli", "run"]
envs = collect_wasm_env()
for key in envs:
command.append("--env")