Even better test parameters
This commit is contained in:
parent
322c2aaa8b
commit
34a3514856
14
.github/workflows/ci.yml
vendored
14
.github/workflows/ci.yml
vendored
@ -61,9 +61,6 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
os: [ ubuntu-24.04 ]
|
os: [ ubuntu-24.04 ]
|
||||||
BIRTH_ZIG_BUILD_TYPE: ${{ fromJSON(needs.generate-config.outputs.BIRTH_ZIG_BUILD_TYPES) }}
|
BIRTH_ZIG_BUILD_TYPE: ${{ fromJSON(needs.generate-config.outputs.BIRTH_ZIG_BUILD_TYPES) }}
|
||||||
SYSTEM_LLVM: [ true, false ]
|
|
||||||
TEST_BUILD_MODE: [ debug_none, debug_fast, debug_size, soft_optimize, optimize_for_speed, optimize_for_size, aggressively_optimize_for_speed, aggressively_optimize_for_size ]
|
|
||||||
HAS_DEBUG_INFO: [ true, false ]
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
env:
|
env:
|
||||||
BIRTH_LINUX_IMAGE: ${{ needs.generate-config.outputs.BIRTH_LINUX_IMAGE }}
|
BIRTH_LINUX_IMAGE: ${{ needs.generate-config.outputs.BIRTH_LINUX_IMAGE }}
|
||||||
@ -77,8 +74,13 @@ jobs:
|
|||||||
version: master
|
version: master
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: sudo apt-get update && sudo apt-get install -y llvm-dev liblld-dev
|
run: sudo apt-get update && sudo apt-get install -y llvm-dev liblld-dev
|
||||||
- name: Build and test
|
- name: Build and test (Packaged LLVM)
|
||||||
run: |
|
run: |
|
||||||
zig build test --summary all -Doptimize=${{matrix.BIRTH_ZIG_BUILD_TYPE}} -Dsystem_llvm=${{matrix.SYSTEM_LLVM}} -Dtest_build_mode=${{matrix.TEST_BUILD_MODE}} -Dhas_debug_info=${{matrix.HAS_DEBUG_INFO}}
|
zig build test --summary all -Doptimize=${{matrix.BIRTH_ZIG_BUILD_TYPE}} -Dsystem_llvm=false
|
||||||
zig build install -Doptimize=${{matrix.BIRTH_ZIG_BUILD_TYPE}} -Dsystem_llvm=${{matrix.SYSTEM_LLVM}}
|
zig build install -Doptimize=${{matrix.BIRTH_ZIG_BUILD_TYPE}} -Dsystem_llvm=false
|
||||||
|
ldd zig-out/bin/bloat-buster
|
||||||
|
- name: Build and test (System LLVM)
|
||||||
|
run: |
|
||||||
|
zig build test --summary all -Doptimize=${{matrix.BIRTH_ZIG_BUILD_TYPE}} -Dsystem_llvm=true
|
||||||
|
zig build install -Doptimize=${{matrix.BIRTH_ZIG_BUILD_TYPE}} -Dsystem_llvm=true
|
||||||
ldd zig-out/bin/bloat-buster
|
ldd zig-out/bin/bloat-buster
|
||||||
|
@ -302,19 +302,11 @@ pub fn build(b: *std.Build) !void {
|
|||||||
system_llvm = b.option(bool, "system_llvm", "Link against system LLVM libraries") orelse true;
|
system_llvm = b.option(bool, "system_llvm", "Link against system LLVM libraries") orelse true;
|
||||||
const path = env.get("PATH") orelse unreachable;
|
const path = env.get("PATH") orelse unreachable;
|
||||||
|
|
||||||
const test_build_mode = b.option(BuildMode, "test_build_mode", "Test build mode") orelse .debug_none;
|
|
||||||
const has_debug_info = b.option(bool, "has_debug_info", "Has debug information") orelse true;
|
|
||||||
|
|
||||||
const configuration = b.addOptions();
|
|
||||||
configuration.addOption(BuildMode, "test_build_mode", test_build_mode);
|
|
||||||
configuration.addOption(u1, "has_debug_info", @intFromBool(has_debug_info));
|
|
||||||
|
|
||||||
const exe_mod = b.createModule(.{
|
const exe_mod = b.createModule(.{
|
||||||
.root_source_file = b.path("src/main.zig"),
|
.root_source_file = b.path("src/main.zig"),
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
exe_mod.addOptions("configuration", configuration);
|
|
||||||
|
|
||||||
const llvm = try LLVM.setup(b, path);
|
const llvm = try LLVM.setup(b, path);
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ const builtin = @import("builtin");
|
|||||||
const Arena = lib.Arena;
|
const Arena = lib.Arena;
|
||||||
const assert = lib.assert;
|
const assert = lib.assert;
|
||||||
const api = @import("llvm_api.zig");
|
const api = @import("llvm_api.zig");
|
||||||
const configuration = @import("configuration");
|
|
||||||
|
|
||||||
/// This is a String which ABI-compatible with C++
|
/// This is a String which ABI-compatible with C++
|
||||||
pub const String = extern struct {
|
pub const String = extern struct {
|
||||||
|
@ -3,7 +3,6 @@ const assert = lib.assert;
|
|||||||
const os = lib.os;
|
const os = lib.os;
|
||||||
const Arena = lib.Arena;
|
const Arena = lib.Arena;
|
||||||
const llvm = @import("LLVM.zig");
|
const llvm = @import("LLVM.zig");
|
||||||
const configuration = @import("configuration");
|
|
||||||
|
|
||||||
const LexerResult = struct {
|
const LexerResult = struct {
|
||||||
token: Token,
|
token: Token,
|
||||||
@ -307,7 +306,9 @@ const ConvertOptions = struct {
|
|||||||
executable: [:0]const u8,
|
executable: [:0]const u8,
|
||||||
build_mode: BuildMode,
|
build_mode: BuildMode,
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
|
has_debug_info: u1,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub noinline fn convert(options: ConvertOptions) void {
|
pub noinline fn convert(options: ConvertOptions) void {
|
||||||
var converter = Converter{
|
var converter = Converter{
|
||||||
.content = options.content,
|
.content = options.content,
|
||||||
@ -478,7 +479,7 @@ pub noinline fn convert(options: ConvertOptions) void {
|
|||||||
|
|
||||||
const object_generate_result = llvm.object_generate(module_builder.module, target_machine, .{
|
const object_generate_result = llvm.object_generate(module_builder.module, target_machine, .{
|
||||||
.optimize_when_possible = @intFromBool(@intFromEnum(options.build_mode) > @intFromEnum(BuildMode.soft_optimize)),
|
.optimize_when_possible = @intFromBool(@intFromEnum(options.build_mode) > @intFromEnum(BuildMode.soft_optimize)),
|
||||||
.debug_info = configuration.has_debug_info,
|
.debug_info = options.has_debug_info,
|
||||||
.optimization_level = if (options.build_mode != .debug_none) options.build_mode.to_llvm_ir() else null,
|
.optimization_level = if (options.build_mode != .debug_none) options.build_mode.to_llvm_ir() else null,
|
||||||
.path = options.object,
|
.path = options.object,
|
||||||
});
|
});
|
||||||
@ -499,15 +500,25 @@ pub noinline fn convert(options: ConvertOptions) void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_test_build_mode() BuildMode {
|
|
||||||
return @enumFromInt(@intFromEnum(configuration.test_build_mode));
|
|
||||||
}
|
|
||||||
|
|
||||||
test "minimal" {
|
test "minimal" {
|
||||||
invoke("minimal", get_test_build_mode());
|
invoke("minimal");
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn invoke(name: []const u8, build_mode: BuildMode) void {
|
fn invoke(name: []const u8) void {
|
||||||
|
inline for (@typeInfo(BuildMode).@"enum".fields) |f| {
|
||||||
|
const build_mode = @field(BuildMode, f.name);
|
||||||
|
inline for ([2]u1{ 0, 1 }) |has_debug_info| {
|
||||||
|
invoke_wrapper(name, build_mode, has_debug_info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// We invoke a function with comptime parameters so it's easily visible in CI stack traces
|
||||||
|
fn invoke_wrapper(name: []const u8, comptime build_mode: BuildMode, comptime has_debug_info: u1) void {
|
||||||
|
return invoke_single(name, build_mode, has_debug_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn invoke_single(name: []const u8, build_mode: BuildMode, has_debug_info: u1) void {
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
if (!lib.GlobalState.initialized) {
|
if (!lib.GlobalState.initialized) {
|
||||||
lib.GlobalState.initialize();
|
lib.GlobalState.initialize();
|
||||||
@ -531,5 +542,6 @@ pub fn invoke(name: []const u8, build_mode: BuildMode) void {
|
|||||||
.executable = executable_path,
|
.executable = executable_path,
|
||||||
.build_mode = build_mode,
|
.build_mode = build_mode,
|
||||||
.name = name,
|
.name = name,
|
||||||
|
.has_debug_info = has_debug_info,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
const lib = @import("lib.zig");
|
const lib = @import("lib.zig");
|
||||||
const configuration = @import("configuration");
|
|
||||||
const llvm = @import("LLVM.zig");
|
const llvm = @import("LLVM.zig");
|
||||||
const converter = @import("converter.zig");
|
const converter = @import("converter.zig");
|
||||||
const Arena = lib.Arena;
|
const Arena = lib.Arena;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user