authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-09-13 17:26:19+01:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-10-18 09:28:42+01:00
log7a5d2a196f2d78eb55f8ef294b4c899e0378f71e
tree1b969a67d606cf818b95ee5e09f4bf5fc9504b44
parentd0b92a80224e1ed44434ed8546fa2ff497cc5312
signaturelock-open Commit is signed but in an unrecognized format.

tweak tests to avoid timeouts


5 files changed, 41 insertions(+), 47 deletions(-)

lib/compiler_rt/memcpy.zig+30-31
......@@ -194,37 +194,36 @@ inline fn copyRange4(
194194 copyFixedLength(dest + last, src + last, copy_len);
195195}
196196
197test "memcpy" {
198 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
199
200 const S = struct {
201 fn testFunc(comptime copy_func: anytype) !void {
202 const max_len = 1024;
203 var buffer: [max_len + @alignOf(Element) - 1]u8 align(@alignOf(Element)) = undefined;
204 for (&buffer, 0..) |*b, i| {
205 b.* = @intCast(i % 97);
206 }
207 var dest: [max_len + @alignOf(Element) - 1]u8 align(@alignOf(Element)) = undefined;
208
209 for (0..max_len) |copy_len| {
210 for (0..@alignOf(Element)) |s_offset| {
211 for (0..@alignOf(Element)) |d_offset| {
212 @memset(&dest, 0xff);
213 const s = buffer[s_offset..][0..copy_len];
214 const d = dest[d_offset..][0..copy_len];
215 _ = copy_func(@ptrCast(d.ptr), @ptrCast(s.ptr), s.len);
216 std.testing.expectEqualSlices(u8, s, d) catch |e| {
217 std.debug.print("error encountered for length={d}, s_offset={d}, d_offset={d}\n", .{
218 copy_len, s_offset, d_offset,
219 });
220 return e;
221 };
222 }
223 }
197fn testMemcpyImpl(comptime memcpyImpl: anytype) !void {
198 const max_len = 1024;
199 var buffer: [max_len + @alignOf(Element) - 1]u8 align(@alignOf(Element)) = undefined;
200 for (&buffer, 0..) |*b, i| {
201 b.* = @intCast(i % 97);
202 }
203 var dest: [max_len + @alignOf(Element) - 1]u8 align(@alignOf(Element)) = undefined;
204
205 for (0..max_len) |copy_len| {
206 for (0..@alignOf(Element)) |s_offset| {
207 for (0..@alignOf(Element)) |d_offset| {
208 @memset(&dest, 0xff);
209 const s = buffer[s_offset..][0..copy_len];
210 const d = dest[d_offset..][0..copy_len];
211 _ = memcpyImpl(@ptrCast(d.ptr), @ptrCast(s.ptr), s.len);
212 std.testing.expectEqualSlices(u8, s, d) catch |e| {
213 std.debug.print("error encountered for length={d}, s_offset={d}, d_offset={d}\n", .{
214 copy_len, s_offset, d_offset,
215 });
216 return e;
217 };
224218 }
225219 }
226 };
227
228 try S.testFunc(memcpySmall);
229 try S.testFunc(memcpyFast);
220 }
221}
222test memcpySmall {
223 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
224 try testMemcpyImpl(memcpySmall);
225}
226test memcpyFast {
227 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
228 try testMemcpyImpl(memcpyFast);
230229}
lib/std/Thread/RwLock.zig+2-2
......@@ -301,8 +301,8 @@ test "concurrent access" {
301301
302302 const num_writers: usize = 2;
303303 const num_readers: usize = 4;
304 const num_writes: usize = 10000;
305 const num_reads: usize = num_writes * 2;
304 const num_writes: usize = 4096;
305 const num_reads: usize = 8192;
306306
307307 const Runner = struct {
308308 const Self = @This();
lib/std/crypto/25519/ed25519.zig+1-2
......@@ -587,8 +587,7 @@ test "signature" {
587587}
588588
589589test "batch verification" {
590 var i: usize = 0;
591 while (i < 100) : (i += 1) {
590 for (0..16) |_| {
592591 const key_pair = Ed25519.KeyPair.generate();
593592 var msg1: [32]u8 = undefined;
594593 var msg2: [32]u8 = undefined;
lib/std/posix/test.zig+4-8
......@@ -562,15 +562,11 @@ test "sync" {
562562 if (native_os != .linux)
563563 return error.SkipZigTest;
564564
565 var tmp = tmpDir(.{});
566 defer tmp.cleanup();
567
568 const test_out_file = "os_tmp_test";
569 const file = try tmp.dir.createFile(test_out_file, .{});
570 defer file.close();
565 // Unfortunately, we cannot safely call `sync` or `syncfs`, because if file IO is happening
566 // than the system can commit the results to disk, such calls could block indefinitely.
571567
572 posix.sync();
573 try posix.syncfs(file.handle);
568 _ = &posix.sync;
569 _ = &posix.syncfs;
574570}
575571
576572test "fsync" {
test/behavior/call.zig+4-4
......@@ -320,7 +320,7 @@ test "inline call preserves tail call" {
320320
321321 if (builtin.zig_backend == .stage2_c and builtin.os.tag == .windows) return error.SkipZigTest; // MSVC doesn't support always tail calls
322322
323 const max = std.math.maxInt(u16);
323 const max_depth = 1000;
324324 const S = struct {
325325 var a: u16 = 0;
326326 fn foo() void {
......@@ -328,16 +328,16 @@ test "inline call preserves tail call" {
328328 }
329329
330330 inline fn bar() void {
331 if (a == max) return;
331 if (a == max_depth) return;
332332 // Stack overflow if not tail called
333 var buf: [max]u16 = undefined;
333 var buf: [100_000]u16 = undefined;
334334 buf[a] = a;
335335 a += 1;
336336 return @call(.always_tail, foo, .{});
337337 }
338338 };
339339 S.foo();
340 try expect(S.a == std.math.maxInt(u16));
340 try expect(S.a == max_depth);
341341}
342342
343343test "inline call doesn't re-evaluate non generic struct" {