this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

test(interop): add snappy and tar.{lzma,br,lz4,sz} interop tests

+44 -10
+43 -10
bin/test.sh
··· 282 282 test_brotli_level 11 283 283 } 284 284 285 + # Test framed snappy interop against the snzip CLI. snzip's default format is 286 + # `framing2`, which is the same official framing format the `snap` crate uses 287 + # (and that cmprss writes with the `.sz` extension). Snappy has no compression 288 + # level, so no --level is passed. 289 + test_snappy() { 290 + tmpdir 291 + echo "Testing snappy in $PWD" 292 + echo "Creating random data" 293 + random_file 1000000 file 294 + echo "Compressing with snzip and cmprss" 295 + snzip -c file >snzip_file.sz 296 + cmprss snappy file cmprss_file.sz --progress=off 297 + compare_size snzip_file.sz cmprss_file.sz 298 + echo "Decompressing" 299 + snzip -d -c snzip_file.sz >snzip_snzip 300 + snzip -d -c cmprss_file.sz >cmprss_snzip 301 + cmprss snappy --extract cmprss_file.sz cmprss_cmprss --progress=off 302 + cmprss snappy --extract snzip_file.sz snzip_cmprss --progress=off 303 + echo "Comparing the decompressed files" 304 + compare file snzip_snzip 305 + compare file cmprss_snzip 306 + compare file cmprss_cmprss 307 + compare file snzip_cmprss 308 + echo "No errors detected" 309 + } 310 + 285 311 # Test tar archive interop with the tar CLI. Tar has no progress bar, so no 286 312 # --progress flag is passed. 287 313 test_tar() { ··· 324 350 echo "No errors detected" 325 351 } 326 352 327 - # Shared helper for tar.<codec> pipeline interop. Takes the compound extension 328 - # (tar.gz/tar.xz/tar.zst/tar.bz2) and the corresponding tar short flag 329 - # (-z/-J/--zstd/-j). Verifies that cmprss produces archives the tar CLI can 330 - # read, and vice versa. Pipelines are invoked without a subcommand so 331 - # --progress isn't accepted; the archive is written to a file, not stdout, 332 - # which is fine for tests. 353 + # Shared helper for tar.<codec> pipeline interop. The first arg is the compound 354 + # extension; the rest are the tar flags used to compress/extract that codec 355 + # (e.g. `-z`, `--zstd`, or `-I lzma` for codecs without a short flag). 356 + # Verifies that cmprss produces archives the tar CLI can read, and vice versa. 357 + # Pipelines are invoked without a subcommand so --progress isn't accepted; the 358 + # archive is written to a file, not stdout, which is fine for tests. 333 359 test_tar_pipeline() { 334 360 local ext="$1" 335 - local tar_flag="$2" 361 + shift 362 + local tar_flags=("$@") 336 363 tmpdir 337 364 echo "Testing $ext pipeline in $PWD" 338 365 echo "Creating random data" 339 366 random_dir 10 indir 340 367 echo "Creating $ext archives with each tool" 341 - tar "$tar_flag" -cf tar_archive."$ext" indir 368 + tar "${tar_flags[@]}" -cf tar_archive."$ext" indir 342 369 cmprss indir cmprss_archive."$ext" 343 370 echo "Extracting each archive with the opposite tool" 344 371 mkdir -p tar_from_cmprss 345 - tar "$tar_flag" -xf cmprss_archive."$ext" -C tar_from_cmprss 372 + tar "${tar_flags[@]}" -xf cmprss_archive."$ext" -C tar_from_cmprss 346 373 mkdir -p cmprss_from_tar 347 374 cmprss --extract tar_archive."$ext" cmprss_from_tar 348 375 echo "Comparing the extracted contents" ··· 355 382 test_tar_xz() { test_tar_pipeline tar.xz -J; } 356 383 test_tar_bz2() { test_tar_pipeline tar.bz2 -j; } 357 384 test_tar_zst() { test_tar_pipeline tar.zst --zstd; } 385 + # tar has no short flag for these codecs; drive the external CLI via -I. 386 + test_tar_lzma() { test_tar_pipeline tar.lzma -I lzma; } 387 + test_tar_br() { test_tar_pipeline tar.br -I brotli; } 388 + test_tar_lz4() { test_tar_pipeline tar.lz4 -I lz4; } 389 + test_tar_sz() { test_tar_pipeline tar.sz -I snzip; } 358 390 359 391 # Run all the tests if no arguments are given 360 392 if [ $# -eq 0 ]; then 361 - set -- gzip xz bzip2 zstd lz4 lzma brotli tar zip tar_gz tar_xz tar_bz2 tar_zst 393 + set -- gzip xz bzip2 zstd lz4 lzma brotli snappy tar zip \ 394 + tar_gz tar_xz tar_bz2 tar_zst tar_lzma tar_br tar_lz4 tar_sz 362 395 fi 363 396 364 397 # Run the tests given on the command line
+1
flake.nix
··· 288 288 gnutar 289 289 gzip 290 290 lz4 291 + snzip 291 292 unzip 292 293 xz 293 294 zip