bstinson / centos / t_functional

Forked from centos/t_functional 4 years ago
Clone

Blame tests/p_bzip2/10-bzip2-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 bzip2,bzcat and bunzip2 test."
Christoph Galuschka 4fdfe1
Christoph Galuschka 4fdfe1
# create file
Christoph Galuschka 4fdfe1
FILE=/var/tmp/bzip2-test.txt
Christoph Galuschka 4fdfe1
Christoph Galuschka 4fdfe1
cat > $FILE <
Christoph Galuschka 4fdfe1
bzip2-test of single file
Christoph Galuschka 4fdfe1
EOF
Christoph Galuschka 4fdfe1
Christoph Galuschka 4fdfe1
# run file through bzip2
Christoph Galuschka 4fdfe1
bzip2 $FILE
trishnaguha a17e62
#just to make sure
Christoph Galuschka 4fdfe1
/bin/rm -rf $FILE
Christoph Galuschka 4fdfe1
Christoph Galuschka 4fdfe1
#run file through bzcat
Christoph Galuschka 4fdfe1
bzcat $FILE.bz2 | grep -q 'bzip2-test of single file'
Christoph Galuschka 4fdfe1
if [ $? == 1 ]
Christoph Galuschka 4fdfe1
  then
Christoph Galuschka 4fdfe1
  t_Log 'bzcat failed'
Christoph Galuschka 4fdfe1
  exit
Christoph Galuschka 4fdfe1
fi
Christoph Galuschka 4fdfe1
Christoph Galuschka 4fdfe1
#run file through bunzip2
Christoph Galuschka 4fdfe1
bunzip2 $FILE.bz2
Christoph Galuschka 4fdfe1
Christoph Galuschka 4fdfe1
#checking file contents
Christoph Galuschka 4fdfe1
grep -q 'bzip2-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*