bstinson / centos / t_functional

Forked from centos/t_functional 4 years ago
Clone

Blame tests/p_gzip/30-gzexe-test

iaind 56c8c8
#!/bin/bash
iaind 56c8c8
#Author: Iain Douglas <centos@1n6.org.uk>
iaind 56c8c8
iaind 56c8c8
function ExitFail {
iaind 56c8c8
    t_Log "FAIL"
iaind 56c8c8
    exit $FAIL
iaind 56c8c8
}
iaind 56c8c8
iaind 56c8c8
t_Log Running $0 Check gzexe
iaind 56c8c8
iaind 56c8c8
# Create a file to work with
iaind 56c8c8
iaind 56c8c8
t_Log "Create file to work with"
iaind 56c8c8
iaind 56c8c8
FILE=/var/tmp/gzexe-test-script
iaind 56c8c8
rm $FILE* $OUTPUT &>/dev/null
iaind 56c8c8
iaind 56c8c8
cat <<EOF >$FILE
iaind 56c8c8
#!/bin/bash
iaind 56c8c8
echo "Hello World"
iaind 56c8c8
EOF
iaind 56c8c8
iaind 56c8c8
chmod +x $FILE
iaind 56c8c8
$FILE | grep -q "Hello World" || ExitFail
iaind 56c8c8
iaind 56c8c8
t_Log "Run file through gzexe"
iaind 56c8c8
iaind 56c8c8
gzexe $FILE &>/dev/null || ExitFail
iaind 56c8c8
iaind 56c8c8
t_Log "Check resultant file runs"
iaind 56c8c8
$FILE | grep -q "Hello World"
iaind 56c8c8
t_CheckExitStatus $?
iaind 56c8c8
iaind 56c8c8
#Cleanup
iaind 56c8c8
rm $FILE* 2>/dev/null
iaind 56c8c8