forked from ziglang/zig
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stage2: Add support for testing LLVM enabled builds in test-stage2
To make sure that we don't have to rebuild libc for every case, we now have a seperate cache directory for the global cache, which remains the same between test runs. Also make sure to destory the Compilation before executing a child process, otherwise the compiler deadlocks. (ziglang#7596)
- Loading branch information
1 parent
a926c91
commit 2d3dfaa
Showing
3 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const std = @import("std"); | ||
const TestContext = @import("../../src/test.zig").TestContext; | ||
const build_options = @import("build_options"); | ||
|
||
// These tests should work with all platforms, but we're using linux_x64 for | ||
// now for consistency. Will be expanded eventually. | ||
const linux_x64 = std.zig.CrossTarget{ | ||
.cpu_arch = .x86_64, | ||
.os_tag = .linux, | ||
}; | ||
|
||
pub fn addCases(ctx: *TestContext) !void { | ||
{ | ||
var case = ctx.exeUsingLlvmBackend("simple addition and subtraction", linux_x64); | ||
|
||
case.addCompareOutput( | ||
\\fn add(a: i32, b: i32) i32 { | ||
\\ return a + b; | ||
\\} | ||
\\ | ||
\\export fn main() c_int { | ||
\\ var a: i32 = -5; | ||
\\ const x = add(a, 7); | ||
\\ var y = add(2, 0); | ||
\\ y -= x; | ||
\\ return y; | ||
\\} | ||
, ""); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters