Blame tests/p_gzip/10-gzip-test.sh
|
Christoph Galuschka |
4fdfe1 |
#!/bin/sh
|
|
Christoph Galuschka |
4fdfe1 |
# Author: Athmane Madjoudj <athmanem@gmail.com>
|
|
Christoph Galuschka |
4fdfe1 |
# Author: Christoph Galuschka <christoph.galuschka@chello.at>
|
|
Christoph Galuschka |
4fdfe1 |
|
|
Christoph Galuschka |
4fdfe1 |
t_Log "Running $0 - run a file through gzip,zcat and gunzip test."
|
|
Christoph Galuschka |
4fdfe1 |
|
|
Christoph Galuschka |
4fdfe1 |
# create file
|
|
Christoph Galuschka |
4fdfe1 |
FILE=/var/tmp/gzip-test.txt
|
|
Christoph Galuschka |
4fdfe1 |
|
|
Christoph Galuschka |
4fdfe1 |
cat > $FILE <
|
|
Christoph Galuschka |
4fdfe1 |
gzip-test of single file
|
|
Christoph Galuschka |
4fdfe1 |
EOF
|
|
Christoph Galuschka |
4fdfe1 |
|
|
Christoph Galuschka |
4fdfe1 |
# run file through gzip
|
|
Christoph Galuschka |
4fdfe1 |
gzip $FILE
|
|
Christoph Galuschka |
4fdfe1 |
#just to make shure
|
|
Christoph Galuschka |
4fdfe1 |
/bin/rm -rf $FILE
|
|
Christoph Galuschka |
4fdfe1 |
|
|
Christoph Galuschka |
4fdfe1 |
#run file through zcat
|
|
Christoph Galuschka |
4fdfe1 |
zcat $FILE.gz | grep -q 'gzip-test of single file'
|
|
Christoph Galuschka |
4fdfe1 |
if [ $? == 1 ]
|
|
Christoph Galuschka |
4fdfe1 |
then
|
|
Christoph Galuschka |
4fdfe1 |
t_Log 'zcat failed'
|
|
Christoph Galuschka |
4fdfe1 |
exit
|
|
Christoph Galuschka |
4fdfe1 |
fi
|
|
Christoph Galuschka |
4fdfe1 |
|
|
Christoph Galuschka |
4fdfe1 |
|
|
Christoph Galuschka |
4fdfe1 |
#run file through gunzip
|
|
Christoph Galuschka |
4fdfe1 |
gunzip $FILE.gz
|
|
Christoph Galuschka |
4fdfe1 |
|
|
Christoph Galuschka |
4fdfe1 |
#checking file contents
|
|
Christoph Galuschka |
4fdfe1 |
grep -q 'gzip-test of single file' $FILE
|
|
Christoph Galuschka |
4fdfe1 |
|
|
Christoph Galuschka |
4fdfe1 |
t_CheckExitStatus $?
|
|
Christoph Galuschka |
4fdfe1 |
|
|
Christoph Galuschka |
4fdfe1 |
#reversing changes
|
|
Christoph Galuschka |
4fdfe1 |
/bin/rm -rf $FILE*
|