aboutsummaryrefslogtreecommitdiff
path: root/test/src/Cases.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-12-05 16:09:07 -0700
committerAndrew Kelley <andrew@ziglang.org>2024-01-01 17:51:18 -0700
commitb92e30ff0bd2b77a486451b21d17666a311407f3 (patch)
treecd2504c6815b27486e554c2541d4496d7e8f91ab /test/src/Cases.zig
parentf5613a0e3589fcca51411ce379f3c90eace99fa6 (diff)
downloadzig-b92e30ff0bd2b77a486451b21d17666a311407f3.tar.gz
zig-b92e30ff0bd2b77a486451b21d17666a311407f3.zip
std.Build.ResolvedTarget: rename target field to result
This change is seemingly insignificant but I actually agonized over this for three days. Some other things I considered: * (status quo in master branch) make Compile step creation functions accept a Target.Query and delete the ResolvedTarget struct. - downside: redundantly resolve target queries many times * same as before but additionally add a hash map to cache target query resolutions. - downside: now there is a hash map that doesn't actually need to exist, just to make the API more ergonomic. * add is_native_os and is_native_abi fields to std.Target and use it directly as the result of resolving a target query. - downside: they really don't belong there. They would be available as comptime booleans via `@import("builtin")` but they should not be exposed that way. With this change the downsides are: * the option name of addExecutable and friends is `target` instead of `resolved_target` matching the type name. - upside: this does not break compatibility with existing build scripts * you likely end up seeing `target.result.cpu.arch` rather than `target.cpu.arch`. - upside: this is an improvement over `target.target.cpu.arch` which it was before this commit. - downside: `b.host.target` is now `b.host.result`.
Diffstat (limited to 'test/src/Cases.zig')
-rw-r--r--test/src/Cases.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/src/Cases.zig b/test/src/Cases.zig
index 0f2645f0e0..6fedf43bf7 100644
--- a/test/src/Cases.zig
+++ b/test/src/Cases.zig
@@ -467,7 +467,7 @@ fn addFromDirInner(
// Cross-product to get all possible test combinations
for (targets) |target_query| {
const resolved_target = b.resolveTargetQuery(target_query);
- const target = resolved_target.target;
+ const target = resolved_target.result;
for (backends) |backend| {
if (backend == .stage2 and
target.cpu.arch != .wasm32 and target.cpu.arch != .x86_64)
@@ -647,8 +647,8 @@ pub fn lowerToBuildSteps(
parent_step.dependOn(&artifact.step);
},
.Execution => |expected_stdout| no_exec: {
- const run = if (case.target.target.ofmt == .c) run_step: {
- if (getExternalExecutor(host, &case.target.target, .{ .link_libc = true }) != .native) {
+ const run = if (case.target.result.ofmt == .c) run_step: {
+ if (getExternalExecutor(host, &case.target.result, .{ .link_libc = true }) != .native) {
// We wouldn't be able to run the compiled C code.
break :no_exec;
}
@@ -667,7 +667,7 @@ pub fn lowerToBuildSteps(
"--",
"-lc",
"-target",
- case.target.target.zigTriple(b.allocator) catch @panic("OOM"),
+ case.target.result.zigTriple(b.allocator) catch @panic("OOM"),
});
run_c.addArtifactArg(artifact);
break :run_step run_c;
@@ -693,7 +693,7 @@ pub fn lowerToBuildSteps(
continue; // Pass test.
}
- if (getExternalExecutor(host, &case.target.target, .{ .link_libc = true }) != .native) {
+ if (getExternalExecutor(host, &case.target.result, .{ .link_libc = true }) != .native) {
// We wouldn't be able to run the compiled C code.
continue; // Pass test.
}