aboutsummaryrefslogtreecommitdiff
path: root/test/src/Cases.zig
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2023-07-23 23:45:31 -0400
committerJacob Young <jacobly0@users.noreply.github.com>2023-07-23 23:48:19 -0400
commitc610cde1eb460ddf80910f34e19c8a68d1bc86a9 (patch)
tree7ddba1eab424cc3c6c26d30d4d73cbb570e7d666 /test/src/Cases.zig
parent06af9cc101d0e688f7c6a1c2cc009b917f0a7bdf (diff)
downloadzig-c610cde1eb460ddf80910f34e19c8a68d1bc86a9.tar.gz
zig-c610cde1eb460ddf80910f34e19c8a68d1bc86a9.zip
test: test for issues starting codegen on many targets
Specifically this is to make sure llvm data layout generation doesn't regress. The no emit bin is to allow testing targets that can't currently be linked. The commented out targets are ones that fail in the linker anyway when no emit bin is passed.
Diffstat (limited to 'test/src/Cases.zig')
-rw-r--r--test/src/Cases.zig16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/src/Cases.zig b/test/src/Cases.zig
index 92ec3cb35f..ce080b5490 100644
--- a/test/src/Cases.zig
+++ b/test/src/Cases.zig
@@ -76,6 +76,7 @@ pub const Case = struct {
output_mode: std.builtin.OutputMode,
optimize_mode: std.builtin.Mode = .Debug,
updates: std.ArrayList(Update),
+ emit_bin: bool = true,
emit_h: bool = false,
is_test: bool = false,
expect_exact: bool = false,
@@ -176,6 +177,19 @@ pub fn exeFromCompiledC(ctx: *Cases, name: []const u8, target: CrossTarget) *Cas
return &ctx.cases.items[ctx.cases.items.len - 1];
}
+pub fn noEmitUsingLlvmBackend(ctx: *Cases, name: []const u8, target: CrossTarget) *Case {
+ ctx.cases.append(Case{
+ .name = name,
+ .target = target,
+ .updates = std.ArrayList(Update).init(ctx.cases.allocator),
+ .output_mode = .Obj,
+ .emit_bin = false,
+ .deps = std.ArrayList(DepModule).init(ctx.arena),
+ .backend = .llvm,
+ }) catch @panic("out of memory");
+ return &ctx.cases.items[ctx.cases.items.len - 1];
+}
+
/// Adds a test case that uses the LLVM backend to emit an executable.
/// Currently this implies linking libc, because only then we can generate a testable executable.
pub fn exeUsingLlvmBackend(ctx: *Cases, name: []const u8, target: CrossTarget) *Case {
@@ -537,6 +551,8 @@ pub fn lowerToBuildSteps(
}),
};
+ artifact.emit_bin = if (case.emit_bin) .default else .no_emit;
+
if (case.link_libc) artifact.linkLibC();
switch (case.backend) {