From 9c75e653f785fd49af73ba63e1c88ddc66924dc2 Mon Sep 17 00:00:00 2001 From: Christoph Galuschka Date: Jul 27 2012 21:17:10 +0000 Subject: Merge remote branch 'upstream/master' --- diff --git a/AUTHORS b/AUTHORS index be5451e..6f5b94a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -7,3 +7,7 @@ Steve Barnes Johnny Hughes Christoph Galuschka Dan Trainor +Nikhil Lanjewar +Sahil Muthoo +Sahil Aggarwal +Saager Mhatre diff --git a/runtests.sh b/runtests.sh index a5e8427..1acf223 100755 --- a/runtests.sh +++ b/runtests.sh @@ -19,10 +19,15 @@ set -e set -u # process our test scripts -t_Process <(/usr/bin/find ./tests/0_*/ -type f|sort -t'/' ) -t_Process <(/usr/bin/find ./tests/p_*/ -type f|sort -t'/' ) -t_Process <(/usr/bin/find ./tests/r_*/ -type f|sort -t'/' ) -t_Process <(/usr/bin/find ./tests/z_*/ -type f|sort -t'/' ) +if [ $# -gt 0 ]; then + t_Process <(/usr/bin/find ./tests/0_*/ -type f|sort -t'/' ) + t_Process <(/usr/bin/find ./tests/$1/ -type f|sort -t'/' ) +else + t_Process <(/usr/bin/find ./tests/p_*/ -type f|sort -t'/' ) + t_Process <(/usr/bin/find ./tests/0_*/ -type f|sort -t'/' ) + t_Process <(/usr/bin/find ./tests/r_*/ -type f|sort -t'/' ) + t_Process <(/usr/bin/find ./tests/z_*/ -type f|sort -t'/' ) +fi # and, we're done. t_Log "QA t_functional tests finished." diff --git a/tests/0_lib/functions.sh b/tests/0_lib/functions.sh index de4093c..8643624 100755 --- a/tests/0_lib/functions.sh +++ b/tests/0_lib/functions.sh @@ -115,6 +115,12 @@ function t_GetArch rpm -q --queryformat '%{arch}\n' centos-release } +function t_Assert +{ + $@ >/dev/null 2>&1 + t_CheckExitStatus $? +} + export -f t_Log export -f t_CheckExitStatus export -f t_InstallPackage @@ -126,3 +132,4 @@ export -f t_GetPkgRel export -f t_DistCheck export -f t_GetPkgVer export -f t_GetArch +export -f t_Assert diff --git a/tests/p_bc/0-install_bc.sh b/tests/p_bc/0-install_bc.sh new file mode 100755 index 0000000..2107276 --- /dev/null +++ b/tests/p_bc/0-install_bc.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Author : Varadharajan M +# Manoj Mahalingam +t_InstallPackage bc +t_CheckExitStatus $? diff --git a/tests/p_bc/bc-test-basic-functionalities.sh b/tests/p_bc/bc-test-basic-functionalities.sh new file mode 100644 index 0000000..716b9a1 --- /dev/null +++ b/tests/p_bc/bc-test-basic-functionalities.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author : Varadharajan M +# Manoj Mahalingam + +t_Log "Running $0 - Testing basic bc functionalities" +test `echo "5 + 6 * 5 / 10 - 1" | bc` -eq "7" ; t_CheckExitStatus $? diff --git a/tests/p_bc/bc-test-installation.sh b/tests/p_bc/bc-test-installation.sh new file mode 100644 index 0000000..a58d7a1 --- /dev/null +++ b/tests/p_bc/bc-test-installation.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# Author : Varadharajan M +# Manoj Mahalingam + + +t_Log "Running $0 - Test bc is installed" +bc --version +t_CheckExitStatus $? diff --git a/tests/p_file/00_file_package.sh b/tests/p_file/00_file_package.sh new file mode 100755 index 0000000..402649c --- /dev/null +++ b/tests/p_file/00_file_package.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +t_Log "Running $0 - checking if file package is installed" + +t_Assert "rpm -q file" diff --git a/tests/p_file/01_file_mime_application.sh b/tests/p_file/01_file_mime_application.sh new file mode 100755 index 0000000..6645fa5 --- /dev/null +++ b/tests/p_file/01_file_mime_application.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +t_Log "Running $0 - checking if file can recognixe mime executable type " + +file /bin/bash --mime-type | grep "application/x-executable" + +t_CheckExitStatus $? diff --git a/tests/p_file/02_file_mime_image.sh b/tests/p_file/02_file_mime_image.sh new file mode 100755 index 0000000..bae423e --- /dev/null +++ b/tests/p_file/02_file_mime_image.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +t_Log "Running $0 - checking if file can recognize image mime file type " + +file /usr/lib/anaconda-runtime/boot/syslinux-splash.png --mime-type | grep 'image/png' + +t_CheckExitStatus $? + diff --git a/tests/p_file/03_file_mime_symlink.sh b/tests/p_file/03_file_mime_symlink.sh new file mode 100755 index 0000000..e8c3211 --- /dev/null +++ b/tests/p_file/03_file_mime_symlink.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +t_Log "Running $0 - checking if file can recognize symlink mime file type " + +file /etc/favicon.png --mime-type | grep 'application/x-symlink' + +t_CheckExitStatus $? diff --git a/tests/p_git/0-install_git.sh b/tests/p_git/0-install_git.sh new file mode 100755 index 0000000..872e5e3 --- /dev/null +++ b/tests/p_git/0-install_git.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Author: Pratima Singh , Nilesh Bairagi , Madhurranjan Mohaan + +# Install git +t_Log "Running $0 - installing git" + +t_InstallPackage git diff --git a/tests/p_git/10-test_git.sh b/tests/p_git/10-test_git.sh new file mode 100755 index 0000000..ba249f6 --- /dev/null +++ b/tests/p_git/10-test_git.sh @@ -0,0 +1,6 @@ +#!/bin/bash +# Author: Pratima Singh , Nilesh Bairagi , Madhurranjan Mohaan + +# Check git installation +git --version +t_CheckExitStatus $? diff --git a/tests/p_git/11-test_git_clone.sh b/tests/p_git/11-test_git_clone.sh new file mode 100755 index 0000000..f7118dd --- /dev/null +++ b/tests/p_git/11-test_git_clone.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Author: Pratima Singh , Nilesh Bairagi , Madhurranjan Mohaan + +# Testing Git clone by comparing SHAs +rm -rf /tmp/temprepo/ /tmp/cloned_repo/ /tmp/testing_clone_repo +temp_repo="/tmp/temprepo" +SHA1=`echo "hello world" | git hash-object --stdin` +mkdir -p $temp_repo +cd $temp_repo +git init . --bare +cd /tmp +git clone $temp_repo cloned_repo +cd cloned_repo +echo "hello world" > hello +git add hello +git commit -m "Temp commit" +git push origin master + +git clone $temp_repo /tmp/testing_clone_repo +cd /tmp/testing_clone_repo +SHA2=`cat hello | git hash-object --stdin` +expr $SHA1 == $SHA2 2>&1 +t_CheckExitStatus $? diff --git a/tests/p_git/12-test_git_log.sh b/tests/p_git/12-test_git_log.sh new file mode 100755 index 0000000..89d0ba8 --- /dev/null +++ b/tests/p_git/12-test_git_log.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Author: Pratima Singh , Nilesh Bairagi , Madhurranjan Mohaan + +# Tsting git log and git commit msgs +rm -rf /tmp/temprepo/ /tmp/cloned_repo/ +temp_repo="/tmp/temprepo" +mkdir -p $temp_repo +cd $temp_repo +git init . --bare +cd /tmp +git clone $temp_repo cloned_repo +cd cloned_repo +echo "hello world" > hello +git add hello +git commit -m "Temp commit" 2>&1 +git log --grep="Temp commit" 2>&1 +t_CheckExitStatus $? diff --git a/tests/p_lftp/0_install_lftp.sh b/tests/p_lftp/0_install_lftp.sh new file mode 100755 index 0000000..724e4bf --- /dev/null +++ b/tests/p_lftp/0_install_lftp.sh @@ -0,0 +1,7 @@ +# Author: Piyush Kumar +# Author: Munish Kumar +# Author: Ayush Gupta +# Author: Konark Modi + +t_Log "Running $0 -installing lftp." +t_InstallPackage lftp diff --git a/tests/p_lftp/10_lftp_http_test.sh b/tests/p_lftp/10_lftp_http_test.sh new file mode 100755 index 0000000..40d7b0e --- /dev/null +++ b/tests/p_lftp/10_lftp_http_test.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# Author: Piyush Kumar +# Author: Munish Kumar +# Author: Ayush Gupta +# Author: Konark Modi + +t_Log "Running $0 - lftp: HTTP test" +if [ $SKIP_QA_HARNESS ]; then +CHECK_FOR="UTC" +URL="http://mirror.centos.org/centos//timestamp.txt" +else +CHECK_FOR="UTC" +URL="http://mirror.centos.org/centos//timestamp.txt" +fi + +t_Log "Querying ${URL}" + +lftp << EOF +pget -n 5 ${URL} +bye +EOF + +grep -q "${CHECK_FOR}" timestamp.txt +ret_val=$? +rm timestamp.txt +t_CheckExitStatus $ret_val diff --git a/tests/p_lftp/20_lftp_ftp.sh b/tests/p_lftp/20_lftp_ftp.sh new file mode 100755 index 0000000..eedce86 --- /dev/null +++ b/tests/p_lftp/20_lftp_ftp.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# Author: Piyush Kumar +# Author: Munish Kumar +# Author: Ayush Gupta +# Author: Konark Modi +FILE=/tmp/test_lftp_ftp.txt + +if [ $SKIP_QA_HARNESS ]; then +URL="ftp://ftp.freebsd.org/pub/FreeBSD/" +else +URL="ftp://ftp.freebsd.org/pub/FreeBSD/" +fi + + +lftp -e 'set net:timeout 10; get README.TXT -o $FILE; bye' $URL > /dev/null 2>&1 +t_Log "Running $0 - lftp test with FTP test." +if [ -f $FILE ] + then + grep -ci 'konark' $FILE + ret_val=$? + else + t_Log "FTP test for lftp failed" + ret_val=$? +fi +rm -f $FILE +t_CheckExitStatus $ret_val diff --git a/tests/p_network/networking_enabled_test.sh b/tests/p_network/networking_enabled_test.sh index fbc1c1c..84e54c2 100755 --- a/tests/p_network/networking_enabled_test.sh +++ b/tests/p_network/networking_enabled_test.sh @@ -3,7 +3,7 @@ t_Log "Running $0 - Check if networking is enabled." -grep -q 'NETWORKING=yes' /etc/sysconfig/network +grep -Eqi "NETWORKING=.*yes" /etc/sysconfig/network t_CheckExitStatus $? diff --git a/tests/p_ruby/0-install-ruby.sh b/tests/p_ruby/0-install-ruby.sh new file mode 100755 index 0000000..14d98b9 --- /dev/null +++ b/tests/p_ruby/0-install-ruby.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# Author: Nikhil Lanjewar +# Author: Sahil Muthoo +# Author: Sahil Aggarwal +# 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 + diff --git a/tests/p_ruby/10-ruby-installed-test.sh b/tests/p_ruby/10-ruby-installed-test.sh new file mode 100755 index 0000000..cf3783e --- /dev/null +++ b/tests/p_ruby/10-ruby-installed-test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Author: Nikhil Lanjewar +# Author: Sahil Muthoo +# Author: Sahil Aggarwal +# Author: Saager Mhatre + +t_Log "Running $0 - Check successful installation of ruby." +ruby -v +t_CheckExitStatus $? + diff --git a/tests/p_ruby/20-ruby-version-test.sh b/tests/p_ruby/20-ruby-version-test.sh new file mode 100755 index 0000000..94bef97 --- /dev/null +++ b/tests/p_ruby/20-ruby-version-test.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# Author: Nikhil Lanjewar +# Author: Sahil Muthoo +# Author: Sahil Aggarwal +# Author: Saager Mhatre + +t_Log "Running $0 - Check successful installation of ruby." +ruby -v | grep -q '1.8.7' +t_CheckExitStatus $? + diff --git a/tests/p_ruby/30-irb-test.sh b/tests/p_ruby/30-irb-test.sh new file mode 100755 index 0000000..53e09d8 --- /dev/null +++ b/tests/p_ruby/30-irb-test.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# Author: Nikhil Lanjewar +# Author: Sahil Muthoo +# Author: Sahil Aggarwal +# Author: Saager Mhatre + +t_Log "Running $0 - Check successful installation of irb." + +irb -v | grep '0.9.5' + +t_CheckExitStatus $? + diff --git a/tests/p_ruby/40-ri-test.sh b/tests/p_ruby/40-ri-test.sh new file mode 100755 index 0000000..1a5d230 --- /dev/null +++ b/tests/p_ruby/40-ri-test.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# Author: Nikhil Lanjewar +# Author: Sahil Muthoo +# Author: Sahil Aggarwal +# Author: Saager Mhatre + +t_Log "Running $0 - Check successful installation of ruby ri." + +ri -v | grep 'v1.0.1' + +t_CheckExitStatus $? + diff --git a/tests/p_ruby/50-rdoc-test.sh b/tests/p_ruby/50-rdoc-test.sh new file mode 100755 index 0000000..9d351dd --- /dev/null +++ b/tests/p_ruby/50-rdoc-test.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# Author: Nikhil Lanjewar +# Author: Sahil Muthoo +# Author: Sahil Aggarwal +# Author: Saager Mhatre + +t_Log "Running $0 - Check successful installation of ruby rdoc." + +rdoc -v | grep 'V1.0.1' + +t_CheckExitStatus $? + diff --git a/tests_incomplete/p_0lzo/0-install_lzo.sh b/tests_incomplete/p_0lzo/0-install_lzo.sh new file mode 100755 index 0000000..d91ca7b --- /dev/null +++ b/tests_incomplete/p_0lzo/0-install_lzo.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Author: Vivek Dubey +# Akshay Karle + +t_InstallPackage lzop diff --git a/tests_incomplete/p_0lzo/abc b/tests_incomplete/p_0lzo/abc new file mode 100644 index 0000000..1aad27d --- /dev/null +++ b/tests_incomplete/p_0lzo/abc @@ -0,0 +1 @@ +blahblahblah diff --git a/tests_incomplete/p_0lzo/foo b/tests_incomplete/p_0lzo/foo new file mode 100644 index 0000000..1aad27d --- /dev/null +++ b/tests_incomplete/p_0lzo/foo @@ -0,0 +1 @@ +blahblahblah diff --git a/tests_incomplete/p_0lzo/foo.lzo b/tests_incomplete/p_0lzo/foo.lzo new file mode 100644 index 0000000..0cf13d8 Binary files /dev/null and b/tests_incomplete/p_0lzo/foo.lzo differ diff --git a/tests_incomplete/p_0lzo/test_lzo.sh b/tests_incomplete/p_0lzo/test_lzo.sh new file mode 100644 index 0000000..e9614a8 --- /dev/null +++ b/tests_incomplete/p_0lzo/test_lzo.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# Author: Vivek Dubey +# Akshay Karle + +echo 'blahblahblah' > /tmp/foo + +lzop -9v /tmp/foo -o /tmp/foo.lzo + +lzop -d /tmp/foo.lzo -o /tmp/abc + +rm -f /tmp/foo +rm -f /tmp/foo.lzo +rm -f /tmp/abc +t_CheckExitStatus $?