| author | |
| committer | |
| log | 79d9121670ebb73937ef0bed6d6b8044fada8715 |
| tree | 0e687f443c234bd13807a4ccb6e01cf173094f28 |
| parent | 0fd39f9e92a25f61562b0a067a9d7b2fdbed9f8c |
| parent | 38c1536b96888b17626b35acf911cef56668b54f |
| signature | Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM |
55 files changed, 413 insertions(+), 854 deletions(-)
build.zig+1| ... | @@ -636,6 +636,7 @@ pub fn build(b: *std.Build) !void { | ... | @@ -636,6 +636,7 @@ pub fn build(b: *std.Build) !void { |
| 636 | test_step.dependOn(tests.addStandaloneTests( | 636 | test_step.dependOn(tests.addStandaloneTests( |
| 637 | b, | 637 | b, |
| 638 | optimize_modes, | 638 | optimize_modes, |
| 639 | skip_non_native, | ||
| 639 | enable_macos_sdk, | 640 | enable_macos_sdk, |
| 640 | enable_ios_sdk, | 641 | enable_ios_sdk, |
| 641 | enable_symlinks_windows, | 642 | enable_symlinks_windows, |
lib/std/zig/target.zig+158| ... | @@ -537,6 +537,164 @@ pub fn compilerRtFloatAbi(target: *const std.Target, bits: u16) std.Target.Abi.F | ... | @@ -537,6 +537,164 @@ pub fn compilerRtFloatAbi(target: *const std.Target, bits: u16) std.Target.Abi.F |
| 537 | return .hard; | 537 | return .hard; |
| 538 | } | 538 | } |
| 539 | 539 | ||
| 540 | fn supportedCompatArch(host: *const std.Target, arch: std.Target.Cpu.Arch) bool { | ||
| 541 | // aarch64-freebsd and aarch64-linux can technically run 32-bit ARM binaries, but that depends | ||
| 542 | // on AArch32 support in the CPU. Since modern AArch64 CPUs have largely dropped this support, | ||
| 543 | // avoid reporting compatibility for 32-bit here since we'd just build a bunch of test binaries | ||
| 544 | // that never get run anyway. This added almost an hour's worth of useless work to aarch64-linux | ||
| 545 | // CI, for example. | ||
| 546 | // | ||
| 547 | // riscv64-linux and riscv64-netbsd similarly support 32-bit binaries. However, this requires a | ||
| 548 | // very recent kernel and for the kernel feature to be enabled. Additionally, contemporary | ||
| 549 | // RISC-V hardware is just too slow to justify building the 32-bit binaries. | ||
| 550 | return switch (host.os.tag) { | ||
| 551 | .illumos => switch (host.cpu.arch) { | ||
| 552 | .x86_64 => arch == .x86, | ||
| 553 | else => false, | ||
| 554 | }, | ||
| 555 | .linux => switch (host.cpu.arch) { | ||
| 556 | .mips64 => arch == .mips, | ||
| 557 | .mips64el => arch == .mipsel, | ||
| 558 | .powerpc64 => arch == .powerpc, | ||
| 559 | .sparc64 => arch == .sparc, | ||
| 560 | .x86_64 => arch == .x86, | ||
| 561 | else => false, | ||
| 562 | }, | ||
| 563 | .netbsd => switch (host.cpu.arch) { | ||
| 564 | .sparc64 => arch == .sparc, | ||
| 565 | .x86_64 => arch == .x86, | ||
| 566 | else => false, | ||
| 567 | }, | ||
| 568 | .windows => switch (host.cpu.arch) { | ||
| 569 | .x86_64 => arch == .x86, | ||
| 570 | else => false, | ||
| 571 | }, | ||
| 572 | else => false, | ||
| 573 | }; | ||
| 574 | } | ||
| 575 | |||
| 576 | /// Intended for test code to determine whether it makes sense to run a test for a particular target | ||
| 577 | /// on the host. This is not an objective check; it is best-effort and also makes subjective | ||
| 578 | /// judgements for some targets. | ||
| 579 | pub fn isNative(query: *const std.Target.Query, target: *const std.Target, host: *const std.Target) bool { | ||
| 580 | if (query.isNative()) return true; | ||
| 581 | |||
| 582 | if (target.cpu.arch != host.cpu.arch and !supportedCompatArch(host, target.cpu.arch)) | ||
| 583 | return false; | ||
| 584 | |||
| 585 | if (target.os.tag != host.os.tag) | ||
| 586 | return false; | ||
| 587 | |||
| 588 | // This check is really only necessary for the case where `host.cpu.arch.isAarch64()` and | ||
| 589 | // `target.cpu.arch.isArm()`. As they are wholly separate `std.Target` families with their own | ||
| 590 | // feature bits, the logic below would produce complete nonsense. | ||
| 591 | // | ||
| 592 | // This does mean that we aren't actually checking feature compatibility between these two | ||
| 593 | // families even though we should. That's not a problem currently, but in the future, we may | ||
| 594 | // need to add a special code path just for this specific case... | ||
| 595 | if (target.cpu.arch.family() != host.cpu.arch.family()) | ||
| 596 | return true; | ||
| 597 | |||
| 598 | // Remove features that don't actually affect compatibility. | ||
| 599 | const irrelevant: std.Target.Cpu.Feature.Set = switch (host.cpu.arch) { | ||
| 600 | .x86_64 => std.Target.x86.featureSet(&.{ | ||
| 601 | .@"16bit_mode", | ||
| 602 | .@"32bit_mode", | ||
| 603 | .@"64bit", | ||
| 604 | .false_deps_bls, | ||
| 605 | .false_deps_compress, | ||
| 606 | .false_deps_expand, | ||
| 607 | .false_deps_getmant, | ||
| 608 | .false_deps_lzcnt, | ||
| 609 | .false_deps_mulc, | ||
| 610 | .false_deps_mullq, | ||
| 611 | .false_deps_perm, | ||
| 612 | .false_deps_popcnt, | ||
| 613 | .false_deps_range, | ||
| 614 | .false_deps_tzcnt, | ||
| 615 | .fast_11bytenop, | ||
| 616 | .fast_15bytenop, | ||
| 617 | .fast_7bytenop, | ||
| 618 | .fast_bextr, | ||
| 619 | .fast_dpwssd, | ||
| 620 | .fast_gather, | ||
| 621 | .fast_hops, | ||
| 622 | .fast_imm16, | ||
| 623 | .fast_lzcnt, | ||
| 624 | .fast_movbe, | ||
| 625 | .fast_scalar_fsqrt, | ||
| 626 | .fast_scalar_shift_masks, | ||
| 627 | .fast_shld_rotate, | ||
| 628 | .fast_variable_crosslane_shuffle, | ||
| 629 | .fast_variable_perlane_shuffle, | ||
| 630 | .fast_vector_fsqrt, | ||
| 631 | .fast_vector_shift_masks, | ||
| 632 | .faster_shift_than_shuffle, | ||
| 633 | .no_bypass_delay, | ||
| 634 | .no_bypass_delay_blend, | ||
| 635 | .no_bypass_delay_mov, | ||
| 636 | .no_bypass_delay_shuffle, | ||
| 637 | .prefer_128_bit, | ||
| 638 | .prefer_256_bit, | ||
| 639 | .prefer_legacy_setcc, | ||
| 640 | .prefer_mask_registers, | ||
| 641 | .prefer_movmsk_over_vtest, | ||
| 642 | .prefer_ndd_mem, | ||
| 643 | .prefer_no_gather, | ||
| 644 | .prefer_no_scatter, | ||
| 645 | .slow_3ops_lea, | ||
| 646 | .slow_incdec, | ||
| 647 | .slow_indirect_call, | ||
| 648 | .slow_lea, | ||
| 649 | .slow_pmaddwd, | ||
| 650 | .slow_pmulld, | ||
| 651 | .slow_pmullq, | ||
| 652 | .slow_shld, | ||
| 653 | .slow_two_mem_ops, | ||
| 654 | .slow_unaligned_mem_16, | ||
| 655 | .slow_unaligned_mem_32, | ||
| 656 | }), | ||
| 657 | .aarch64, .aarch64_be => std.Target.aarch64.featureSet(&.{ | ||
| 658 | .addr_lsl_slow_14, | ||
| 659 | .align_cmp_csel_pairs, | ||
| 660 | .alu_lsl_fast, | ||
| 661 | .avoid_ldapur, | ||
| 662 | .disable_fast_inc_vl, | ||
| 663 | .exynos_cheap_as_move, | ||
| 664 | .fast_ld1_single, | ||
| 665 | .fixed_load_latency_4, | ||
| 666 | .fuse_address, | ||
| 667 | .fuse_addsub_2reg_const1, | ||
| 668 | .fuse_adrp_add, | ||
| 669 | .fuse_aes, | ||
| 670 | .fuse_arith_logic, | ||
| 671 | .fuse_crypto_eor, | ||
| 672 | .fuse_csel, | ||
| 673 | .fuse_cset, | ||
| 674 | .fuse_fcsel, | ||
| 675 | .fuse_literals, | ||
| 676 | .has_limited_64bit_vector_mul_bandwidth, | ||
| 677 | .predictable_select_expensive, | ||
| 678 | .slow_misaligned_128store, | ||
| 679 | .slow_paired_128, | ||
| 680 | .slow_strqro_store, | ||
| 681 | .use_experimental_zeroing_pseudos, | ||
| 682 | .use_fixed_over_scalable_if_equal_cost, | ||
| 683 | .use_postra_scheduler, | ||
| 684 | .use_reciprocal_square_root, | ||
| 685 | .use_wzr_to_vec_move, | ||
| 686 | }), | ||
| 687 | else => .empty, | ||
| 688 | }; | ||
| 689 | var set = target.cpu.features; | ||
| 690 | set.removeFeatureSet(irrelevant); | ||
| 691 | |||
| 692 | if (!host.cpu.features.isSuperSetOf(set)) | ||
| 693 | return false; | ||
| 694 | |||
| 695 | return true; | ||
| 696 | } | ||
| 697 | |||
| 540 | const std = @import("std"); | 698 | const std = @import("std"); |
| 541 | const assert = std.debug.assert; | 699 | const assert = std.debug.assert; |
| 542 | const Allocator = std.mem.Allocator; | 700 | const Allocator = std.mem.Allocator; |
test/behavior/while.zig+8| ... | @@ -419,3 +419,11 @@ test "labeled break from else" { | ... | @@ -419,3 +419,11 @@ test "labeled break from else" { |
| 419 | try S.doTheTest(5); | 419 | try S.doTheTest(5); |
| 420 | try comptime S.doTheTest(5); | 420 | try comptime S.doTheTest(5); |
| 421 | } | 421 | } |
| 422 | |||
| 423 | fn infiniteLoop() noreturn { | ||
| 424 | while (true) {} | ||
| 425 | } | ||
| 426 | |||
| 427 | test "infinite while true" { | ||
| 428 | _ = &infiniteLoop; | ||
| 429 | } |
test/c_abi/cfuncs.c+11| ... | @@ -1,6 +1,7 @@ | ... | @@ -1,6 +1,7 @@ |
| 1 | #include <complex.h> | 1 | #include <complex.h> |
| 2 | #include <inttypes.h> | 2 | #include <inttypes.h> |
| 3 | #include <stdalign.h> | 3 | #include <stdalign.h> |
| 4 | #include <stdarg.h> | ||
| 4 | #include <stdbool.h> | 5 | #include <stdbool.h> |
| 5 | #include <stdlib.h> | 6 | #include <stdlib.h> |
| 6 | #include <string.h> | 7 | #include <string.h> |
| ... | @@ -16775,6 +16776,16 @@ void c_x86_64_sysv_uint_int_uint_int(unsigned a, int b, unsigned c, int d) { | ... | @@ -16775,6 +16776,16 @@ void c_x86_64_sysv_uint_int_uint_int(unsigned a, int b, unsigned c, int d) { |
| 16775 | assert_or_panic(d == -4); | 16776 | assert_or_panic(d == -4); |
| 16776 | } | 16777 | } |
| 16777 | 16778 | ||
| 16779 | void c_varargs_fn_ptr(int n, ...) { | ||
| 16780 | assert_or_panic(n == 2); | ||
| 16781 | va_list ap; | ||
| 16782 | va_start(ap, n); | ||
| 16783 | void (*fn_ptr)(int) = va_arg(ap, void (*)(int)); | ||
| 16784 | int arg = va_arg(ap, int); | ||
| 16785 | va_end(ap); | ||
| 16786 | fn_ptr(arg); | ||
| 16787 | } | ||
| 16788 | |||
| 16778 | void c_win64_varargs_u64_f64_u64_f64(uint64_t a, double b, uint64_t c, double d) { | 16789 | void c_win64_varargs_u64_f64_u64_f64(uint64_t a, double b, uint64_t c, double d) { |
| 16779 | assert_or_panic(a == UINT64_C(0x3ff0000000000000)); | 16790 | assert_or_panic(a == UINT64_C(0x3ff0000000000000)); |
| 16780 | assert_or_panic(b == 2.0); | 16791 | assert_or_panic(b == 2.0); |
test/c_abi/main.zig+11| ... | @@ -18009,6 +18009,17 @@ test "x86_64 sysv args" { | ... | @@ -18009,6 +18009,17 @@ test "x86_64 sysv args" { |
| 18009 | c_x86_64_sysv_uint_int_uint_int(1, -2, 3, -4); | 18009 | c_x86_64_sysv_uint_int_uint_int(1, -2, 3, -4); |
| 18010 | } | 18010 | } |
| 18011 | 18011 | ||
| 18012 | extern fn c_varargs_fn_ptr(n: c_int, ...) void; | ||
| 18013 | |||
| 18014 | fn zigVaCb(x: c_int) callconv(.c) void { | ||
| 18015 | expect(x == 123) catch @panic("test failure: zigVaCb"); | ||
| 18016 | } | ||
| 18017 | |||
| 18018 | test "function pointer through varargs" { | ||
| 18019 | // Bare function (not `&`), as in the original #12706 repro. | ||
| 18020 | c_varargs_fn_ptr(2, zigVaCb, @as(c_int, 123)); | ||
| 18021 | } | ||
| 18022 | |||
| 18012 | extern fn c_win64_varargs_u64_f64_u64_f64(...) void; | 18023 | extern fn c_win64_varargs_u64_f64_u64_f64(...) void; |
| 18013 | extern fn c_win64_varargs_f64_u64_f64_u64(...) void; | 18024 | extern fn c_win64_varargs_f64_u64_f64_u64(...) void; |
| 18014 | 18025 |
test/cases/custom_logfn_freestanding.zig created+25| ... | @@ -0,0 +1,25 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub const std_options: std.Options = .{ | ||
| 4 | .logFn = log, | ||
| 5 | }; | ||
| 6 | |||
| 7 | pub fn log( | ||
| 8 | comptime message_level: std.log.Level, | ||
| 9 | comptime scope: @EnumLiteral(), | ||
| 10 | comptime format: []const u8, | ||
| 11 | args: anytype, | ||
| 12 | ) void { | ||
| 13 | _ = message_level; | ||
| 14 | _ = scope; | ||
| 15 | _ = format; | ||
| 16 | _ = args; | ||
| 17 | } | ||
| 18 | |||
| 19 | pub fn main() anyerror!void { | ||
| 20 | std.log.info("All your codebase are belong to us.", .{}); | ||
| 21 | } | ||
| 22 | |||
| 23 | // compile | ||
| 24 | // output_mode=Exe | ||
| 25 | // target=wasm32-freestanding | ||
test/cases/empty_global_error_set.zig created+6| ... | @@ -0,0 +1,6 @@ | ||
| 1 | fn errorName(err: anyerror) [:0]const u8 { | ||
| 2 | return @errorName(err); | ||
| 3 | } | ||
| 4 | export const error_name: *const anyopaque = &errorName; | ||
| 5 | |||
| 6 | // compile | ||
test/cases/hello_world.zig deleted-13| ... | @@ -1,13 +0,0 @@ | ||
| 1 | extern fn puts(s: [*:0]const u8) c_int; | ||
| 2 | |||
| 3 | pub fn main() void { | ||
| 4 | _ = puts("hello world!"); | ||
| 5 | } | ||
| 6 | |||
| 7 | // run | ||
| 8 | // backend=selfhosted,llvm | ||
| 9 | // target=x86_64-linux,x86_64-macos | ||
| 10 | // link_libc=true | ||
| 11 | // | ||
| 12 | // hello world! | ||
| 13 | // | ||
test/cases/main_return_error_u8.zig created+8| ... | @@ -0,0 +1,8 @@ | ||
| 1 | const Err = error{Foo}; | ||
| 2 | |||
| 3 | pub fn main() !u8 { | ||
| 4 | return Err.Foo; | ||
| 5 | } | ||
| 6 | |||
| 7 | // compile | ||
| 8 | // output_mode=Exe | ||
test/cases/main_return_error_u8_non_zero.zig created+13| ... | @@ -0,0 +1,13 @@ | ||
| 1 | const Err = error{Foo}; | ||
| 2 | |||
| 3 | fn foo() u8 { | ||
| 4 | return @intCast(9); | ||
| 5 | } | ||
| 6 | |||
| 7 | pub fn main() !u8 { | ||
| 8 | if (foo() == 7) return Err.Foo; | ||
| 9 | return 123; | ||
| 10 | } | ||
| 11 | |||
| 12 | // compile | ||
| 13 | // output_mode=Exe | ||
test/cases/noreturn_call_as_arg.zig created+13| ... | @@ -0,0 +1,13 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | fn foo() noreturn { | ||
| 4 | std.process.exit(0); | ||
| 5 | } | ||
| 6 | |||
| 7 | fn bar(_: u8, _: u8) void {} | ||
| 8 | |||
| 9 | pub fn main() void { | ||
| 10 | bar(foo(), @compileError("bad")); | ||
| 11 | } | ||
| 12 | |||
| 13 | // run | ||
test/cases/noreturn_call_inline.zig created+15| ... | @@ -0,0 +1,15 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn main() void { | ||
| 4 | _ = bar(); | ||
| 5 | } | ||
| 6 | |||
| 7 | inline fn bar() u8 { | ||
| 8 | noret(); | ||
| 9 | } | ||
| 10 | |||
| 11 | inline fn noret() noreturn { | ||
| 12 | std.process.exit(0); | ||
| 13 | } | ||
| 14 | |||
| 15 | // run | ||
test/gen_h.zig deleted-148| ... | @@ -1,148 +0,0 @@ | ||
| 1 | const tests = @import("tests.zig"); | ||
| 2 | |||
| 3 | pub fn addCases(cases: *tests.GenHContext) void { | ||
| 4 | cases.add("declare enum", | ||
| 5 | \\const Foo = extern enum { A, B, C }; | ||
| 6 | \\export fn entry(foo: Foo) void { } | ||
| 7 | , &[_][]const u8{ | ||
| 8 | \\enum Foo { | ||
| 9 | \\ A = 0, | ||
| 10 | \\ B = 1, | ||
| 11 | \\ C = 2 | ||
| 12 | \\}; | ||
| 13 | , | ||
| 14 | \\void entry(enum Foo foo); | ||
| 15 | }); | ||
| 16 | |||
| 17 | cases.add("declare struct", | ||
| 18 | \\const Foo = extern struct { | ||
| 19 | \\ A: i32, | ||
| 20 | \\ B: f32, | ||
| 21 | \\ C: bool, | ||
| 22 | \\ D: u64, | ||
| 23 | \\ E: u64, | ||
| 24 | \\ F: u64, | ||
| 25 | \\}; | ||
| 26 | \\export fn entry(foo: Foo) void { } | ||
| 27 | , &[_][]const u8{ | ||
| 28 | \\struct Foo { | ||
| 29 | \\ int32_t A; | ||
| 30 | \\ float B; | ||
| 31 | \\ bool C; | ||
| 32 | \\ uint64_t D; | ||
| 33 | \\ uint64_t E; | ||
| 34 | \\ uint64_t F; | ||
| 35 | \\}; | ||
| 36 | , | ||
| 37 | \\void entry(struct Foo foo); | ||
| 38 | \\ | ||
| 39 | }); | ||
| 40 | |||
| 41 | cases.add("declare union", | ||
| 42 | \\const Big = extern struct { | ||
| 43 | \\ A: u64, | ||
| 44 | \\ B: u64, | ||
| 45 | \\ C: u64, | ||
| 46 | \\ D: u64, | ||
| 47 | \\ E: u64, | ||
| 48 | \\}; | ||
| 49 | \\const Foo = extern union { | ||
| 50 | \\ A: i32, | ||
| 51 | \\ B: f32, | ||
| 52 | \\ C: bool, | ||
| 53 | \\ D: Big, | ||
| 54 | \\}; | ||
| 55 | \\export fn entry(foo: Foo) void {} | ||
| 56 | , &[_][]const u8{ | ||
| 57 | \\struct Big { | ||
| 58 | \\ uint64_t A; | ||
| 59 | \\ uint64_t B; | ||
| 60 | \\ uint64_t C; | ||
| 61 | \\ uint64_t D; | ||
| 62 | \\ uint64_t E; | ||
| 63 | \\}; | ||
| 64 | \\ | ||
| 65 | \\union Foo { | ||
| 66 | \\ int32_t A; | ||
| 67 | \\ float B; | ||
| 68 | \\ bool C; | ||
| 69 | \\ struct Big D; | ||
| 70 | \\}; | ||
| 71 | , | ||
| 72 | \\void entry(union Foo foo); | ||
| 73 | \\ | ||
| 74 | }); | ||
| 75 | |||
| 76 | cases.add("declare opaque type", | ||
| 77 | \\const Foo = opaque {}; | ||
| 78 | \\ | ||
| 79 | \\export fn entry(foo: ?*Foo) void { } | ||
| 80 | , &[_][]const u8{ | ||
| 81 | \\struct Foo; | ||
| 82 | , | ||
| 83 | \\void entry(struct Foo * foo); | ||
| 84 | }); | ||
| 85 | |||
| 86 | cases.add("array field-type", | ||
| 87 | \\const Foo = extern struct { | ||
| 88 | \\ A: [2]i32, | ||
| 89 | \\ B: [4]*u32, | ||
| 90 | \\}; | ||
| 91 | \\export fn entry(foo: Foo, bar: [3]u8) void { } | ||
| 92 | , &[_][]const u8{ | ||
| 93 | \\struct Foo { | ||
| 94 | \\ int32_t A[2]; | ||
| 95 | \\ uint32_t * B[4]; | ||
| 96 | \\}; | ||
| 97 | , | ||
| 98 | \\void entry(struct Foo foo, uint8_t bar[]); | ||
| 99 | \\ | ||
| 100 | }); | ||
| 101 | |||
| 102 | cases.add("ptr to zig struct", | ||
| 103 | \\const S = struct { | ||
| 104 | \\ a: u8, | ||
| 105 | \\}; | ||
| 106 | \\ | ||
| 107 | \\export fn a(s: *S) u8 { | ||
| 108 | \\ return s.a; | ||
| 109 | \\} | ||
| 110 | , &[_][]const u8{ | ||
| 111 | \\struct S; | ||
| 112 | , | ||
| 113 | \\uint8_t a(struct S * s); | ||
| 114 | \\ | ||
| 115 | }); | ||
| 116 | |||
| 117 | cases.add("ptr to zig union", | ||
| 118 | \\const U = union(enum) { | ||
| 119 | \\ A: u8, | ||
| 120 | \\ B: u16, | ||
| 121 | \\}; | ||
| 122 | \\ | ||
| 123 | \\export fn a(s: *U) u8 { | ||
| 124 | \\ return s.A; | ||
| 125 | \\} | ||
| 126 | , &[_][]const u8{ | ||
| 127 | \\union U; | ||
| 128 | , | ||
| 129 | \\uint8_t a(union U * s); | ||
| 130 | \\ | ||
| 131 | }); | ||
| 132 | |||
| 133 | cases.add("ptr to zig enum", | ||
| 134 | \\const E = enum(u8) { | ||
| 135 | \\ A, | ||
| 136 | \\ B, | ||
| 137 | \\}; | ||
| 138 | \\ | ||
| 139 | \\export fn a(s: *E) u8 { | ||
| 140 | \\ return @intFromEnum(s.*); | ||
| 141 | \\} | ||
| 142 | , &[_][]const u8{ | ||
| 143 | \\enum E; | ||
| 144 | , | ||
| 145 | \\uint8_t a(enum E * s); | ||
| 146 | \\ | ||
| 147 | }); | ||
| 148 | } | ||
test/src/Cases.zig+1-1| ... | @@ -495,7 +495,7 @@ pub fn lowerToBuildSteps( | ... | @@ -495,7 +495,7 @@ pub fn lowerToBuildSteps( |
| 495 | 495 | ||
| 496 | if (case.case.? == .Error and options.skip_compile_errors) continue; | 496 | if (case.case.? == .Error and options.skip_compile_errors) continue; |
| 497 | 497 | ||
| 498 | if (options.skip_non_native and !@import("../tests.zig").isNative(&case.target, &b.graph.host.result)) | 498 | if (options.skip_non_native and !std.zig.target.isNative(&case.target.query, &case.target.result, &b.graph.host.result)) |
| 499 | continue; | 499 | continue; |
| 500 | 500 | ||
| 501 | if (options.skip_spirv and case.target.query.cpu_arch != null and case.target.query.cpu_arch.?.isSpirV()) continue; | 501 | if (options.skip_spirv and case.target.query.cpu_arch != null and case.target.query.cpu_arch.?.isSpirV()) continue; |
test/src/ErrorTrace.zig+1-1| ... | @@ -385,7 +385,7 @@ pub fn addCases(self: *ErrorTrace) void { | ... | @@ -385,7 +385,7 @@ pub fn addCases(self: *ErrorTrace) void { |
| 385 | 385 | ||
| 386 | if (!self.options.test_extra_targets and params.extra_target) continue; | 386 | if (!self.options.test_extra_targets and params.extra_target) continue; |
| 387 | 387 | ||
| 388 | if (self.options.skip_non_native and !tests.isNative(&resolved_target, &b.graph.host.result)) continue; | 388 | if (self.options.skip_non_native and !std.zig.target.isNative(&resolved_target.query, &resolved_target.result, &b.graph.host.result)) continue; |
| 389 | 389 | ||
| 390 | if (self.options.skip_freebsd and target.os.tag == .freebsd) continue; | 390 | if (self.options.skip_freebsd and target.os.tag == .freebsd) continue; |
| 391 | if (self.options.skip_netbsd and target.os.tag == .netbsd) continue; | 391 | if (self.options.skip_netbsd and target.os.tag == .netbsd) continue; |
test/src/StackTrace.zig+1-1| ... | @@ -995,7 +995,7 @@ pub fn addCases(self: *StackTrace) void { | ... | @@ -995,7 +995,7 @@ pub fn addCases(self: *StackTrace) void { |
| 995 | 995 | ||
| 996 | if (!self.options.test_extra_targets and params.extra_target) continue; | 996 | if (!self.options.test_extra_targets and params.extra_target) continue; |
| 997 | 997 | ||
| 998 | if (self.options.skip_non_native and !tests.isNative(&resolved_target, &b.graph.host.result)) continue; | 998 | if (self.options.skip_non_native and !std.zig.target.isNative(&resolved_target.query, &resolved_target.result, &b.graph.host.result)) continue; |
| 999 | 999 | ||
| 1000 | if (self.options.skip_freebsd and target.os.tag == .freebsd) continue; | 1000 | if (self.options.skip_freebsd and target.os.tag == .freebsd) continue; |
| 1001 | if (self.options.skip_netbsd and target.os.tag == .netbsd) continue; | 1001 | if (self.options.skip_netbsd and target.os.tag == .netbsd) continue; |
test/standalone/build.zig+8-3| ... | @@ -14,6 +14,7 @@ pub fn build(b: *std.Build) void { | ... | @@ -14,6 +14,7 @@ pub fn build(b: *std.Build) void { |
| 14 | const simple_skip_release_safe = b.option(bool, "simple_skip_release_safe", "Simple tests skip release-safe builds") orelse false; | 14 | const simple_skip_release_safe = b.option(bool, "simple_skip_release_safe", "Simple tests skip release-safe builds") orelse false; |
| 15 | const simple_skip_release_fast = b.option(bool, "simple_skip_release_fast", "Simple tests skip release-fast builds") orelse false; | 15 | const simple_skip_release_fast = b.option(bool, "simple_skip_release_fast", "Simple tests skip release-fast builds") orelse false; |
| 16 | const simple_skip_release_small = b.option(bool, "simple_skip_release_small", "Simple tests skip release-small builds") orelse false; | 16 | const simple_skip_release_small = b.option(bool, "simple_skip_release_small", "Simple tests skip release-small builds") orelse false; |
| 17 | const skip_non_native = b.option(bool, "skip_non_native", "Skip non-native targets") orelse false; | ||
| 17 | 18 | ||
| 18 | const simple_dep = b.dependency("simple", .{ | 19 | const simple_dep = b.dependency("simple", .{ |
| 19 | .skip_debug = simple_skip_debug, | 20 | .skip_debug = simple_skip_debug, |
| ... | @@ -103,7 +104,7 @@ pub fn build(b: *std.Build) void { | ... | @@ -103,7 +104,7 @@ pub fn build(b: *std.Build) void { |
| 103 | if (std.mem.eql(u8, dep_name, "simple")) continue; | 104 | if (std.mem.eql(u8, dep_name, "simple")) continue; |
| 104 | 105 | ||
| 105 | const all_pkgs = @import("root").dependencies.packages; | 106 | const all_pkgs = @import("root").dependencies.packages; |
| 106 | inline for (@typeInfo(all_pkgs).@"struct".decl_names) |pkg_hash| { | 107 | const forward_skip_non_native = inline for (@typeInfo(all_pkgs).@"struct".decl_names) |pkg_hash| { |
| 107 | if (std.mem.eql(u8, dep_hash, pkg_hash)) { | 108 | if (std.mem.eql(u8, dep_hash, pkg_hash)) { |
| 108 | const pkg = @field(all_pkgs, pkg_hash); | 109 | const pkg = @field(all_pkgs, pkg_hash); |
| 109 | if (!@hasDecl(pkg, "build_zig")) { | 110 | if (!@hasDecl(pkg, "build_zig")) { |
| ... | @@ -121,11 +122,15 @@ pub fn build(b: *std.Build) void { | ... | @@ -121,11 +122,15 @@ pub fn build(b: *std.Build) void { |
| 121 | { | 122 | { |
| 122 | continue :add_dep_steps; | 123 | continue :add_dep_steps; |
| 123 | } | 124 | } |
| 124 | break; | 125 | break @hasDecl(pkg.build_zig, "supports_skip_non_native") and |
| 126 | pkg.build_zig.supports_skip_non_native; | ||
| 125 | } | 127 | } |
| 126 | } else unreachable; | 128 | } else unreachable; |
| 127 | 129 | ||
| 128 | const dep = b.dependency(dep_name, .{}); | 130 | const dep = if (forward_skip_non_native) |
| 131 | b.dependency(dep_name, .{ .skip_non_native = skip_non_native }) | ||
| 132 | else | ||
| 133 | b.dependency(dep_name, .{}); | ||
| 129 | const dep_step = dep.builder.default_step; | 134 | const dep_step = dep.builder.default_step; |
| 130 | dep_step.name = b.fmt("standalone_test_cases.{s}", .{dep_name}); | 135 | dep_step.name = b.fmt("standalone_test_cases.{s}", .{dep_name}); |
| 131 | step.dependOn(dep_step); | 136 | step.dependOn(dep_step); |
test/standalone/build.zig.zon+3-28| ... | @@ -30,15 +30,9 @@ | ... | @@ -30,15 +30,9 @@ |
| 30 | .static_c_lib = .{ | 30 | .static_c_lib = .{ |
| 31 | .path = "static_c_lib", | 31 | .path = "static_c_lib", |
| 32 | }, | 32 | }, |
| 33 | .issue_339 = .{ | ||
| 34 | .path = "issue_339", | ||
| 35 | }, | ||
| 36 | .compile_asm = .{ | 33 | .compile_asm = .{ |
| 37 | .path = "compile_asm", | 34 | .path = "compile_asm", |
| 38 | }, | 35 | }, |
| 39 | .issue_5825 = .{ | ||
| 40 | .path = "issue_5825", | ||
| 41 | }, | ||
| 42 | .pkg_import = .{ | 36 | .pkg_import = .{ |
| 43 | .path = "pkg_import", | 37 | .path = "pkg_import", |
| 44 | }, | 38 | }, |
| ... | @@ -132,24 +126,9 @@ | ... | @@ -132,24 +126,9 @@ |
| 132 | .c_embed_path = .{ | 126 | .c_embed_path = .{ |
| 133 | .path = "c_embed_path", | 127 | .path = "c_embed_path", |
| 134 | }, | 128 | }, |
| 135 | .issue_12706 = .{ | ||
| 136 | .path = "issue_12706", | ||
| 137 | }, | ||
| 138 | .strip_empty_loop = .{ | ||
| 139 | .path = "strip_empty_loop", | ||
| 140 | }, | ||
| 141 | .strip_struct_init = .{ | ||
| 142 | .path = "strip_struct_init", | ||
| 143 | }, | ||
| 144 | .zerolength_check = .{ | ||
| 145 | .path = "zerolength_check", | ||
| 146 | }, | ||
| 147 | .coff_dwarf = .{ | 129 | .coff_dwarf = .{ |
| 148 | .path = "coff_dwarf", | 130 | .path = "coff_dwarf", |
| 149 | }, | 131 | }, |
| 150 | .compiler_rt_panic = .{ | ||
| 151 | .path = "compiler_rt_panic", | ||
| 152 | }, | ||
| 153 | .ios = .{ | 132 | .ios = .{ |
| 154 | .path = "ios", | 133 | .path = "ios", |
| 155 | }, | 134 | }, |
| ... | @@ -168,9 +147,6 @@ | ... | @@ -168,9 +147,6 @@ |
| 168 | .run_output_paths = .{ | 147 | .run_output_paths = .{ |
| 169 | .path = "run_output_paths", | 148 | .path = "run_output_paths", |
| 170 | }, | 149 | }, |
| 171 | .empty_global_error_set = .{ | ||
| 172 | .path = "empty_global_error_set", | ||
| 173 | }, | ||
| 174 | .config_header = .{ | 150 | .config_header = .{ |
| 175 | .path = "config_header", | 151 | .path = "config_header", |
| 176 | }, | 152 | }, |
| ... | @@ -180,10 +156,9 @@ | ... | @@ -180,10 +156,9 @@ |
| 180 | .run_cwd = .{ | 156 | .run_cwd = .{ |
| 181 | .path = "run_cwd", | 157 | .path = "run_cwd", |
| 182 | }, | 158 | }, |
| 183 | // https://github.com/ziglang/zig/issues/25471 | 159 | .tsan = .{ |
| 184 | // .tsan = .{ | 160 | .path = "tsan", |
| 185 | // .path = "tsan", | 161 | }, |
| 186 | // }, | ||
| 187 | .posix = .{ | 162 | .posix = .{ |
| 188 | .path = "posix", | 163 | .path = "posix", |
| 189 | }, | 164 | }, |
test/standalone/c_compiler/test.cpp+2-7| ... | @@ -1,9 +1,6 @@ | ... | @@ -1,9 +1,6 @@ |
| 1 | #include <cassert> | 1 | #include <cassert> |
| 2 | #include <iostream> | 2 | #include <iostream> |
| 3 | |||
| 4 | #ifndef _LIBCPP_HAS_NO_THREADS | ||
| 5 | #include <future> | 3 | #include <future> |
| 6 | #endif | ||
| 7 | 4 | ||
| 8 | thread_local unsigned int tls_counter = 1; | 5 | thread_local unsigned int tls_counter = 1; |
| 9 | 6 | ||
| ... | @@ -59,14 +56,12 @@ int main (int argc, char *argv[]) | ... | @@ -59,14 +56,12 @@ int main (int argc, char *argv[]) |
| 59 | 56 | ||
| 60 | if (!ok) abort(); | 57 | if (!ok) abort(); |
| 61 | 58 | ||
| 62 | #ifndef _LIBCPP_HAS_NO_THREADS | ||
| 63 | std::future<bool> fut = std::async(is_prime, 313); | 59 | std::future<bool> fut = std::async(is_prime, 313); |
| 64 | bool ret = fut.get(); | 60 | bool ret = fut.get(); |
| 65 | assert(ret); | 61 | assert(ret); |
| 66 | #endif | ||
| 67 | 62 | ||
| 68 | #if !defined(__wasm__) && !defined(__APPLE__) | 63 | #if !defined(__APPLE__) |
| 69 | // WASM and macOS are not passing this yet. | 64 | // macOS is not passing this yet. |
| 70 | // TODO file an issue for this and link it here. | 65 | // TODO file an issue for this and link it here. |
| 71 | try { | 66 | try { |
| 72 | throw 20; | 67 | throw 20; |
test/standalone/coff_dwarf/build.zig+6-11| ... | @@ -1,19 +1,12 @@ | ... | @@ -1,19 +1,12 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub const supports_skip_non_native = true; | ||
| 4 | |||
| 3 | /// This tests the path where DWARF information is embedded in a COFF binary | 5 | /// This tests the path where DWARF information is embedded in a COFF binary |
| 4 | pub fn build(b: *std.Build) void { | 6 | pub fn build(b: *std.Build) void { |
| 5 | const host = b.graph.host; | 7 | const skip_non_native = b.option(bool, "skip_non_native", "Skip non-native targets") orelse false; |
| 6 | |||
| 7 | // https://github.com/ziglang/zig/issues/25471 | ||
| 8 | if (host.result.os.tag == .freebsd) return; | ||
| 9 | 8 | ||
| 10 | switch (host.result.cpu.arch) { | 9 | const host = b.graph.host; |
| 11 | .aarch64, | ||
| 12 | .x86, | ||
| 13 | .x86_64, | ||
| 14 | => {}, | ||
| 15 | else => return, | ||
| 16 | } | ||
| 17 | 10 | ||
| 18 | const test_step = b.step("test", "Test it"); | 11 | const test_step = b.step("test", "Test it"); |
| 19 | b.default_step = test_step; | 12 | b.default_step = test_step; |
| ... | @@ -24,6 +17,8 @@ pub fn build(b: *std.Build) void { | ... | @@ -24,6 +17,8 @@ pub fn build(b: *std.Build) void { |
| 24 | else => b.resolveTargetQuery(.{ .os_tag = .windows }), | 17 | else => b.resolveTargetQuery(.{ .os_tag = .windows }), |
| 25 | }; | 18 | }; |
| 26 | 19 | ||
| 20 | if (skip_non_native and !std.zig.target.isNative(&target.query, &target.result, &host.result)) return; | ||
| 21 | |||
| 27 | const exe = b.addExecutable(.{ | 22 | const exe = b.addExecutable(.{ |
| 28 | .name = "main", | 23 | .name = "main", |
| 29 | .root_module = b.createModule(.{ | 24 | .root_module = b.createModule(.{ |
test/standalone/compile_asm/build.zig+6| ... | @@ -1,6 +1,10 @@ | ... | @@ -1,6 +1,10 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub const supports_skip_non_native = true; | ||
| 4 | |||
| 3 | pub fn build(b: *std.Build) !void { | 5 | pub fn build(b: *std.Build) !void { |
| 6 | const skip_non_native = b.option(bool, "skip_non_native", "Skip non-native targets") orelse false; | ||
| 7 | |||
| 4 | const test_step = b.step("test", "Test it"); | 8 | const test_step = b.step("test", "Test it"); |
| 5 | b.default_step = test_step; | 9 | b.default_step = test_step; |
| 6 | 10 | ||
| ... | @@ -13,6 +17,8 @@ pub fn build(b: *std.Build) !void { | ... | @@ -13,6 +17,8 @@ pub fn build(b: *std.Build) !void { |
| 13 | }, | 17 | }, |
| 14 | }); | 18 | }); |
| 15 | 19 | ||
| 20 | if (skip_non_native and !std.zig.target.isNative(&target.query, &target.result, &b.graph.host.result)) return; | ||
| 21 | |||
| 16 | const kernel = b.addExecutable(.{ | 22 | const kernel = b.addExecutable(.{ |
| 17 | .name = "kernel", | 23 | .name = "kernel", |
| 18 | .root_module = b.createModule(.{ | 24 | .root_module = b.createModule(.{ |
test/standalone/compiler_rt_panic/build.zig deleted-28| ... | @@ -1,28 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn build(b: *std.Build) void { | ||
| 4 | const test_step = b.step("test", "Test it"); | ||
| 5 | b.default_step = test_step; | ||
| 6 | |||
| 7 | const target = b.standardTargetOptions(.{}); | ||
| 8 | const optimize = b.standardOptimizeOption(.{}); | ||
| 9 | |||
| 10 | if (target.result.ofmt != .elf or !(target.result.abi.isMusl() or target.result.abi.isGnu())) | ||
| 11 | return; | ||
| 12 | |||
| 13 | const exe = b.addExecutable(.{ | ||
| 14 | .name = "main", | ||
| 15 | .root_module = b.createModule(.{ | ||
| 16 | .root_source_file = null, | ||
| 17 | .optimize = optimize, | ||
| 18 | .target = target, | ||
| 19 | .link_libc = true, | ||
| 20 | }), | ||
| 21 | }); | ||
| 22 | exe.root_module.addCSourceFile(.{ | ||
| 23 | .file = b.path("main.c"), | ||
| 24 | .flags = &.{}, | ||
| 25 | }); | ||
| 26 | exe.link_gc_sections = false; | ||
| 27 | exe.bundle_compiler_rt = true; | ||
| 28 | } | ||
test/standalone/compiler_rt_panic/main.c deleted-11| ... | @@ -1,11 +0,0 @@ | ||
| 1 | #include <stddef.h> | ||
| 2 | |||
| 3 | void *__memset_chk(void *dest, int c, size_t n, size_t dest_n); | ||
| 4 | |||
| 5 | char foo[128]; | ||
| 6 | |||
| 7 | int main() { | ||
| 8 | __memset_chk(&foo[0], 0xff, 128, 128); | ||
| 9 | return foo[64]; | ||
| 10 | } | ||
| 11 | |||
test/standalone/dirname/has_basename.zig deleted-37| ... | @@ -1,37 +0,0 @@ | ||
| 1 | //! Checks that the basename of the given path matches a string. | ||
| 2 | //! | ||
| 3 | //! Usage: | ||
| 4 | //! | ||
| 5 | //! ``` | ||
| 6 | //! has_basename <path> <basename> | ||
| 7 | //! ``` | ||
| 8 | //! | ||
| 9 | //! <path> must be absolute. | ||
| 10 | //! | ||
| 11 | //! Returns a non-zero exit code if basename | ||
| 12 | //! does not match the given string. | ||
| 13 | |||
| 14 | const std = @import("std"); | ||
| 15 | |||
| 16 | pub fn main(init: std.process.Init) !void { | ||
| 17 | var args = try init.minimal.args.iterateAllocator(init.gpa); | ||
| 18 | defer args.deinit(); | ||
| 19 | _ = args.next() orelse unreachable; // skip binary name | ||
| 20 | |||
| 21 | const path = args.next() orelse { | ||
| 22 | std.log.err("missing <path> argument", .{}); | ||
| 23 | return error.BadUsage; | ||
| 24 | }; | ||
| 25 | |||
| 26 | const basename = args.next() orelse { | ||
| 27 | std.log.err("missing <basename> argument", .{}); | ||
| 28 | return error.BadUsage; | ||
| 29 | }; | ||
| 30 | |||
| 31 | const actual_basename = std.fs.path.basename(path); | ||
| 32 | if (std.mem.eql(u8, actual_basename, basename)) { | ||
| 33 | return; | ||
| 34 | } | ||
| 35 | |||
| 36 | return error.NotEqual; | ||
| 37 | } | ||
test/standalone/elf2/build.zig+7| ... | @@ -1,4 +1,8 @@ | ... | @@ -1,4 +1,8 @@ |
| 1 | pub const supports_skip_non_native = true; | ||
| 2 | |||
| 1 | pub fn build(b: *Build) void { | 3 | pub fn build(b: *Build) void { |
| 4 | const skip_non_native = b.option(bool, "skip_non_native", "Skip non-native targets") orelse false; | ||
| 5 | |||
| 2 | const test_step = b.step("test", "Test the new ELF linker"); | 6 | const test_step = b.step("test", "Test the new ELF linker"); |
| 3 | b.default_step = test_step; | 7 | b.default_step = test_step; |
| 4 | 8 | ||
| ... | @@ -15,6 +19,9 @@ pub fn build(b: *Build) void { | ... | @@ -15,6 +19,9 @@ pub fn build(b: *Build) void { |
| 15 | .cpu_arch = .x86_64, | 19 | .cpu_arch = .x86_64, |
| 16 | .os_tag = .linux, | 20 | .os_tag = .linux, |
| 17 | }); | 21 | }); |
| 22 | |||
| 23 | if (skip_non_native and !std.zig.target.isNative(&x86_64_linux_target.query, &x86_64_linux_target.result, &b.graph.host.result)) return; | ||
| 24 | |||
| 18 | addOne(b, test_step, x86_64_linux_target, false, .static, false, false, "elf2-hello-selfhosted-static"); | 25 | addOne(b, test_step, x86_64_linux_target, false, .static, false, false, "elf2-hello-selfhosted-static"); |
| 19 | addOne(b, test_step, x86_64_linux_target, false, .static, true, false, "elf2-hello-selfhosted-static-pie"); | 26 | addOne(b, test_step, x86_64_linux_target, false, .static, true, false, "elf2-hello-selfhosted-static-pie"); |
| 20 | addOne(b, test_step, x86_64_linux_target, true, .static, false, false, "elf2-hello-llvm-static"); | 27 | addOne(b, test_step, x86_64_linux_target, true, .static, false, false, "elf2-hello-llvm-static"); |
test/standalone/embed_generated_file/build.zig+12-4| ... | @@ -1,6 +1,17 @@ | ... | @@ -1,6 +1,17 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub const supports_skip_non_native = true; | ||
| 4 | |||
| 3 | pub fn build(b: *std.Build) void { | 5 | pub fn build(b: *std.Build) void { |
| 6 | const skip_non_native = b.option(bool, "skip_non_native", "Skip non-native targets") orelse false; | ||
| 7 | |||
| 8 | const target = b.resolveTargetQuery(.{ | ||
| 9 | .cpu_arch = .x86, | ||
| 10 | .os_tag = .freestanding, | ||
| 11 | }); | ||
| 12 | |||
| 13 | if (skip_non_native and !std.zig.target.isNative(&target.query, &target.result, &b.graph.host.result)) return; | ||
| 14 | |||
| 4 | const test_step = b.step("test", "Test it"); | 15 | const test_step = b.step("test", "Test it"); |
| 5 | b.default_step = test_step; | 16 | b.default_step = test_step; |
| 6 | 17 | ||
| ... | @@ -8,10 +19,7 @@ pub fn build(b: *std.Build) void { | ... | @@ -8,10 +19,7 @@ pub fn build(b: *std.Build) void { |
| 8 | .name = "bootloader", | 19 | .name = "bootloader", |
| 9 | .root_module = b.createModule(.{ | 20 | .root_module = b.createModule(.{ |
| 10 | .root_source_file = b.path("bootloader.zig"), | 21 | .root_source_file = b.path("bootloader.zig"), |
| 11 | .target = b.resolveTargetQuery(.{ | 22 | .target = target, |
| 12 | .cpu_arch = .x86, | ||
| 13 | .os_tag = .freestanding, | ||
| 14 | }), | ||
| 15 | .optimize = .small, | 23 | .optimize = .small, |
| 16 | }), | 24 | }), |
| 17 | }); | 25 | }); |
test/standalone/empty_global_error_set/build.zig deleted-24| ... | @@ -1,24 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | const builtin = @import("builtin"); | ||
| 3 | |||
| 4 | pub fn build(b: *std.Build) void { | ||
| 5 | const test_step = b.step("test", "Test it"); | ||
| 6 | b.default_step = test_step; | ||
| 7 | |||
| 8 | for ([_]bool{ false, true }) |use_llvm| { | ||
| 9 | const main = b.addObject(.{ | ||
| 10 | .name = "main", | ||
| 11 | .root_module = b.createModule(.{ | ||
| 12 | .root_source_file = b.path("main.zig"), | ||
| 13 | .target = b.resolveTargetQuery(.{ | ||
| 14 | .cpu_arch = .x86_64, | ||
| 15 | .os_tag = .linux, | ||
| 16 | }), | ||
| 17 | }), | ||
| 18 | .use_llvm = use_llvm, | ||
| 19 | .use_lld = use_llvm, | ||
| 20 | }); | ||
| 21 | _ = main.getEmittedBin(); | ||
| 22 | test_step.dependOn(&main.step); | ||
| 23 | } | ||
| 24 | } | ||
test/standalone/empty_global_error_set/main.zig deleted-4| ... | @@ -1,4 +0,0 @@ | ||
| 1 | fn errorName(err: anyerror) [:0]const u8 { | ||
| 2 | return @errorName(err); | ||
| 3 | } | ||
| 4 | export const error_name: *const anyopaque = &errorName; | ||
test/standalone/entry_point/build.zig+11-3| ... | @@ -1,11 +1,19 @@ | ... | @@ -1,11 +1,19 @@ |
| 1 | pub const supports_skip_non_native = true; | ||
| 2 | |||
| 1 | pub fn build(b: *std.Build) !void { | 3 | pub fn build(b: *std.Build) !void { |
| 4 | const skip_non_native = b.option(bool, "skip_non_native", "Skip non-native targets") orelse false; | ||
| 5 | |||
| 6 | const target = b.resolveTargetQuery(try .parse(.{ | ||
| 7 | .arch_os_abi = "x86_64-linux", | ||
| 8 | })); | ||
| 9 | |||
| 10 | if (skip_non_native and !std.zig.target.isNative(&target.query, &target.result, &b.graph.host.result)) return; | ||
| 11 | |||
| 2 | const mod = b.createModule(.{ | 12 | const mod = b.createModule(.{ |
| 3 | // Setting the entry point doesn't work properly on all targets right now. Since we're | 13 | // Setting the entry point doesn't work properly on all targets right now. Since we're |
| 4 | // really just trying to make sure that the compiler *frontend* respects `-fentry` and | 14 | // really just trying to make sure that the compiler *frontend* respects `-fentry` and |
| 5 | // includes it in the cache manifest, just test for a target where it works. | 15 | // includes it in the cache manifest, just test for a target where it works. |
| 6 | .target = b.resolveTargetQuery(try .parse(.{ | 16 | .target = target, |
| 7 | .arch_os_abi = "x86_64-linux", | ||
| 8 | })), | ||
| 9 | .optimize = .fast, // non-Debug build for reproducible output | 17 | .optimize = .fast, // non-Debug build for reproducible output |
| 10 | .root_source_file = b.path("main.zig"), | 18 | .root_source_file = b.path("main.zig"), |
| 11 | }); | 19 | }); |
test/standalone/glibc_compat/build.zig+15-3| ... | @@ -1,6 +1,8 @@ | ... | @@ -1,6 +1,8 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | 2 | const builtin = @import("builtin"); |
| 3 | 3 | ||
| 4 | pub const supports_skip_non_native = true; | ||
| 5 | |||
| 4 | // To run executables linked against a specific glibc version, the | 6 | // To run executables linked against a specific glibc version, the |
| 5 | // run-time glibc version needs to be new enough. Check the host's glibc | 7 | // run-time glibc version needs to be new enough. Check the host's glibc |
| 6 | // version. Note that this does not allow for translation/vm/emulation | 8 | // version. Note that this does not allow for translation/vm/emulation |
| ... | @@ -8,17 +10,23 @@ const builtin = @import("builtin"); | ... | @@ -8,17 +10,23 @@ const builtin = @import("builtin"); |
| 8 | const running_glibc_ver = builtin.os.versionRange().gnuLibCVersion(); | 10 | const running_glibc_ver = builtin.os.versionRange().gnuLibCVersion(); |
| 9 | 11 | ||
| 10 | pub fn build(b: *std.Build) void { | 12 | pub fn build(b: *std.Build) void { |
| 13 | const skip_non_native = b.option(bool, "skip_non_native", "Skip non-native targets") orelse false; | ||
| 14 | |||
| 11 | const test_step = b.step("test", "Test"); | 15 | const test_step = b.step("test", "Test"); |
| 12 | b.default_step = test_step; | 16 | b.default_step = test_step; |
| 13 | 17 | ||
| 14 | for ([_][]const u8{ "aarch64-linux-gnu.2.27", "aarch64-linux-gnu.2.34" }) |t| { | 18 | for ([_][]const u8{ "aarch64-linux-gnu.2.27", "aarch64-linux-gnu.2.34" }) |t| { |
| 19 | const target = b.resolveTargetQuery(std.Target.Query.parse( | ||
| 20 | .{ .arch_os_abi = t }, | ||
| 21 | ) catch unreachable); | ||
| 22 | |||
| 23 | if (skip_non_native and !std.zig.target.isNative(&target.query, &target.result, &b.graph.host.result)) continue; | ||
| 24 | |||
| 15 | const exe = b.addExecutable(.{ | 25 | const exe = b.addExecutable(.{ |
| 16 | .name = t, | 26 | .name = t, |
| 17 | .root_module = b.createModule(.{ | 27 | .root_module = b.createModule(.{ |
| 18 | .root_source_file = null, | 28 | .root_source_file = null, |
| 19 | .target = b.resolveTargetQuery(std.Target.Query.parse( | 29 | .target = target, |
| 20 | .{ .arch_os_abi = t }, | ||
| 21 | ) catch unreachable), | ||
| 22 | .link_libc = true, | 30 | .link_libc = true, |
| 23 | }), | 31 | }), |
| 24 | }); | 32 | }); |
| ... | @@ -49,6 +57,8 @@ pub fn build(b: *std.Build) void { | ... | @@ -49,6 +57,8 @@ pub fn build(b: *std.Build) void { |
| 49 | .{ .arch_os_abi = t }, | 57 | .{ .arch_os_abi = t }, |
| 50 | ) catch unreachable); | 58 | ) catch unreachable); |
| 51 | 59 | ||
| 60 | if (skip_non_native and !std.zig.target.isNative(&target.query, &target.result, &b.graph.host.result)) continue; | ||
| 61 | |||
| 52 | const glibc_ver = target.result.os.version_range.linux.glibc; | 62 | const glibc_ver = target.result.os.version_range.linux.glibc; |
| 53 | 63 | ||
| 54 | // only build test if glibc version supports the architecture | 64 | // only build test if glibc version supports the architecture |
| ... | @@ -103,6 +113,8 @@ pub fn build(b: *std.Build) void { | ... | @@ -103,6 +113,8 @@ pub fn build(b: *std.Build) void { |
| 103 | .{ .arch_os_abi = t }, | 113 | .{ .arch_os_abi = t }, |
| 104 | ) catch unreachable); | 114 | ) catch unreachable); |
| 105 | 115 | ||
| 116 | if (skip_non_native and !std.zig.target.isNative(&target.query, &target.result, &b.graph.host.result)) continue; | ||
| 117 | |||
| 106 | if (target.result.cpu.arch.isLoongArch()) continue; // https://github.com/Vexu/arocc/issues/1096 | 118 | if (target.result.cpu.arch.isLoongArch()) continue; // https://github.com/Vexu/arocc/issues/1096 |
| 107 | 119 | ||
| 108 | const glibc_ver = target.result.os.version_range.linux.glibc; | 120 | const glibc_ver = target.result.os.version_range.linux.glibc; |
test/standalone/install_raw_hex/build.zig+6| ... | @@ -1,7 +1,11 @@ | ... | @@ -1,7 +1,11 @@ |
| 1 | const builtin = @import("builtin"); | 1 | const builtin = @import("builtin"); |
| 2 | const std = @import("std"); | 2 | const std = @import("std"); |
| 3 | 3 | ||
| 4 | pub const supports_skip_non_native = true; | ||
| 5 | |||
| 4 | pub fn build(b: *std.Build) void { | 6 | pub fn build(b: *std.Build) void { |
| 7 | const skip_non_native = b.option(bool, "skip_non_native", "Skip non-native targets") orelse false; | ||
| 8 | |||
| 5 | const test_step = b.step("test", "Test it"); | 9 | const test_step = b.step("test", "Test it"); |
| 6 | b.default_step = test_step; | 10 | b.default_step = test_step; |
| 7 | 11 | ||
| ... | @@ -12,6 +16,8 @@ pub fn build(b: *std.Build) void { | ... | @@ -12,6 +16,8 @@ pub fn build(b: *std.Build) void { |
| 12 | .abi = .gnueabihf, | 16 | .abi = .gnueabihf, |
| 13 | }); | 17 | }); |
| 14 | 18 | ||
| 19 | if (skip_non_native and !std.zig.target.isNative(&target.query, &target.result, &b.graph.host.result)) return; | ||
| 20 | |||
| 15 | const optimize: std.builtin.Optimize = .debug; | 21 | const optimize: std.builtin.Optimize = .debug; |
| 16 | 22 | ||
| 17 | const elf = b.addExecutable(.{ | 23 | const elf = b.addExecutable(.{ |
test/standalone/issue_12706/build.zig deleted-30| ... | @@ -1,30 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | const builtin = @import("builtin"); | ||
| 3 | |||
| 4 | pub fn build(b: *std.Build) void { | ||
| 5 | const test_step = b.step("test", "Test it"); | ||
| 6 | b.default_step = test_step; | ||
| 7 | |||
| 8 | const optimize: std.builtin.Optimize = .debug; | ||
| 9 | const target = b.graph.host; | ||
| 10 | |||
| 11 | const exe = b.addExecutable(.{ | ||
| 12 | .name = "main", | ||
| 13 | .root_module = b.createModule(.{ | ||
| 14 | .root_source_file = b.path("main.zig"), | ||
| 15 | .optimize = optimize, | ||
| 16 | .target = target, | ||
| 17 | }), | ||
| 18 | }); | ||
| 19 | |||
| 20 | const c_sources = [_][]const u8{ | ||
| 21 | "test.c", | ||
| 22 | }; | ||
| 23 | exe.root_module.addCSourceFiles(.{ .files = &c_sources }); | ||
| 24 | exe.root_module.link_libc = true; | ||
| 25 | |||
| 26 | const run_cmd = b.addRunArtifact(exe); | ||
| 27 | run_cmd.expectExitCode(0); | ||
| 28 | run_cmd.skip_foreign_checks = true; | ||
| 29 | test_step.dependOn(&run_cmd.step); | ||
| 30 | } | ||
test/standalone/issue_12706/main.zig deleted-12| ... | @@ -1,12 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | extern fn testFnPtr(n: c_int, ...) void; | ||
| 3 | |||
| 4 | const val: c_int = 123; | ||
| 5 | |||
| 6 | fn func(a: c_int) callconv(.c) void { | ||
| 7 | std.debug.assert(a == val); | ||
| 8 | } | ||
| 9 | |||
| 10 | pub fn main() void { | ||
| 11 | testFnPtr(2, func, val); | ||
| 12 | } | ||
test/standalone/issue_12706/test.c deleted-11| ... | @@ -1,11 +0,0 @@ | ||
| 1 | #include <stdarg.h> | ||
| 2 | |||
| 3 | void testFnPtr(int n, ...) { | ||
| 4 | va_list ap; | ||
| 5 | va_start(ap, n); | ||
| 6 | |||
| 7 | void (*fnPtr)(int) = va_arg(ap, void (*)(int)); | ||
| 8 | int arg = va_arg(ap, int); | ||
| 9 | fnPtr(arg); | ||
| 10 | va_end(ap); | ||
| 11 | } | ||
| \ No newline at end of file | |||
test/standalone/issue_339/build.zig deleted-23| ... | @@ -1,23 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn build(b: *std.Build) void { | ||
| 4 | const test_step = b.step("test", "Test it"); | ||
| 5 | b.default_step = test_step; | ||
| 6 | |||
| 7 | const optimize: std.builtin.Optimize = .debug; | ||
| 8 | const target = b.graph.host; | ||
| 9 | |||
| 10 | const obj = b.addObject(.{ | ||
| 11 | .name = "test", | ||
| 12 | .root_module = b.createModule(.{ | ||
| 13 | .root_source_file = b.path("test.zig"), | ||
| 14 | .target = target, | ||
| 15 | .optimize = optimize, | ||
| 16 | }), | ||
| 17 | }); | ||
| 18 | |||
| 19 | // TODO: actually check the output | ||
| 20 | _ = obj.getEmittedBin(); | ||
| 21 | |||
| 22 | test_step.dependOn(&obj.step); | ||
| 23 | } | ||
test/standalone/issue_339/test.zig deleted-13| ... | @@ -1,13 +0,0 @@ | ||
| 1 | const StackTrace = @import("std").builtin.StackTrace; | ||
| 2 | pub fn panic(msg: []const u8, stack_trace: ?*StackTrace, _: ?usize) noreturn { | ||
| 3 | _ = msg; | ||
| 4 | _ = stack_trace; | ||
| 5 | @breakpoint(); | ||
| 6 | while (true) {} | ||
| 7 | } | ||
| 8 | |||
| 9 | fn bar() anyerror!void {} | ||
| 10 | |||
| 11 | export fn foo() void { | ||
| 12 | bar() catch unreachable; | ||
| 13 | } | ||
test/standalone/issue_5825/build.zig deleted-43| ... | @@ -1,43 +0,0 @@ | ||
| 1 | const builtin = @import("builtin"); | ||
| 2 | const std = @import("std"); | ||
| 3 | |||
| 4 | pub fn build(b: *std.Build) void { | ||
| 5 | const test_step = b.step("test", "Test it"); | ||
| 6 | b.default_step = test_step; | ||
| 7 | |||
| 8 | // Building for the msvc abi requires a native MSVC installation | ||
| 9 | if (builtin.os.tag != .windows or builtin.cpu.arch != .x86_64) return; | ||
| 10 | |||
| 11 | const target = b.resolveTargetQuery(.{ | ||
| 12 | .cpu_arch = .x86_64, | ||
| 13 | .os_tag = .windows, | ||
| 14 | .abi = .msvc, | ||
| 15 | }); | ||
| 16 | const optimize: std.builtin.Optimize = .debug; | ||
| 17 | const obj = b.addObject(.{ | ||
| 18 | .name = "issue_5825", | ||
| 19 | .root_module = b.createModule(.{ | ||
| 20 | .root_source_file = b.path("main.zig"), | ||
| 21 | .optimize = optimize, | ||
| 22 | .target = target, | ||
| 23 | }), | ||
| 24 | }); | ||
| 25 | |||
| 26 | const exe = b.addExecutable(.{ | ||
| 27 | .name = "issue_5825", | ||
| 28 | .root_module = b.createModule(.{ | ||
| 29 | .root_source_file = null, | ||
| 30 | .optimize = optimize, | ||
| 31 | .target = target, | ||
| 32 | }), | ||
| 33 | }); | ||
| 34 | exe.subsystem = .console; | ||
| 35 | exe.root_module.linkSystemLibrary("kernel32", .{}); | ||
| 36 | exe.root_module.linkSystemLibrary("ntdll", .{}); | ||
| 37 | exe.root_module.addObject(obj); | ||
| 38 | |||
| 39 | // TODO: actually check the output | ||
| 40 | _ = exe.getEmittedBin(); | ||
| 41 | |||
| 42 | test_step.dependOn(&exe.step); | ||
| 43 | } | ||
test/standalone/issue_5825/main.zig deleted-5| ... | @@ -1,5 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn main() anyerror!void { | ||
| 4 | std.log.info("All your codebase are belong to us.", .{}); | ||
| 5 | } | ||
test/standalone/simple/build.zig-20| ... | @@ -97,26 +97,6 @@ const cases = [_]Case{ | ... | @@ -97,26 +97,6 @@ const cases = [_]Case{ |
| 97 | .{ | 97 | .{ |
| 98 | .src_path = "cat/main.zig", | 98 | .src_path = "cat/main.zig", |
| 99 | }, | 99 | }, |
| 100 | // https://github.com/ziglang/zig/issues/6025 | ||
| 101 | //.{ | ||
| 102 | // .src_path = "issue_9693/main.zig", | ||
| 103 | //}, | ||
| 104 | .{ | ||
| 105 | .src_path = "issue_7030.zig", | ||
| 106 | .target = .{ | ||
| 107 | .cpu_arch = .wasm32, | ||
| 108 | .os_tag = .freestanding, | ||
| 109 | }, | ||
| 110 | }, | ||
| 111 | .{ .src_path = "guess_number/main.zig" }, | 100 | .{ .src_path = "guess_number/main.zig" }, |
| 112 | .{ .src_path = "main_return_error/error_u8.zig" }, | ||
| 113 | .{ .src_path = "main_return_error/error_u8_non_zero.zig" }, | ||
| 114 | .{ .src_path = "noreturn_call/inline.zig" }, | ||
| 115 | .{ .src_path = "noreturn_call/as_arg.zig" }, | ||
| 116 | .{ .src_path = "std_enums_big_enums.zig" }, | 101 | .{ .src_path = "std_enums_big_enums.zig" }, |
| 117 | .{ | ||
| 118 | .src_path = "issue_9402/main.zig", | ||
| 119 | .os_filter = .windows, | ||
| 120 | .link_libc = true, | ||
| 121 | }, | ||
| 122 | }; | 102 | }; |
test/standalone/simple/issue_7030.zig deleted-21| ... | @@ -1,21 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub const std_options: std.Options = .{ | ||
| 4 | .logFn = log, | ||
| 5 | }; | ||
| 6 | |||
| 7 | pub fn log( | ||
| 8 | comptime message_level: std.log.Level, | ||
| 9 | comptime scope: @EnumLiteral(), | ||
| 10 | comptime format: []const u8, | ||
| 11 | args: anytype, | ||
| 12 | ) void { | ||
| 13 | _ = message_level; | ||
| 14 | _ = scope; | ||
| 15 | _ = format; | ||
| 16 | _ = args; | ||
| 17 | } | ||
| 18 | |||
| 19 | pub fn main() anyerror!void { | ||
| 20 | std.log.info("All your codebase are belong to us.", .{}); | ||
| 21 | } | ||
test/standalone/simple/issue_9402/main.zig deleted-14| ... | @@ -1,14 +0,0 @@ | ||
| 1 | const FILE = extern struct { | ||
| 2 | dummy_field: u8, | ||
| 3 | }; | ||
| 4 | |||
| 5 | extern fn _ftelli64([*c]FILE) i64; | ||
| 6 | extern fn _fseeki64([*c]FILE, i64, c_int) c_int; | ||
| 7 | |||
| 8 | pub export fn main(argc: c_int, argv: **u8) c_int { | ||
| 9 | _ = argv; | ||
| 10 | _ = argc; | ||
| 11 | _ = _ftelli64(null); | ||
| 12 | _ = _fseeki64(null, 123, 2); | ||
| 13 | return 0; | ||
| 14 | } | ||
test/standalone/simple/main_return_error/error_u8.zig deleted-5| ... | @@ -1,5 +0,0 @@ | ||
| 1 | const Err = error{Foo}; | ||
| 2 | |||
| 3 | pub fn main() !u8 { | ||
| 4 | return Err.Foo; | ||
| 5 | } | ||
test/standalone/simple/main_return_error/error_u8_non_zero.zig deleted-10| ... | @@ -1,10 +0,0 @@ | ||
| 1 | const Err = error{Foo}; | ||
| 2 | |||
| 3 | fn foo() u8 { | ||
| 4 | return @intCast(9); | ||
| 5 | } | ||
| 6 | |||
| 7 | pub fn main() !u8 { | ||
| 8 | if (foo() == 7) return Err.Foo; | ||
| 9 | return 123; | ||
| 10 | } | ||
test/standalone/simple/noreturn_call/as_arg.zig deleted-8| ... | @@ -1,8 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | fn foo() noreturn { | ||
| 3 | std.process.exit(0); | ||
| 4 | } | ||
| 5 | fn bar(_: u8, _: u8) void {} | ||
| 6 | pub fn main() void { | ||
| 7 | bar(foo(), @compileError("bad")); | ||
| 8 | } | ||
test/standalone/simple/noreturn_call/inline.zig deleted-10| ... | @@ -1,10 +0,0 @@ | ||
| 1 | pub fn main() void { | ||
| 2 | _ = bar(); | ||
| 3 | } | ||
| 4 | inline fn bar() u8 { | ||
| 5 | noret(); | ||
| 6 | } | ||
| 7 | const std = @import("std"); | ||
| 8 | inline fn noret() noreturn { | ||
| 9 | std.process.exit(0); | ||
| 10 | } | ||
test/standalone/strip_empty_loop/build.zig deleted-24| ... | @@ -1,24 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn build(b: *std.Build) void { | ||
| 4 | const test_step = b.step("test", "Test the program"); | ||
| 5 | b.default_step = test_step; | ||
| 6 | |||
| 7 | const optimize = std.builtin.Optimize.debug; | ||
| 8 | const target = b.graph.host; | ||
| 9 | |||
| 10 | const main = b.addExecutable(.{ | ||
| 11 | .name = "main", | ||
| 12 | .root_module = b.createModule(.{ | ||
| 13 | .root_source_file = b.path("main.zig"), | ||
| 14 | .optimize = optimize, | ||
| 15 | .target = target, | ||
| 16 | .strip = true, | ||
| 17 | }), | ||
| 18 | }); | ||
| 19 | |||
| 20 | // TODO: actually check the output | ||
| 21 | _ = main.getEmittedBin(); | ||
| 22 | |||
| 23 | test_step.dependOn(&main.step); | ||
| 24 | } | ||
test/standalone/strip_empty_loop/main.zig deleted-3| ... | @@ -1,3 +0,0 @@ | ||
| 1 | pub fn main() noreturn { | ||
| 2 | while (true) {} // When built without debug info, this produces an Air loop with no instructions | ||
| 3 | } | ||
test/standalone/strip_struct_init/build.zig deleted-19| ... | @@ -1,19 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn build(b: *std.Build) void { | ||
| 4 | const test_step = b.step("test", "Test it"); | ||
| 5 | b.default_step = test_step; | ||
| 6 | |||
| 7 | const optimize: std.builtin.Optimize = .debug; | ||
| 8 | |||
| 9 | const main = b.addTest(.{ | ||
| 10 | .root_module = b.createModule(.{ | ||
| 11 | .root_source_file = b.path("main.zig"), | ||
| 12 | .target = b.graph.host, | ||
| 13 | .optimize = optimize, | ||
| 14 | .strip = true, | ||
| 15 | }), | ||
| 16 | }); | ||
| 17 | |||
| 18 | test_step.dependOn(&b.addRunArtifact(main).step); | ||
| 19 | } | ||
test/standalone/strip_struct_init/main.zig deleted-23| ... | @@ -1,23 +0,0 @@ | ||
| 1 | fn Func(comptime Type: type) type { | ||
| 2 | return struct { value: Type }; | ||
| 3 | } | ||
| 4 | |||
| 5 | inline fn func(value: anytype) Func(@TypeOf(value)) { | ||
| 6 | return .{ .value = value }; | ||
| 7 | } | ||
| 8 | |||
| 9 | test { | ||
| 10 | _ = func(type); | ||
| 11 | } | ||
| 12 | |||
| 13 | test { | ||
| 14 | const S = struct { field: u32 }; | ||
| 15 | comptime var arr: [1]S = undefined; | ||
| 16 | arr[0] = .{ .field = 0 }; | ||
| 17 | } | ||
| 18 | |||
| 19 | test { | ||
| 20 | const S = struct { u32 }; | ||
| 21 | comptime var arr: [1]S = undefined; | ||
| 22 | arr[0] = .{0}; | ||
| 23 | } | ||
test/standalone/tsan/build.zig+47-22| ... | @@ -1,34 +1,62 @@ | ... | @@ -1,34 +1,62 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub const supports_skip_non_native = true; | ||
| 4 | |||
| 5 | const targets: []const std.Target.Query = &.{ | ||
| 6 | .{ .cpu_arch = .aarch64, .os_tag = .freebsd, .abi = .none }, | ||
| 7 | .{ .cpu_arch = .x86_64, .os_tag = .freebsd, .abi = .none }, | ||
| 8 | |||
| 9 | .{ .cpu_arch = .aarch64, .os_tag = .linux, .abi = .gnu }, | ||
| 10 | .{ .cpu_arch = .aarch64, .os_tag = .linux, .abi = .musl }, | ||
| 11 | .{ .cpu_arch = .aarch64_be, .os_tag = .linux, .abi = .gnu }, | ||
| 12 | .{ .cpu_arch = .aarch64_be, .os_tag = .linux, .abi = .musl }, | ||
| 13 | .{ .cpu_arch = .loongarch64, .os_tag = .linux, .abi = .gnu }, | ||
| 14 | .{ .cpu_arch = .loongarch64, .os_tag = .linux, .abi = .musl }, | ||
| 15 | .{ .cpu_arch = .mips64, .os_tag = .linux, .abi = .gnuabi64 }, | ||
| 16 | .{ .cpu_arch = .mips64, .os_tag = .linux, .abi = .muslabi64 }, | ||
| 17 | .{ .cpu_arch = .mips64el, .os_tag = .linux, .abi = .gnuabi64 }, | ||
| 18 | .{ .cpu_arch = .mips64el, .os_tag = .linux, .abi = .muslabi64 }, | ||
| 19 | .{ .cpu_arch = .powerpc64le, .os_tag = .linux, .abi = .gnu }, | ||
| 20 | .{ .cpu_arch = .powerpc64le, .os_tag = .linux, .abi = .musl }, | ||
| 21 | .{ .cpu_arch = .riscv64, .os_tag = .linux, .abi = .gnu }, | ||
| 22 | .{ .cpu_arch = .riscv64, .os_tag = .linux, .abi = .musl }, | ||
| 23 | .{ .cpu_arch = .s390x, .os_tag = .linux, .abi = .gnu }, | ||
| 24 | // .{ .cpu_arch = .s390x, .os_tag = .linux, .abi = .musl }, | ||
| 25 | .{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .gnu }, | ||
| 26 | .{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .musl }, | ||
| 27 | |||
| 28 | .{ .cpu_arch = .aarch64, .os_tag = .macos, .abi = .none }, | ||
| 29 | |||
| 30 | // .{ .cpu_arch = .x86_64, .os_tag = .netbsd, .abi = .none }, | ||
| 31 | |||
| 32 | // .{ .cpu_arch = .aarch64, .os_tag = .windows, .abi = .gnu }, | ||
| 33 | // .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu }, | ||
| 34 | }; | ||
| 35 | |||
| 3 | pub fn build(b: *std.Build) !void { | 36 | pub fn build(b: *std.Build) !void { |
| 37 | const skip_non_native = b.option(bool, "skip_non_native", "Skip non-native targets") orelse false; | ||
| 38 | |||
| 4 | const test_step = b.step("test", "Test the program"); | 39 | const test_step = b.step("test", "Test the program"); |
| 5 | b.default_step = test_step; | 40 | b.default_step = test_step; |
| 6 | 41 | ||
| 7 | const is_macos = b.graph.host.result.os.tag == .macos; | 42 | const is_macos = b.graph.host.result.os.tag == .macos; |
| 8 | 43 | ||
| 9 | for ([_]struct { std.Target.Os.Tag, []const std.Target.Cpu.Arch }{ | 44 | for (targets) |query| { |
| 10 | // .s390x and mips64(el) fail to build | 45 | const target = b.resolveTargetQuery(query); |
| 11 | .{ .linux, &.{ .aarch64, .aarch64_be, .loongarch64, .powerpc64, .powerpc64le, .riscv64, .x86_64 } }, | ||
| 12 | .{ .macos, &.{ .aarch64, .x86_64 } }, | ||
| 13 | |||
| 14 | // powerpc64, powerpc64le, and riscv64 are not supported by TSan yet. | ||
| 15 | .{ .freebsd, &.{ .aarch64, .x86_64 } }, | ||
| 16 | 46 | ||
| 17 | .{ .netbsd, &.{.x86_64} }, | 47 | if (skip_non_native and !std.zig.target.isNative(&target.query, &target.result, &b.graph.host.result)) continue; |
| 18 | 48 | ||
| 19 | // TSan doesn't have full support for windows yet. | 49 | switch (target.result.os.tag) { |
| 20 | // .{ .windows, &.{ .aarch64, .x86_64 } }, | ||
| 21 | }) |entry| { | ||
| 22 | switch (entry[0]) { | ||
| 23 | // compiling tsan on macos requires system headers that aren't present during cross-compilation | ||
| 24 | .macos => { | 50 | .macos => { |
| 51 | // compiling tsan on macos requires system headers that aren't present during cross-compilation | ||
| 25 | if (!is_macos) continue; | 52 | if (!is_macos) continue; |
| 26 | const target = b.resolveTargetQuery(.{}); | 53 | |
| 27 | const exe = b.addExecutable(.{ | 54 | const exe = b.addExecutable(.{ |
| 28 | .name = b.fmt("tsan_{s}_{s}", .{ @tagName(entry[0]), @tagName(target.result.cpu.arch) }), | 55 | .name = b.fmt("tsan_{s}_{s}", .{ @tagName(target.result.os.tag), @tagName(target.result.cpu.arch) }), |
| 56 | .linkage = .dynamic, | ||
| 29 | .root_module = b.createModule(.{ | 57 | .root_module = b.createModule(.{ |
| 30 | .root_source_file = b.path("main.zig"), | 58 | .root_source_file = b.path("main.zig"), |
| 31 | .target = target, | 59 | .target = b.graph.host, |
| 32 | .optimize = .debug, | 60 | .optimize = .debug, |
| 33 | .sanitize_thread = true, | 61 | .sanitize_thread = true, |
| 34 | }), | 62 | }), |
| ... | @@ -36,13 +64,10 @@ pub fn build(b: *std.Build) !void { | ... | @@ -36,13 +64,10 @@ pub fn build(b: *std.Build) !void { |
| 36 | const install_exe = b.addInstallArtifact(exe, .{}); | 64 | const install_exe = b.addInstallArtifact(exe, .{}); |
| 37 | test_step.dependOn(&install_exe.step); | 65 | test_step.dependOn(&install_exe.step); |
| 38 | }, | 66 | }, |
| 39 | else => for (entry[1]) |arch| { | 67 | else => { |
| 40 | const target = b.resolveTargetQuery(.{ | ||
| 41 | .os_tag = entry[0], | ||
| 42 | .cpu_arch = arch, | ||
| 43 | }); | ||
| 44 | const exe = b.addExecutable(.{ | 68 | const exe = b.addExecutable(.{ |
| 45 | .name = b.fmt("tsan_{s}_{s}", .{ @tagName(entry[0]), @tagName(arch) }), | 69 | .name = b.fmt("tsan_{s}_{s}", .{ @tagName(target.result.os.tag), @tagName(target.result.cpu.arch) }), |
| 70 | .linkage = .dynamic, | ||
| 46 | .root_module = b.createModule(.{ | 71 | .root_module = b.createModule(.{ |
| 47 | .root_source_file = b.path("main.zig"), | 72 | .root_source_file = b.path("main.zig"), |
| 48 | .target = target, | 73 | .target = target, |
test/standalone/windows_entry_points/build.zig+6| ... | @@ -1,6 +1,10 @@ | ... | @@ -1,6 +1,10 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub const supports_skip_non_native = true; | ||
| 4 | |||
| 3 | pub fn build(b: *std.Build) void { | 5 | pub fn build(b: *std.Build) void { |
| 6 | const skip_non_native = b.option(bool, "skip_non_native", "Skip non-native targets") orelse false; | ||
| 7 | |||
| 4 | const test_step = b.step("test", "Test it"); | 8 | const test_step = b.step("test", "Test it"); |
| 5 | b.default_step = test_step; | 9 | b.default_step = test_step; |
| 6 | 10 | ||
| ... | @@ -10,6 +14,8 @@ pub fn build(b: *std.Build) void { | ... | @@ -10,6 +14,8 @@ pub fn build(b: *std.Build) void { |
| 10 | .abi = .gnu, | 14 | .abi = .gnu, |
| 11 | }); | 15 | }); |
| 12 | 16 | ||
| 17 | if (skip_non_native and !std.zig.target.isNative(&target.query, &target.result, &b.graph.host.result)) return; | ||
| 18 | |||
| 13 | { | 19 | { |
| 14 | const exe = b.addExecutable(.{ | 20 | const exe = b.addExecutable(.{ |
| 15 | .name = "main", | 21 | .name = "main", |
test/standalone/windows_resources/build.zig+6| ... | @@ -1,6 +1,10 @@ | ... | @@ -1,6 +1,10 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub const supports_skip_non_native = true; | ||
| 4 | |||
| 3 | pub fn build(b: *std.Build) void { | 5 | pub fn build(b: *std.Build) void { |
| 6 | const skip_non_native = b.option(bool, "skip_non_native", "Skip non-native targets") orelse false; | ||
| 7 | |||
| 4 | const test_step = b.step("test", "Test it"); | 8 | const test_step = b.step("test", "Test it"); |
| 5 | b.default_step = test_step; | 9 | b.default_step = test_step; |
| 6 | 10 | ||
| ... | @@ -10,6 +14,8 @@ pub fn build(b: *std.Build) void { | ... | @@ -10,6 +14,8 @@ pub fn build(b: *std.Build) void { |
| 10 | .abi = .gnu, | 14 | .abi = .gnu, |
| 11 | }); | 15 | }); |
| 12 | 16 | ||
| 17 | if (skip_non_native and !std.zig.target.isNative(&target.query, &target.result, &b.graph.host.result)) return; | ||
| 18 | |||
| 13 | const generated_h_step = b.addWriteFile("generated.h", "#define GENERATED_DEFINE \"foo\""); | 19 | const generated_h_step = b.addWriteFile("generated.h", "#define GENERATED_DEFINE \"foo\""); |
| 14 | 20 | ||
| 15 | add(b, b.graph.host, .any, test_step, generated_h_step); | 21 | add(b, b.graph.host, .any, test_step, generated_h_step); |
test/standalone/zerolength_check/build.zig deleted-27| ... | @@ -1,27 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn build(b: *std.Build) void { | ||
| 4 | const test_step = b.step("test", "Test it"); | ||
| 5 | b.default_step = test_step; | ||
| 6 | |||
| 7 | add(b, test_step, .debug); | ||
| 8 | add(b, test_step, .fast); | ||
| 9 | add(b, test_step, .small); | ||
| 10 | add(b, test_step, .safe); | ||
| 11 | } | ||
| 12 | |||
| 13 | fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize) void { | ||
| 14 | const unit_tests = b.addTest(.{ .root_module = b.createModule(.{ | ||
| 15 | .root_source_file = b.path("src/main.zig"), | ||
| 16 | .target = b.resolveTargetQuery(.{ | ||
| 17 | .os_tag = .wasi, | ||
| 18 | .cpu_arch = .wasm32, | ||
| 19 | .cpu_features_add = std.Target.wasm.featureSet(&.{.bulk_memory}), | ||
| 20 | }), | ||
| 21 | .optimize = optimize, | ||
| 22 | }) }); | ||
| 23 | |||
| 24 | const run_unit_tests = b.addRunArtifact(unit_tests); | ||
| 25 | run_unit_tests.skip_foreign_checks = true; | ||
| 26 | test_step.dependOn(&run_unit_tests.step); | ||
| 27 | } | ||
test/standalone/zerolength_check/src/main.zig deleted-24| ... | @@ -1,24 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | test { | ||
| 4 | const dest = foo(); | ||
| 5 | const source = foo(); | ||
| 6 | |||
| 7 | @memcpy(dest, source); | ||
| 8 | @memmove(dest, source); | ||
| 9 | @memset(dest, 4); | ||
| 10 | @memset(dest, undefined); | ||
| 11 | |||
| 12 | const dest2 = foo2(); | ||
| 13 | @memset(dest2, 0); | ||
| 14 | } | ||
| 15 | |||
| 16 | fn foo() []u8 { | ||
| 17 | const ptr = comptime std.mem.alignBackward(usize, std.math.maxInt(usize), 1); | ||
| 18 | return @as([*]align(1) u8, @ptrFromInt(ptr))[0..0]; | ||
| 19 | } | ||
| 20 | |||
| 21 | fn foo2() []u64 { | ||
| 22 | const ptr = comptime std.mem.alignBackward(usize, std.math.maxInt(usize), 1); | ||
| 23 | return @as([*]align(1) u64, @ptrFromInt(ptr))[0..0]; | ||
| 24 | } | ||
test/tests.zig+6-160| ... | @@ -2323,162 +2323,6 @@ pub const debugger_matrix: []const RunnerTarget = &.{ | ... | @@ -2323,162 +2323,6 @@ pub const debugger_matrix: []const RunnerTarget = &.{ |
| 2323 | }, | 2323 | }, |
| 2324 | }; | 2324 | }; |
| 2325 | 2325 | ||
| 2326 | fn supportedCompatArch(host: *const std.Target, arch: std.Target.Cpu.Arch) bool { | ||
| 2327 | // aarch64-freebsd and aarch64-linux can technically run 32-bit ARM binaries, but that depends | ||
| 2328 | // on AArch32 support in the CPU. Since modern AArch64 CPUs have largely dropped this support, | ||
| 2329 | // avoid reporting compatibility for 32-bit here since we'd just build a bunch of test binaries | ||
| 2330 | // that never get run anyway. This added almost an hour's worth of useless work to aarch64-linux | ||
| 2331 | // CI, for example. | ||
| 2332 | // | ||
| 2333 | // riscv64-linux and riscv64-netbsd similarly support 32-bit binaries. However, this requires a | ||
| 2334 | // very recent kernel and for the kernel feature to be enabled. Additionally, contemporary | ||
| 2335 | // RISC-V hardware is just too slow to justify building the 32-bit binaries. | ||
| 2336 | return switch (host.os.tag) { | ||
| 2337 | .illumos => switch (host.cpu.arch) { | ||
| 2338 | .x86_64 => arch == .x86, | ||
| 2339 | else => false, | ||
| 2340 | }, | ||
| 2341 | .linux => switch (host.cpu.arch) { | ||
| 2342 | .mips64 => arch == .mips, | ||
| 2343 | .mips64el => arch == .mipsel, | ||
| 2344 | .powerpc64 => arch == .powerpc, | ||
| 2345 | .sparc64 => arch == .sparc, | ||
| 2346 | .x86_64 => arch == .x86, | ||
| 2347 | else => false, | ||
| 2348 | }, | ||
| 2349 | .netbsd => switch (host.cpu.arch) { | ||
| 2350 | .sparc64 => arch == .sparc, | ||
| 2351 | .x86_64 => arch == .x86, | ||
| 2352 | else => false, | ||
| 2353 | }, | ||
| 2354 | .windows => switch (host.cpu.arch) { | ||
| 2355 | .x86_64 => arch == .x86, | ||
| 2356 | else => false, | ||
| 2357 | }, | ||
| 2358 | else => false, | ||
| 2359 | }; | ||
| 2360 | } | ||
| 2361 | |||
| 2362 | pub fn isNative(actual_target: *const std.Build.ResolvedTarget, host: *const std.Target) bool { | ||
| 2363 | if (actual_target.query.isNative()) return true; | ||
| 2364 | const actual = &actual_target.result; | ||
| 2365 | |||
| 2366 | if (actual.cpu.arch != host.cpu.arch and !supportedCompatArch(host, actual.cpu.arch)) | ||
| 2367 | return false; | ||
| 2368 | |||
| 2369 | if (actual.os.tag != host.os.tag) | ||
| 2370 | return false; | ||
| 2371 | |||
| 2372 | // This check is really only necessary for the case where `host.cpu.arch.isAarch64()` and | ||
| 2373 | // `actual.cpu.arch.isArm()`. As they are wholly separate `std.Target` families with their own | ||
| 2374 | // feature bits, the logic below would produce complete nonsense. | ||
| 2375 | // | ||
| 2376 | // This does mean that we aren't actually checking feature compatibility between these two | ||
| 2377 | // families even though we should. That's not a problem currently, but in the future, we may | ||
| 2378 | // need to add a special code path just for this specific case... | ||
| 2379 | if (actual.cpu.arch.family() != host.cpu.arch.family()) | ||
| 2380 | return true; | ||
| 2381 | |||
| 2382 | // Remove features that don't actually affect compatibility. | ||
| 2383 | const irrelevant: std.Target.Cpu.Feature.Set = switch (host.cpu.arch) { | ||
| 2384 | .x86_64 => std.Target.x86.featureSet(&.{ | ||
| 2385 | .@"16bit_mode", | ||
| 2386 | .@"32bit_mode", | ||
| 2387 | .@"64bit", | ||
| 2388 | .false_deps_bls, | ||
| 2389 | .false_deps_compress, | ||
| 2390 | .false_deps_expand, | ||
| 2391 | .false_deps_getmant, | ||
| 2392 | .false_deps_lzcnt, | ||
| 2393 | .false_deps_mulc, | ||
| 2394 | .false_deps_mullq, | ||
| 2395 | .false_deps_perm, | ||
| 2396 | .false_deps_popcnt, | ||
| 2397 | .false_deps_range, | ||
| 2398 | .false_deps_tzcnt, | ||
| 2399 | .fast_11bytenop, | ||
| 2400 | .fast_15bytenop, | ||
| 2401 | .fast_7bytenop, | ||
| 2402 | .fast_bextr, | ||
| 2403 | .fast_dpwssd, | ||
| 2404 | .fast_gather, | ||
| 2405 | .fast_hops, | ||
| 2406 | .fast_imm16, | ||
| 2407 | .fast_lzcnt, | ||
| 2408 | .fast_movbe, | ||
| 2409 | .fast_scalar_fsqrt, | ||
| 2410 | .fast_scalar_shift_masks, | ||
| 2411 | .fast_shld_rotate, | ||
| 2412 | .fast_variable_crosslane_shuffle, | ||
| 2413 | .fast_variable_perlane_shuffle, | ||
| 2414 | .fast_vector_fsqrt, | ||
| 2415 | .fast_vector_shift_masks, | ||
| 2416 | .faster_shift_than_shuffle, | ||
| 2417 | .no_bypass_delay, | ||
| 2418 | .no_bypass_delay_blend, | ||
| 2419 | .no_bypass_delay_mov, | ||
| 2420 | .no_bypass_delay_shuffle, | ||
| 2421 | .prefer_128_bit, | ||
| 2422 | .prefer_256_bit, | ||
| 2423 | .prefer_legacy_setcc, | ||
| 2424 | .prefer_mask_registers, | ||
| 2425 | .prefer_movmsk_over_vtest, | ||
| 2426 | .prefer_ndd_mem, | ||
| 2427 | .prefer_no_gather, | ||
| 2428 | .prefer_no_scatter, | ||
| 2429 | .slow_3ops_lea, | ||
| 2430 | .slow_incdec, | ||
| 2431 | .slow_indirect_call, | ||
| 2432 | .slow_lea, | ||
| 2433 | .slow_pmaddwd, | ||
| 2434 | .slow_pmulld, | ||
| 2435 | .slow_pmullq, | ||
| 2436 | .slow_shld, | ||
| 2437 | .slow_two_mem_ops, | ||
| 2438 | .slow_unaligned_mem_16, | ||
| 2439 | .slow_unaligned_mem_32, | ||
| 2440 | }), | ||
| 2441 | .aarch64, .aarch64_be => std.Target.aarch64.featureSet(&.{ | ||
| 2442 | .addr_lsl_slow_14, | ||
| 2443 | .align_cmp_csel_pairs, | ||
| 2444 | .alu_lsl_fast, | ||
| 2445 | .avoid_ldapur, | ||
| 2446 | .disable_fast_inc_vl, | ||
| 2447 | .exynos_cheap_as_move, | ||
| 2448 | .fast_ld1_single, | ||
| 2449 | .fixed_load_latency_4, | ||
| 2450 | .fuse_address, | ||
| 2451 | .fuse_addsub_2reg_const1, | ||
| 2452 | .fuse_adrp_add, | ||
| 2453 | .fuse_aes, | ||
| 2454 | .fuse_arith_logic, | ||
| 2455 | .fuse_crypto_eor, | ||
| 2456 | .fuse_csel, | ||
| 2457 | .fuse_cset, | ||
| 2458 | .fuse_fcsel, | ||
| 2459 | .fuse_literals, | ||
| 2460 | .has_limited_64bit_vector_mul_bandwidth, | ||
| 2461 | .predictable_select_expensive, | ||
| 2462 | .slow_misaligned_128store, | ||
| 2463 | .slow_paired_128, | ||
| 2464 | .slow_strqro_store, | ||
| 2465 | .use_experimental_zeroing_pseudos, | ||
| 2466 | .use_fixed_over_scalable_if_equal_cost, | ||
| 2467 | .use_postra_scheduler, | ||
| 2468 | .use_reciprocal_square_root, | ||
| 2469 | .use_wzr_to_vec_move, | ||
| 2470 | }), | ||
| 2471 | else => .empty, | ||
| 2472 | }; | ||
| 2473 | var set = actual.cpu.features; | ||
| 2474 | set.removeFeatureSet(irrelevant); | ||
| 2475 | |||
| 2476 | if (!host.cpu.features.isSuperSetOf(set)) | ||
| 2477 | return false; | ||
| 2478 | |||
| 2479 | return true; | ||
| 2480 | } | ||
| 2481 | |||
| 2482 | pub fn addStackTraceTests(b: *std.Build, options: StackTracesContext.Options) *Step { | 2326 | pub fn addStackTraceTests(b: *std.Build, options: StackTracesContext.Options) *Step { |
| 2483 | const step = b.step("test-stack-traces", "Run the stack trace tests"); | 2327 | const step = b.step("test-stack-traces", "Run the stack trace tests"); |
| 2484 | 2328 | ||
| ... | @@ -2530,6 +2374,7 @@ pub fn addErrorTraceTests(b: *std.Build, options: ErrorTracesContext.Options) *S | ... | @@ -2530,6 +2374,7 @@ pub fn addErrorTraceTests(b: *std.Build, options: ErrorTracesContext.Options) *S |
| 2530 | pub fn addStandaloneTests( | 2374 | pub fn addStandaloneTests( |
| 2531 | b: *std.Build, | 2375 | b: *std.Build, |
| 2532 | optimize_modes: []const OptimizeMode, | 2376 | optimize_modes: []const OptimizeMode, |
| 2377 | skip_non_native: bool, | ||
| 2533 | enable_macos_sdk: bool, | 2378 | enable_macos_sdk: bool, |
| 2534 | enable_ios_sdk: bool, | 2379 | enable_ios_sdk: bool, |
| 2535 | enable_symlinks_windows: bool, | 2380 | enable_symlinks_windows: bool, |
| ... | @@ -2544,6 +2389,7 @@ pub fn addStandaloneTests( | ... | @@ -2544,6 +2389,7 @@ pub fn addStandaloneTests( |
| 2544 | .simple_skip_release_safe = mem.findScalar(OptimizeMode, optimize_modes, .safe) == null, | 2389 | .simple_skip_release_safe = mem.findScalar(OptimizeMode, optimize_modes, .safe) == null, |
| 2545 | .simple_skip_release_fast = mem.findScalar(OptimizeMode, optimize_modes, .fast) == null, | 2390 | .simple_skip_release_fast = mem.findScalar(OptimizeMode, optimize_modes, .fast) == null, |
| 2546 | .simple_skip_release_small = mem.findScalar(OptimizeMode, optimize_modes, .small) == null, | 2391 | .simple_skip_release_small = mem.findScalar(OptimizeMode, optimize_modes, .small) == null, |
| 2392 | .skip_non_native = skip_non_native, | ||
| 2547 | }); | 2393 | }); |
| 2548 | const test_cases_dep_step = test_cases_dep.builder.default_step; | 2394 | const test_cases_dep_step = test_cases_dep.builder.default_step; |
| 2549 | test_cases_dep_step.name = test_cases_dep_name; | 2395 | test_cases_dep_step.name = test_cases_dep_name; |
| ... | @@ -2830,7 +2676,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { | ... | @@ -2830,7 +2676,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { |
| 2830 | 2676 | ||
| 2831 | if (!options.test_extra_targets and test_target.extra_target) continue; | 2677 | if (!options.test_extra_targets and test_target.extra_target) continue; |
| 2832 | 2678 | ||
| 2833 | if (options.skip_non_native and !isNative(&resolved_target, &b.graph.host.result)) | 2679 | if (options.skip_non_native and !std.zig.target.isNative(&resolved_target.query, &resolved_target.result, &b.graph.host.result)) |
| 2834 | continue; | 2680 | continue; |
| 2835 | 2681 | ||
| 2836 | const target = &resolved_target.result; | 2682 | const target = &resolved_target.result; |
| ... | @@ -3156,7 +3002,7 @@ pub fn addCAbiTests(b: *std.Build, options: CAbiTestOptions) *Step { | ... | @@ -3156,7 +3002,7 @@ pub fn addCAbiTests(b: *std.Build, options: CAbiTestOptions) *Step { |
| 3156 | const triple_txt = resolved_target.query.zigTriple(b.allocator) catch @panic("OOM"); | 3002 | const triple_txt = resolved_target.query.zigTriple(b.allocator) catch @panic("OOM"); |
| 3157 | const target = &resolved_target.result; | 3003 | const target = &resolved_target.result; |
| 3158 | 3004 | ||
| 3159 | if (options.skip_non_native and !isNative(&resolved_target, &b.graph.host.result)) | 3005 | if (options.skip_non_native and !std.zig.target.isNative(&resolved_target.query, &resolved_target.result, &b.graph.host.result)) |
| 3160 | continue; | 3006 | continue; |
| 3161 | 3007 | ||
| 3162 | if (options.test_target_filters.len > 0) { | 3008 | if (options.test_target_filters.len > 0) { |
| ... | @@ -3249,7 +3095,7 @@ pub fn addLinkTests(b: *std.Build, options: LinkTestOptions) *Step { | ... | @@ -3249,7 +3095,7 @@ pub fn addLinkTests(b: *std.Build, options: LinkTestOptions) *Step { |
| 3249 | for (link_targets) |link_target| { | 3095 | for (link_targets) |link_target| { |
| 3250 | const resolved_target = b.resolveTargetQuery(link_target.target); | 3096 | const resolved_target = b.resolveTargetQuery(link_target.target); |
| 3251 | 3097 | ||
| 3252 | if (options.skip_non_native and !isNative(&resolved_target, &b.graph.host.result)) | 3098 | if (options.skip_non_native and !std.zig.target.isNative(&resolved_target.query, &resolved_target.result, &b.graph.host.result)) |
| 3253 | continue; | 3099 | continue; |
| 3254 | 3100 | ||
| 3255 | const target = &resolved_target.result; | 3101 | const target = &resolved_target.result; |
| ... | @@ -3399,7 +3245,7 @@ pub fn addRunnerTests( | ... | @@ -3399,7 +3245,7 @@ pub fn addRunnerTests( |
| 3399 | for (matrix) |test_target| { | 3245 | for (matrix) |test_target| { |
| 3400 | const resolved_target = b.resolveTargetQuery(test_target.target); | 3246 | const resolved_target = b.resolveTargetQuery(test_target.target); |
| 3401 | 3247 | ||
| 3402 | if (options.skip_non_native and !isNative(&resolved_target, &b.graph.host.result)) | 3248 | if (options.skip_non_native and !std.zig.target.isNative(&resolved_target.query, &resolved_target.result, &b.graph.host.result)) |
| 3403 | continue; | 3249 | continue; |
| 3404 | 3250 | ||
| 3405 | const target = &resolved_target.result; | 3251 | const target = &resolved_target.result; |