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 {
6262 Header: []const u8,
6363 },
6464
65 emit_asm: bool = false,
6566 emit_bin: bool = true,
6667 emit_h: bool = false,
6768 is_test: bool = false,
......@@ -371,6 +372,7 @@ fn addFromDirInner(
371372 const output_mode = try manifest.getConfigForKeyAssertSingle("output_mode", std.builtin.OutputMode);
372373 const pic = try manifest.getConfigForKeyAssertSingle("pic", ?bool);
373374 const pie = try manifest.getConfigForKeyAssertSingle("pie", ?bool);
375 const emit_asm = try manifest.getConfigForKeyAssertSingle("emit_asm", bool);
374376 const emit_bin = try manifest.getConfigForKeyAssertSingle("emit_bin", bool);
375377 const imports = try manifest.getConfigForKeyAlloc(ctx.arena, "imports", []const u8);
376378
......@@ -438,6 +440,7 @@ fn addFromDirInner(
438440 .backend = backend,
439441 .files = .init(ctx.arena),
440442 .case = null,
443 .emit_asm = emit_asm,
441444 .emit_bin = emit_bin,
442445 .is_test = is_test,
443446 .output_mode = output_mode,
......@@ -663,7 +666,10 @@ pub fn lowerToBuildSteps(
663666
664667 switch (case.case.?) {
665668 .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 }
667673 if (case.emit_bin) {
668674 _ = artifact.getEmittedBin();
669675 }
......@@ -761,6 +767,8 @@ const TestManifestConfigDefaults = struct {
761767 .run_translated_c => "Obj",
762768 .cli => @panic("TODO test harness for CLI tests"),
763769 };
770 } else if (std.mem.eql(u8, key, "emit_asm")) {
771 return "false";
764772 } else if (std.mem.eql(u8, key, "emit_bin")) {
765773 return "true";
766774 } else if (std.mem.eql(u8, key, "is_test")) {
......@@ -802,6 +810,7 @@ const TestManifest = struct {
802810 trailing_bytes: []const u8 = "",
803811
804812 const valid_keys = std.StaticStringMap(void).initComptime(.{
813 .{ "emit_asm", {} },
805814 .{ "emit_bin", {} },
806815 .{ "is_test", {} },
807816 .{ "output_mode", {} },