authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-04-27 00:05:20+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-04-27 14:09:05+02:00
log5411358956ef1c07e28ab477b10b66ade1000c58
tree16d1c2cc7f1de7ffbcca0e5c128503bbf26f750b
parent26bb429093141e70e136da1f7861e2d6473328df
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

test: Allow cases to set emit_asm (defaults to false).


1 files changed, 10 insertions(+), 1 deletions(-)

test/src/Cases.zig+10-1
...@@ -62,6 +62,7 @@ pub const Case = struct {...@@ -62,6 +62,7 @@ pub const Case = struct {
62 Header: []const u8,62 Header: []const u8,
63 },63 },
6464
65 emit_asm: bool = false,
65 emit_bin: bool = true,66 emit_bin: bool = true,
66 emit_h: bool = false,67 emit_h: bool = false,
67 is_test: bool = false,68 is_test: bool = false,
...@@ -371,6 +372,7 @@ fn addFromDirInner(...@@ -371,6 +372,7 @@ fn addFromDirInner(
371 const output_mode = try manifest.getConfigForKeyAssertSingle("output_mode", std.builtin.OutputMode);372 const output_mode = try manifest.getConfigForKeyAssertSingle("output_mode", std.builtin.OutputMode);
372 const pic = try manifest.getConfigForKeyAssertSingle("pic", ?bool);373 const pic = try manifest.getConfigForKeyAssertSingle("pic", ?bool);
373 const pie = try manifest.getConfigForKeyAssertSingle("pie", ?bool);374 const pie = try manifest.getConfigForKeyAssertSingle("pie", ?bool);
375 const emit_asm = try manifest.getConfigForKeyAssertSingle("emit_asm", bool);
374 const emit_bin = try manifest.getConfigForKeyAssertSingle("emit_bin", bool);376 const emit_bin = try manifest.getConfigForKeyAssertSingle("emit_bin", bool);
375 const imports = try manifest.getConfigForKeyAlloc(ctx.arena, "imports", []const u8);377 const imports = try manifest.getConfigForKeyAlloc(ctx.arena, "imports", []const u8);
376378
...@@ -438,6 +440,7 @@ fn addFromDirInner(...@@ -438,6 +440,7 @@ fn addFromDirInner(
438 .backend = backend,440 .backend = backend,
439 .files = .init(ctx.arena),441 .files = .init(ctx.arena),
440 .case = null,442 .case = null,
443 .emit_asm = emit_asm,
441 .emit_bin = emit_bin,444 .emit_bin = emit_bin,
442 .is_test = is_test,445 .is_test = is_test,
443 .output_mode = output_mode,446 .output_mode = output_mode,
...@@ -663,7 +666,10 @@ pub fn lowerToBuildSteps(...@@ -663,7 +666,10 @@ pub fn lowerToBuildSteps(
663666
664 switch (case.case.?) {667 switch (case.case.?) {
665 .Compile => {668 .Compile => {
666 // Force the binary to be emitted if requested.669 // Force the assembly/binary to be emitted if requested.
670 if (case.emit_asm) {
671 _ = artifact.getEmittedAsm();
672 }
667 if (case.emit_bin) {673 if (case.emit_bin) {
668 _ = artifact.getEmittedBin();674 _ = artifact.getEmittedBin();
669 }675 }
...@@ -761,6 +767,8 @@ const TestManifestConfigDefaults = struct {...@@ -761,6 +767,8 @@ const TestManifestConfigDefaults = struct {
761 .run_translated_c => "Obj",767 .run_translated_c => "Obj",
762 .cli => @panic("TODO test harness for CLI tests"),768 .cli => @panic("TODO test harness for CLI tests"),
763 };769 };
770 } else if (std.mem.eql(u8, key, "emit_asm")) {
771 return "false";
764 } else if (std.mem.eql(u8, key, "emit_bin")) {772 } else if (std.mem.eql(u8, key, "emit_bin")) {
765 return "true";773 return "true";
766 } else if (std.mem.eql(u8, key, "is_test")) {774 } else if (std.mem.eql(u8, key, "is_test")) {
...@@ -802,6 +810,7 @@ const TestManifest = struct {...@@ -802,6 +810,7 @@ const TestManifest = struct {
802 trailing_bytes: []const u8 = "",810 trailing_bytes: []const u8 = "",
803811
804 const valid_keys = std.StaticStringMap(void).initComptime(.{812 const valid_keys = std.StaticStringMap(void).initComptime(.{
813 .{ "emit_asm", {} },
805 .{ "emit_bin", {} },814 .{ "emit_bin", {} },
806 .{ "is_test", {} },815 .{ "is_test", {} },
807 .{ "output_mode", {} },816 .{ "output_mode", {} },