bstinson / centos / t_functional

Forked from centos/t_functional 4 years ago
Clone

Blame tests/p_lzop/lzop_test.sh

Christoph Galuschka 9d9640
#!/bin/sh
Christoph Galuschka 9d9640
# Author: Vivek Dubey <dvivek@thoughtworks.com>
Christoph Galuschka 9d9640
# Akshay Karle <akshayka@thoughtworks.com>
Christoph Galuschka 4042b4
# Christoph Galuschka <christoph.galuschka@chello.at>
Christoph Galuschka 9d9640
Christoph Galuschka eebee6
t_Log "Running $0 - testing lzop compression and decompression"
Christoph Galuschka 9d9640
Christoph Galuschka eb4cba
if [ $centos_ver = 5 ]
Christoph Galuschka eb4cba
  then
Christoph Galuschka eb4cba
  t_Log "This is a C5 system. Skipping."
Christoph Galuschka eb4cba
  ret_val=0
Christoph Galuschka 0c0a39
elif [ $(t_GetArch) = i686 ]
Christoph Galuschka eebee6
  then
Christoph Galuschka eebee6
  t_Log "Package not available in i386 architecture. Skipping"
Christoph Galuschka eebee6
  ret_val=0
Christoph Galuschka eb4cba
else
Christoph Galuschka eb4cba
  FILE1=/tmp/testfile.txt
Christoph Galuschka eb4cba
  FILE2=/tmp/testfile.lzo
Christoph Galuschka 9d9640
Christoph Galuschka eb4cba
  echo 'CentOS' > ${FILE1}
Christoph Galuschka 9d9640
Christoph Galuschka eb4cba
  # running compression
Christoph Galuschka eb4cba
  lzop -9 ${FILE1} -o ${FILE2}
Christoph Galuschka eb4cba
  /bin/rm ${FILE1}
Christoph Galuschka 9d9640
Christoph Galuschka eb4cba
  lzop -d ${FILE2} -o ${FILE1}
Christoph Galuschka eb4cba
  /bin/rm ${FILE2}
Christoph Galuschka 9d9640
Christoph Galuschka eb4cba
  #checking file content
Christoph Galuschka eb4cba
  grep -q 'CentOS' ${FILE1}
Christoph Galuschka eb4cba
  ret_val=$?
Christoph Galuschka 9d9640
Christoph Galuschka eb4cba
  #clean up
Christoph Galuschka eb4cba
  /bin/rm ${FILE1}
Christoph Galuschka eb4cba
fi
Christoph Galuschka eb4cba
Christoph Galuschka eb4cba
t_CheckExitStatus $ret_val