Created
December 15, 2022 03:29
-
-
Save mikdusan/315f4769c5792140b5feedb18afc8cfc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit a43d026ff7be87ddb74fb463df37c864fbcbe8c4 | |
Author: Michael Dusan <michael.dusan@gmail.com> | |
Date: Sat Dec 10 09:03:54 2022 -0500 | |
std: fix deflate tests to not use openDirAbsolute | |
This was tripping assert because path was relative. | |
diff --git a/lib/std/compress/deflate/compressor_test.zig b/lib/std/compress/deflate/compressor_test.zig | |
index 51f459cd6..d0bfcd3bf 100644 | |
--- a/lib/std/compress/deflate/compressor_test.zig | |
+++ b/lib/std/compress/deflate/compressor_test.zig | |
@@ -394,10 +394,7 @@ test "Go non-regression test for 2508" { | |
} | |
test "deflate/inflate string" { | |
- // Skip wasi because it does not support std.fs.openDirAbsolute() | |
- if (builtin.os.tag == .wasi) return error.SkipZigTest; | |
- | |
- const current_dir = try std.fs.openDirAbsolute(std.fs.path.dirname(@src().file).?, .{}); | |
+ const current_dir = try std.fs.cwd().openDir(std.fs.path.dirname(@src().file).?, .{}); | |
const testdata_dir = try current_dir.openDir("testdata", .{}); | |
const StringTest = struct { | |
diff --git a/lib/std/compress/deflate/huffman_bit_writer.zig b/lib/std/compress/deflate/huffman_bit_writer.zig | |
index 357846218..38037e678 100644 | |
--- a/lib/std/compress/deflate/huffman_bit_writer.zig | |
+++ b/lib/std/compress/deflate/huffman_bit_writer.zig | |
@@ -887,10 +887,7 @@ test "writeBlockHuff" { | |
} | |
fn testBlockHuff(in_name: []const u8, want_name: []const u8) !void { | |
- // Skip wasi because it does not support std.fs.openDirAbsolute() | |
- if (builtin.os.tag == .wasi) return error.SkipZigTest; | |
- | |
- const current_dir = try std.fs.openDirAbsolute(std.fs.path.dirname(@src().file).?, .{}); | |
+ const current_dir = try std.fs.cwd().openDir(std.fs.path.dirname(@src().file).?, .{}); | |
const testdata_dir = try current_dir.openDir("testdata", .{}); | |
const in_file = try testdata_dir.openFile(in_name, .{}); | |
defer in_file.close(); | |
@@ -1613,16 +1610,13 @@ test "writeBlockDynamic" { | |
// testBlock tests a block against its references, | |
// or regenerate the references, if "-update" flag is set. | |
fn testBlock(comptime ht: HuffTest, ttype: TestType) !void { | |
- // Skip wasi because it does not support std.fs.openDirAbsolute() | |
- if (builtin.os.tag == .wasi) return error.SkipZigTest; | |
- | |
var want_name: []u8 = undefined; | |
var want_name_no_input: []u8 = undefined; | |
var input: []u8 = undefined; | |
var want: []u8 = undefined; | |
var want_ni: []u8 = undefined; // want no input: what we expect when input is empty | |
- const current_dir = try std.fs.openDirAbsolute(std.fs.path.dirname(@src().file).?, .{}); | |
+ const current_dir = try std.fs.cwd().openDir(std.fs.path.dirname(@src().file).?, .{}); | |
const testdata_dir = try current_dir.openDir("testdata", .{}); | |
var want_name_type = if (ht.want.len == 0) .{} else .{ttype.to_s()}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment