From d49afb26ca7f35dd525d3f2132c284d17563413b Mon Sep 17 00:00:00 2001 From: Iain Douglas Date: Dec 01 2012 21:53:33 +0000 Subject: Merge remote branch 'upstream/master' --- diff --git a/tests/p_attr/attr_check_installed.sh b/tests/p_attr/attr_check_installed.sh index 9b00b43..e27b007 100755 --- a/tests/p_attr/attr_check_installed.sh +++ b/tests/p_attr/attr_check_installed.sh @@ -14,7 +14,7 @@ mkdir /mnt/attr_test mount -t ext3 -o loop,user_xattr /tmp/attrtest.img /mnt/attr_test touch /mnt/attr_test/testfile setfattr -n user.test /mnt/attr_test/testfile -getfattr /mnt/attr_test/testfile | grep -o "user.test" +getfattr /mnt/attr_test/testfile | grep -oq "user.test" t_CheckExitStatus $? diff --git a/tests/p_exim/0-install_exim.sh b/tests/p_exim/0-install_exim.sh index 4685ddc..d50c44c 100755 --- a/tests/p_exim/0-install_exim.sh +++ b/tests/p_exim/0-install_exim.sh @@ -2,6 +2,8 @@ # Author: Athmane Madjoudj # Christoph Galuschka +t_Log "Running $0 - remove unused MTAs and install exim" + if (t_GetPkgRel basesystem | grep -q el5) then t_InstallPackage exim diff --git a/tests/p_grep/11-test_grep.sh b/tests/p_grep/11-test_grep.sh index 9645502..70b63d6 100755 --- a/tests/p_grep/11-test_grep.sh +++ b/tests/p_grep/11-test_grep.sh @@ -5,5 +5,5 @@ t_Log "Running $0 - checking grep functionality" -echo "wow grep is working" | grep "wow" +echo "wow grep is working" | grep -q "wow" t_CheckExitStatus $? diff --git a/tests/p_grep/test b/tests/p_grep/test deleted file mode 100644 index 3758846..0000000 --- a/tests/p_grep/test +++ /dev/null @@ -1,6 +0,0 @@ -wow this session -is awesome. -wow once again -i want this session. -wow for the sake of -mamu. diff --git a/tests/p_gzip/0_install_gzip.sh b/tests/p_gzip/0_install_gzip.sh index a67aa81..30d3a44 100755 --- a/tests/p_gzip/0_install_gzip.sh +++ b/tests/p_gzip/0_install_gzip.sh @@ -2,5 +2,4 @@ # Author: Christoph Galuschka t_Log "Running $0 - attempting to install gzip." -t_InstallPackage gzip ncompress zip diffutils less util-linux-ng - +t_InstallPackage gzip ncompress zip diffutils less util-linux-ng expect diff --git a/tests/p_gzip/20-gzip-test b/tests/p_gzip/20-gzip-test index 9541902..7214c31 100755 --- a/tests/p_gzip/20-gzip-test +++ b/tests/p_gzip/20-gzip-test @@ -62,7 +62,13 @@ gzip -f $FILE || ExitFail # Check that -a is ignored t_Log "Check -a is ignored as we're on CentOS" -gunzip -a $FILE.gz 2>&1 | head -n 1 | grep -q 'gzip: option --ascii ignored on this system' || ExitFail +if [ $centos_ver == '5' ] + then + gunzip -a $FILE.gz 2>&1 | head -n 1 | grep -q 'gunzip: option --ascii ignored on this system' || ExitFail +elif [ $centos_ver == '6' ] + then + gunzip -a $FILE.gz 2>&1 | head -n 1 | grep -q 'gzip: option --ascii ignored on this system' || ExitFail +fi # Check -c writes to stdout t_Log "check -c writes to stdout" diff --git a/tests/p_lftp/20_lftp_ftp.sh b/tests/p_lftp/20_lftp_ftp.sh index 7df9f02..b0104c1 100755 --- a/tests/p_lftp/20_lftp_ftp.sh +++ b/tests/p_lftp/20_lftp_ftp.sh @@ -36,6 +36,5 @@ fi rm -f $TESTFILE rm -f $SOURCE$FILE t_ServiceControl vsftpd stop -t_RemovePackage vsftpd t_CheckExitStatus $ret_val diff --git a/tests/p_net-snmp/0-install_snmpd.sh b/tests/p_net-snmp/0-install_snmpd.sh index 8cf63be..413c167 100755 --- a/tests/p_net-snmp/0-install_snmpd.sh +++ b/tests/p_net-snmp/0-install_snmpd.sh @@ -1,10 +1,10 @@ #!/bin/bash # Author: Christoph Galuschka -t_Log "Running $0 - attempting to install net-snmp" +t_Log "Running $0 - attempting to install net-snmp, net-snmp-utils" -# Install net-snmp -t_InstallPackage net-snmp +# Install net-snmp and net-snmp-utils +t_InstallPackage net-snmp net-snmp-utils # start daemon with default settings t_ServiceControl snmpd start diff --git a/tests/p_net-snmp/snmpv1_test.sh b/tests/p_net-snmp/snmpv1_test.sh index 8931d71..4c59649 100755 --- a/tests/p_net-snmp/snmpv1_test.sh +++ b/tests/p_net-snmp/snmpv1_test.sh @@ -3,8 +3,6 @@ t_Log "Running $0 - snmpv1 test" -t_InstallPackage net-snmp-utils - snmpwalk -v 1 -c public 127.0.0.1 > /dev/null 2>&1 t_CheckExitStatus $? diff --git a/tests/p_net-snmp/snmpv2c_test.sh b/tests/p_net-snmp/snmpv2c_test.sh index 35f9779..1de9f7d 100755 --- a/tests/p_net-snmp/snmpv2c_test.sh +++ b/tests/p_net-snmp/snmpv2c_test.sh @@ -4,8 +4,6 @@ t_Log "Running $0 - snmpv2c test" -t_InstallPackage net-snmp-utils - snmpwalk -v 2c -c public 127.0.0.1 > /dev/null 2>&1 t_CheckExitStatus $? diff --git a/tests/p_net-snmp/snmpv3_test.sh b/tests/p_net-snmp/snmpv3_test.sh index 5328744..3628564 100755 --- a/tests/p_net-snmp/snmpv3_test.sh +++ b/tests/p_net-snmp/snmpv3_test.sh @@ -4,8 +4,6 @@ t_Log "Running $0 - snmpv3 test" -t_InstallPackage net-snmp-utils - # Make Backup of snmpd.conf and add V3-settings /bin/cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig echo 'rouser centosro' >> /etc/snmp/snmpd.conf diff --git a/tests/p_passwd/20_root_tests b/tests/p_passwd/20_root_tests index c2cb9a1..078d0f1 100755 --- a/tests/p_passwd/20_root_tests +++ b/tests/p_passwd/20_root_tests @@ -44,15 +44,19 @@ fi # Check that passwd -e expires an account. Field 3 of /etc/shadow is set to 0 t_Log "Check password can be expired" -passwd -e passtest &>/dev/null - -if [ $? -eq "0" ] -then +if [ $centos_ver == '5' ] + then + t_Log 'This is a C5 system - option -e does not exist - skipping' +else + passwd -e passtest &>/dev/null + if [ $? -eq "0" ] + then getent shadow passtest | cut -f3 -d: | grep '^0' &>/dev/null t_CheckExitStatus $? echo passtest | passwd --stdin passtest &>/dev/null -else + else ExitFail + fi fi # Check that passwd -n, -x, -w -i set the mindays, maxdays, warndays and diff --git a/tests/p_postfix/0-install_postfix.sh b/tests/p_postfix/0-install_postfix.sh index 9edb4a7..db7b1ec 100755 --- a/tests/p_postfix/0-install_postfix.sh +++ b/tests/p_postfix/0-install_postfix.sh @@ -1,12 +1,13 @@ #!/bin/bash # Author: Athmane Madjoudj +t_Log "Running $0 - remove unused MTAs and install postfix" + # Remove other MTAs t_ServiceControl sendmail stop t_ServiceControl exim stop sleep 3 -t_RemovePackage sendmail -t_RemovePackage exim +t_RemovePackage sendmail exim # Postfix t_InstallPackage postfix diff --git a/tests/p_postfix/1-test-sendmail.sh b/tests/p_postfix/1-test-sendmail.sh deleted file mode 100755 index 23c1184..0000000 --- a/tests/p_postfix/1-test-sendmail.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# Author: Christoph Galuschka - -t_Log "Running $0 - testing if /usr/sbin/sendmail for postfix is sane." - -mta=$(ls -H /usr/sbin/sendmail) - -if [ $mta == '/usr/sbin/sendmail' ] - then - t_Log "link to sendmail seems to be sane" - ret_val=0 -else - t_Log "link to sendmail seems to be wrong" - ret_val=1 -fi - -t_CheckExitStatus $ret_val diff --git a/tests/p_postfix/10_postfix_smtp.sh b/tests/p_postfix/10_postfix_smtp.sh new file mode 100755 index 0000000..7489f6d --- /dev/null +++ b/tests/p_postfix/10_postfix_smtp.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# Author: Athmane Madjoudj + +t_Log "Running $0 - Postfix SMTP test." + +echo "helo test" | nc -w 3 localhost 25 | grep -q '250' + +t_CheckExitStatus $? diff --git a/tests/p_postfix/20_postfix_mta.sh b/tests/p_postfix/20_postfix_mta.sh new file mode 100755 index 0000000..7379b35 --- /dev/null +++ b/tests/p_postfix/20_postfix_mta.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - postfix can accept and deliver local email." + +MAILSPOOL=/var/spool/mail/root + +# make shure spool file is empty +cat /dev/null > $MAILSPOOL +ret_val=1 + +# send mail to localhost +echo -e "helo localhost\nmail from: root@localhost\nrcpt to: root@localhost\ndata\nt_functional test\n.\nquit\n" | nc -w 5 localhost 25 | grep -q "250 2.0.0" +if [ $? = 0 ] + then + t_Log 'Mail has been queued successfully' + MTA_ACCEPT=0 +fi + +sleep 1 +grep -q 't_functional test' $MAILSPOOL +if [ $? = 0 ] + then + t_Log 'previously sent mail is in '$MAILSPOOL + SPOOLFILE=0 +fi + +if ([ $MTA_ACCEPT = 0 ] && [ $SPOOLFILE = 0 ]) + then + ret_val=0 +fi + +t_CheckExitStatus $ret_val + diff --git a/tests/p_postfix/postfix_smtp.sh b/tests/p_postfix/postfix_smtp.sh deleted file mode 100755 index 7489f6d..0000000 --- a/tests/p_postfix/postfix_smtp.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# Author: Athmane Madjoudj - -t_Log "Running $0 - Postfix SMTP test." - -echo "helo test" | nc -w 3 localhost 25 | grep -q '250' - -t_CheckExitStatus $? diff --git a/tests/p_ruby/0-install-ruby.sh b/tests/p_ruby/0-install-ruby.sh index 14d98b9..1a3f4ec 100755 --- a/tests/p_ruby/0-install-ruby.sh +++ b/tests/p_ruby/0-install-ruby.sh @@ -5,8 +5,5 @@ # Author: Saager Mhatre t_Log "Running $0 - attempting to install ruby, ruby-irb, ruby-ri and ruby-rdoc4" -t_InstallPackage ruby -t_InstallPackage ruby-irb -t_InstallPackage ruby-ri -t_InstallPackage ruby-rdoc +t_InstallPackage ruby ruby-irb ruby-ri ruby-rdoc diff --git a/tests/p_ruby/25_ruby_hello-world.sh b/tests/p_ruby/25_ruby_hello-world.sh new file mode 100755 index 0000000..b2e21cf --- /dev/null +++ b/tests/p_ruby/25_ruby_hello-world.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - ruby can run 'hello world'" + +# create ruby script +FILE=/var/tmp/test.rb +cat > $FILE < +t_Log "Running $0 - remove unused MTAs and install sendmail" + t_InstallPackage sendmail # Remove other MTAs t_ServiceControl postfix stop t_ServiceControl exim stop sleep 3 -t_RemovePackage postfix -t_RemovePackage exim +t_RemovePackage postfix exim t_ServiceControl sendmail start diff --git a/tests/p_sendmail/20_sendmail_mta.sh b/tests/p_sendmail/20_sendmail_mta.sh new file mode 100755 index 0000000..69a5c38 --- /dev/null +++ b/tests/p_sendmail/20_sendmail_mta.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# Author: Christoph Galuschka + +t_Log "Running $0 - sendmail can accept and deliver local email." + +MAILSPOOL=/var/spool/mail/root + +# make shure spool file is empty +cat /dev/null > $MAILSPOOL +ret_val=1 + +# send mail to localhost +echo -e "helo localhost\nmail from: root@localhost\nrcpt to: root@localhost\ndata\nt_functional test\n.\nquit\n" | nc -w 5 localhost 25 | grep -q "250 2.0.0" +if [ $? = 0 ] + then + t_Log 'Mail has been queued successfully' + MTA_ACCEPT=0 +fi + +sleep 1 +grep -q 't_functional test' $MAILSPOOL +if [ $? = 0 ] + then + t_Log 'previously sent mail is in '$MAILSPOOL + SPOOLFILE=0 +fi + +if ([ $MTA_ACCEPT = 0 ] && [ $SPOOLFILE = 0 ]) + then + ret_val=0 +fi + +t_CheckExitStatus $ret_val + diff --git a/tests/p_vsftpd/vsftpd_anonymous_login.sh b/tests/p_vsftpd/vsftpd_anonymous_login.sh index ad26f35..0a04a6f 100755 --- a/tests/p_vsftpd/vsftpd_anonymous_login.sh +++ b/tests/p_vsftpd/vsftpd_anonymous_login.sh @@ -3,6 +3,6 @@ t_Log "Running $0 - vsFTPd anonymous can login test." -echo -e "user anonymous\npass password\nquit" | nc localhost 21 | grep "230 Login successful." +echo -e "user anonymous\npass password\nquit" | nc localhost 21 | grep -q "230 Login successful." t_CheckExitStatus $? diff --git a/tests/p_vsftpd/vsftpd_localusers_login.sh b/tests/p_vsftpd/vsftpd_localusers_login.sh index d2abce1..ca122c8 100755 --- a/tests/p_vsftpd/vsftpd_localusers_login.sh +++ b/tests/p_vsftpd/vsftpd_localusers_login.sh @@ -9,7 +9,7 @@ t_Log "Running $0 - vsFTPd local user can login test." # Fix SELinux boolean setsebool ftp_home_dir 1 -echo -e "user ftptest\npass ftptest\nquit" | nc localhost 21 | grep "230 Login successful." +echo -e "user ftptest\npass ftptest\nquit" | nc localhost 21 | grep -q "230 Login successful." t_CheckExitStatus $?