zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 36eadb569a31a87b610b9b70e225a981dc181df4 (tree)
parent 58dc2b719c8e5a13c91ebbbbf476998c7f3e925b
Author: Andrew Kelley <superjoe30@gmail.com>
Date:   Wed, 28 Feb 2018 18:56:26 -0500

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.

Diffstat:
Mtest/behavior.zig | 14+++++++++++++-
Mtest/cases/coroutines.zig | 4++--
2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/test/behavior.zig b/test/behavior.zig @@ -1,3 +1,5 @@ +const builtin = @import("builtin"); + comptime { _ = @import("cases/align.zig"); _ = @import("cases/alignof.zig"); @@ -11,7 +13,6 @@ comptime { _ = @import("cases/bugs/656.zig"); _ = @import("cases/cast.zig"); _ = @import("cases/const_slice_child.zig"); - _ = @import("cases/coroutines.zig"); _ = @import("cases/defer.zig"); _ = @import("cases/enum.zig"); _ = @import("cases/enum_with_members.zig"); @@ -48,4 +49,15 @@ comptime { _ = @import("cases/var_args.zig"); _ = @import("cases/void.zig"); _ = @import("cases/while.zig"); + + + // 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. + if (builtin.mode == builtin.Mode.Debug) { + _ = @import("cases/coroutines.zig"); + } + } diff --git a/test/cases/coroutines.zig b/test/cases/coroutines.zig @@ -4,12 +4,12 @@ const assert = std.debug.assert; var x: i32 = 1; test "create a coroutine and cancel it" { - const p = try (async(std.debug.global_allocator) emptyAsyncFn()); + const p = try (async(std.debug.global_allocator) simpleAsyncFn()); cancel p; assert(x == 2); } -async fn emptyAsyncFn() void { +async fn simpleAsyncFn() void { x += 1; suspend; x += 1;