Skip to content

Commit 99594c5

Browse files
authored
Add tests to ensure tarballs are compressed with the expected format (#433)
1 parent 11f41fb commit 99594c5

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

test/archive_utils.jl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using BinaryBuilderBase: Prefix, archive_artifact, package, list_tarball_files
1+
using BinaryBuilderBase: Prefix, archive_artifact, package, list_tarball_files, detect_compressor
22
using Pkg.Artifacts: create_artifact, remove_artifact, with_artifacts_directory
33
using SHA
44
using Test
@@ -27,14 +27,17 @@ using Test
2727

2828
mktempdir() do output_dir
2929
for (format, ext, hash) in (("gzip", "gz", "568f743e965b63d3187b6a2647700a71d1d7520b4596fbf2bfb39ffa67c4bb55"),
30-
# Compressing with p7zip/xz doesn't seem to be fully reproducible, at least not
31-
# across different systems. We'll try to investigate more, but for the time being
32-
# skip the reproducibility test for it.
33-
("xz", "xz", ""))
30+
("xz", "xz", "293736704ee772836edf67ba4bac55c9604721d6df332cef9bdf4c9c06b39a8c"))
3431
tarball_path = joinpath(output_dir, "foo.tar.$ext")
3532
package(prefix, tarball_path; format=format)
3633
@test isfile(tarball_path)
3734

35+
compressor = open(tarball_path) do io
36+
detect_compressor(read(io, 6))
37+
end
38+
# Make sure the compression format is what we expect
39+
@test compressor == format
40+
3841
if !isempty(hash)
3942
tarball_hash = open(tarball_path, "r") do io
4043
bytes2hex(sha256(io))

test/prefix.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ end
8181
bytes2hex(sha256(f))
8282
end
8383
@test tarball_hash_check == tarball_hash
84+
85+
compressor = open(tarball_path) do io
86+
BinaryBuilderBase.detect_compressor(read(io, 6))
87+
end
88+
# Make sure the compression format is what we expect
89+
@test compressor == compression_format
8490
end
8591

8692
# Test that packaging into a file that already exists fails

0 commit comments

Comments
 (0)