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