zig/test/link/wasm/producers/build.zig
Luuk de Gram 8635c18e40
test/link: don't strip producers section for wasm
When testing the Wasm linker for the producers section
we do not ever want to strip the binary as this will remove
the producers section in release-small.

This fixes the CI errors by d086b371f0e21e5029e1b0d05838b87502eb63e6
2022-10-11 21:27:09 +02:00

38 lines
1.2 KiB
Zig

const std = @import("std");
const builtin = @import("builtin");
const Builder = std.build.Builder;
pub fn build(b: *Builder) void {
const mode = b.standardReleaseOptions();
const test_step = b.step("test", "Test");
test_step.dependOn(b.getInstallStep());
const lib = b.addSharedLibrary("lib", "lib.zig", .unversioned);
lib.setBuildMode(mode);
lib.setTarget(.{ .cpu_arch = .wasm32, .os_tag = .freestanding });
lib.use_llvm = false;
lib.use_stage1 = false;
lib.use_lld = false;
lib.strip = false;
lib.install();
const zig_version = builtin.zig_version;
var version_buf: [100]u8 = undefined;
const version_fmt = std.fmt.bufPrint(&version_buf, "version {}", .{zig_version}) catch unreachable;
const check_lib = lib.checkObject(.wasm);
check_lib.checkStart("name producers");
check_lib.checkNext("fields 2");
check_lib.checkNext("field_name language");
check_lib.checkNext("values 1");
check_lib.checkNext("value_name Zig");
check_lib.checkNext(version_fmt);
check_lib.checkNext("field_name processed-by");
check_lib.checkNext("values 1");
check_lib.checkNext("value_name Zig");
check_lib.checkNext(version_fmt);
test_step.dependOn(&check_lib.step);
}