Skip to content

Instantly share code, notes, and snippets.

@themactep
Created March 31, 2023 16:02
Show Gist options
  • Save themactep/f26099e8da4b148c5a7a88378a7ad6c7 to your computer and use it in GitHub Desktop.
Save themactep/f26099e8da4b148c5a7a88378a7ad6c7 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Compression test
# Paul Philippov <paul@themactep.com>
payload=""
name="payload"
in="${name}.txt"
[ -d ./test_data/ ] && rm -r ./test_data/
[ ! -d ./test_data/ ] && mkdir ./test_data/
cd ./test_data/
ex() {
echo "\$ $1"
echo "$payload" >$in
$1 >/dev/null
echo ""
}
echo "Testing 7z"
out="${name}.7z"; [ -f "$out" ] && rm $out
ex "7z a $out $in"
echo "Testing ARJ"
out="${name}.arj"; [ -f "$out" ] && rm $out
ex "arj a $out $in"
echo "Testing Brotli"
out="${in}.br"; [ -f "$out" ] && rm $out
ex "brotli $in"
echo "Testing BZip2"
out="${in}.bz2"; [ -f "$out" ] && rm $out
ex "bzip2 $in"
echo "Testing GZip"
out="${in}.gz"; [ -f "$out" ] && rm $out
ex "gzip $in"
echo "Testing LZ4"
out="${name}.lz4"; [ -f "$out" ] && rm $out
ex "lz4 $in $out"
echo "Testing LZMA"
out="${in}.lzma"; [ -f "$out" ] && rm $out
ex "lzma $in"
echo "Testing LZOP"
out="${in}.lzo"; [ -f "$out" ] && rm $out
ex "lzop $in"
echo "Testing RAR"
out="${in}.rar"; [ -f "$out" ] && rm $out
ex "rar a $out $in"
echo "Testing XZ"
out="${in}.xz"; [ -f "$out" ] && rm $out
ex "xz $in"
echo "Testing Zip"
out="${name}.zip"; [ -f "$out" ] && rm $out
ex "zip $out $in"
ls -al
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment