From e6a4e87f69cdb8c76b24f136c945694db69f9b50 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 18 Dec 2022 16:28:30 -0700 Subject: [PATCH 1/3] update gitattributes and move test data into subdir --- .gitattributes | 4 ++-- build.zig | 2 +- lib/std/compress/gzip.zig | 4 ++-- lib/std/compress/{ => testdata}/rfc1951.txt | 0 .../compress/{ => testdata}/rfc1951.txt.fixed.z.9 | Bin lib/std/compress/{ => testdata}/rfc1951.txt.z.0 | Bin lib/std/compress/{ => testdata}/rfc1951.txt.z.9 | Bin lib/std/compress/{ => testdata}/rfc1952.txt | 0 lib/std/compress/{ => testdata}/rfc1952.txt.gz | Bin lib/std/compress/zlib.zig | 8 ++++---- 10 files changed, 9 insertions(+), 9 deletions(-) rename lib/std/compress/{ => testdata}/rfc1951.txt (100%) rename lib/std/compress/{ => testdata}/rfc1951.txt.fixed.z.9 (100%) rename lib/std/compress/{ => testdata}/rfc1951.txt.z.0 (100%) rename lib/std/compress/{ => testdata}/rfc1951.txt.z.9 (100%) rename lib/std/compress/{ => testdata}/rfc1952.txt (100%) rename lib/std/compress/{ => testdata}/rfc1952.txt.gz (100%) diff --git a/.gitattributes b/.gitattributes index 2983afbfc3..581789817c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,9 +1,9 @@ *.zig text eol=lf *.txt text eol=lf langref.html.in text eol=lf -deps/SoftFloat-3e/*.txt text eol=crlf +lib/std/compress/testdata/** binary +lib/std/compress/deflate/testdata/** binary -deps/** linguist-vendored lib/include/** linguist-vendored lib/libc/** linguist-vendored lib/libcxx/** linguist-vendored diff --git a/build.zig b/build.zig index f2a7e48dc7..edcdfabfe0 100644 --- a/build.zig +++ b/build.zig @@ -106,7 +106,7 @@ pub fn build(b: *Builder) !void { .install_dir = .lib, .install_subdir = "zig", .exclude_extensions = &[_][]const u8{ - // exclude files from lib/std/compress/ + // exclude files from lib/std/compress/testdata ".gz", ".z.0", ".z.9", diff --git a/lib/std/compress/gzip.zig b/lib/std/compress/gzip.zig index c3b2335a1a..d7a2cb0094 100644 --- a/lib/std/compress/gzip.zig +++ b/lib/std/compress/gzip.zig @@ -172,8 +172,8 @@ fn testReader(data: []const u8, comptime expected: []const u8) !void { // SHA256=164ef0897b4cbec63abf1b57f069f3599bd0fb7c72c2a4dee21bd7e03ec9af67 test "compressed data" { try testReader( - @embedFile("rfc1952.txt.gz"), - @embedFile("rfc1952.txt"), + @embedFile("testdata/rfc1952.txt.gz"), + @embedFile("testdata/rfc1952.txt"), ); } diff --git a/lib/std/compress/rfc1951.txt b/lib/std/compress/testdata/rfc1951.txt similarity index 100% rename from lib/std/compress/rfc1951.txt rename to lib/std/compress/testdata/rfc1951.txt diff --git a/lib/std/compress/rfc1951.txt.fixed.z.9 b/lib/std/compress/testdata/rfc1951.txt.fixed.z.9 similarity index 100% rename from lib/std/compress/rfc1951.txt.fixed.z.9 rename to lib/std/compress/testdata/rfc1951.txt.fixed.z.9 diff --git a/lib/std/compress/rfc1951.txt.z.0 b/lib/std/compress/testdata/rfc1951.txt.z.0 similarity index 100% rename from lib/std/compress/rfc1951.txt.z.0 rename to lib/std/compress/testdata/rfc1951.txt.z.0 diff --git a/lib/std/compress/rfc1951.txt.z.9 b/lib/std/compress/testdata/rfc1951.txt.z.9 similarity index 100% rename from lib/std/compress/rfc1951.txt.z.9 rename to lib/std/compress/testdata/rfc1951.txt.z.9 diff --git a/lib/std/compress/rfc1952.txt b/lib/std/compress/testdata/rfc1952.txt similarity index 100% rename from lib/std/compress/rfc1952.txt rename to lib/std/compress/testdata/rfc1952.txt diff --git a/lib/std/compress/rfc1952.txt.gz b/lib/std/compress/testdata/rfc1952.txt.gz similarity index 100% rename from lib/std/compress/rfc1952.txt.gz rename to lib/std/compress/testdata/rfc1952.txt.gz diff --git a/lib/std/compress/zlib.zig b/lib/std/compress/zlib.zig index 500bb0bb5b..0fc96a5aa9 100644 --- a/lib/std/compress/zlib.zig +++ b/lib/std/compress/zlib.zig @@ -107,21 +107,21 @@ fn testReader(data: []const u8, expected: []const u8) !void { // https://tools.ietf.org/rfc/rfc1951.txt length=36944 bytes // SHA256=5ebf4b5b7fe1c3a0c0ab9aa3ac8c0f3853a7dc484905e76e03b0b0f301350009 test "compressed data" { - const rfc1951_txt = @embedFile("rfc1951.txt"); + const rfc1951_txt = @embedFile("testdata/rfc1951.txt"); // Compressed with compression level = 0 try testReader( - @embedFile("rfc1951.txt.z.0"), + @embedFile("testdata/rfc1951.txt.z.0"), rfc1951_txt, ); // Compressed with compression level = 9 try testReader( - @embedFile("rfc1951.txt.z.9"), + @embedFile("testdata/rfc1951.txt.z.9"), rfc1951_txt, ); // Compressed with compression level = 9 and fixed Huffman codes try testReader( - @embedFile("rfc1951.txt.fixed.z.9"), + @embedFile("testdata/rfc1951.txt.fixed.z.9"), rfc1951_txt, ); } From aa44512b8511e18a334dcee55c1d9ae5d5aba842 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 18 Dec 2022 16:31:12 -0700 Subject: [PATCH 2/3] CI: workaround git bug regarding changed attributes --- ci/aarch64-windows.ps1 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ci/aarch64-windows.ps1 b/ci/aarch64-windows.ps1 index bf80d3a091..0e43c1bf69 100644 --- a/ci/aarch64-windows.ps1 +++ b/ci/aarch64-windows.ps1 @@ -31,6 +31,11 @@ if ((git rev-parse --is-shallow-repository) -eq "true") { git fetch --unshallow # `git describe` won't work on a shallow repo } +# Fix files that have their gitattributes changed +git rm -rf lib +git restore --staged lib +git checkout lib + Write-Output "Building from source..." Remove-Item -Path 'build-release' -Recurse -Force -ErrorAction Ignore New-Item -Path 'build-release' -ItemType Directory From 8f98a2b90fe0834af34a943886c67855ba6c4f7b Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 18 Dec 2022 16:32:55 -0700 Subject: [PATCH 3/3] std.compress.deflate: re-enable test on windows closes #13892 --- lib/std/compress/deflate/huffman_bit_writer.zig | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/std/compress/deflate/huffman_bit_writer.zig b/lib/std/compress/deflate/huffman_bit_writer.zig index 3b83eecea3..fc5727ca63 100644 --- a/lib/std/compress/deflate/huffman_bit_writer.zig +++ b/lib/std/compress/deflate/huffman_bit_writer.zig @@ -848,11 +848,6 @@ test "writeBlockHuff" { // Tests huffman encoding against reference files to detect possible regressions. // If encoding/bit allocation changes you can regenerate these files - if (builtin.os.tag == .windows) { - // https://github.com/ziglang/zig/issues/13892 - return error.SkipZigTest; - } - try testBlockHuff( "huffman-null-max.input", "huffman-null-max.golden",