From beb06320b094609052df828a398f9685d6592f01 Mon Sep 17 00:00:00 2001 From: Christoph Galuschka Date: Dec 03 2012 19:49:20 +0000 Subject: Merge commit 'refs/merge-requests/33' of git://gitorious.org/testautomation/t_functional into merge-requests/33 --- diff --git a/tests/p_gzip/10-C5-test-binaries b/tests/p_gzip/10-C5-test-binaries new file mode 100755 index 0000000..52f3c13 --- /dev/null +++ b/tests/p_gzip/10-C5-test-binaries @@ -0,0 +1,41 @@ +#!/bin/bash +# Author: Iain Douglas +# +# Check the binaries from the CentOS 5 package exist and run ok + +function ExitFail { + t_Log "Fail" + exit $FAIL +} + +[ $centos_ver != '5' ] && exit + +# Some ov the binaries respond to a --version and some don't. Of those that +# don't, some exit with a status of 1 and others exit with a status of 2 +# nice and consistent NOT! + +t_Log "Checking binaries are present and run" +[ "$(readlink -e /usr/bin/gunzip)" == "/bin/gunzip" ] || ExitFail +[ "$(readlink -e /usr/bin/gzip)" == "/bin/gzip" ] || ExitFail + +for binary in gunzip gzip zcat gzexe zless +do + echo -n "$binary " + $binary --version &>/dev/null || ExitFail +done + +for binary in znew zmore zforce +do + echo -n "$binary " + $binary &>/dev/null + [ $? != '1' ] && ExitFail +done + +for binary in zgrep zfgrep zegrep zdiff zcmp +do + echo -n "$binary " + $binary &>/dev/null + [ $? != '2' ] && ExitFail +done +echo "" +t_Log "PASS" diff --git a/tests/p_gzip/10-test-binaries b/tests/p_gzip/10-test-binaries index 8f6b975..28b45c3 100755 --- a/tests/p_gzip/10-test-binaries +++ b/tests/p_gzip/10-test-binaries @@ -7,6 +7,8 @@ function ExitFail { t_Log "Fail" exit $FAIL } + +[ $centos_ver != '6' ] && exit t_Log "Checking binaries are present and run" [ "$(readlink -e /usr/bin/gunzip)" == "/bin/gunzip" ] || ExitFail diff --git a/tests/p_gzip/20-gzip-test b/tests/p_gzip/20-gzip-test index 7214c31..a8df5d5 100755 --- a/tests/p_gzip/20-gzip-test +++ b/tests/p_gzip/20-gzip-test @@ -101,7 +101,7 @@ gzip -lv $FILE | grep -q "d14bbb86" || ExitFail t_Log "check -n and -N work correctly" TZ_SAVE=$TZ -TZ=UTC +export TZ=UTC gunzip $FILE.gz ls -l --time-style=+"%F %R" $FILE | grep -q '2010-11-22 13:11' && ExitFail @@ -117,7 +117,7 @@ cp ./tests/p_gzip/gzip-test.txt.gz /var/tmp/gzip-test.txt.1.gz # The file should gunzip with it's original name and timestamp. gunzip -f -N $FILE.1.gz ls -l $FILE --time-style=+"%F %R" | grep -q '2010-11-22 13:11' || ExitFail -TZ=$TZ_SAVE +export TZ=$TZ_SAVE # Check that -t works and detects a damaged file t_Log "Check -t can detect a corrupt file" gzip $FILE