pbzip2/tests/scripts/run_tests.sh
Brian C. Lane 9b7fd16b8b tests: Add gating test
Do a basic test on pbzip2 for gating.

Resolves: RHEL-53370
2024-08-21 07:57:18 -07:00

28 lines
613 B
Bash
Executable File

#!/bin/bash
set -eux
# Test basic pbzip2 operations
# Just some text we know is present
cat /usr/share/doc/pbzip2/* > test-file.txt
sha256sum test-file.txt > test-file.txt.sha256
# Compress a stream from stdin
pbzip2 -p4 < test-file.txt > test-stream.bz2
[ -e test-stream.bz2 ] || exit 1
# Uncompress and check it
pbzip2 -p4 -dc < test-stream.bz2 > test-file.txt
sha256sum -c test-file.txt.sha256
# Compress a file (removes original)
pbzip2 -p4 test-file.txt
[ -e test-file.txt.bz2 ] || exit 1
# Uncompress and check it
pbzip2 -p4 -df test-file.txt.bz2
sha256sum -c test-file.txt.sha256
echo "PASS"
exit 0