diff --git a/build.zig b/build.zig index bc15a3193..9e409fd87 100644 --- a/build.zig +++ b/build.zig @@ -60,7 +60,6 @@ pub fn build(b: *Builder) !void { const skip_release_safe = b.option(bool, "skip-release-safe", "Main test suite skips release-safe builds") orelse skip_release; const skip_non_native = b.option(bool, "skip-non-native", "Main test suite skips non-native builds") orelse false; const skip_libc = b.option(bool, "skip-libc", "Main test suite skips tests that link libc") orelse false; - const skip_wasi = b.option(bool, "skip-wasi", "Main test suite skips WASI build") orelse false; const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false; const enable_llvm = b.option(bool, "enable-llvm", "Build self-hosted compiler with LLVM backend enabled") orelse false; @@ -87,6 +86,7 @@ pub fn build(b: *Builder) !void { const is_wine_enabled = b.option(bool, "enable-wine", "Use Wine to run cross compiled Windows tests") orelse false; const is_qemu_enabled = b.option(bool, "enable-qemu", "Use QEMU to run cross compiled foreign architecture tests") orelse false; + const is_wasmtime_enabled = b.option(bool, "enable-wasmtime", "Use Wasmtime to enable and run WASI libstd tests") orelse false; const glibc_multi_dir = b.option([]const u8, "enable-foreign-glibc", "Provide directory with glibc installations to run cross compiled tests that link glibc"); const test_stage2_step = b.step("test-stage2", "Run the stage2 compiler tests"); @@ -117,11 +117,11 @@ pub fn build(b: *Builder) !void { fmt_step.dependOn(&fmt_build_zig.step); // TODO for the moment, skip wasm32-wasi until bugs are sorted out. - test_step.dependOn(tests.addPkgTests(b, test_filter, "test/stage1/behavior.zig", "behavior", "Run the behavior tests", modes, false, skip_non_native, skip_libc, true, is_wine_enabled, is_qemu_enabled, glibc_multi_dir)); + test_step.dependOn(tests.addPkgTests(b, test_filter, "test/stage1/behavior.zig", "behavior", "Run the behavior tests", modes, false, skip_non_native, skip_libc, is_wine_enabled, is_qemu_enabled, false, glibc_multi_dir)); - test_step.dependOn(tests.addPkgTests(b, test_filter, "lib/std/std.zig", "std", "Run the standard library tests", modes, false, skip_non_native, skip_libc, skip_wasi, is_wine_enabled, is_qemu_enabled, glibc_multi_dir)); + test_step.dependOn(tests.addPkgTests(b, test_filter, "lib/std/std.zig", "std", "Run the standard library tests", modes, false, skip_non_native, skip_libc, is_wine_enabled, is_qemu_enabled, is_wasmtime_enabled, glibc_multi_dir)); - test_step.dependOn(tests.addPkgTests(b, test_filter, "lib/std/special/compiler_rt.zig", "compiler-rt", "Run the compiler_rt tests", modes, true, skip_non_native, true, skip_wasi, is_wine_enabled, is_qemu_enabled, glibc_multi_dir)); + test_step.dependOn(tests.addPkgTests(b, test_filter, "lib/std/special/compiler_rt.zig", "compiler-rt", "Run the compiler_rt tests", modes, true, skip_non_native, true, is_wine_enabled, is_qemu_enabled, is_wasmtime_enabled, glibc_multi_dir)); test_step.dependOn(tests.addCompareOutputTests(b, test_filter, modes)); test_step.dependOn(tests.addStandaloneTests(b, test_filter, modes)); diff --git a/ci/azure/linux_script b/ci/azure/linux_script index 9dff29458..2bc940206 100755 --- a/ci/azure/linux_script +++ b/ci/azure/linux_script @@ -50,7 +50,7 @@ mkdir build cd build cmake .. -DCMAKE_BUILD_TYPE=Release make -j$(nproc) install -./zig build test -Denable-qemu +./zig build test -Denable-qemu -Denable-wasmtime VERSION="$(./zig version)" if [ "${BUILD_REASON}" != "PullRequest" ]; then diff --git a/ci/azure/macos_script b/ci/azure/macos_script index 37c65dab4..7dd4344e3 100755 --- a/ci/azure/macos_script +++ b/ci/azure/macos_script @@ -88,7 +88,7 @@ mkdir build cd build cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$PREFIX -DCMAKE_INSTALL_PREFIX=$(pwd)/release -DZIG_STATIC=ON make $JOBS install -release/bin/zig build test -Dskip-wasi +release/bin/zig build test if [ "${BUILD_REASON}" != "PullRequest" ]; then mv ../LICENSE release/ diff --git a/ci/azure/windows_mingw_script b/ci/azure/windows_mingw_script index 2b261faf8..788376642 100644 --- a/ci/azure/windows_mingw_script +++ b/ci/azure/windows_mingw_script @@ -18,4 +18,4 @@ cmake .. -G 'MSYS Makefiles' -DCMAKE_BUILD_TYPE=RelWithDebInfo $CMAKEFLAGS -DCMA make -j$(nproc) install -./zig build test-behavior -Dskip-non-native -Dskip-release -Dskip-wasi +./zig build test-behavior -Dskip-non-native -Dskip-release diff --git a/ci/azure/windows_msvc_script.bat b/ci/azure/windows_msvc_script.bat index f44b2385d..b2063a8e5 100644 --- a/ci/azure/windows_msvc_script.bat +++ b/ci/azure/windows_msvc_script.bat @@ -24,7 +24,7 @@ cd %ZIGBUILDDIR% cmake.exe .. -Thost=x64 -G"Visual Studio 16 2019" -A x64 "-DCMAKE_INSTALL_PREFIX=%ZIGINSTALLDIR%" "-DCMAKE_PREFIX_PATH=%ZIGPREFIXPATH%" -DCMAKE_BUILD_TYPE=Release || exit /b msbuild /maxcpucount /p:Configuration=Release INSTALL.vcxproj || exit /b -"%ZIGINSTALLDIR%\bin\zig.exe" build test -Dskip-wasi || exit /b +"%ZIGINSTALLDIR%\bin\zig.exe" build test || exit /b set "PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem" SET "MSYSTEM=MINGW64" diff --git a/ci/drone/linux_script b/ci/drone/linux_script index 15fe5a86d..ca587eed8 100755 --- a/ci/drone/linux_script +++ b/ci/drone/linux_script @@ -20,7 +20,7 @@ cd build cmake .. -DCMAKE_BUILD_TYPE=Release "-DCMAKE_INSTALL_PREFIX=$DISTDIR" -DZIG_STATIC=ON -DCMAKE_PREFIX_PATH=/deps/local make -j$(nproc) install -./zig build test -Dskip-release -Dskip-non-native -Dskip-wasi +./zig build test -Dskip-release -Dskip-non-native if [ -z "$DRONE_PULL_REQUEST" ]; then mv ../LICENSE "$DISTDIR/" diff --git a/ci/srht/freebsd_script b/ci/srht/freebsd_script index e111ded26..97b869c9f 100755 --- a/ci/srht/freebsd_script +++ b/ci/srht/freebsd_script @@ -27,13 +27,13 @@ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$PREFIX "-DCMAKE_INSTALL make $JOBS install release/bin/zig build test-fmt -release/bin/zig build test-behavior -Dskip-wasi +release/bin/zig build test-behavior # This test is disabled because it triggers "out of memory" on the sr.ht CI service. # See https://github.com/ziglang/zig/issues/3210 # release/bin/zig build test-std -release/bin/zig build test-compiler-rt -Dskip-wasi +release/bin/zig build test-compiler-rt release/bin/zig build test-compare-output release/bin/zig build test-standalone release/bin/zig build test-stack-traces diff --git a/test/tests.zig b/test/tests.zig index b53881863..3b70d0e36 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -472,9 +472,9 @@ pub fn addPkgTests( skip_single_threaded: bool, skip_non_native: bool, skip_libc: bool, - skip_wasi: bool, is_wine_enabled: bool, is_qemu_enabled: bool, + is_wasmtime_enabled: bool, glibc_dir: ?[]const u8, ) *build.Step { const step = b.step(b.fmt("test-{}", .{name}), desc); @@ -483,7 +483,7 @@ pub fn addPkgTests( if (skip_non_native and !test_target.target.isNative()) continue; - if (skip_wasi) { + if (!is_wasmtime_enabled) { if (test_target.target.os_tag) |tag| { if (tag == .wasi) { warn("Skipping {} on wasm32-wasi.\n", .{root_src}); @@ -544,7 +544,7 @@ pub fn addPkgTests( these_tests.overrideZigLibDir("lib"); these_tests.enable_wine = is_wine_enabled; these_tests.enable_qemu = is_qemu_enabled; - these_tests.enable_wasmtime = !skip_wasi; + these_tests.enable_wasmtime = is_wasmtime_enabled; these_tests.glibc_multi_install_dir = glibc_dir; step.dependOn(&these_tests.step);