From dea3ed7f59347e87a1b8fa237202873988084ae8 Mon Sep 17 00:00:00 2001 From: Ivan Date: Mon, 28 Jul 2025 07:10:23 +0000 Subject: [PATCH] build: fix error in standalone test when using `--release` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Carl Ã…stholm --- test/standalone/dependency_options/build.zig | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/standalone/dependency_options/build.zig b/test/standalone/dependency_options/build.zig index 20e2db1fa2..95cde3c891 100644 --- a/test/standalone/dependency_options/build.zig +++ b/test/standalone/dependency_options/build.zig @@ -10,7 +10,14 @@ pub fn build(b: *std.Build) !void { const none_specified_mod = none_specified.module("dummy"); if (!none_specified_mod.resolved_target.?.query.eql(b.graph.host.query)) return error.TestFailed; - if (none_specified_mod.optimize.? != .Debug) return error.TestFailed; + const expected_optimize: std.builtin.OptimizeMode = switch (b.release_mode) { + .off => .Debug, + .any => unreachable, + .fast => .ReleaseFast, + .safe => .ReleaseSafe, + .small => .ReleaseSmall, + }; + if (none_specified_mod.optimize.? != expected_optimize) return error.TestFailed; // Passing null is the same as not specifying the option, // so this should resolve to the same cached dependency instance.