diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2025-04-27 00:05:20 +0200 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2025-04-27 14:09:05 +0200 |
| commit | 5411358956ef1c07e28ab477b10b66ade1000c58 (patch) | |
| tree | 16d1c2cc7f1de7ffbcca0e5c128503bbf26f750b /test/src/Cases.zig | |
| parent | 26bb429093141e70e136da1f7861e2d6473328df (diff) | |
| download | zig-5411358956ef1c07e28ab477b10b66ade1000c58.tar.gz zig-5411358956ef1c07e28ab477b10b66ade1000c58.zip | |
test: Allow cases to set emit_asm (defaults to false).
Diffstat (limited to 'test/src/Cases.zig')
| -rw-r--r-- | test/src/Cases.zig | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/src/Cases.zig b/test/src/Cases.zig index 5f0c12c2b2..367db9765d 100644 --- a/test/src/Cases.zig +++ b/test/src/Cases.zig @@ -62,6 +62,7 @@ pub const Case = struct { Header: []const u8, }, + emit_asm: bool = false, emit_bin: bool = true, emit_h: bool = false, is_test: bool = false, @@ -371,6 +372,7 @@ fn addFromDirInner( const output_mode = try manifest.getConfigForKeyAssertSingle("output_mode", std.builtin.OutputMode); const pic = try manifest.getConfigForKeyAssertSingle("pic", ?bool); const pie = try manifest.getConfigForKeyAssertSingle("pie", ?bool); + const emit_asm = try manifest.getConfigForKeyAssertSingle("emit_asm", bool); const emit_bin = try manifest.getConfigForKeyAssertSingle("emit_bin", bool); const imports = try manifest.getConfigForKeyAlloc(ctx.arena, "imports", []const u8); @@ -438,6 +440,7 @@ fn addFromDirInner( .backend = backend, .files = .init(ctx.arena), .case = null, + .emit_asm = emit_asm, .emit_bin = emit_bin, .is_test = is_test, .output_mode = output_mode, @@ -663,7 +666,10 @@ pub fn lowerToBuildSteps( switch (case.case.?) { .Compile => { - // Force the binary to be emitted if requested. + // Force the assembly/binary to be emitted if requested. + if (case.emit_asm) { + _ = artifact.getEmittedAsm(); + } if (case.emit_bin) { _ = artifact.getEmittedBin(); } @@ -761,6 +767,8 @@ const TestManifestConfigDefaults = struct { .run_translated_c => "Obj", .cli => @panic("TODO test harness for CLI tests"), }; + } else if (std.mem.eql(u8, key, "emit_asm")) { + return "false"; } else if (std.mem.eql(u8, key, "emit_bin")) { return "true"; } else if (std.mem.eql(u8, key, "is_test")) { @@ -802,6 +810,7 @@ const TestManifest = struct { trailing_bytes: []const u8 = "", const valid_keys = std.StaticStringMap(void).initComptime(.{ + .{ "emit_asm", {} }, .{ "emit_bin", {} }, .{ "is_test", {} }, .{ "output_mode", {} }, |
