authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-02-28 18:56:26-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-02-28 18:56:26-05:00
log36eadb569a31a87b610b9b70e225a981dc181df4
tree3637ac156cf7261382989ec87efe3c22b50d1f43
parent58dc2b719c8e5a13c91ebbbbf476998c7f3e925b

run coroutine tests only in Debug mode

LLVM 5.0.1, 6.0.0, and trunk crash when attempting to optimize coroutine code. So, Zig does not support ReleaseFast or ReleaseSafe for coroutines yet. Luckily, Clang users are running into the same crashes, so folks from the LLVM community are working on fixes. If we're really lucky they'll be fixed in 6.0.1. Otherwise we can hope for 7.0.0.

2 files changed, 15 insertions(+), 3 deletions(-)

test/behavior.zig+13-1
...@@ -1,3 +1,5 @@...@@ -1,3 +1,5 @@
1const builtin = @import("builtin");
2
1comptime {3comptime {
2 _ = @import("cases/align.zig");4 _ = @import("cases/align.zig");
3 _ = @import("cases/alignof.zig");5 _ = @import("cases/alignof.zig");
...@@ -11,7 +13,6 @@ comptime {...@@ -11,7 +13,6 @@ comptime {
11 _ = @import("cases/bugs/656.zig");13 _ = @import("cases/bugs/656.zig");
12 _ = @import("cases/cast.zig");14 _ = @import("cases/cast.zig");
13 _ = @import("cases/const_slice_child.zig");15 _ = @import("cases/const_slice_child.zig");
14 _ = @import("cases/coroutines.zig");
15 _ = @import("cases/defer.zig");16 _ = @import("cases/defer.zig");
16 _ = @import("cases/enum.zig");17 _ = @import("cases/enum.zig");
17 _ = @import("cases/enum_with_members.zig");18 _ = @import("cases/enum_with_members.zig");
...@@ -48,4 +49,15 @@ comptime {...@@ -48,4 +49,15 @@ comptime {
48 _ = @import("cases/var_args.zig");49 _ = @import("cases/var_args.zig");
49 _ = @import("cases/void.zig");50 _ = @import("cases/void.zig");
50 _ = @import("cases/while.zig");51 _ = @import("cases/while.zig");
52
53
54 // LLVM 5.0.1, 6.0.0, and trunk crash when attempting to optimize coroutine code.
55 // So, Zig does not support ReleaseFast or ReleaseSafe for coroutines yet.
56 // Luckily, Clang users are running into the same crashes, so folks from the LLVM
57 // community are working on fixes. If we're really lucky they'll be fixed in 6.0.1.
58 // Otherwise we can hope for 7.0.0.
59 if (builtin.mode == builtin.Mode.Debug) {
60 _ = @import("cases/coroutines.zig");
61 }
62
51}63}
test/cases/coroutines.zig+2-2
...@@ -4,12 +4,12 @@ const assert = std.debug.assert;...@@ -4,12 +4,12 @@ const assert = std.debug.assert;
4var x: i32 = 1;4var x: i32 = 1;
55
6test "create a coroutine and cancel it" {6test "create a coroutine and cancel it" {
7 const p = try (async(std.debug.global_allocator) emptyAsyncFn());7 const p = try (async(std.debug.global_allocator) simpleAsyncFn());
8 cancel p;8 cancel p;
9 assert(x == 2);9 assert(x == 2);
10}10}
1111
12async fn emptyAsyncFn() void {12async fn simpleAsyncFn() void {
13 x += 1;13 x += 1;
14 suspend;14 suspend;
15 x += 1;15 x += 1;