| author | |
| committer | |
| log | b0186f31002760c9940d8c06c2ac7baa9d52f404 |
| tree | 25bb2c86739f6ee3d9cd8a9e5f77d046c4b12487 |
| parent | 397649fb0934b75122e795bfb234d46693425d98 |
| parent | 9e6647582da0d7cbf8a441cefea0bb9fae18bb5c |
| signature |
add CI test coverage for more target combinations15 files changed, 359 insertions(+), 144 deletions(-)
build.zig+4-17| ... | ... | @@ -85,9 +85,7 @@ pub fn build(b: *std.Build) !void { |
| 85 | 85 | const skip_cross_glibc = b.option(bool, "skip-cross-glibc", "Main test suite skips builds that require cross glibc") orelse false; |
| 86 | 86 | const skip_libc = b.option(bool, "skip-libc", "Main test suite skips tests that link libc") orelse false; |
| 87 | 87 | const skip_single_threaded = b.option(bool, "skip-single-threaded", "Main test suite skips tests that are single-threaded") orelse false; |
| 88 | const skip_stage1 = b.option(bool, "skip-stage1", "Main test suite skips stage1 compile error tests") orelse false; | |
| 89 | 88 | const skip_run_translated_c = b.option(bool, "skip-run-translated-c", "Main test suite skips run-translated-c tests") orelse false; |
| 90 | const skip_stage2_tests = b.option(bool, "skip-stage2-tests", "Main test suite skips self-hosted compiler tests") orelse false; | |
| 91 | 89 | |
| 92 | 90 | const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false; |
| 93 | 91 | |
| ... | ... | @@ -187,9 +185,7 @@ pub fn build(b: *std.Build) !void { |
| 187 | 185 | const compile_step = b.step("compile", "Build the self-hosted compiler"); |
| 188 | 186 | compile_step.dependOn(&exe.step); |
| 189 | 187 | |
| 190 | if (!skip_stage2_tests) { | |
| 191 | test_step.dependOn(&exe.step); | |
| 192 | } | |
| 188 | test_step.dependOn(&exe.step); | |
| 193 | 189 | |
| 194 | 190 | exe.single_threaded = single_threaded; |
| 195 | 191 | |
| ... | ... | @@ -360,7 +356,6 @@ pub fn build(b: *std.Build) !void { |
| 360 | 356 | test_cases_options.addOption(bool, "enable_link_snapshots", enable_link_snapshots); |
| 361 | 357 | test_cases_options.addOption(bool, "skip_non_native", skip_non_native); |
| 362 | 358 | test_cases_options.addOption(bool, "skip_cross_glibc", skip_cross_glibc); |
| 363 | test_cases_options.addOption(bool, "skip_stage1", skip_stage1); | |
| 364 | 359 | test_cases_options.addOption(bool, "have_llvm", enable_llvm); |
| 365 | 360 | test_cases_options.addOption(bool, "llvm_has_m68k", llvm_has_m68k); |
| 366 | 361 | test_cases_options.addOption(bool, "llvm_has_csky", llvm_has_csky); |
| ... | ... | @@ -416,7 +411,7 @@ pub fn build(b: *std.Build) !void { |
| 416 | 411 | |
| 417 | 412 | const test_cases_step = b.step("test-cases", "Run the main compiler test cases"); |
| 418 | 413 | try tests.addCases(b, test_cases_step, test_filter, check_case_exe); |
| 419 | if (!skip_stage2_tests) test_step.dependOn(test_cases_step); | |
| 414 | test_step.dependOn(test_cases_step); | |
| 420 | 415 | |
| 421 | 416 | test_step.dependOn(tests.addModuleTests(b, .{ |
| 422 | 417 | .test_filter = test_filter, |
| ... | ... | @@ -428,8 +423,6 @@ pub fn build(b: *std.Build) !void { |
| 428 | 423 | .skip_non_native = skip_non_native, |
| 429 | 424 | .skip_cross_glibc = skip_cross_glibc, |
| 430 | 425 | .skip_libc = skip_libc, |
| 431 | .skip_stage1 = skip_stage1, | |
| 432 | .skip_stage2 = skip_stage2_tests, | |
| 433 | 426 | .max_rss = 1 * 1024 * 1024 * 1024, |
| 434 | 427 | })); |
| 435 | 428 | |
| ... | ... | @@ -443,8 +436,6 @@ pub fn build(b: *std.Build) !void { |
| 443 | 436 | .skip_non_native = skip_non_native, |
| 444 | 437 | .skip_cross_glibc = skip_cross_glibc, |
| 445 | 438 | .skip_libc = true, |
| 446 | .skip_stage1 = skip_stage1, | |
| 447 | .skip_stage2 = true, // TODO get all these passing | |
| 448 | 439 | })); |
| 449 | 440 | |
| 450 | 441 | test_step.dependOn(tests.addModuleTests(b, .{ |
| ... | ... | @@ -457,8 +448,6 @@ pub fn build(b: *std.Build) !void { |
| 457 | 448 | .skip_non_native = skip_non_native, |
| 458 | 449 | .skip_cross_glibc = skip_cross_glibc, |
| 459 | 450 | .skip_libc = true, |
| 460 | .skip_stage1 = skip_stage1, | |
| 461 | .skip_stage2 = true, // TODO get all these passing | |
| 462 | 451 | })); |
| 463 | 452 | |
| 464 | 453 | test_step.dependOn(tests.addCompareOutputTests(b, test_filter, optimization_modes)); |
| ... | ... | @@ -466,11 +455,11 @@ pub fn build(b: *std.Build) !void { |
| 466 | 455 | b, |
| 467 | 456 | optimization_modes, |
| 468 | 457 | enable_macos_sdk, |
| 469 | skip_stage2_tests, | |
| 458 | false, | |
| 470 | 459 | enable_symlinks_windows, |
| 471 | 460 | )); |
| 472 | 461 | test_step.dependOn(tests.addCAbiTests(b, skip_non_native, skip_release)); |
| 473 | test_step.dependOn(tests.addLinkTests(b, enable_macos_sdk, skip_stage2_tests, enable_symlinks_windows)); | |
| 462 | test_step.dependOn(tests.addLinkTests(b, enable_macos_sdk, false, enable_symlinks_windows)); | |
| 474 | 463 | test_step.dependOn(tests.addStackTraceTests(b, test_filter, optimization_modes)); |
| 475 | 464 | test_step.dependOn(tests.addCliTests(b)); |
| 476 | 465 | test_step.dependOn(tests.addAssembleAndLinkTests(b, test_filter, optimization_modes)); |
| ... | ... | @@ -489,8 +478,6 @@ pub fn build(b: *std.Build) !void { |
| 489 | 478 | .skip_non_native = skip_non_native, |
| 490 | 479 | .skip_cross_glibc = skip_cross_glibc, |
| 491 | 480 | .skip_libc = skip_libc, |
| 492 | .skip_stage1 = skip_stage1, | |
| 493 | .skip_stage2 = true, // TODO get all these passing | |
| 494 | 481 | // I observed a value of 3398275072 on my M1, and multiplied by 1.1 to |
| 495 | 482 | // get this amount: |
| 496 | 483 | .max_rss = 3738102579, |
lib/compiler_rt/common.zig+2-1| ... | ... | @@ -6,7 +6,8 @@ pub const linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .Internal el |
| 6 | 6 | /// Determines the symbol's visibility to other objects. |
| 7 | 7 | /// For WebAssembly this allows the symbol to be resolved to other modules, but will not |
| 8 | 8 | /// export it to the host runtime. |
| 9 | pub const visibility: std.builtin.SymbolVisibility = if (builtin.target.isWasm()) .hidden else .default; | |
| 9 | pub const visibility: std.builtin.SymbolVisibility = | |
| 10 | if (builtin.target.isWasm() and linkage != .Internal) .hidden else .default; | |
| 10 | 11 | pub const want_aeabi = switch (builtin.abi) { |
| 11 | 12 | .eabi, |
| 12 | 13 | .eabihf, |
lib/std/Build.zig+41-2| ... | ... | @@ -454,6 +454,10 @@ pub const ExecutableOptions = struct { |
| 454 | 454 | optimize: std.builtin.Mode = .Debug, |
| 455 | 455 | linkage: ?CompileStep.Linkage = null, |
| 456 | 456 | max_rss: usize = 0, |
| 457 | link_libc: ?bool = null, | |
| 458 | single_threaded: ?bool = null, | |
| 459 | use_llvm: ?bool = null, | |
| 460 | use_lld: ?bool = null, | |
| 457 | 461 | }; |
| 458 | 462 | |
| 459 | 463 | pub fn addExecutable(b: *Build, options: ExecutableOptions) *CompileStep { |
| ... | ... | @@ -466,6 +470,10 @@ pub fn addExecutable(b: *Build, options: ExecutableOptions) *CompileStep { |
| 466 | 470 | .kind = .exe, |
| 467 | 471 | .linkage = options.linkage, |
| 468 | 472 | .max_rss = options.max_rss, |
| 473 | .link_libc = options.link_libc, | |
| 474 | .single_threaded = options.single_threaded, | |
| 475 | .use_llvm = options.use_llvm, | |
| 476 | .use_lld = options.use_lld, | |
| 469 | 477 | }); |
| 470 | 478 | } |
| 471 | 479 | |
| ... | ... | @@ -475,6 +483,10 @@ pub const ObjectOptions = struct { |
| 475 | 483 | target: CrossTarget, |
| 476 | 484 | optimize: std.builtin.Mode, |
| 477 | 485 | max_rss: usize = 0, |
| 486 | link_libc: ?bool = null, | |
| 487 | single_threaded: ?bool = null, | |
| 488 | use_llvm: ?bool = null, | |
| 489 | use_lld: ?bool = null, | |
| 478 | 490 | }; |
| 479 | 491 | |
| 480 | 492 | pub fn addObject(b: *Build, options: ObjectOptions) *CompileStep { |
| ... | ... | @@ -485,6 +497,10 @@ pub fn addObject(b: *Build, options: ObjectOptions) *CompileStep { |
| 485 | 497 | .optimize = options.optimize, |
| 486 | 498 | .kind = .obj, |
| 487 | 499 | .max_rss = options.max_rss, |
| 500 | .link_libc = options.link_libc, | |
| 501 | .single_threaded = options.single_threaded, | |
| 502 | .use_llvm = options.use_llvm, | |
| 503 | .use_lld = options.use_lld, | |
| 488 | 504 | }); |
| 489 | 505 | } |
| 490 | 506 | |
| ... | ... | @@ -495,6 +511,10 @@ pub const SharedLibraryOptions = struct { |
| 495 | 511 | target: CrossTarget, |
| 496 | 512 | optimize: std.builtin.Mode, |
| 497 | 513 | max_rss: usize = 0, |
| 514 | link_libc: ?bool = null, | |
| 515 | single_threaded: ?bool = null, | |
| 516 | use_llvm: ?bool = null, | |
| 517 | use_lld: ?bool = null, | |
| 498 | 518 | }; |
| 499 | 519 | |
| 500 | 520 | pub fn addSharedLibrary(b: *Build, options: SharedLibraryOptions) *CompileStep { |
| ... | ... | @@ -507,6 +527,10 @@ pub fn addSharedLibrary(b: *Build, options: SharedLibraryOptions) *CompileStep { |
| 507 | 527 | .target = options.target, |
| 508 | 528 | .optimize = options.optimize, |
| 509 | 529 | .max_rss = options.max_rss, |
| 530 | .link_libc = options.link_libc, | |
| 531 | .single_threaded = options.single_threaded, | |
| 532 | .use_llvm = options.use_llvm, | |
| 533 | .use_lld = options.use_lld, | |
| 510 | 534 | }); |
| 511 | 535 | } |
| 512 | 536 | |
| ... | ... | @@ -517,6 +541,10 @@ pub const StaticLibraryOptions = struct { |
| 517 | 541 | optimize: std.builtin.Mode, |
| 518 | 542 | version: ?std.builtin.Version = null, |
| 519 | 543 | max_rss: usize = 0, |
| 544 | link_libc: ?bool = null, | |
| 545 | single_threaded: ?bool = null, | |
| 546 | use_llvm: ?bool = null, | |
| 547 | use_lld: ?bool = null, | |
| 520 | 548 | }; |
| 521 | 549 | |
| 522 | 550 | pub fn addStaticLibrary(b: *Build, options: StaticLibraryOptions) *CompileStep { |
| ... | ... | @@ -529,6 +557,10 @@ pub fn addStaticLibrary(b: *Build, options: StaticLibraryOptions) *CompileStep { |
| 529 | 557 | .target = options.target, |
| 530 | 558 | .optimize = options.optimize, |
| 531 | 559 | .max_rss = options.max_rss, |
| 560 | .link_libc = options.link_libc, | |
| 561 | .single_threaded = options.single_threaded, | |
| 562 | .use_llvm = options.use_llvm, | |
| 563 | .use_lld = options.use_lld, | |
| 532 | 564 | }); |
| 533 | 565 | } |
| 534 | 566 | |
| ... | ... | @@ -541,6 +573,10 @@ pub const TestOptions = struct { |
| 541 | 573 | max_rss: usize = 0, |
| 542 | 574 | filter: ?[]const u8 = null, |
| 543 | 575 | test_runner: ?[]const u8 = null, |
| 576 | link_libc: ?bool = null, | |
| 577 | single_threaded: ?bool = null, | |
| 578 | use_llvm: ?bool = null, | |
| 579 | use_lld: ?bool = null, | |
| 544 | 580 | }; |
| 545 | 581 | |
| 546 | 582 | pub fn addTest(b: *Build, options: TestOptions) *CompileStep { |
| ... | ... | @@ -553,6 +589,10 @@ pub fn addTest(b: *Build, options: TestOptions) *CompileStep { |
| 553 | 589 | .max_rss = options.max_rss, |
| 554 | 590 | .filter = options.filter, |
| 555 | 591 | .test_runner = options.test_runner, |
| 592 | .link_libc = options.link_libc, | |
| 593 | .single_threaded = options.single_threaded, | |
| 594 | .use_llvm = options.use_llvm, | |
| 595 | .use_lld = options.use_lld, | |
| 556 | 596 | }); |
| 557 | 597 | } |
| 558 | 598 | |
| ... | ... | @@ -639,8 +679,7 @@ pub fn addRunArtifact(b: *Build, exe: *CompileStep) *RunStep { |
| 639 | 679 | run_step.addArtifactArg(exe); |
| 640 | 680 | |
| 641 | 681 | if (exe.kind == .@"test") { |
| 642 | run_step.stdio = .zig_test; | |
| 643 | run_step.addArgs(&.{"--listen=-"}); | |
| 682 | run_step.enableTestRunnerMode(); | |
| 644 | 683 | } |
| 645 | 684 | |
| 646 | 685 | if (exe.vcpkg_bin_path) |path| { |
lib/std/Build/CompileStep.zig+15-5| ... | ... | @@ -63,7 +63,7 @@ emit_llvm_ir: EmitOption = .default, |
| 63 | 63 | // so it is not an EmitOption for now. |
| 64 | 64 | emit_h: bool = false, |
| 65 | 65 | bundle_compiler_rt: ?bool = null, |
| 66 | single_threaded: ?bool = null, | |
| 66 | single_threaded: ?bool, | |
| 67 | 67 | stack_protector: ?bool = null, |
| 68 | 68 | disable_stack_probing: bool, |
| 69 | 69 | disable_sanitize_c: bool, |
| ... | ... | @@ -101,8 +101,8 @@ link_objects: ArrayList(LinkObject), |
| 101 | 101 | include_dirs: ArrayList(IncludeDir), |
| 102 | 102 | c_macros: ArrayList([]const u8), |
| 103 | 103 | installed_headers: ArrayList(*Step), |
| 104 | is_linking_libc: bool = false, | |
| 105 | is_linking_libcpp: bool = false, | |
| 104 | is_linking_libc: bool, | |
| 105 | is_linking_libcpp: bool, | |
| 106 | 106 | vcpkg_bin_path: ?[]const u8 = null, |
| 107 | 107 | |
| 108 | 108 | /// This may be set in order to override the default install directory |
| ... | ... | @@ -207,8 +207,8 @@ force_undefined_symbols: std.StringHashMap(void), |
| 207 | 207 | stack_size: ?u64 = null, |
| 208 | 208 | |
| 209 | 209 | want_lto: ?bool = null, |
| 210 | use_llvm: ?bool = null, | |
| 211 | use_lld: ?bool = null, | |
| 210 | use_llvm: ?bool, | |
| 211 | use_lld: ?bool, | |
| 212 | 212 | |
| 213 | 213 | /// This is an advanced setting that can change the intent of this CompileStep. |
| 214 | 214 | /// If this slice has nonzero length, it means that this CompileStep exists to |
| ... | ... | @@ -287,6 +287,10 @@ pub const Options = struct { |
| 287 | 287 | max_rss: usize = 0, |
| 288 | 288 | filter: ?[]const u8 = null, |
| 289 | 289 | test_runner: ?[]const u8 = null, |
| 290 | link_libc: ?bool = null, | |
| 291 | single_threaded: ?bool = null, | |
| 292 | use_llvm: ?bool = null, | |
| 293 | use_lld: ?bool = null, | |
| 290 | 294 | }; |
| 291 | 295 | |
| 292 | 296 | pub const Kind = enum { |
| ... | ... | @@ -412,6 +416,12 @@ pub fn create(owner: *std.Build, options: Options) *CompileStep { |
| 412 | 416 | .output_dirname_source = GeneratedFile{ .step = &self.step }, |
| 413 | 417 | |
| 414 | 418 | .target_info = target_info, |
| 419 | ||
| 420 | .is_linking_libc = options.link_libc orelse false, | |
| 421 | .is_linking_libcpp = false, | |
| 422 | .single_threaded = options.single_threaded, | |
| 423 | .use_llvm = options.use_llvm, | |
| 424 | .use_lld = options.use_lld, | |
| 415 | 425 | }; |
| 416 | 426 | |
| 417 | 427 | if (self.kind == .lib) { |
lib/std/Build/RunStep.zig+5| ... | ... | @@ -140,6 +140,11 @@ pub fn setName(self: *RunStep, name: []const u8) void { |
| 140 | 140 | self.rename_step_with_output_arg = false; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | pub fn enableTestRunnerMode(rs: *RunStep) void { | |
| 144 | rs.stdio = .zig_test; | |
| 145 | rs.addArgs(&.{"--listen=-"}); | |
| 146 | } | |
| 147 | ||
| 143 | 148 | pub fn addArtifactArg(self: *RunStep, artifact: *CompileStep) void { |
| 144 | 149 | self.argv.append(Arg{ .artifact = artifact }) catch @panic("OOM"); |
| 145 | 150 | self.step.dependOn(&artifact.step); |
lib/std/zig/Server.zig+4-8| ... | ... | @@ -104,11 +104,9 @@ pub fn receiveMessage(s: *Server) !InMessage.Header { |
| 104 | 104 | const buf = fifo.readableSlice(0); |
| 105 | 105 | assert(fifo.readableLength() == buf.len); |
| 106 | 106 | if (buf.len >= @sizeOf(Header)) { |
| 107 | const header = @ptrCast(*align(1) const Header, buf[0..@sizeOf(Header)]); | |
| 108 | 107 | // workaround for https://github.com/ziglang/zig/issues/14904 |
| 109 | const bytes_len = bswap_and_workaround_u32(&header.bytes_len); | |
| 110 | // workaround for https://github.com/ziglang/zig/issues/14904 | |
| 111 | const tag = bswap_and_workaround_tag(&header.tag); | |
| 108 | const bytes_len = bswap_and_workaround_u32(buf[4..][0..4]); | |
| 109 | const tag = bswap_and_workaround_tag(buf[0..][0..4]); | |
| 112 | 110 | |
| 113 | 111 | if (buf.len - @sizeOf(Header) >= bytes_len) { |
| 114 | 112 | fifo.discard(@sizeOf(Header)); |
| ... | ... | @@ -281,14 +279,12 @@ fn bswap_u32_array(slice: []u32) void { |
| 281 | 279 | } |
| 282 | 280 | |
| 283 | 281 | /// workaround for https://github.com/ziglang/zig/issues/14904 |
| 284 | fn bswap_and_workaround_u32(x: *align(1) const u32) u32 { | |
| 285 | const bytes_ptr = @ptrCast(*const [4]u8, x); | |
| 282 | fn bswap_and_workaround_u32(bytes_ptr: *const [4]u8) u32 { | |
| 286 | 283 | return std.mem.readIntLittle(u32, bytes_ptr); |
| 287 | 284 | } |
| 288 | 285 | |
| 289 | 286 | /// workaround for https://github.com/ziglang/zig/issues/14904 |
| 290 | fn bswap_and_workaround_tag(x: *align(1) const InMessage.Tag) InMessage.Tag { | |
| 291 | const bytes_ptr = @ptrCast(*const [4]u8, x); | |
| 287 | fn bswap_and_workaround_tag(bytes_ptr: *const [4]u8) InMessage.Tag { | |
| 292 | 288 | const int = std.mem.readIntLittle(u32, bytes_ptr); |
| 293 | 289 | return @intToEnum(InMessage.Tag, int); |
| 294 | 290 | } |
test/behavior/atomics.zig+6| ... | ... | @@ -209,6 +209,12 @@ test "atomicrmw with floats" { |
| 209 | 209 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 210 | 210 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 211 | 211 | |
| 212 | if (builtin.zig_backend == .stage2_c) { | |
| 213 | // TODO: test.c:34929:7: error: address argument to atomic operation must be a pointer to integer or pointer ('zig_f32 *' (aka 'float *') invalid | |
| 214 | // when compiling with -std=c99 -pedantic | |
| 215 | return error.SkipZigTest; | |
| 216 | } | |
| 217 | ||
| 212 | 218 | if ((builtin.zig_backend == .stage2_llvm or builtin.zig_backend == .stage2_c) and |
| 213 | 219 | builtin.cpu.arch == .aarch64) |
| 214 | 220 | { |
test/behavior/bugs/12680.zig+4| ... | ... | @@ -11,6 +11,10 @@ test "export a function twice" { |
| 11 | 11 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; |
| 12 | 12 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 13 | 13 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 14 | if (builtin.os.tag == .macos and builtin.zig_backend == .stage2_c) { | |
| 15 | // TODO: test.c: error: aliases are not supported on darwin | |
| 16 | return error.SkipZigTest; | |
| 17 | } | |
| 14 | 18 | |
| 15 | 19 | // If it exports the function correctly, `test_func` and `testFunc` will points to the same address. |
| 16 | 20 | try expectEqual(test_func(), other_file.testFunc()); |
test/behavior/cast.zig+20| ... | ... | @@ -1313,6 +1313,16 @@ test "cast f16 to wider types" { |
| 1313 | 1313 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 1314 | 1314 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1315 | 1315 | |
| 1316 | if (builtin.os.tag == .macos and builtin.zig_backend == .stage2_c) { | |
| 1317 | // TODO: test is failing | |
| 1318 | return error.SkipZigTest; | |
| 1319 | } | |
| 1320 | ||
| 1321 | if (builtin.os.tag == .windows and builtin.zig_backend == .stage2_c and builtin.cpu.arch == .aarch64) { | |
| 1322 | // TODO: test is failing | |
| 1323 | return error.SkipZigTest; | |
| 1324 | } | |
| 1325 | ||
| 1316 | 1326 | const S = struct { |
| 1317 | 1327 | fn doTheTest() !void { |
| 1318 | 1328 | var x: f16 = 1234.0; |
| ... | ... | @@ -1339,6 +1349,11 @@ test "cast f128 to narrower types" { |
| 1339 | 1349 | return error.SkipZigTest; |
| 1340 | 1350 | } |
| 1341 | 1351 | |
| 1352 | if (builtin.os.tag == .macos and builtin.zig_backend == .stage2_c) { | |
| 1353 | // TODO: test is failing | |
| 1354 | return error.SkipZigTest; | |
| 1355 | } | |
| 1356 | ||
| 1342 | 1357 | const S = struct { |
| 1343 | 1358 | fn doTheTest() !void { |
| 1344 | 1359 | var x: f128 = 1234.0; |
| ... | ... | @@ -1429,6 +1444,11 @@ test "coerce between pointers of compatible differently-named floats" { |
| 1429 | 1444 | return error.SkipZigTest; |
| 1430 | 1445 | } |
| 1431 | 1446 | |
| 1447 | if (builtin.os.tag == .macos and builtin.zig_backend == .stage2_c and builtin.cpu.arch == .aarch64) { | |
| 1448 | // TODO: test is failing | |
| 1449 | return error.SkipZigTest; | |
| 1450 | } | |
| 1451 | ||
| 1432 | 1452 | const F = switch (@typeInfo(c_longdouble).Float.bits) { |
| 1433 | 1453 | 16 => f16, |
| 1434 | 1454 | 32 => f32, |
test/behavior/floatop.zig+35| ... | ... | @@ -542,6 +542,11 @@ test "another, possibly redundant, @fabs test" { |
| 542 | 542 | return error.SkipZigTest; |
| 543 | 543 | } |
| 544 | 544 | |
| 545 | if (builtin.os.tag == .macos and builtin.zig_backend == .stage2_c) { | |
| 546 | // TODO: test is failing | |
| 547 | return error.SkipZigTest; | |
| 548 | } | |
| 549 | ||
| 545 | 550 | try testFabsLegacy(f128, 12.0); |
| 546 | 551 | comptime try testFabsLegacy(f128, 12.0); |
| 547 | 552 | try testFabsLegacy(f64, 12.0); |
| ... | ... | @@ -586,6 +591,11 @@ test "a third @fabs test, surely there should not be three fabs tests" { |
| 586 | 591 | return error.SkipZigTest; |
| 587 | 592 | } |
| 588 | 593 | |
| 594 | if (builtin.os.tag == .macos and builtin.zig_backend == .stage2_c) { | |
| 595 | // TODO: test is failing | |
| 596 | return error.SkipZigTest; | |
| 597 | } | |
| 598 | ||
| 589 | 599 | inline for ([_]type{ f16, f32, f64, f80, f128, c_longdouble }) |T| { |
| 590 | 600 | // normals |
| 591 | 601 | try expect(@fabs(@as(T, 1.0)) == 1.0); |
| ... | ... | @@ -688,6 +698,11 @@ test "@floor f128" { |
| 688 | 698 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 689 | 699 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| 690 | 700 | |
| 701 | if (builtin.os.tag == .macos and builtin.zig_backend == .stage2_c) { | |
| 702 | // TODO: test is failing | |
| 703 | return error.SkipZigTest; | |
| 704 | } | |
| 705 | ||
| 691 | 706 | try testFloorLegacy(f128, 12.0); |
| 692 | 707 | comptime try testFloorLegacy(f128, 12.0); |
| 693 | 708 | } |
| ... | ... | @@ -778,6 +793,11 @@ test "@ceil f128" { |
| 778 | 793 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 779 | 794 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| 780 | 795 | |
| 796 | if (builtin.os.tag == .macos and builtin.zig_backend == .stage2_c and builtin.cpu.arch == .x86_64) { | |
| 797 | // TODO: test is failing | |
| 798 | return error.SkipZigTest; | |
| 799 | } | |
| 800 | ||
| 781 | 801 | try testCeilLegacy(f128, 12.0); |
| 782 | 802 | comptime try testCeilLegacy(f128, 12.0); |
| 783 | 803 | } |
| ... | ... | @@ -874,6 +894,11 @@ test "@trunc f128" { |
| 874 | 894 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 875 | 895 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| 876 | 896 | |
| 897 | if (builtin.os.tag == .macos and builtin.zig_backend == .stage2_c) { | |
| 898 | // TODO: test is failing | |
| 899 | return error.SkipZigTest; | |
| 900 | } | |
| 901 | ||
| 877 | 902 | try testTruncLegacy(f128, 12.0); |
| 878 | 903 | comptime try testTruncLegacy(f128, 12.0); |
| 879 | 904 | } |
| ... | ... | @@ -992,6 +1017,11 @@ test "negation f128" { |
| 992 | 1017 | return error.SkipZigTest; |
| 993 | 1018 | } |
| 994 | 1019 | |
| 1020 | if (builtin.os.tag == .macos and builtin.zig_backend == .stage2_c) { | |
| 1021 | // TODO: test is failing | |
| 1022 | return error.SkipZigTest; | |
| 1023 | } | |
| 1024 | ||
| 995 | 1025 | const S = struct { |
| 996 | 1026 | fn doTheTest() !void { |
| 997 | 1027 | var a: f128 = 1; |
| ... | ... | @@ -1035,6 +1065,11 @@ test "comptime fixed-width float zero divided by zero produces NaN" { |
| 1035 | 1065 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1036 | 1066 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1037 | 1067 | |
| 1068 | if (builtin.os.tag == .macos and builtin.zig_backend == .stage2_c and builtin.cpu.arch == .x86_64) { | |
| 1069 | // TODO: test is failing | |
| 1070 | return error.SkipZigTest; | |
| 1071 | } | |
| 1072 | ||
| 1038 | 1073 | inline for (.{ f16, f32, f64, f80, f128 }) |F| { |
| 1039 | 1074 | try expect(math.isNan(@as(F, 0) / @as(F, 0))); |
| 1040 | 1075 | } |
test/behavior/math.zig+36| ... | ... | @@ -622,6 +622,11 @@ test "f128" { |
| 622 | 622 | return error.SkipZigTest; |
| 623 | 623 | } |
| 624 | 624 | |
| 625 | if (builtin.os.tag == .macos and builtin.zig_backend == .stage2_c) { | |
| 626 | // TODO: test is failing | |
| 627 | return error.SkipZigTest; | |
| 628 | } | |
| 629 | ||
| 625 | 630 | try test_f128(); |
| 626 | 631 | comptime try test_f128(); |
| 627 | 632 | } |
| ... | ... | @@ -1299,6 +1304,11 @@ test "remainder division" { |
| 1299 | 1304 | return error.SkipZigTest; |
| 1300 | 1305 | } |
| 1301 | 1306 | |
| 1307 | if (builtin.os.tag == .macos and builtin.zig_backend == .stage2_c) { | |
| 1308 | // TODO: test is failing | |
| 1309 | return error.SkipZigTest; | |
| 1310 | } | |
| 1311 | ||
| 1302 | 1312 | comptime try remdiv(f16); |
| 1303 | 1313 | comptime try remdiv(f32); |
| 1304 | 1314 | comptime try remdiv(f64); |
| ... | ... | @@ -1330,6 +1340,11 @@ test "float remainder division using @rem" { |
| 1330 | 1340 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1331 | 1341 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| 1332 | 1342 | |
| 1343 | if (builtin.os.tag == .macos and builtin.zig_backend == .stage2_c and builtin.cpu.arch == .x86_64) { | |
| 1344 | // TODO: test is failing | |
| 1345 | return error.SkipZigTest; | |
| 1346 | } | |
| 1347 | ||
| 1333 | 1348 | comptime try frem(f16); |
| 1334 | 1349 | comptime try frem(f32); |
| 1335 | 1350 | comptime try frem(f64); |
| ... | ... | @@ -1372,6 +1387,11 @@ test "float modulo division using @mod" { |
| 1372 | 1387 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| 1373 | 1388 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1374 | 1389 | |
| 1390 | if (builtin.os.tag == .macos and builtin.zig_backend == .stage2_c and builtin.cpu.arch == .x86_64) { | |
| 1391 | // TODO: test is failing | |
| 1392 | return error.SkipZigTest; | |
| 1393 | } | |
| 1394 | ||
| 1375 | 1395 | comptime try fmod(f16); |
| 1376 | 1396 | comptime try fmod(f32); |
| 1377 | 1397 | comptime try fmod(f64); |
| ... | ... | @@ -1445,6 +1465,11 @@ test "@round f128" { |
| 1445 | 1465 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| 1446 | 1466 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1447 | 1467 | |
| 1468 | if (builtin.os.tag == .macos and builtin.zig_backend == .stage2_c) { | |
| 1469 | // TODO: test is failing | |
| 1470 | return error.SkipZigTest; | |
| 1471 | } | |
| 1472 | ||
| 1448 | 1473 | try testRound(f128, 12.0); |
| 1449 | 1474 | comptime try testRound(f128, 12.0); |
| 1450 | 1475 | } |
| ... | ... | @@ -1490,6 +1515,11 @@ test "NaN comparison" { |
| 1490 | 1515 | return error.SkipZigTest; |
| 1491 | 1516 | } |
| 1492 | 1517 | |
| 1518 | if (builtin.os.tag == .macos and builtin.zig_backend == .stage2_c) { | |
| 1519 | // TODO: test is failing | |
| 1520 | return error.SkipZigTest; | |
| 1521 | } | |
| 1522 | ||
| 1493 | 1523 | try testNanEqNan(f16); |
| 1494 | 1524 | try testNanEqNan(f32); |
| 1495 | 1525 | try testNanEqNan(f64); |
| ... | ... | @@ -1562,6 +1592,12 @@ test "signed zeros are represented properly" { |
| 1562 | 1592 | if (builtin.os.tag == .windows and builtin.cpu.arch == .aarch64 and |
| 1563 | 1593 | builtin.zig_backend == .stage2_c) |
| 1564 | 1594 | { |
| 1595 | // TODO: test is failing | |
| 1596 | return error.SkipZigTest; | |
| 1597 | } | |
| 1598 | ||
| 1599 | if (builtin.os.tag == .macos and builtin.zig_backend == .stage2_c and builtin.cpu.arch == .aarch64) { | |
| 1600 | // TODO: test is failing | |
| 1565 | 1601 | return error.SkipZigTest; |
| 1566 | 1602 | } |
| 1567 | 1603 |
test/behavior/muladd.zig+10| ... | ... | @@ -75,6 +75,11 @@ test "@mulAdd f128" { |
| 75 | 75 | return error.SkipZigTest; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | if (builtin.os.tag == .macos and builtin.zig_backend == .stage2_c) { | |
| 79 | // TODO: test is failing | |
| 80 | return error.SkipZigTest; | |
| 81 | } | |
| 82 | ||
| 78 | 83 | comptime try testMulAdd128(); |
| 79 | 84 | try testMulAdd128(); |
| 80 | 85 | } |
| ... | ... | @@ -203,6 +208,11 @@ test "vector f128" { |
| 203 | 208 | return error.SkipZigTest; |
| 204 | 209 | } |
| 205 | 210 | |
| 211 | if (builtin.os.tag == .macos and builtin.zig_backend == .stage2_c and builtin.cpu.arch == .aarch64) { | |
| 212 | // TODO: test is failing | |
| 213 | return error.SkipZigTest; | |
| 214 | } | |
| 215 | ||
| 206 | 216 | comptime try vector128(); |
| 207 | 217 | try vector128(); |
| 208 | 218 | } |
test/behavior/vector.zig+5| ... | ... | @@ -103,6 +103,11 @@ test "vector float operators" { |
| 103 | 103 | return error.SkipZigTest; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | if (builtin.os.tag == .macos and builtin.zig_backend == .stage2_c) { | |
| 107 | // TODO: test is failing | |
| 108 | return error.SkipZigTest; | |
| 109 | } | |
| 110 | ||
| 106 | 111 | inline for ([_]type{ f16, f32, f64, f80, f128 }) |T| { |
| 107 | 112 | const S = struct { |
| 108 | 113 | fn doTheTest() !void { |
test/behavior/widening.zig+10| ... | ... | @@ -50,6 +50,11 @@ test "float widening" { |
| 50 | 50 | return error.SkipZigTest; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | if (builtin.os.tag == .macos and builtin.zig_backend == .stage2_c) { | |
| 54 | // TODO: test is failing | |
| 55 | return error.SkipZigTest; | |
| 56 | } | |
| 57 | ||
| 53 | 58 | var a: f16 = 12.34; |
| 54 | 59 | var b: f32 = a; |
| 55 | 60 | var c: f64 = b; |
| ... | ... | @@ -77,6 +82,11 @@ test "float widening f16 to f128" { |
| 77 | 82 | return error.SkipZigTest; |
| 78 | 83 | } |
| 79 | 84 | |
| 85 | if (builtin.os.tag == .macos and builtin.zig_backend == .stage2_c) { | |
| 86 | // TODO: test is failing | |
| 87 | return error.SkipZigTest; | |
| 88 | } | |
| 89 | ||
| 80 | 90 | var x: f16 = 12.34; |
| 81 | 91 | var y: f128 = x; |
| 82 | 92 | try expect(x == y); |
test/tests.zig+162-111| ... | ... | @@ -22,12 +22,12 @@ pub const CompareOutputContext = @import("src/CompareOutput.zig"); |
| 22 | 22 | pub const StackTracesContext = @import("src/StackTrace.zig"); |
| 23 | 23 | |
| 24 | 24 | const TestTarget = struct { |
| 25 | target: CrossTarget = @as(CrossTarget, .{}), | |
| 25 | target: CrossTarget = .{}, | |
| 26 | 26 | optimize_mode: std.builtin.OptimizeMode = .Debug, |
| 27 | link_libc: bool = false, | |
| 28 | single_threaded: bool = false, | |
| 29 | disable_native: bool = false, | |
| 30 | backend: ?std.builtin.CompilerBackend = null, | |
| 27 | link_libc: ?bool = null, | |
| 28 | single_threaded: ?bool = null, | |
| 29 | use_llvm: ?bool = null, | |
| 30 | use_lld: ?bool = null, | |
| 31 | 31 | }; |
| 32 | 32 | |
| 33 | 33 | const test_targets = blk: { |
| ... | ... | @@ -43,13 +43,47 @@ const test_targets = blk: { |
| 43 | 43 | .{ |
| 44 | 44 | .single_threaded = true, |
| 45 | 45 | }, |
| 46 | .{ | |
| 47 | .optimize_mode = .ReleaseFast, | |
| 48 | }, | |
| 49 | .{ | |
| 50 | .link_libc = true, | |
| 51 | .optimize_mode = .ReleaseFast, | |
| 52 | }, | |
| 53 | .{ | |
| 54 | .optimize_mode = .ReleaseFast, | |
| 55 | .single_threaded = true, | |
| 56 | }, | |
| 57 | ||
| 58 | .{ | |
| 59 | .optimize_mode = .ReleaseSafe, | |
| 60 | }, | |
| 61 | .{ | |
| 62 | .link_libc = true, | |
| 63 | .optimize_mode = .ReleaseSafe, | |
| 64 | }, | |
| 65 | .{ | |
| 66 | .optimize_mode = .ReleaseSafe, | |
| 67 | .single_threaded = true, | |
| 68 | }, | |
| 69 | ||
| 70 | .{ | |
| 71 | .optimize_mode = .ReleaseSmall, | |
| 72 | }, | |
| 73 | .{ | |
| 74 | .link_libc = true, | |
| 75 | .optimize_mode = .ReleaseSmall, | |
| 76 | }, | |
| 77 | .{ | |
| 78 | .optimize_mode = .ReleaseSmall, | |
| 79 | .single_threaded = true, | |
| 80 | }, | |
| 46 | 81 | |
| 47 | 82 | .{ |
| 48 | 83 | .target = .{ |
| 49 | 84 | .ofmt = .c, |
| 50 | 85 | }, |
| 51 | 86 | .link_libc = true, |
| 52 | .backend = .stage2_c, | |
| 53 | 87 | }, |
| 54 | 88 | .{ |
| 55 | 89 | .target = .{ |
| ... | ... | @@ -57,22 +91,24 @@ const test_targets = blk: { |
| 57 | 91 | .os_tag = .linux, |
| 58 | 92 | .abi = .none, |
| 59 | 93 | }, |
| 60 | .backend = .stage2_x86_64, | |
| 94 | .use_llvm = false, | |
| 95 | .use_lld = false, | |
| 61 | 96 | }, |
| 62 | 97 | .{ |
| 63 | 98 | .target = .{ |
| 64 | 99 | .cpu_arch = .aarch64, |
| 65 | 100 | .os_tag = .linux, |
| 66 | 101 | }, |
| 67 | .backend = .stage2_aarch64, | |
| 102 | .use_llvm = false, | |
| 103 | .use_lld = false, | |
| 68 | 104 | }, |
| 69 | 105 | .{ |
| 70 | 106 | .target = .{ |
| 71 | 107 | .cpu_arch = .wasm32, |
| 72 | 108 | .os_tag = .wasi, |
| 73 | 109 | }, |
| 74 | .single_threaded = true, | |
| 75 | .backend = .stage2_wasm, | |
| 110 | .use_llvm = false, | |
| 111 | .use_lld = false, | |
| 76 | 112 | }, |
| 77 | 113 | // https://github.com/ziglang/zig/issues/13623 |
| 78 | 114 | //.{ |
| ... | ... | @@ -80,7 +116,8 @@ const test_targets = blk: { |
| 80 | 116 | // .cpu_arch = .arm, |
| 81 | 117 | // .os_tag = .linux, |
| 82 | 118 | // }, |
| 83 | // .backend = .stage2_arm, | |
| 119 | // .use_llvm = false, | |
| 120 | // .use_lld = false, | |
| 84 | 121 | //}, |
| 85 | 122 | // https://github.com/ziglang/zig/issues/13623 |
| 86 | 123 | //.{ |
| ... | ... | @@ -88,7 +125,8 @@ const test_targets = blk: { |
| 88 | 125 | // .arch_os_abi = "arm-linux-none", |
| 89 | 126 | // .cpu_features = "generic+v8a", |
| 90 | 127 | // }) catch unreachable, |
| 91 | // .backend = .stage2_arm, | |
| 128 | // .use_llvm = false, | |
| 129 | // .use_lld = false, | |
| 92 | 130 | //}, |
| 93 | 131 | .{ |
| 94 | 132 | .target = .{ |
| ... | ... | @@ -96,7 +134,8 @@ const test_targets = blk: { |
| 96 | 134 | .os_tag = .macos, |
| 97 | 135 | .abi = .none, |
| 98 | 136 | }, |
| 99 | .backend = .stage2_aarch64, | |
| 137 | .use_llvm = false, | |
| 138 | .use_lld = false, | |
| 100 | 139 | }, |
| 101 | 140 | .{ |
| 102 | 141 | .target = .{ |
| ... | ... | @@ -104,7 +143,8 @@ const test_targets = blk: { |
| 104 | 143 | .os_tag = .macos, |
| 105 | 144 | .abi = .none, |
| 106 | 145 | }, |
| 107 | .backend = .stage2_x86_64, | |
| 146 | .use_llvm = false, | |
| 147 | .use_lld = false, | |
| 108 | 148 | }, |
| 109 | 149 | .{ |
| 110 | 150 | .target = .{ |
| ... | ... | @@ -112,7 +152,8 @@ const test_targets = blk: { |
| 112 | 152 | .os_tag = .windows, |
| 113 | 153 | .abi = .gnu, |
| 114 | 154 | }, |
| 115 | .backend = .stage2_x86_64, | |
| 155 | .use_llvm = false, | |
| 156 | .use_lld = false, | |
| 116 | 157 | }, |
| 117 | 158 | |
| 118 | 159 | .{ |
| ... | ... | @@ -121,7 +162,6 @@ const test_targets = blk: { |
| 121 | 162 | .os_tag = .wasi, |
| 122 | 163 | }, |
| 123 | 164 | .link_libc = false, |
| 124 | .single_threaded = true, | |
| 125 | 165 | }, |
| 126 | 166 | .{ |
| 127 | 167 | .target = .{ |
| ... | ... | @@ -129,7 +169,6 @@ const test_targets = blk: { |
| 129 | 169 | .os_tag = .wasi, |
| 130 | 170 | }, |
| 131 | 171 | .link_libc = true, |
| 132 | .single_threaded = true, | |
| 133 | 172 | }, |
| 134 | 173 | |
| 135 | 174 | .{ |
| ... | ... | @@ -413,43 +452,6 @@ const test_targets = blk: { |
| 413 | 452 | }, |
| 414 | 453 | .link_libc = true, |
| 415 | 454 | }, |
| 416 | ||
| 417 | // Do the release tests last because they take a long time | |
| 418 | .{ | |
| 419 | .optimize_mode = .ReleaseFast, | |
| 420 | }, | |
| 421 | .{ | |
| 422 | .link_libc = true, | |
| 423 | .optimize_mode = .ReleaseFast, | |
| 424 | }, | |
| 425 | .{ | |
| 426 | .optimize_mode = .ReleaseFast, | |
| 427 | .single_threaded = true, | |
| 428 | }, | |
| 429 | ||
| 430 | .{ | |
| 431 | .optimize_mode = .ReleaseSafe, | |
| 432 | }, | |
| 433 | .{ | |
| 434 | .link_libc = true, | |
| 435 | .optimize_mode = .ReleaseSafe, | |
| 436 | }, | |
| 437 | .{ | |
| 438 | .optimize_mode = .ReleaseSafe, | |
| 439 | .single_threaded = true, | |
| 440 | }, | |
| 441 | ||
| 442 | .{ | |
| 443 | .optimize_mode = .ReleaseSmall, | |
| 444 | }, | |
| 445 | .{ | |
| 446 | .link_libc = true, | |
| 447 | .optimize_mode = .ReleaseSmall, | |
| 448 | }, | |
| 449 | .{ | |
| 450 | .optimize_mode = .ReleaseSmall, | |
| 451 | .single_threaded = true, | |
| 452 | }, | |
| 453 | 455 | }; |
| 454 | 456 | }; |
| 455 | 457 | |
| ... | ... | @@ -913,8 +915,6 @@ const ModuleTestOptions = struct { |
| 913 | 915 | skip_non_native: bool, |
| 914 | 916 | skip_cross_glibc: bool, |
| 915 | 917 | skip_libc: bool, |
| 916 | skip_stage1: bool, | |
| 917 | skip_stage2: bool, | |
| 918 | 918 | max_rss: usize = 0, |
| 919 | 919 | }; |
| 920 | 920 | |
| ... | ... | @@ -922,49 +922,65 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { |
| 922 | 922 | const step = b.step(b.fmt("test-{s}", .{options.name}), options.desc); |
| 923 | 923 | |
| 924 | 924 | for (test_targets) |test_target| { |
| 925 | if (options.skip_non_native and !test_target.target.isNative()) | |
| 925 | const is_native = test_target.target.isNative() or | |
| 926 | (test_target.target.getOsTag() == builtin.os.tag and | |
| 927 | test_target.target.getCpuArch() == builtin.cpu.arch); | |
| 928 | ||
| 929 | if (options.skip_non_native and !is_native) | |
| 926 | 930 | continue; |
| 927 | 931 | |
| 928 | if (options.skip_cross_glibc and test_target.target.isGnuLibC() and test_target.link_libc) | |
| 932 | if (options.skip_cross_glibc and test_target.target.isGnuLibC() and test_target.link_libc == true) | |
| 929 | 933 | continue; |
| 930 | 934 | |
| 931 | if (options.skip_libc and test_target.link_libc) | |
| 935 | if (options.skip_libc and test_target.link_libc == true) | |
| 932 | 936 | continue; |
| 933 | 937 | |
| 934 | if (test_target.link_libc and test_target.target.getOs().requiresLibC()) { | |
| 935 | // This would be a redundant test. | |
| 938 | if (options.skip_single_threaded and test_target.single_threaded == true) | |
| 936 | 939 | continue; |
| 937 | } | |
| 938 | 940 | |
| 939 | if (options.skip_single_threaded and test_target.single_threaded) | |
| 941 | // TODO get compiler-rt tests passing for self-hosted backends. | |
| 942 | if (test_target.use_llvm == false and mem.eql(u8, options.name, "compiler-rt")) | |
| 940 | 943 | continue; |
| 941 | 944 | |
| 942 | if (test_target.disable_native and | |
| 943 | test_target.target.getOsTag() == builtin.os.tag and | |
| 944 | test_target.target.getCpuArch() == builtin.cpu.arch) | |
| 945 | // TODO get the x86_64 self-hosted backend tests passing on Windows | |
| 946 | if (test_target.target.getCpuArch() == .x86_64 and | |
| 947 | test_target.target.getOsTag() == .windows and | |
| 948 | test_target.use_llvm == false) | |
| 945 | 949 | { |
| 946 | 950 | continue; |
| 947 | 951 | } |
| 948 | 952 | |
| 949 | if (test_target.backend) |backend| switch (backend) { | |
| 950 | .stage1 => if (options.skip_stage1) continue, | |
| 951 | .stage2_llvm => {}, | |
| 952 | else => if (options.skip_stage2) continue, | |
| 953 | }; | |
| 953 | // TODO get compiler-rt tests passing for wasm32-wasi | |
| 954 | // currently causes "LLVM ERROR: Unable to expand fixed point multiplication." | |
| 955 | if (test_target.target.getCpuArch() == .wasm32 and | |
| 956 | test_target.target.getOsTag() == .wasi and | |
| 957 | mem.eql(u8, options.name, "compiler-rt")) | |
| 958 | { | |
| 959 | continue; | |
| 960 | } | |
| 961 | ||
| 962 | // TODO get universal-libc tests passing for self-hosted backends. | |
| 963 | if (test_target.use_llvm == false and mem.eql(u8, options.name, "universal-libc")) | |
| 964 | continue; | |
| 965 | ||
| 966 | // TODO get std lib tests passing for self-hosted backends. | |
| 967 | if (test_target.use_llvm == false and mem.eql(u8, options.name, "std")) | |
| 968 | continue; | |
| 969 | ||
| 970 | // TODO get std lib tests passing for the C backend | |
| 971 | if (test_target.target.ofmt == std.Target.ObjectFormat.c and | |
| 972 | mem.eql(u8, options.name, "std")) | |
| 973 | { | |
| 974 | continue; | |
| 975 | } | |
| 954 | 976 | |
| 955 | 977 | const want_this_mode = for (options.optimize_modes) |m| { |
| 956 | 978 | if (m == test_target.optimize_mode) break true; |
| 957 | 979 | } else false; |
| 958 | 980 | if (!want_this_mode) continue; |
| 959 | 981 | |
| 960 | const libc_prefix = if (test_target.target.getOs().requiresLibC()) | |
| 961 | "" | |
| 962 | else if (test_target.link_libc) | |
| 963 | "c" | |
| 964 | else | |
| 965 | "bare"; | |
| 966 | ||
| 967 | const triple_prefix = test_target.target.zigTriple(b.allocator) catch @panic("OOM"); | |
| 982 | const libc_suffix = if (test_target.link_libc == true) "-libc" else ""; | |
| 983 | const triple_txt = test_target.target.zigTriple(b.allocator) catch @panic("OOM"); | |
| 968 | 984 | |
| 969 | 985 | // wasm32-wasi builds need more RAM, idk why |
| 970 | 986 | const max_rss = if (test_target.target.getOs().tag == .wasi) |
| ... | ... | @@ -978,45 +994,80 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { |
| 978 | 994 | .target = test_target.target, |
| 979 | 995 | .max_rss = max_rss, |
| 980 | 996 | .filter = options.test_filter, |
| 997 | .link_libc = test_target.link_libc, | |
| 998 | .single_threaded = test_target.single_threaded, | |
| 999 | .use_llvm = test_target.use_llvm, | |
| 1000 | .use_lld = test_target.use_lld, | |
| 981 | 1001 | }); |
| 982 | const single_threaded_txt = if (test_target.single_threaded) "single" else "multi"; | |
| 983 | const backend_txt = if (test_target.backend) |backend| @tagName(backend) else "default"; | |
| 984 | these_tests.single_threaded = test_target.single_threaded; | |
| 985 | if (test_target.link_libc) { | |
| 986 | these_tests.linkSystemLibrary("c"); | |
| 987 | } | |
| 1002 | const single_threaded_suffix = if (test_target.single_threaded == true) "-single" else ""; | |
| 1003 | const backend_suffix = if (test_target.use_llvm == true) | |
| 1004 | "-llvm" | |
| 1005 | else if (test_target.target.ofmt == std.Target.ObjectFormat.c) | |
| 1006 | "-cbe" | |
| 1007 | else if (test_target.use_llvm == false) | |
| 1008 | "-selfhosted" | |
| 1009 | else | |
| 1010 | ""; | |
| 1011 | ||
| 988 | 1012 | these_tests.overrideZigLibDir("lib"); |
| 989 | 1013 | these_tests.addIncludePath("test"); |
| 990 | if (test_target.backend) |backend| switch (backend) { | |
| 991 | .stage1 => { | |
| 992 | @panic("stage1 testing requested"); | |
| 993 | }, | |
| 994 | .stage2_llvm => { | |
| 995 | these_tests.use_llvm = true; | |
| 996 | }, | |
| 997 | .stage2_c => { | |
| 998 | these_tests.use_llvm = false; | |
| 999 | }, | |
| 1000 | else => { | |
| 1001 | these_tests.use_llvm = false; | |
| 1002 | // TODO: force self-hosted linkers to avoid LLD creeping in | |
| 1003 | // until the auto-select mechanism deems them worthy | |
| 1004 | these_tests.use_lld = false; | |
| 1005 | }, | |
| 1006 | }; | |
| 1007 | 1014 | |
| 1008 | const run = b.addRunArtifact(these_tests); | |
| 1009 | run.skip_foreign_checks = true; | |
| 1010 | run.setName(b.fmt("run test {s}-{s}-{s}-{s}-{s}-{s}", .{ | |
| 1015 | const qualified_name = b.fmt("{s}-{s}-{s}{s}{s}{s}", .{ | |
| 1011 | 1016 | options.name, |
| 1012 | triple_prefix, | |
| 1017 | triple_txt, | |
| 1013 | 1018 | @tagName(test_target.optimize_mode), |
| 1014 | libc_prefix, | |
| 1015 | single_threaded_txt, | |
| 1016 | backend_txt, | |
| 1017 | })); | |
| 1019 | libc_suffix, | |
| 1020 | single_threaded_suffix, | |
| 1021 | backend_suffix, | |
| 1022 | }); | |
| 1023 | ||
| 1024 | if (test_target.target.ofmt == std.Target.ObjectFormat.c) { | |
| 1025 | var altered_target = test_target.target; | |
| 1026 | altered_target.ofmt = null; | |
| 1018 | 1027 | |
| 1019 | step.dependOn(&run.step); | |
| 1028 | const compile_c = b.addExecutable(.{ | |
| 1029 | .name = qualified_name, | |
| 1030 | .link_libc = test_target.link_libc, | |
| 1031 | .target = altered_target, | |
| 1032 | }); | |
| 1033 | compile_c.overrideZigLibDir("lib"); | |
| 1034 | compile_c.addCSourceFileSource(.{ | |
| 1035 | .source = these_tests.getOutputSource(), | |
| 1036 | .args = &.{ | |
| 1037 | // TODO output -std=c89 compatible C code | |
| 1038 | "-std=c99", | |
| 1039 | "-pedantic", | |
| 1040 | "-Werror", | |
| 1041 | // TODO stop violating these pedantic errors. spotted on linux | |
| 1042 | "-Wno-address-of-packed-member", | |
| 1043 | "-Wno-gnu-folding-constant", | |
| 1044 | "-Wno-incompatible-pointer-types", | |
| 1045 | "-Wno-overlength-strings", | |
| 1046 | // TODO stop violating these pedantic errors. spotted on darwin | |
| 1047 | "-Wno-dollar-in-identifier-extension", | |
| 1048 | "-Wno-absolute-value", | |
| 1049 | }, | |
| 1050 | }); | |
| 1051 | compile_c.addIncludePath("lib"); // for zig.h | |
| 1052 | if (test_target.link_libc == false and test_target.target.getOsTag() == .windows) { | |
| 1053 | compile_c.subsystem = .Console; | |
| 1054 | compile_c.linkSystemLibrary("kernel32"); | |
| 1055 | compile_c.linkSystemLibrary("ntdll"); | |
| 1056 | } | |
| 1057 | ||
| 1058 | const run = b.addRunArtifact(compile_c); | |
| 1059 | run.skip_foreign_checks = true; | |
| 1060 | run.enableTestRunnerMode(); | |
| 1061 | run.setName(b.fmt("run test {s}", .{qualified_name})); | |
| 1062 | ||
| 1063 | step.dependOn(&run.step); | |
| 1064 | } else { | |
| 1065 | const run = b.addRunArtifact(these_tests); | |
| 1066 | run.skip_foreign_checks = true; | |
| 1067 | run.setName(b.fmt("run test {s}", .{qualified_name})); | |
| 1068 | ||
| 1069 | step.dependOn(&run.step); | |
| 1070 | } | |
| 1020 | 1071 | } |
| 1021 | 1072 | return step; |
| 1022 | 1073 | } |