| 1 | #!/bin/sh |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | . "$COMMON/platform.sh" |
| 6 | |
| 7 | echo "" > 1 |
| 8 | echo "2" > 2 |
| 9 | echo "23" > 3 |
| 10 | echo "234" > 4 |
| 11 | echo "some data" > file |
| 12 | |
| 13 | println "+ passthrough enabled" |
| 14 | |
| 15 | zstd file |
| 16 | |
| 17 | # Test short files |
| 18 | zstd -dc --pass-through 1 2 3 4 |
| 19 | |
| 20 | # Test *cat symlinks |
| 21 | zstdcat file |
| 22 | "$ZSTD_SYMLINK_DIR/zcat" file |
| 23 | "$ZSTD_SYMLINK_DIR/gzcat" file |
| 24 | |
| 25 | # Test multiple files with mix of compressed & not |
| 26 | zstdcat file file.zst |
| 27 | zstdcat file.zst file |
| 28 | |
| 29 | # Test --pass-through |
| 30 | zstd -dc --pass-through file |
| 31 | zstd -d --pass-through file -o pass-through-file |
| 32 | |
| 33 | # Test legacy implicit passthrough with -fc |
| 34 | zstd -dcf file |
| 35 | zstd -dcf file file.zst |
| 36 | zstd -df < file |
| 37 | zstd -dcf < file file.zst - |
| 38 | zstd -dcf < file.zst file - |
| 39 | |
| 40 | $DIFF file pass-through-file |
| 41 | |
| 42 | println "+ passthrough disabled" |
| 43 | |
| 44 | # Test *cat |
| 45 | zstdcat --no-pass-through file && die "should fail" |
| 46 | "$ZSTD_SYMLINK_DIR/zcat" --no-pass-through file && die "should fail" |
| 47 | "$ZSTD_SYMLINK_DIR/gzcat" --no-pass-through file && die "should fail" |
| 48 | # Test zstd without implicit passthrough |
| 49 | zstd -d file -o no-pass-through-file && die "should fail" |
| 50 | zstd -d < file && die "should fail" |
| 51 | |
| 52 | # Test legacy implicit passthrough with -fc |
| 53 | zstd --no-pass-through -dcf file && die "should fail" |
| 54 | zstd --no-pass-through -dcf file file.zst && die "should fail" |
| 55 | zstd --no-pass-through -df < file && die "should fail" |
| 56 | zstd --no-pass-through -dcf < file file.zst - && die "should fail" |
| 57 | zstd --no-pass-through -dcf < file.zst file - && die "should fail" ||: |