authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-05-25 19:46:28-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-05-25 19:46:28-04:00
loga83aab5209a040dc8718c71de87a1fa72967ba9d
tree3d0a6d7361b1286851c7298f6296750e4e101d27
parentcda102be020ef9c5c1425553ff611720f496f17e

fix std lib tests for WASI


1 files changed, 17 insertions(+), 1 deletions(-)

lib/std/cache_hash.zig+17-1
...@@ -291,7 +291,7 @@ pub const CacheHash = struct {...@@ -291,7 +291,7 @@ pub const CacheHash = struct {
291 return error.FileTooBig;291 return error.FileTooBig;
292 }292 }
293293
294 const contents = try self.allocator.alloc(u8, ch_file.stat.size);294 const contents = try self.allocator.alloc(u8, @intCast(usize, ch_file.stat.size));
295 errdefer self.allocator.free(contents);295 errdefer self.allocator.free(contents);
296296
297 // Hash while reading from disk, to keep the contents in the cpu cache while297 // Hash while reading from disk, to keep the contents in the cpu cache while
...@@ -470,6 +470,10 @@ fn isProblematicTimestamp(fs_clock: i128) bool {...@@ -470,6 +470,10 @@ fn isProblematicTimestamp(fs_clock: i128) bool {
470}470}
471471
472test "cache file and then recall it" {472test "cache file and then recall it" {
473 if (std.Target.current.os.tag == .wasi) {
474 // https://github.com/ziglang/zig/issues/5437
475 return error.SkipZigTest;
476 }
473 const cwd = fs.cwd();477 const cwd = fs.cwd();
474478
475 const temp_file = "test.txt";479 const temp_file = "test.txt";
...@@ -530,6 +534,10 @@ test "give nonproblematic timestamp" {...@@ -530,6 +534,10 @@ test "give nonproblematic timestamp" {
530}534}
531535
532test "check that changing a file makes cache fail" {536test "check that changing a file makes cache fail" {
537 if (std.Target.current.os.tag == .wasi) {
538 // https://github.com/ziglang/zig/issues/5437
539 return error.SkipZigTest;
540 }
533 const cwd = fs.cwd();541 const cwd = fs.cwd();
534542
535 const temp_file = "cache_hash_change_file_test.txt";543 const temp_file = "cache_hash_change_file_test.txt";
...@@ -590,6 +598,10 @@ test "check that changing a file makes cache fail" {...@@ -590,6 +598,10 @@ test "check that changing a file makes cache fail" {
590}598}
591599
592test "no file inputs" {600test "no file inputs" {
601 if (std.Target.current.os.tag == .wasi) {
602 // https://github.com/ziglang/zig/issues/5437
603 return error.SkipZigTest;
604 }
593 const cwd = fs.cwd();605 const cwd = fs.cwd();
594 const temp_manifest_dir = "no_file_inputs_manifest_dir";606 const temp_manifest_dir = "no_file_inputs_manifest_dir";
595 defer cwd.deleteTree(temp_manifest_dir) catch unreachable;607 defer cwd.deleteTree(temp_manifest_dir) catch unreachable;
...@@ -621,6 +633,10 @@ test "no file inputs" {...@@ -621,6 +633,10 @@ test "no file inputs" {
621}633}
622634
623test "CacheHashes with files added after initial hash work" {635test "CacheHashes with files added after initial hash work" {
636 if (std.Target.current.os.tag == .wasi) {
637 // https://github.com/ziglang/zig/issues/5437
638 return error.SkipZigTest;
639 }
624 const cwd = fs.cwd();640 const cwd = fs.cwd();
625641
626 const temp_file1 = "cache_hash_post_file_test1.txt";642 const temp_file1 = "cache_hash_post_file_test1.txt";