authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-05-02 21:34:34-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-05-02 21:34:34-04:00
log02c1b9df3bcf2e0324adf02fd6c0ed56fe58c6d3
treeea5605110789b468d204b6c44c9d393c1855d61d
parentc186cd187e9b75ee1514a5f3371abeffb36d871a

fix compiler-rt tests accidentally running std tests

also reduce the aggressiveness of std.atomic.stack and std.atomic.queue fuzz testing. appveyor has 1 core and 10,000 iterations is too much for 6 threads to thrash over

15 files changed, 56 insertions(+), 36 deletions(-)

std/atomic/queue.zig+8-2
......@@ -49,14 +49,20 @@ const Context = struct {
4949 get_count: usize,
5050 puts_done: u8, // TODO make this a bool
5151};
52const puts_per_thread = 10000;
52
53// TODO add lazy evaluated build options and then put puts_per_thread behind
54// some option such as: "AggressiveMultithreadedFuzzTest". In the AppVeyor
55// CI we would use a less aggressive setting since at 1 core, while we still
56// want this test to pass, we need a smaller value since there is so much thrashing
57// we would also use a less aggressive setting when running in valgrind
58const puts_per_thread = 500;
5359const put_thread_count = 3;
5460
5561test "std.atomic.queue" {
5662 var direct_allocator = std.heap.DirectAllocator.init();
5763 defer direct_allocator.deinit();
5864
59 var plenty_of_memory = try direct_allocator.allocator.alloc(u8, 600 * 1024);
65 var plenty_of_memory = try direct_allocator.allocator.alloc(u8, 300 * 1024);
6066 defer direct_allocator.allocator.free(plenty_of_memory);
6167
6268 var fixed_buffer_allocator = std.heap.ThreadSafeFixedBufferAllocator.init(plenty_of_memory);
std/atomic/stack.zig+7-2
......@@ -56,14 +56,19 @@ const Context = struct {
5656 get_count: usize,
5757 puts_done: u8, // TODO make this a bool
5858};
59const puts_per_thread = 1000;
59// TODO add lazy evaluated build options and then put puts_per_thread behind
60// some option such as: "AggressiveMultithreadedFuzzTest". In the AppVeyor
61// CI we would use a less aggressive setting since at 1 core, while we still
62// want this test to pass, we need a smaller value since there is so much thrashing
63// we would also use a less aggressive setting when running in valgrind
64const puts_per_thread = 500;
6065const put_thread_count = 3;
6166
6267test "std.atomic.stack" {
6368 var direct_allocator = std.heap.DirectAllocator.init();
6469 defer direct_allocator.deinit();
6570
66 var plenty_of_memory = try direct_allocator.allocator.alloc(u8, 600 * 1024);
71 var plenty_of_memory = try direct_allocator.allocator.alloc(u8, 300 * 1024);
6772 defer direct_allocator.allocator.free(plenty_of_memory);
6873
6974 var fixed_buffer_allocator = std.heap.ThreadSafeFixedBufferAllocator.init(plenty_of_memory);
std/special/compiler_rt/fixuint.zig+1-1
......@@ -1,5 +1,5 @@
11const is_test = @import("builtin").is_test;
2const Log2Int = @import("../../math/index.zig").Log2Int;
2const Log2Int = @import("std").math.Log2Int;
33
44pub fn fixuint(comptime fp_t: type, comptime fixuint_t: type, a: fp_t) fixuint_t {
55 @setRuntimeSafety(is_test);
std/special/compiler_rt/fixunsdfdi_test.zig+1-1
......@@ -1,5 +1,5 @@
11const __fixunsdfdi = @import("fixunsdfdi.zig").__fixunsdfdi;
2const assert = @import("../../index.zig").debug.assert;
2const assert = @import("std").debug.assert;
33
44fn test__fixunsdfdi(a: f64, expected: u64) void {
55 const x = __fixunsdfdi(a);
std/special/compiler_rt/fixunsdfsi_test.zig+1-1
......@@ -1,5 +1,5 @@
11const __fixunsdfsi = @import("fixunsdfsi.zig").__fixunsdfsi;
2const assert = @import("../../index.zig").debug.assert;
2const assert = @import("std").debug.assert;
33
44fn test__fixunsdfsi(a: f64, expected: u32) void {
55 const x = __fixunsdfsi(a);
std/special/compiler_rt/fixunsdfti_test.zig+1-1
......@@ -1,5 +1,5 @@
11const __fixunsdfti = @import("fixunsdfti.zig").__fixunsdfti;
2const assert = @import("../../index.zig").debug.assert;
2const assert = @import("std").debug.assert;
33
44fn test__fixunsdfti(a: f64, expected: u128) void {
55 const x = __fixunsdfti(a);
std/special/compiler_rt/fixunssfdi_test.zig+1-1
......@@ -1,5 +1,5 @@
11const __fixunssfdi = @import("fixunssfdi.zig").__fixunssfdi;
2const assert = @import("../../index.zig").debug.assert;
2const assert = @import("std").debug.assert;
33
44fn test__fixunssfdi(a: f32, expected: u64) void {
55 const x = __fixunssfdi(a);
std/special/compiler_rt/fixunssfsi_test.zig+1-1
......@@ -1,5 +1,5 @@
11const __fixunssfsi = @import("fixunssfsi.zig").__fixunssfsi;
2const assert = @import("../../index.zig").debug.assert;
2const assert = @import("std").debug.assert;
33
44fn test__fixunssfsi(a: f32, expected: u32) void {
55 const x = __fixunssfsi(a);
std/special/compiler_rt/fixunssfti_test.zig+1-1
......@@ -1,5 +1,5 @@
11const __fixunssfti = @import("fixunssfti.zig").__fixunssfti;
2const assert = @import("../../index.zig").debug.assert;
2const assert = @import("std").debug.assert;
33
44fn test__fixunssfti(a: f32, expected: u128) void {
55 const x = __fixunssfti(a);
std/special/compiler_rt/fixunstfdi_test.zig+1-1
......@@ -1,5 +1,5 @@
11const __fixunstfdi = @import("fixunstfdi.zig").__fixunstfdi;
2const assert = @import("../../index.zig").debug.assert;
2const assert = @import("std").debug.assert;
33
44fn test__fixunstfdi(a: f128, expected: u64) void {
55 const x = __fixunstfdi(a);
std/special/compiler_rt/fixunstfsi_test.zig+1-1
......@@ -1,5 +1,5 @@
11const __fixunstfsi = @import("fixunstfsi.zig").__fixunstfsi;
2const assert = @import("../../index.zig").debug.assert;
2const assert = @import("std").debug.assert;
33
44fn test__fixunstfsi(a: f128, expected: u32) void {
55 const x = __fixunstfsi(a);
std/special/compiler_rt/fixunstfti_test.zig+1-1
......@@ -1,5 +1,5 @@
11const __fixunstfti = @import("fixunstfti.zig").__fixunstfti;
2const assert = @import("../../index.zig").debug.assert;
2const assert = @import("std").debug.assert;
33
44fn test__fixunstfti(a: f128, expected: u128) void {
55 const x = __fixunstfti(a);
std/special/compiler_rt/index.zig+3-2
......@@ -71,7 +71,8 @@ comptime {
7171 }
7272}
7373
74const assert = @import("../../index.zig").debug.assert;
74const std = @import("std");
75const assert = std.debug.assert;
7576
7677const __udivmoddi4 = @import("udivmoddi4.zig").__udivmoddi4;
7778
......@@ -80,7 +81,7 @@ const __udivmoddi4 = @import("udivmoddi4.zig").__udivmoddi4;
8081pub fn panic(msg: []const u8, error_return_trace: ?&builtin.StackTrace) noreturn {
8182 @setCold(true);
8283 if (is_test) {
83 @import("std").debug.panic("{}", msg);
84 std.debug.panic("{}", msg);
8485 } else {
8586 unreachable;
8687 }
std/special/compiler_rt/udivmod.zig+1-1
......@@ -9,7 +9,7 @@ pub fn udivmod(comptime DoubleInt: type, a: DoubleInt, b: DoubleInt, maybe_rem:
99
1010 const SingleInt = @IntType(false, @divExact(DoubleInt.bit_count, 2));
1111 const SignedDoubleInt = @IntType(true, DoubleInt.bit_count);
12 const Log2SingleInt = @import("../../math/index.zig").Log2Int(SingleInt);
12 const Log2SingleInt = @import("std").math.Log2Int(SingleInt);
1313
1414 const n = *@ptrCast(&const [2]SingleInt, &a); // TODO issue #421
1515 const d = *@ptrCast(&const [2]SingleInt, &b); // TODO issue #421
std/zig/parser_test.zig+27-19
......@@ -1,3 +1,30 @@
1// TODO
2//if (sr > n_uword_bits - 1) // d > r
3// return 0;
4
5// TODO switch with no body
6// format(&size, error{}, countSize, fmt, args) catch |err| switch (err) {};
7
8
9//TODO
10//test "zig fmt: same-line comptime" {
11// try testCanonical(
12// \\test "" {
13// \\ comptime assert(@typeId(T) == builtin.TypeId.Int); // must pass an integer to absInt
14// \\}
15// \\
16// );
17//}
18
19
20//TODO
21//test "zig fmt: number literals" {
22// try testCanonical(
23// \\pub const f64_true_min = 4.94065645841246544177e-324;
24// \\
25// );
26//}
27
128test "zig fmt: line comments in struct initializer" {
229 try testCanonical(
330 \\fn foo() void {
......@@ -20,25 +47,6 @@ test "zig fmt: line comments in struct initializer" {
2047 );
2148}
2249
23//TODO
24//test "zig fmt: same-line comptime" {
25// try testCanonical(
26// \\test "" {
27// \\ comptime assert(@typeId(T) == builtin.TypeId.Int); // must pass an integer to absInt
28// \\}
29// \\
30// );
31//}
32
33
34//TODO
35//test "zig fmt: number literals" {
36// try testCanonical(
37// \\pub const f64_true_min = 4.94065645841246544177e-324;
38// \\
39// );
40//}
41
4250test "zig fmt: doc comments before struct field" {
4351 try testCanonical(
4452 \\pub const Allocator = struct {