aboutsummaryrefslogtreecommitdiff
path: root/src-self-hosted/test.zig
diff options
context:
space:
mode:
authorVexu <15308111+Vexu@users.noreply.github.com>2019-11-23 20:15:59 +0200
committerVexu <15308111+Vexu@users.noreply.github.com>2019-11-23 21:57:24 +0200
commitd40f204ec05d5913046c17ae46bba3b14cdaf384 (patch)
tree15df55915afb4a7dad4ee55ab39fa911ba4e658e /src-self-hosted/test.zig
parent133579d7c05a92e33bd8a4cfaf5c460f48150de7 (diff)
downloadzig-d40f204ec05d5913046c17ae46bba3b14cdaf384.tar.gz
zig-d40f204ec05d5913046c17ae46bba3b14cdaf384.zip
self hosted compiler: small miscellaneous fixes
Diffstat (limited to 'src-self-hosted/test.zig')
-rw-r--r--src-self-hosted/test.zig16
1 files changed, 6 insertions, 10 deletions
diff --git a/src-self-hosted/test.zig b/src-self-hosted/test.zig
index 8bfa0a46ed..670fc8ad6d 100644
--- a/src-self-hosted/test.zig
+++ b/src-self-hosted/test.zig
@@ -16,7 +16,7 @@ test "stage2" {
try @import("../test/stage2/compile_errors.zig").addCases(&ctx);
try @import("../test/stage2/compare_output.zig").addCases(&ctx);
- try ctx.run();
+ async ctx.run();
}
const file1 = "1.zig";
@@ -44,7 +44,7 @@ pub const TestContext = struct {
errdefer self.zig_compiler.deinit();
self.group = std.event.Group(anyerror!void).init(allocator);
- errdefer self.group.wait();
+ errdefer self.group.wait() catch {};
self.zig_lib_dir = try introspect.resolveZigLibDir(allocator);
errdefer allocator.free(self.zig_lib_dir);
@@ -59,14 +59,10 @@ pub const TestContext = struct {
self.zig_compiler.deinit();
}
- fn run(self: *TestContext) !void {
- const handle = try std.event.Loop.instance.?.call(waitForGroup, self);
- await handle;
- return self.any_err;
- }
-
- async fn waitForGroup(self: *TestContext) void {
+ fn run(self: *TestContext) void {
+ std.event.Loop.instance.?.startCpuBoundOperation();
self.any_err = self.group.wait();
+ return self.any_err;
}
fn testCompileError(
@@ -173,7 +169,7 @@ pub const TestContext = struct {
},
Compilation.Event.Error => |err| return err,
Compilation.Event.Fail => |msgs| {
- var stderr = try std.io.getStdErr();
+ const stderr = std.io.getStdErr();
try stderr.write("build incorrectly failed:\n");
for (msgs) |msg| {
defer msg.destroy();