diff --git a/src/main.zig b/src/main.zig index 160e9bb..ded836a 100644 --- a/src/main.zig +++ b/src/main.zig @@ -154,10 +154,12 @@ pub fn entry_point(arguments: []const [*:0]const u8, environment: [*:null]const }); if (!result.is_successful()) { - lib.print_string("Failed to run test "); + lib.print_string("[BOOTSTRAP] Failed to run test "); lib.print_string(name); lib.print_string(" with build mode "); lib.print_string(@tagName(build_mode)); + lib.print_string("\n"); + if (stop_at_failure) { lib.libc.exit(1); } @@ -165,6 +167,51 @@ pub fn entry_point(arguments: []const [*:0]const u8, environment: [*:null]const } } } + + const relative_file_path = arena.join_string(&.{"src/compiler.bbb"}); + for (build_modes) |build_mode| { + for ([2]bool{ true, false }) |has_debug_info| { + const position = arena.position; + defer arena.restore(position); + + const compile_result = compile_file(arena, .{ + .relative_file_path = relative_file_path, + .build_mode = build_mode, + .has_debug_info = has_debug_info, + .silent = true, + }); + + for (names) |name| { + for (build_modes) |self_hosted_build_mode| { + for ([2]bool{ true, false }) |self_hosted_has_debug_info| { + const self_hosted_relative_file_path = arena.join_string(&.{ "tests/", name, ".bbb" }); + const result = lib.os.run_child_process(arena, &.{ compile_result.executable, "compile", self_hosted_relative_file_path, @tagName(self_hosted_build_mode), if (self_hosted_has_debug_info) "true" else "false" }, environment, .{ + .stdout = .inherit, + .stderr = .inherit, + .null_file_descriptor = null, + }); + if (!result.is_successful()) { + lib.print_string("[SELF-HOSTED] Failed to compile "); + lib.print_string(name); + lib.print_string(" with build mode "); + lib.print_string(@tagName(build_mode)); + lib.print_string(" and debug info "); + lib.print_string(if (has_debug_info) "on" else "off"); + lib.print_string(", with self-hosted build mode "); + lib.print_string(@tagName(self_hosted_build_mode)); + lib.print_string(" and self-hosted debug info "); + lib.print_string(if (self_hosted_has_debug_info) "on" else "off"); + lib.print_string("\n"); + + if (stop_at_failure) { + lib.libc.exit(1); + } + } + } + } + } + } + } }, } }