bstinson / centos / t_functional

Forked from centos/t_functional 4 years ago
Clone

Blame tests/p_gzip/80-zmore-tests

iaind 56c8c8
#!/bin/bash
iaind 56c8c8
# Author: Iain Douglas <centos@1n6.org.uk>
iaind 56c8c8
iaind 56c8c8
t_Log "Running $0 Testing zmore"
iaind 56c8c8
iaind 56c8c8
# The zmore utility is just a wrapper round more which should be 
iaind 56c8c8
# tested as part of p_util-linux-ng. It does however deal with 
iaind 56c8c8
# multiple files for more so test that.
iaind 56c8c8
iaind 56c8c8
TESTFILE="./tests/p_gzip/gzip-test.txt.gz"
iaind 56c8c8
t_Log "Check single file invocation"
Pablo Greco edbc89
zmore $TESTFILE | grep -q -- 'gzip-test of single file'
iaind 56c8c8
t_CheckExitStatus $?
iaind 56c8c8
iaind 56c8c8
# Check multifile invocation 
iaind 56c8c8
iaind 56c8c8
t_Log "Check multifile invocation"
iaind 56c8c8
Pablo Greco edbc89
if [ $centos_ver -ge 8 ]
Pablo Greco edbc89
then
Pablo Greco edbc89
expect << EOF &>/dev/null
Pablo Greco edbc89
spawn zmore $TESTFILE $TESTFILE
Pablo Greco edbc89
set timeout 2
Pablo Greco edbc89
set match_max 1000
Pablo Greco edbc89
expect -- "gzip-test of single file"
Pablo Greco edbc89
expect -- "gzip-test of single file" {exit 0}
Pablo Greco edbc89
exit 1
Pablo Greco edbc89
EOF
Pablo Greco edbc89
retval=$?
Pablo Greco edbc89
else
iaind 56c8c8
expect << EOF &>/dev/null
iaind 56c8c8
spawn zmore $TESTFILE $TESTFILE
iaind 56c8c8
set timeout 2 
iaind 56c8c8
set match_max 1000
iaind 56c8c8
expect -- "--More--(Next file: ./tests/p_gzip/gzip-test.txt.gz)" {send n} timeout {exit 1 }
iaind 56c8c8
expect -- "gzip-test of single file" {exit 0} 
iaind 56c8c8
exit 1
iaind 56c8c8
EOF
Pablo Greco edbc89
retval=$?
Pablo Greco edbc89
fi
iaind 56c8c8
Pablo Greco edbc89
t_CheckExitStatus $retval
iaind 56c8c8
iaind 56c8c8