From aa2e404ba21cabe5ffc2b367cc7298521bc4bac4 Mon Sep 17 00:00:00 2001 From: Pratima, Madhurranjan, Nilesh Date: Jul 22 2012 12:10:04 +0000 Subject: Adding tests for basic git actions --- diff --git a/tests/p_0-git/0-install_git.sh b/tests/p_0-git/0-install_git.sh new file mode 100755 index 0000000..872e5e3 --- /dev/null +++ b/tests/p_0-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_0-git/10-test_git.sh b/tests/p_0-git/10-test_git.sh new file mode 100755 index 0000000..ba249f6 --- /dev/null +++ b/tests/p_0-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_0-git/11-test_git_clone.sh b/tests/p_0-git/11-test_git_clone.sh new file mode 100755 index 0000000..f7118dd --- /dev/null +++ b/tests/p_0-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_0-git/12-test_git_log.sh b/tests/p_0-git/12-test_git_log.sh new file mode 100755 index 0000000..89d0ba8 --- /dev/null +++ b/tests/p_0-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 $?