diff --git a/tests/0_common/50_set_OS-version.sh b/tests/0_common/50_set_OS-version.sh new file mode 100755 index 0000000..d3cb71d --- /dev/null +++ b/tests/0_common/50_set_OS-version.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Author: Christoph Galuschka + + +t_Log "Running $0 - Setting OS version to 5 or 6" + +OS_VERSION=$(t_DistCheck) diff --git a/tests/p_git/0-install_git.sh b/tests/p_git/0-install_git.sh index 872e5e3..e6352cd 100755 --- a/tests/p_git/0-install_git.sh +++ b/tests/p_git/0-install_git.sh @@ -1,7 +1,13 @@ #!/bin/bash # Author: Pratima Singh , Nilesh Bairagi , Madhurranjan Mohaan +# Christoph Galuschka -# Install git t_Log "Running $0 - installing git" -t_InstallPackage git +# Install git +if [ $OS_VERSION -eq '6' ] + then + t_InstallPackage git +else + t_Log "This test is skipped in CentOS5." +fi diff --git a/tests/p_git/10-test_git.sh b/tests/p_git/10-test_git.sh index ba249f6..66dfc37 100755 --- a/tests/p_git/10-test_git.sh +++ b/tests/p_git/10-test_git.sh @@ -1,6 +1,18 @@ #!/bin/bash # Author: Pratima Singh , Nilesh Bairagi , Madhurranjan Mohaan +# Christoph Galuschka # Check git installation -git --version -t_CheckExitStatus $? + +t_Log "Running $0 - checking git installation" + +if [ $OS_VERSION -eq '6' ] + then + git --version + ret_val=$? +else + t_Log "This test is skipped in CentOS5." + ret_val=0 +fi + +t_CheckExitStatus $ret_val diff --git a/tests/p_git/11-test_git_clone.sh b/tests/p_git/11-test_git_clone.sh index f7118dd..117118f 100755 --- a/tests/p_git/11-test_git_clone.sh +++ b/tests/p_git/11-test_git_clone.sh @@ -1,24 +1,37 @@ #!/bin/bash # Author: Pratima Singh , Nilesh Bairagi , Madhurranjan Mohaan +# Christoph Galuschka -# 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 +t_Log "Running $0 - testing a local git clone operation" -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 $? +if [ $OS_VERSION -eq '6' ] + then + # Testing Git clone by comparing SHAs + workpath=$(pwd) + 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 + ret_val=$? + cd $workpath +else + t_Log "This test is skipped in CentOS5." + ret_val=0 +fi + +t_CheckExitStatus $ret_val diff --git a/tests/p_git/12-test_git_log.sh b/tests/p_git/12-test_git_log.sh index 89d0ba8..ff5504b 100755 --- a/tests/p_git/12-test_git_log.sh +++ b/tests/p_git/12-test_git_log.sh @@ -1,18 +1,31 @@ #!/bin/bash # Author: Pratima Singh , Nilesh Bairagi , Madhurranjan Mohaan +# Christoph Galuschka -# 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 $? +t_Log "Running $0 - testing git logging and commit messages" + +if [ $OS_VERSION -eq '6' ] + then + # Testing git log and git commit msgs + workpath=$(pwd) + 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 + ret_val=$? + cd $workpath +else + t_Log "This test is skipped in CentOS5." + ret_val=0 +fi + +t_CheckExitStatus $ret_val