diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-02-25 16:30:40 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-02-25 16:30:40 -0500 |
| commit | f33bf48af7d9c99d532864f8a6c3f695ad5bbd21 (patch) | |
| tree | fa39bd6b654178e653d06e1c79f22ad1d29cd526 /test/tests.zig | |
| parent | 64365bc5d7b1e2c507806ee8976acc3479ad7862 (diff) | |
| parent | 416a547cdb8dbbf3d2e7ce32132f0a25f2a8607e (diff) | |
| download | zig-f33bf48af7d9c99d532864f8a6c3f695ad5bbd21.tar.gz zig-f33bf48af7d9c99d532864f8a6c3f695ad5bbd21.zip | |
Merge remote-tracking branch 'origin/master' into llvm10
Diffstat (limited to 'test/tests.zig')
| -rw-r--r-- | test/tests.zig | 89 |
1 files changed, 32 insertions, 57 deletions
diff --git a/test/tests.zig b/test/tests.zig index 8fef5b1ff2..266c02e5a8 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -55,20 +55,18 @@ const test_targets = blk: { TestTarget{ .target = Target{ .Cross = CrossTarget{ + .cpu = Target.Cpu.baseline(.x86_64), .os = .linux, - .arch = .x86_64, .abi = .none, - .cpu_features = Target.Arch.x86_64.getBaselineCpuFeatures(), }, }, }, TestTarget{ .target = Target{ .Cross = CrossTarget{ + .cpu = Target.Cpu.baseline(.x86_64), .os = .linux, - .arch = .x86_64, .abi = .gnu, - .cpu_features = Target.Arch.x86_64.getBaselineCpuFeatures(), }, }, .link_libc = true, @@ -76,9 +74,8 @@ const test_targets = blk: { TestTarget{ .target = Target{ .Cross = CrossTarget{ + .cpu = Target.Cpu.baseline(.x86_64), .os = .linux, - .arch = .x86_64, - .cpu_features = Target.Arch.x86_64.getBaselineCpuFeatures(), .abi = .musl, }, }, @@ -88,9 +85,8 @@ const test_targets = blk: { TestTarget{ .target = Target{ .Cross = CrossTarget{ + .cpu = Target.Cpu.baseline(.i386), .os = .linux, - .arch = .i386, - .cpu_features = Target.Arch.i386.getBaselineCpuFeatures(), .abi = .none, }, }, @@ -98,9 +94,8 @@ const test_targets = blk: { TestTarget{ .target = Target{ .Cross = CrossTarget{ + .cpu = Target.Cpu.baseline(.i386), .os = .linux, - .arch = .i386, - .cpu_features = Target.Arch.i386.getBaselineCpuFeatures(), .abi = .musl, }, }, @@ -110,9 +105,8 @@ const test_targets = blk: { TestTarget{ .target = Target{ .Cross = CrossTarget{ + .cpu = Target.Cpu.baseline(.aarch64), .os = .linux, - .arch = Target.Arch{ .aarch64 = .v8a }, - .cpu_features = (Target.Arch{ .aarch64 = .v8a }).getBaselineCpuFeatures(), .abi = .none, }, }, @@ -120,9 +114,8 @@ const test_targets = blk: { TestTarget{ .target = Target{ .Cross = CrossTarget{ + .cpu = Target.Cpu.baseline(.aarch64), .os = .linux, - .arch = Target.Arch{ .aarch64 = .v8a }, - .cpu_features = (Target.Arch{ .aarch64 = .v8a }).getBaselineCpuFeatures(), .abi = .musl, }, }, @@ -131,9 +124,8 @@ const test_targets = blk: { TestTarget{ .target = Target{ .Cross = CrossTarget{ + .cpu = Target.Cpu.baseline(.aarch64), .os = .linux, - .arch = Target.Arch{ .aarch64 = .v8a }, - .cpu_features = (Target.Arch{ .aarch64 = .v8a }).getBaselineCpuFeatures(), .abi = .gnu, }, }, @@ -141,45 +133,32 @@ const test_targets = blk: { }, TestTarget{ - .target = Target{ - .Cross = CrossTarget{ - .os = .linux, - .arch = Target.Arch{ .arm = .v8a }, - .cpu_features = (Target.Arch{ .arm = .v8a }).getBaselineCpuFeatures(), - .abi = .none, - }, - }, + .target = Target.parse(.{ + .arch_os_abi = "arm-linux-none", + .cpu_features = "generic+v8a", + }) catch unreachable, }, TestTarget{ - .target = Target{ - .Cross = CrossTarget{ - .os = .linux, - .arch = Target.Arch{ .arm = .v8a }, - .cpu_features = (Target.Arch{ .arm = .v8a }).getBaselineCpuFeatures(), - .abi = .musleabihf, - }, - }, + .target = Target.parse(.{ + .arch_os_abi = "arm-linux-musleabihf", + .cpu_features = "generic+v8a", + }) catch unreachable, .link_libc = true, }, // TODO https://github.com/ziglang/zig/issues/3287 //TestTarget{ - // .target = Target{ - // .Cross = CrossTarget{ - // .os = .linux, - // .arch = Target.Arch{ .arm = .v8a }, - // .cpu_features = (Target.Arch{ .arm = .v8a }).getBaselineCpuFeatures(), - // .abi = .gnueabihf, - // }, - // }, + // .target = Target.parse(.{ + // .arch_os_abi = "arm-linux-gnueabihf", + // .cpu_features = "generic+v8a", + // }) catch unreachable, // .link_libc = true, //}, TestTarget{ .target = Target{ .Cross = CrossTarget{ + .cpu = Target.Cpu.baseline(.mipsel), .os = .linux, - .arch = .mipsel, - .cpu_features = Target.Arch.mipsel.getBaselineCpuFeatures(), .abi = .none, }, }, @@ -187,9 +166,8 @@ const test_targets = blk: { TestTarget{ .target = Target{ .Cross = CrossTarget{ + .cpu = Target.Cpu.baseline(.mipsel), .os = .linux, - .arch = .mipsel, - .cpu_features = Target.Arch.mipsel.getBaselineCpuFeatures(), .abi = .musl, }, }, @@ -236,9 +214,8 @@ const test_targets = blk: { TestTarget{ .target = Target{ .Cross = CrossTarget{ + .cpu = Target.Cpu.baseline(.x86_64), .os = .macosx, - .arch = .x86_64, - .cpu_features = Target.Arch.x86_64.getBaselineCpuFeatures(), .abi = .gnu, }, }, @@ -249,9 +226,8 @@ const test_targets = blk: { TestTarget{ .target = Target{ .Cross = CrossTarget{ + .cpu = Target.Cpu.baseline(.i386), .os = .windows, - .arch = .i386, - .cpu_features = Target.Arch.i386.getBaselineCpuFeatures(), .abi = .msvc, }, }, @@ -260,9 +236,8 @@ const test_targets = blk: { TestTarget{ .target = Target{ .Cross = CrossTarget{ + .cpu = Target.Cpu.baseline(.x86_64), .os = .windows, - .arch = .x86_64, - .cpu_features = Target.Arch.x86_64.getBaselineCpuFeatures(), .abi = .msvc, }, }, @@ -271,9 +246,8 @@ const test_targets = blk: { TestTarget{ .target = Target{ .Cross = CrossTarget{ + .cpu = Target.Cpu.baseline(.i386), .os = .windows, - .arch = .i386, - .cpu_features = Target.Arch.i386.getBaselineCpuFeatures(), .abi = .gnu, }, }, @@ -283,9 +257,8 @@ const test_targets = blk: { TestTarget{ .target = Target{ .Cross = CrossTarget{ + .cpu = Target.Cpu.baseline(.x86_64), .os = .windows, - .arch = .x86_64, - .cpu_features = Target.Arch.x86_64.getBaselineCpuFeatures(), .abi = .gnu, }, }, @@ -513,7 +486,7 @@ pub fn addPkgTests( const ArchTag = @TagType(builtin.Arch); if (test_target.disable_native and test_target.target.getOs() == builtin.os and - @as(ArchTag, test_target.target.getArch()) == @as(ArchTag, builtin.arch)) + test_target.target.getArch() == builtin.arch) { continue; } @@ -714,8 +687,10 @@ pub const StackTracesContext = struct { const got: []const u8 = got_result: { var buf = try Buffer.initSize(b.allocator, 0); defer buf.deinit(); - var bytes = stderr.toSliceConst(); - if (bytes.len != 0 and bytes[bytes.len - 1] == '\n') bytes = bytes[0 .. bytes.len - 1]; + const bytes = if (stderr.endsWith("\n")) + stderr.toSliceConst()[0 .. stderr.len() - 1] + else + stderr.toSliceConst()[0..stderr.len()]; var it = mem.separate(bytes, "\n"); process_lines: while (it.next()) |line| { if (line.len == 0) continue; |
