Skip to content

Commit

Permalink
add standalone test for only dependending on the emitted assembly and…
Browse files Browse the repository at this point in the history
… not the bin
  • Loading branch information
Snektron committed Aug 18, 2024
1 parent bc9b7e9 commit 528f9b8
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/standalone/build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
//.issue_12588 = .{
// .path = "issue_12588",
//},
.emit_asm_no_bin = .{
.path = "emit_asm_no_bin",
},
.child_process = .{
.path = "child_process",
},
Expand Down
25 changes: 25 additions & 0 deletions test/standalone/emit_asm_no_bin/build.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const std = @import("std");

pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

const main = b.addExecutable(.{
.name = "main",
.root_source_file = b.path("main.zig"),
.optimize = optimize,
.target = target,
});

const assemble = b.addExecutable(.{
.name = "assemble",
.optimize = optimize,
.target = target,
});

// Note: the `main` step only has a dependency on the assembly file, and so
// should pass -fno-emit-bin. Don't depend on main otherwise in this test.
assemble.addAssemblyFile(main.getEmittedAsm());

b.installArtifact(assemble);
}
1 change: 1 addition & 0 deletions test/standalone/emit_asm_no_bin/main.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub fn main() void {}

0 comments on commit 528f9b8

Please sign in to comment.