Commit 34f84c3608

Jakub Konka <kubkon@jakubkonka.com>
2020-05-18 17:45:06
Narrow down behaviour test cases; this removes wasmtime-enabled check in tests
1 parent 2a59ecd
test/stage1/behavior/align.zig
@@ -133,6 +133,9 @@ fn alignedBig() align(16) i32 {
 }
 
 test "@alignCast functions" {
+    // TODO investigate why this fails when cross-compiled to wasm.
+    if (builtin.os.tag == .wasi) return error.SkipZigTest;
+
     expect(fnExpectsOnly1(simple4) == 0x19);
 }
 fn fnExpectsOnly1(ptr: fn () align(1) i32) i32 {
@@ -324,6 +327,9 @@ test "align(@alignOf(T)) T does not force resolution of T" {
 }
 
 test "align(N) on functions" {
+    // TODO investigate why this fails when cross-compiled to wasm.
+    if (builtin.os.tag == .wasi) return error.SkipZigTest;
+
     expect((@ptrToInt(overaligned_fn) & (0x1000 - 1)) == 0);
 }
 fn overaligned_fn() align(0x1000) i32 {
test/stage1/behavior/shuffle.zig
@@ -1,9 +1,13 @@
 const std = @import("std");
+const builtin = @import("builtin");
 const mem = std.mem;
 const expect = std.testing.expect;
 const Vector = std.meta.Vector;
 
 test "@shuffle" {
+    // TODO investigate why this fails when cross-compiling to wasm.
+    if (builtin.os.tag == .wasi) return error.SkipZigTest;
+
     const S = struct {
         fn doTheTest() void {
             var v: Vector(4, i32) = [4]i32{ 2147483647, -2, 30, 40 };
test/stage1/behavior/vector.zig
@@ -1,4 +1,5 @@
 const std = @import("std");
+const builtin = @import("builtin");
 const mem = std.mem;
 const math = std.math;
 const expect = std.testing.expect;
@@ -387,6 +388,9 @@ test "vector bitwise not operator" {
 }
 
 test "vector shift operators" {
+    // TODO investigate why this fails when cross-compiled to wasm.
+    if (builtin.os.tag == .wasi) return error.SkipZigTest;
+
     const S = struct {
         fn doTheTestShift(x: var, y: var) void {
             const N = @typeInfo(@TypeOf(x)).Array.len;
test/stage1/behavior.zig
@@ -1,9 +1,13 @@
+const builtin = @import("builtin");
+
 comptime {
     _ = @import("behavior/align.zig");
     _ = @import("behavior/alignof.zig");
     _ = @import("behavior/array.zig");
-    _ = @import("behavior/asm.zig");
-    _ = @import("behavior/async_fn.zig");
+    if (builtin.os.tag != .wasi) {
+        _ = @import("behavior/asm.zig");
+        _ = @import("behavior/async_fn.zig");
+    }
     _ = @import("behavior/atomics.zig");
     _ = @import("behavior/await_struct.zig");
     _ = @import("behavior/bit_shifting.zig");
test/tests.zig
@@ -483,15 +483,6 @@ pub fn addPkgTests(
         if (skip_non_native and !test_target.target.isNative())
             continue;
 
-        if (!is_wasmtime_enabled) {
-            if (test_target.target.os_tag) |tag| {
-                if (tag == .wasi) {
-                    warn("Skipping {} on wasm32-wasi.\n", .{root_src});
-                    continue;
-                }
-            }
-        }
-
         if (skip_libc and test_target.link_libc)
             continue;
 
build.zig
@@ -117,7 +117,7 @@ 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, is_wine_enabled, is_qemu_enabled, false, 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, is_wasmtime_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));