From a83aab5209a040dc8718c71de87a1fa72967ba9d Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 25 May 2020 19:46:28 -0400 Subject: [PATCH] fix std lib tests for WASI --- lib/std/cache_hash.zig | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/std/cache_hash.zig b/lib/std/cache_hash.zig index 6d965a1fcb..d160c4ebb2 100644 --- a/lib/std/cache_hash.zig +++ b/lib/std/cache_hash.zig @@ -291,7 +291,7 @@ pub const CacheHash = struct { return error.FileTooBig; } - const contents = try self.allocator.alloc(u8, ch_file.stat.size); + const contents = try self.allocator.alloc(u8, @intCast(usize, ch_file.stat.size)); errdefer self.allocator.free(contents); // Hash while reading from disk, to keep the contents in the cpu cache while @@ -470,6 +470,10 @@ fn isProblematicTimestamp(fs_clock: i128) bool { } test "cache file and then recall it" { + if (std.Target.current.os.tag == .wasi) { + // https://github.com/ziglang/zig/issues/5437 + return error.SkipZigTest; + } const cwd = fs.cwd(); const temp_file = "test.txt"; @@ -530,6 +534,10 @@ test "give nonproblematic timestamp" { } test "check that changing a file makes cache fail" { + if (std.Target.current.os.tag == .wasi) { + // https://github.com/ziglang/zig/issues/5437 + return error.SkipZigTest; + } const cwd = fs.cwd(); const temp_file = "cache_hash_change_file_test.txt"; @@ -590,6 +598,10 @@ test "check that changing a file makes cache fail" { } test "no file inputs" { + if (std.Target.current.os.tag == .wasi) { + // https://github.com/ziglang/zig/issues/5437 + return error.SkipZigTest; + } const cwd = fs.cwd(); const temp_manifest_dir = "no_file_inputs_manifest_dir"; defer cwd.deleteTree(temp_manifest_dir) catch unreachable; @@ -621,6 +633,10 @@ test "no file inputs" { } test "CacheHashes with files added after initial hash work" { + if (std.Target.current.os.tag == .wasi) { + // https://github.com/ziglang/zig/issues/5437 + return error.SkipZigTest; + } const cwd = fs.cwd(); const temp_file1 = "cache_hash_post_file_test1.txt";