Skip to content

Commit 02c1b9d

Browse files
committedMay 3, 2018
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
·
0.15.20.3.0
1 parent c186cd1 commit 02c1b9d

15 files changed

+56
-36
lines changed
 

‎std/atomic/queue.zig‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,20 @@ const Context = struct {
4949
get_count: usize,
5050
puts_done: u8, // TODO make this a bool
5151
};
52-
const 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
58+
const puts_per_thread = 500;
5359
const put_thread_count = 3;
5460

5561
test "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‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,19 @@ const Context = struct {
5656
get_count: usize,
5757
puts_done: u8, // TODO make this a bool
5858
};
59-
const 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
64+
const puts_per_thread = 500;
6065
const put_thread_count = 3;
6166

6267
test "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‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const is_test = @import("builtin").is_test;
2-
const Log2Int = @import("../../math/index.zig").Log2Int;
2+
const Log2Int = @import("std").math.Log2Int;
33

44
pub 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‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const __fixunsdfdi = @import("fixunsdfdi.zig").__fixunsdfdi;
2-
const assert = @import("../../index.zig").debug.assert;
2+
const assert = @import("std").debug.assert;
33

44
fn test__fixunsdfdi(a: f64, expected: u64) void {
55
const x = __fixunsdfdi(a);

‎std/special/compiler_rt/fixunsdfsi_test.zig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const __fixunsdfsi = @import("fixunsdfsi.zig").__fixunsdfsi;
2-
const assert = @import("../../index.zig").debug.assert;
2+
const assert = @import("std").debug.assert;
33

44
fn test__fixunsdfsi(a: f64, expected: u32) void {
55
const x = __fixunsdfsi(a);

‎std/special/compiler_rt/fixunsdfti_test.zig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const __fixunsdfti = @import("fixunsdfti.zig").__fixunsdfti;
2-
const assert = @import("../../index.zig").debug.assert;
2+
const assert = @import("std").debug.assert;
33

44
fn test__fixunsdfti(a: f64, expected: u128) void {
55
const x = __fixunsdfti(a);

‎std/special/compiler_rt/fixunssfdi_test.zig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const __fixunssfdi = @import("fixunssfdi.zig").__fixunssfdi;
2-
const assert = @import("../../index.zig").debug.assert;
2+
const assert = @import("std").debug.assert;
33

44
fn test__fixunssfdi(a: f32, expected: u64) void {
55
const x = __fixunssfdi(a);

‎std/special/compiler_rt/fixunssfsi_test.zig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const __fixunssfsi = @import("fixunssfsi.zig").__fixunssfsi;
2-
const assert = @import("../../index.zig").debug.assert;
2+
const assert = @import("std").debug.assert;
33

44
fn test__fixunssfsi(a: f32, expected: u32) void {
55
const x = __fixunssfsi(a);

‎std/special/compiler_rt/fixunssfti_test.zig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const __fixunssfti = @import("fixunssfti.zig").__fixunssfti;
2-
const assert = @import("../../index.zig").debug.assert;
2+
const assert = @import("std").debug.assert;
33

44
fn test__fixunssfti(a: f32, expected: u128) void {
55
const x = __fixunssfti(a);

‎std/special/compiler_rt/fixunstfdi_test.zig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const __fixunstfdi = @import("fixunstfdi.zig").__fixunstfdi;
2-
const assert = @import("../../index.zig").debug.assert;
2+
const assert = @import("std").debug.assert;
33

44
fn test__fixunstfdi(a: f128, expected: u64) void {
55
const x = __fixunstfdi(a);

‎std/special/compiler_rt/fixunstfsi_test.zig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const __fixunstfsi = @import("fixunstfsi.zig").__fixunstfsi;
2-
const assert = @import("../../index.zig").debug.assert;
2+
const assert = @import("std").debug.assert;
33

44
fn test__fixunstfsi(a: f128, expected: u32) void {
55
const x = __fixunstfsi(a);

‎std/special/compiler_rt/fixunstfti_test.zig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const __fixunstfti = @import("fixunstfti.zig").__fixunstfti;
2-
const assert = @import("../../index.zig").debug.assert;
2+
const assert = @import("std").debug.assert;
33

44
fn test__fixunstfti(a: f128, expected: u128) void {
55
const x = __fixunstfti(a);

‎std/special/compiler_rt/index.zig‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ comptime {
7171
}
7272
}
7373

74-
const assert = @import("../../index.zig").debug.assert;
74+
const std = @import("std");
75+
const assert = std.debug.assert;
7576

7677
const __udivmoddi4 = @import("udivmoddi4.zig").__udivmoddi4;
7778

@@ -80,7 +81,7 @@ const __udivmoddi4 = @import("udivmoddi4.zig").__udivmoddi4;
8081
pub 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‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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‎

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
128
test "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-
4250
test "zig fmt: doc comments before struct field" {
4351
try testCanonical(
4452
\\pub const Allocator = struct {

0 commit comments

Comments
 (0)
Please sign in to comment.