| ... | ... | @@ -3198,8 +3198,14 @@ const LinkTestOptions = struct { |
| 3198 | 3198 | test_filters: []const []const u8, |
| 3199 | 3199 | optimize_modes: []const OptimizeMode, |
| 3200 | 3200 | skip_non_native: bool, |
| 3201 | skip_freebsd: bool, |
| 3202 | skip_netbsd: bool, |
| 3203 | skip_openbsd: bool, |
| 3201 | 3204 | skip_windows: bool, |
| 3205 | skip_darwin: bool, |
| 3206 | skip_linux: bool, |
| 3202 | 3207 | skip_llvm: bool, |
| 3208 | skip_libc: bool, |
| 3203 | 3209 | max_rss: usize, |
| 3204 | 3210 | }; |
| 3205 | 3211 | |
| ... | ... | @@ -3212,22 +3218,37 @@ pub fn addLinkTests(b: *std.Build, options: LinkTestOptions) *Step { |
| 3212 | 3218 | ) orelse false; |
| 3213 | 3219 | |
| 3214 | 3220 | for (link_targets) |link_target| { |
| 3215 | | if (options.skip_non_native and !link_target.target.isNative()) continue; |
| 3216 | | if (options.skip_windows and link_target.target.os_tag == .windows) continue; |
| 3217 | | |
| 3218 | 3221 | const resolved_target = b.resolveTargetQuery(link_target.target); |
| 3219 | | const triple_txt = resolved_target.query.zigTriple(b.allocator) catch @panic("OOM"); |
| 3222 | |
| 3223 | if (options.skip_non_native and !isNative(&resolved_target, &b.graph.host.result)) |
| 3224 | continue; |
| 3225 | |
| 3220 | 3226 | const target = &resolved_target.result; |
| 3221 | 3227 | |
| 3228 | if (options.skip_freebsd and target.os.tag == .freebsd) continue; |
| 3229 | if (options.skip_netbsd and target.os.tag == .netbsd) continue; |
| 3230 | if (options.skip_openbsd and target.os.tag == .openbsd) continue; |
| 3231 | if (options.skip_windows and target.os.tag == .windows) continue; |
| 3232 | if (options.skip_darwin and target.os.tag.isDarwin()) continue; |
| 3233 | if (options.skip_linux and target.os.tag == .linux) continue; |
| 3234 | |
| 3235 | const triple_txt = resolved_target.query.zigTriple(b.allocator) catch @panic("OOM"); |
| 3236 | |
| 3222 | 3237 | if (options.test_target_filters.len > 0) { |
| 3223 | 3238 | for (options.test_target_filters) |filter| { |
| 3224 | 3239 | if (std.mem.find(u8, triple_txt, filter) != null) break; |
| 3225 | 3240 | } else continue; |
| 3226 | 3241 | } |
| 3227 | 3242 | |
| 3243 | if (options.skip_libc and (link_target.link_libc == true or std.os.targetRequiresLibC(target))) |
| 3244 | continue; |
| 3245 | |
| 3246 | // We can't provide MSVC libc when cross-compiling. |
| 3247 | if (target.abi == .msvc and link_target.link_libc == true and builtin.os.tag != .windows) |
| 3248 | continue; |
| 3249 | |
| 3228 | 3250 | for (options.optimize_modes) |optimize_mode| { |
| 3229 | 3251 | if (link_target.optimize_mode != optimize_mode) continue; |
| 3230 | | if (link_target.link_libc and target.abi == .msvc and b.graph.host.result.os.tag != .windows) continue; |
| 3231 | 3252 | const would_use_llvm = wouldUseLlvm(link_target.use_llvm, link_target.target, optimize_mode); |
| 3232 | 3253 | if (options.skip_llvm and would_use_llvm) continue; |
| 3233 | 3254 | |