diff --git a/build.zig b/build.zig index b20da1f586..47f4bad49c 100644 --- a/build.zig +++ b/build.zig @@ -381,32 +381,6 @@ pub fn build(b: *std.Build) !void { const test_target_filters = b.option([]const []const u8, "test-target-filter", "Skip tests whose target triple do not match any filter") orelse &[0][]const u8{}; const test_slow_targets = b.option(bool, "test-slow-targets", "Enable running module tests for targets that have a slow compiler backend") orelse false; - const test_cases_options = b.addOptions(); - - test_cases_options.addOption(bool, "enable_tracy", false); - test_cases_options.addOption(bool, "enable_debug_extensions", enable_debug_extensions); - test_cases_options.addOption(bool, "enable_logging", enable_logging); - test_cases_options.addOption(bool, "enable_link_snapshots", enable_link_snapshots); - test_cases_options.addOption(bool, "skip_non_native", skip_non_native); - test_cases_options.addOption(bool, "have_llvm", enable_llvm); - test_cases_options.addOption(bool, "llvm_has_m68k", llvm_has_m68k); - test_cases_options.addOption(bool, "llvm_has_csky", llvm_has_csky); - test_cases_options.addOption(bool, "llvm_has_arc", llvm_has_arc); - test_cases_options.addOption(bool, "llvm_has_xtensa", llvm_has_xtensa); - test_cases_options.addOption(bool, "force_gpa", force_gpa); - test_cases_options.addOption(bool, "enable_qemu", b.enable_qemu); - test_cases_options.addOption(bool, "enable_wine", b.enable_wine); - test_cases_options.addOption(bool, "enable_wasmtime", b.enable_wasmtime); - test_cases_options.addOption(bool, "enable_rosetta", b.enable_rosetta); - test_cases_options.addOption(bool, "enable_darling", b.enable_darling); - test_cases_options.addOption(u32, "mem_leak_frames", mem_leak_frames * 2); - test_cases_options.addOption(bool, "value_tracing", value_tracing); - test_cases_options.addOption(?[]const u8, "glibc_runtimes_dir", b.glibc_runtimes_dir); - test_cases_options.addOption([:0]const u8, "version", version); - test_cases_options.addOption(std.SemanticVersion, "semver", semver); - test_cases_options.addOption([]const []const u8, "test_filters", test_filters); - test_cases_options.addOption(DevEnv, "dev", if (only_c) .bootstrap else .core); - var chosen_opt_modes_buf: [4]builtin.OptimizeMode = undefined; var chosen_mode_index: usize = 0; if (!skip_debug) { @@ -533,6 +507,21 @@ pub fn build(b: *std.Build) !void { .max_rss = 5029889638, })); + test_modules_step.dependOn(tests.addModuleTests(b, .{ + .test_filters = test_filters, + .test_target_filters = test_target_filters, + .test_slow_targets = test_slow_targets, + .root_src = "src/main.zig", + .name = "compiler-internals", + .desc = "Run the compiler internals tests", + .optimize_modes = optimization_modes, + .include_paths = &.{}, + .skip_single_threaded = skip_single_threaded, + .skip_non_native = true, + .skip_libc = skip_libc, + .build_options = exe_options, + })); + test_step.dependOn(test_modules_step); test_step.dependOn(tests.addCompareOutputTests(b, test_filters, optimization_modes)); diff --git a/src/InternPool.zig b/src/InternPool.zig index d0ed875d86..749be6348a 100644 --- a/src/InternPool.zig +++ b/src/InternPool.zig @@ -9822,6 +9822,7 @@ test "basic usage" { const gpa = std.testing.allocator; var ip: InternPool = .empty; + try ip.init(gpa, 1); defer ip.deinit(gpa); const i32_type = try ip.get(gpa, .main, .{ .int_type = .{ diff --git a/src/Package/Fetch.zig b/src/Package/Fetch.zig index f64d315fdf..df0f1443c1 100644 --- a/src/Package/Fetch.zig +++ b/src/Package/Fetch.zig @@ -2244,7 +2244,6 @@ const TestFetchBuilder = struct { thread_pool: ThreadPool, http_client: std.http.Client, global_cache_directory: Cache.Directory, - progress: std.Progress, job_queue: Fetch.JobQueue, fetch: Fetch, @@ -2260,8 +2259,6 @@ const TestFetchBuilder = struct { self.http_client = .{ .allocator = allocator }; self.global_cache_directory = .{ .handle = cache_dir, .path = null }; - self.progress = .{ .dont_print_on_dumb = true }; - self.job_queue = .{ .http_client = &self.http_client, .thread_pool = &self.thread_pool, @@ -2281,10 +2278,11 @@ const TestFetchBuilder = struct { .lazy_status = .eager, .parent_package_root = Cache.Path{ .root_dir = Cache.Directory{ .handle = cache_dir, .path = null } }, .parent_manifest_ast = null, - .prog_node = self.progress.start("Fetch", 0), + .prog_node = std.Progress.Node.none, .job_queue = &self.job_queue, .omit_missing_hash_error = true, .allow_missing_paths_field = false, + .use_latest_commit = true, .package_root = undefined, .error_bundle = undefined, @@ -2293,6 +2291,8 @@ const TestFetchBuilder = struct { .actual_hash = undefined, .has_build_zig = false, .oom_flag = false, + .latest_commit = null, + .module = null, }; return &self.fetch; diff --git a/src/link/MachO/dyld_info/Rebase.zig b/src/link/MachO/dyld_info/Rebase.zig index cbd0461431..dc4fcbcc1d 100644 --- a/src/link/MachO/dyld_info/Rebase.zig +++ b/src/link/MachO/dyld_info/Rebase.zig @@ -281,7 +281,7 @@ test "rebase - no entries" { defer rebase.deinit(gpa); try rebase.finalize(gpa); - try testing.expectEqual(@as(u64, 0), rebase.size()); + try testing.expectEqual(0, rebase.buffer.items.len); } test "rebase - single entry" { diff --git a/src/main.zig b/src/main.zig index 1f8bd8d065..e1392428f6 100644 --- a/src/main.zig +++ b/src/main.zig @@ -34,6 +34,10 @@ const Zcu = @import("Zcu.zig"); const mingw = @import("mingw.zig"); const dev = @import("dev.zig"); +test { + _ = Package; +} + pub const std_options: std.Options = .{ .wasiCwd = wasi_cwd, .logFn = log, diff --git a/test/tests.zig b/test/tests.zig index e123dc1e2b..67725b8184 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -1303,6 +1303,7 @@ const ModuleTestOptions = struct { skip_libc: bool, max_rss: usize = 0, no_builtin: bool = false, + build_options: ?*std.Build.Step.Options = null, }; pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { @@ -1392,6 +1393,9 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { .strip = test_target.strip, }); if (options.no_builtin) these_tests.no_builtin = true; + if (options.build_options) |build_options| { + these_tests.root_module.addOptions("build_options", build_options); + } const single_threaded_suffix = if (test_target.single_threaded == true) "-single" else ""; const backend_suffix = if (test_target.use_llvm == true) "-llvm"