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