diff --git a/lib/std/tar.zig b/lib/std/tar.zig index 21d08c5272..ff8cfd4a36 100644 --- a/lib/std/tar.zig +++ b/lib/std/tar.zig @@ -618,10 +618,8 @@ test "tar run Go test cases" { err: ?anyerror = null, // parsing should fail with this error }; - const test_dir = if (std.os.getenv("GO_TAR_TESTDATA_PATH")) |path| - try std.fs.openDirAbsolute(path, .{}) - else - return error.SkipZigTest; + const src_path = comptime std.fs.path.dirname(@src().file) orelse "."; + const test_dir = try std.fs.cwd().openDir(src_path ++ "/../../test/cases/tar", .{}); const cases = [_]Case{ .{ @@ -921,9 +919,9 @@ test "tar run Go test cases" { for (cases) |case| { var fs_file = try test_dir.openFile(case.path, .{}); + defer fs_file.close(); - //var iter = iterator(fs_file.reader(), null); var iter = tarReader(fs_file.reader(), null); var i: usize = 0; while (iter.next() catch |err| { diff --git a/test/cases/tar/gnu-incremental.tar b/test/cases/tar/gnu-incremental.tar new file mode 100644 index 0000000000..4c442e5b82 Binary files /dev/null and b/test/cases/tar/gnu-incremental.tar differ diff --git a/test/cases/tar/gnu-long-nul.tar b/test/cases/tar/gnu-long-nul.tar new file mode 100644 index 0000000000..28bc812aa6 Binary files /dev/null and b/test/cases/tar/gnu-long-nul.tar differ diff --git a/test/cases/tar/gnu-multi-hdrs.tar b/test/cases/tar/gnu-multi-hdrs.tar new file mode 100644 index 0000000000..8bcad55d06 Binary files /dev/null and b/test/cases/tar/gnu-multi-hdrs.tar differ diff --git a/test/cases/tar/gnu-not-utf8.tar b/test/cases/tar/gnu-not-utf8.tar new file mode 100644 index 0000000000..81cec67d33 Binary files /dev/null and b/test/cases/tar/gnu-not-utf8.tar differ diff --git a/test/cases/tar/gnu-utf8.tar b/test/cases/tar/gnu-utf8.tar new file mode 100644 index 0000000000..2c9c8079cf Binary files /dev/null and b/test/cases/tar/gnu-utf8.tar differ diff --git a/test/cases/tar/gnu.tar b/test/cases/tar/gnu.tar new file mode 100644 index 0000000000..fc899dc8dc Binary files /dev/null and b/test/cases/tar/gnu.tar differ diff --git a/test/cases/tar/invalid-go17.tar b/test/cases/tar/invalid-go17.tar new file mode 100644 index 0000000000..58f2488e78 Binary files /dev/null and b/test/cases/tar/invalid-go17.tar differ diff --git a/test/cases/tar/issue10968.tar b/test/cases/tar/issue10968.tar new file mode 100644 index 0000000000..1cc837bcff Binary files /dev/null and b/test/cases/tar/issue10968.tar differ diff --git a/test/cases/tar/issue11169.tar b/test/cases/tar/issue11169.tar new file mode 100644 index 0000000000..4d71fa1526 Binary files /dev/null and b/test/cases/tar/issue11169.tar differ diff --git a/test/cases/tar/issue12435.tar b/test/cases/tar/issue12435.tar new file mode 100644 index 0000000000..3542dd8efd Binary files /dev/null and b/test/cases/tar/issue12435.tar differ diff --git a/test/cases/tar/neg-size.tar b/test/cases/tar/neg-size.tar new file mode 100644 index 0000000000..21edf38cc3 Binary files /dev/null and b/test/cases/tar/neg-size.tar differ diff --git a/test/cases/tar/nil-uid.tar b/test/cases/tar/nil-uid.tar new file mode 100644 index 0000000000..cc9cfaa33c Binary files /dev/null and b/test/cases/tar/nil-uid.tar differ diff --git a/test/cases/tar/pax-bad-hdr-file.tar b/test/cases/tar/pax-bad-hdr-file.tar new file mode 100644 index 0000000000..b97cc981f2 Binary files /dev/null and b/test/cases/tar/pax-bad-hdr-file.tar differ diff --git a/test/cases/tar/pax-global-records.tar b/test/cases/tar/pax-global-records.tar new file mode 100644 index 0000000000..3d3d241e65 Binary files /dev/null and b/test/cases/tar/pax-global-records.tar differ diff --git a/test/cases/tar/pax-multi-hdrs.tar b/test/cases/tar/pax-multi-hdrs.tar new file mode 100644 index 0000000000..14bc759780 Binary files /dev/null and b/test/cases/tar/pax-multi-hdrs.tar differ diff --git a/test/cases/tar/pax-nul-path.tar b/test/cases/tar/pax-nul-path.tar new file mode 100644 index 0000000000..c78f82b16e Binary files /dev/null and b/test/cases/tar/pax-nul-path.tar differ diff --git a/test/cases/tar/pax-nul-xattrs.tar b/test/cases/tar/pax-nul-xattrs.tar new file mode 100644 index 0000000000..881f51768f Binary files /dev/null and b/test/cases/tar/pax-nul-xattrs.tar differ diff --git a/test/cases/tar/pax-pos-size-file.tar b/test/cases/tar/pax-pos-size-file.tar new file mode 100644 index 0000000000..ea5ccf9164 Binary files /dev/null and b/test/cases/tar/pax-pos-size-file.tar differ diff --git a/test/cases/tar/pax-records.tar b/test/cases/tar/pax-records.tar new file mode 100644 index 0000000000..276c211baa Binary files /dev/null and b/test/cases/tar/pax-records.tar differ diff --git a/test/cases/tar/pax.tar b/test/cases/tar/pax.tar new file mode 100644 index 0000000000..9bc24b6587 Binary files /dev/null and b/test/cases/tar/pax.tar differ diff --git a/test/cases/tar/sparse-formats.tar b/test/cases/tar/sparse-formats.tar new file mode 100644 index 0000000000..8bd4e74d50 Binary files /dev/null and b/test/cases/tar/sparse-formats.tar differ diff --git a/test/cases/tar/star.tar b/test/cases/tar/star.tar new file mode 100644 index 0000000000..59e2d4e604 Binary files /dev/null and b/test/cases/tar/star.tar differ diff --git a/test/cases/tar/trailing-slash.tar b/test/cases/tar/trailing-slash.tar new file mode 100644 index 0000000000..93718b3034 Binary files /dev/null and b/test/cases/tar/trailing-slash.tar differ diff --git a/test/cases/tar/ustar-file-devs.tar b/test/cases/tar/ustar-file-devs.tar new file mode 100644 index 0000000000..146e25b79d Binary files /dev/null and b/test/cases/tar/ustar-file-devs.tar differ diff --git a/test/cases/tar/v7.tar b/test/cases/tar/v7.tar new file mode 100644 index 0000000000..eb65fc9410 Binary files /dev/null and b/test/cases/tar/v7.tar differ diff --git a/test/cases/tar/writer-big-long.tar b/test/cases/tar/writer-big-long.tar new file mode 100644 index 0000000000..09fc5dd3dd Binary files /dev/null and b/test/cases/tar/writer-big-long.tar differ diff --git a/test/cases/tar/writer-big.tar b/test/cases/tar/writer-big.tar new file mode 100644 index 0000000000..435dcbce6a Binary files /dev/null and b/test/cases/tar/writer-big.tar differ diff --git a/test/cases/tar/xattrs.tar b/test/cases/tar/xattrs.tar new file mode 100644 index 0000000000..9701950edd Binary files /dev/null and b/test/cases/tar/xattrs.tar differ