xref: /netbsd-src/external/bsd/zstd/dist/tests/cli-tests/compression/basic.sh (revision 3117ece4fc4a4ca4489ba793710b60b0d26bab6c)
1*3117ece4Schristos#!/bin/sh
2*3117ece4Schristos
3*3117ece4Schristosset -e
4*3117ece4Schristos
5*3117ece4Schristos# Uncomment the set -v line for debugging
6*3117ece4Schristos# set -v
7*3117ece4Schristos
8*3117ece4Schristos# Test compression flags and check that they work
9*3117ece4Schristoszstd file                 ; zstd -t file.zst
10*3117ece4Schristoszstd -f file              ; zstd -t file.zst
11*3117ece4Schristoszstd -f -z file           ; zstd -t file.zst
12*3117ece4Schristoszstd -f -k file           ; zstd -t file.zst
13*3117ece4Schristoszstd -f -C file           ; zstd -t file.zst
14*3117ece4Schristoszstd -f --check file      ; zstd -t file.zst
15*3117ece4Schristoszstd -f --no-check file   ; zstd -t file.zst
16*3117ece4Schristoszstd -f -- file           ; zstd -t file.zst
17*3117ece4Schristos
18*3117ece4Schristos# Test output file compression
19*3117ece4Schristoszstd -o file-out.zst ; zstd -t file-out.zst
20*3117ece4Schristoszstd -fo file-out.zst; zstd -t file-out.zst
21*3117ece4Schristos
22*3117ece4Schristos# Test compression to stdout
23*3117ece4Schristoszstd -c file       | zstd -t
24*3117ece4Schristoszstd --stdout file | zstd -t
25*3117ece4Schristosprintln bob | zstd | zstd -t
26*3117ece4Schristos
27*3117ece4Schristos# Test keeping input file when compressing to stdout in gzip mode
28*3117ece4Schristosif $(command -v $ZSTD_SYMLINK_DIR/gzip); then
29*3117ece4Schristos    $ZSTD_SYMLINK_DIR/gzip -c file       | zstd -t ; test -f file
30*3117ece4Schristos    $ZSTD_SYMLINK_DIR/gzip --stdout file | zstd -t ; test -f file
31*3117ece4Schristosfi
32*3117ece4Schristos
33*3117ece4Schristos# Test --rm
34*3117ece4Schristoscp file file-rm
35*3117ece4Schristoszstd --rm file-rm; zstd -t file-rm.zst
36*3117ece4Schristostest ! -f file-rm
37