JuliaIO / Tar.jl

TAR files: create, list, extract them in pure Julia
MIT License
79 stars 19 forks source link

tests: better tests for tarball truncation #107

Closed StefanKarpinski closed 3 years ago

StefanKarpinski commented 3 years ago

While implementing support for hardlinks, the truncated tarball test was causing problems because it was simply cutting the test tarball in half, which is neither guaranteed to create an ill-formed truncated tarball at all (it is easily possible for half a tarball to be a valid tarball by itself), nor guaranteed to consistently truncate the tarball in the same way on different platforms since we generate somewhat different test tarballs on different platforms (depending on: whether we are able to create hardlinks and what the max file name length is). The fact that this test worked previously was essentially dumb luck.

This change replaces the previous test with systematic tests that various specific truncations of a simple, consistent tarball trigger EOFErrors as expected in all the API functions that consume tarballs. It turns out that several of these functions do not error as expected in all circumstances.

codecov[bot] commented 3 years ago

Codecov Report

Merging #107 (427b657) into master (ada4f12) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #107   +/-   ##
=======================================
  Coverage   96.30%   96.30%           
=======================================
  Files           4        4           
  Lines         649      649           
=======================================
  Hits          625      625           
  Misses         24       24           
Impacted Files Coverage Δ
src/Tar.jl 96.10% <ø> (ø)
src/create.jl 97.09% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ada4f12...427b657. Read the comment docs.