| ... | ... | @@ -200,6 +200,7 @@ const module_test_targets = blk: { |
| 200 | 200 | // .use_lld = false, |
| 201 | 201 | // .optimize_mode = .ReleaseFast, |
| 202 | 202 | // .strip = true, |
| 203 | // .skip_modules = &.{"std"}, // TODO get these passing |
| 203 | 204 | //}, |
| 204 | 205 | //.{ |
| 205 | 206 | // .target = .{ |
| ... | ... | @@ -212,6 +213,7 @@ const module_test_targets = blk: { |
| 212 | 213 | // .use_lld = false, |
| 213 | 214 | // .optimize_mode = .ReleaseFast, |
| 214 | 215 | // .strip = true, |
| 216 | // .skip_modules = &.{"std"}, // TODO get these passing |
| 215 | 217 | //}, |
| 216 | 218 | |
| 217 | 219 | .{ |
| ... | ... | @@ -1609,6 +1611,8 @@ const module_test_targets = blk: { |
| 1609 | 1611 | .abi = .msvc, |
| 1610 | 1612 | }, |
| 1611 | 1613 | .link_libc = true, |
| 1614 | // https://codeberg.org/ziglang/zig/issues/35517 |
| 1615 | .skip_modules = &.{"libc"}, |
| 1612 | 1616 | }, |
| 1613 | 1617 | .{ |
| 1614 | 1618 | .target = .{ |
| ... | ... | @@ -1624,6 +1628,8 @@ const module_test_targets = blk: { |
| 1624 | 1628 | .abi = .gnu, |
| 1625 | 1629 | }, |
| 1626 | 1630 | .link_libc = true, |
| 1631 | // https://codeberg.org/ziglang/zig/issues/35517 |
| 1632 | .skip_modules = &.{"libc"}, |
| 1627 | 1633 | }, |
| 1628 | 1634 | |
| 1629 | 1635 | .{ |
| ... | ... | @@ -1634,6 +1640,8 @@ const module_test_targets = blk: { |
| 1634 | 1640 | }, |
| 1635 | 1641 | .use_llvm = false, |
| 1636 | 1642 | .use_lld = false, |
| 1643 | // https://codeberg.org/ziglang/zig/issues/35537 |
| 1644 | .skip_modules = &.{"behavior"}, |
| 1637 | 1645 | }, |
| 1638 | 1646 | .{ |
| 1639 | 1647 | .target = .{ |
| ... | ... | @@ -1649,6 +1657,8 @@ const module_test_targets = blk: { |
| 1649 | 1657 | .abi = .msvc, |
| 1650 | 1658 | }, |
| 1651 | 1659 | .link_libc = true, |
| 1660 | // https://codeberg.org/ziglang/zig/issues/35517 |
| 1661 | .skip_modules = &.{"libc"}, |
| 1652 | 1662 | }, |
| 1653 | 1663 | .{ |
| 1654 | 1664 | .target = .{ |
| ... | ... | @@ -1989,13 +1999,14 @@ const c_abi_targets = blk: { |
| 1989 | 1999 | |
| 1990 | 2000 | // Windows Targets |
| 1991 | 2001 | |
| 1992 | | .{ |
| 1993 | | .target = .{ |
| 1994 | | .cpu_arch = .x86, |
| 1995 | | .os_tag = .windows, |
| 1996 | | .abi = .gnu, |
| 1997 | | }, |
| 1998 | | }, |
| 2002 | // https://codeberg.org/ziglang/zig/issues/35521 |
| 2003 | //.{ |
| 2004 | // .target = .{ |
| 2005 | // .cpu_arch = .x86, |
| 2006 | // .os_tag = .windows, |
| 2007 | // .abi = .gnu, |
| 2008 | // }, |
| 2009 | //}, |
| 1999 | 2010 | .{ |
| 2000 | 2011 | .target = .{ |
| 2001 | 2012 | .cpu_arch = .x86_64, |
| ... | ... | @@ -2026,8 +2037,7 @@ const incremental_targets: []const []const u8 = &.{ |
| 2026 | 2037 | //"wasm32-wasi-selfhosted", |
| 2027 | 2038 | }; |
| 2028 | 2039 | |
| 2029 | | fn compatible32bitArch(b: *std.Build) ?std.Target.Cpu.Arch { |
| 2030 | | const host = b.graph.host.result; |
| 2040 | fn compatible32bitArch(host: *const std.Target) ?std.Target.Cpu.Arch { |
| 2031 | 2041 | return switch (host.os.tag) { |
| 2032 | 2042 | .windows => switch (host.cpu.arch) { |
| 2033 | 2043 | .x86_64 => .x86, |
| ... | ... | @@ -2050,6 +2060,108 @@ fn compatible32bitArch(b: *std.Build) ?std.Target.Cpu.Arch { |
| 2050 | 2060 | }; |
| 2051 | 2061 | } |
| 2052 | 2062 | |
| 2063 | pub fn isNative(actual_target: *const std.Build.ResolvedTarget, host: *const std.Target) bool { |
| 2064 | if (actual_target.query.isNative()) return true; |
| 2065 | const actual = &actual_target.result; |
| 2066 | |
| 2067 | if (actual.cpu.arch != host.cpu.arch and |
| 2068 | actual.cpu.arch != compatible32bitArch(host)) |
| 2069 | { |
| 2070 | return false; |
| 2071 | } |
| 2072 | |
| 2073 | if (actual.os.tag != host.os.tag) |
| 2074 | return false; |
| 2075 | |
| 2076 | // Remove features that don't actually affect compatibility. |
| 2077 | const irrelevant: std.Target.Cpu.Feature.Set = switch (host.cpu.arch) { |
| 2078 | .x86_64 => std.Target.x86.featureSet(&.{ |
| 2079 | .@"16bit_mode", |
| 2080 | .@"32bit_mode", |
| 2081 | .@"64bit", |
| 2082 | .false_deps_getmant, |
| 2083 | .false_deps_lzcnt_tzcnt, |
| 2084 | .false_deps_mulc, |
| 2085 | .false_deps_mullq, |
| 2086 | .false_deps_perm, |
| 2087 | .false_deps_popcnt, |
| 2088 | .false_deps_range, |
| 2089 | .fast_11bytenop, |
| 2090 | .fast_15bytenop, |
| 2091 | .fast_7bytenop, |
| 2092 | .fast_bextr, |
| 2093 | .fast_dpwssd, |
| 2094 | .fast_gather, |
| 2095 | .fast_hops, |
| 2096 | .fast_imm16, |
| 2097 | .fast_lzcnt, |
| 2098 | .fast_movbe, |
| 2099 | .fast_scalar_fsqrt, |
| 2100 | .fast_scalar_shift_masks, |
| 2101 | .fast_shld_rotate, |
| 2102 | .fast_variable_crosslane_shuffle, |
| 2103 | .fast_variable_perlane_shuffle, |
| 2104 | .fast_vector_fsqrt, |
| 2105 | .fast_vector_shift_masks, |
| 2106 | .faster_shift_than_shuffle, |
| 2107 | .no_bypass_delay, |
| 2108 | .no_bypass_delay_blend, |
| 2109 | .no_bypass_delay_mov, |
| 2110 | .no_bypass_delay_shuffle, |
| 2111 | .prefer_128_bit, |
| 2112 | .prefer_256_bit, |
| 2113 | .prefer_legacy_setcc, |
| 2114 | .prefer_mask_registers, |
| 2115 | .prefer_movmsk_over_vtest, |
| 2116 | .prefer_no_gather, |
| 2117 | .prefer_no_scatter, |
| 2118 | .slow_3ops_lea, |
| 2119 | .slow_incdec, |
| 2120 | .slow_lea, |
| 2121 | .slow_pmaddwd, |
| 2122 | .slow_pmulld, |
| 2123 | .slow_pmullq, |
| 2124 | .slow_shld, |
| 2125 | .slow_two_mem_ops, |
| 2126 | .slow_unaligned_mem_16, |
| 2127 | .slow_unaligned_mem_32, |
| 2128 | }), |
| 2129 | .aarch64, .aarch64_be => std.Target.aarch64.featureSet(&.{ |
| 2130 | .addr_lsl_slow_14, |
| 2131 | .alu_lsl_fast, |
| 2132 | .avoid_ldapur, |
| 2133 | .disable_fast_inc_vl, |
| 2134 | .exynos_cheap_as_move, |
| 2135 | .fuse_address, |
| 2136 | .fuse_addsub_2reg_const1, |
| 2137 | .fuse_adrp_add, |
| 2138 | .fuse_aes, |
| 2139 | .fuse_arith_logic, |
| 2140 | .fuse_crypto_eor, |
| 2141 | .fuse_csel, |
| 2142 | .fuse_cset, |
| 2143 | .fuse_literals, |
| 2144 | .predictable_select_expensive, |
| 2145 | .slow_misaligned_128store, |
| 2146 | .slow_paired_128, |
| 2147 | .slow_strqro_store, |
| 2148 | .use_experimental_zeroing_pseudos, |
| 2149 | .use_fixed_over_scalable_if_equal_cost, |
| 2150 | .use_postra_scheduler, |
| 2151 | .use_reciprocal_square_root, |
| 2152 | .use_wzr_to_vec_move, |
| 2153 | }), |
| 2154 | else => .empty, |
| 2155 | }; |
| 2156 | var set = actual.cpu.features; |
| 2157 | set.removeFeatureSet(irrelevant); |
| 2158 | |
| 2159 | if (!host.cpu.features.isSuperSetOf(set)) |
| 2160 | return false; |
| 2161 | |
| 2162 | return true; |
| 2163 | } |
| 2164 | |
| 2053 | 2165 | /// For stack trace tests, we only test native by default, because external executors are pretty |
| 2054 | 2166 | /// unreliable at stack tracing. However, if there's a 32-bit equivalent target which the host can |
| 2055 | 2167 | /// trivially run, we may as well at least test that! |
| ... | ... | @@ -2057,7 +2169,7 @@ fn nativeAndCompatible32bit(b: *std.Build, skip_non_native: bool) []const std.Bu |
| 2057 | 2169 | const host = b.graph.host.result; |
| 2058 | 2170 | const only_native = (&b.graph.host)[0..1]; |
| 2059 | 2171 | if (skip_non_native) return only_native; |
| 2060 | | const arch32 = compatible32bitArch(b) orelse return only_native; |
| 2172 | const arch32 = compatible32bitArch(&b.graph.host.result) orelse return only_native; |
| 2061 | 2173 | return b.graph.arena.dupe(std.Build.ResolvedTarget, &.{ |
| 2062 | 2174 | b.graph.host, |
| 2063 | 2175 | b.resolveTargetQuery(.{ .cpu_arch = arch32, .os_tag = host.os.tag }), |
| ... | ... | @@ -2074,7 +2186,7 @@ fn wineAndCompatible32bit(b: *std.Build, skip_non_native: bool) []const std.Buil |
| 2074 | 2186 | .os_tag = .windows, |
| 2075 | 2187 | })) catch @panic("OOM"); |
| 2076 | 2188 | if (!skip_non_native) { |
| 2077 | | if (compatible32bitArch(b)) |arch| { |
| 2189 | if (compatible32bitArch(&b.graph.host.result)) |arch| { |
| 2078 | 2190 | targets.append(b.graph.arena, b.resolveTargetQuery(.{ |
| 2079 | 2191 | .cpu_arch = arch, |
| 2080 | 2192 | .os_tag = .windows, |
| ... | ... | @@ -2519,11 +2631,21 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { |
| 2519 | 2631 | |
| 2520 | 2632 | if (!options.test_extra_targets and test_target.extra_target) continue; |
| 2521 | 2633 | |
| 2522 | | if (options.skip_non_native and !test_target.target.isNative()) |
| 2634 | if (options.skip_non_native and !isNative(&resolved_target, &b.graph.host.result)) |
| 2523 | 2635 | continue; |
| 2524 | 2636 | |
| 2525 | 2637 | const target = &resolved_target.result; |
| 2526 | 2638 | |
| 2639 | if (target.cpu.arch == .powerpc64le and target.ofmt == .c) { |
| 2640 | // https://codeberg.org/ziglang/zig/issues/35522 |
| 2641 | continue; |
| 2642 | } |
| 2643 | |
| 2644 | if (target.cpu.arch == .s390x and target.ofmt == .c) { |
| 2645 | // https://codeberg.org/ziglang/zig/issues/35523 |
| 2646 | continue; |
| 2647 | } |
| 2648 | |
| 2527 | 2649 | if (std.mem.eql(u8, options.name, "libc")) { |
| 2528 | 2650 | // The libc API tests obviously need to link libc. So for test |
| 2529 | 2651 | // target entries where we wouldn't link libc by default, skip the |
| ... | ... | @@ -2562,11 +2684,6 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { |
| 2562 | 2684 | if (options.skip_single_threaded and test_target.single_threaded == true) |
| 2563 | 2685 | continue; |
| 2564 | 2686 | |
| 2565 | | if (!would_use_llvm and target.cpu.arch == .aarch64) { |
| 2566 | | // TODO get std tests passing for the aarch64 self-hosted backend. |
| 2567 | | if (mem.eql(u8, options.name, "std")) continue; |
| 2568 | | } |
| 2569 | | |
| 2570 | 2687 | const want_this_mode = for (options.optimize_modes) |m| { |
| 2571 | 2688 | if (m == test_target.optimize_mode) break true; |
| 2572 | 2689 | } else false; |
| ... | ... | @@ -2812,8 +2929,6 @@ pub fn addCAbiTests(b: *std.Build, options: CAbiTestOptions) *Step { |
| 2812 | 2929 | const step = b.step("test-c-abi", "Run the C ABI tests"); |
| 2813 | 2930 | |
| 2814 | 2931 | for (c_abi_targets) |c_abi_target| { |
| 2815 | | if (options.skip_non_native and !c_abi_target.target.isNative()) continue; |
| 2816 | | |
| 2817 | 2932 | if (options.skip_wasm and c_abi_target.target.cpu_arch != null and c_abi_target.target.cpu_arch.?.isWasm()) continue; |
| 2818 | 2933 | |
| 2819 | 2934 | if (options.skip_freebsd and c_abi_target.target.os_tag == .freebsd) continue; |
| ... | ... | @@ -2827,6 +2942,9 @@ pub fn addCAbiTests(b: *std.Build, options: CAbiTestOptions) *Step { |
| 2827 | 2942 | const triple_txt = resolved_target.query.zigTriple(b.allocator) catch @panic("OOM"); |
| 2828 | 2943 | const target = &resolved_target.result; |
| 2829 | 2944 | |
| 2945 | if (options.skip_non_native and !isNative(&resolved_target, &b.graph.host.result)) |
| 2946 | continue; |
| 2947 | |
| 2830 | 2948 | if (options.test_target_filters.len > 0) { |
| 2831 | 2949 | for (options.test_target_filters) |filter| { |
| 2832 | 2950 | if (std.mem.indexOf(u8, triple_txt, filter) != null) break; |