summaryrefslogtreecommitdiffstats
path: root/sanity/nightly_sanity/nightly_sanity.sh
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendrabhat@gluster.com>2011-09-21 16:38:20 +0530
committerRaghavendra Bhat <raghavendrabhat@gluster.com>2011-09-21 16:38:20 +0530
commit6aebc171a47f6c1fe1c9a4ea0a799e8ee38b1e70 (patch)
tree35f67903953d5bea8d5b06a5b5a07ed25654587f /sanity/nightly_sanity/nightly_sanity.sh
parent3cdb12adb81731153afc2c3bbed3929aad828df4 (diff)
nightly_sanity/nightly_sanity.sh: option for specifying the branch
Now the script looks into /root/branch file for deciding which branch it should checkout to and pull. If the branch mentioned in the file is not created it will try to create that branch. If wrong branch is given or if any error happens while checking out the branch, then script by default continues on master.
Diffstat (limited to 'sanity/nightly_sanity/nightly_sanity.sh')
-rwxr-xr-xsanity/nightly_sanity/nightly_sanity.sh41
1 files changed, 40 insertions, 1 deletions
diff --git a/sanity/nightly_sanity/nightly_sanity.sh b/sanity/nightly_sanity/nightly_sanity.sh
index 2a76521..8af244c 100755
--- a/sanity/nightly_sanity/nightly_sanity.sh
+++ b/sanity/nightly_sanity/nightly_sanity.sh
@@ -7,6 +7,25 @@ function _init ()
GIT_FILE="/tmp/git_head_`date +%F`";
rm /tmp/git_head*;
export PATH=$PATH:/usr/local/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/qa/tools
+
+ if [ ! -e /root/branch ]; then
+ touch /root/branch;
+ fi
+
+ cd $GIT_DIR;
+ branch=$(cat /root/branch);
+ echo $branch;
+ if [ "$branch" != "master" ]; then
+ checkout_branch;
+ if [ $? -ne 0 ]; then
+ branch="master";
+ git checkout $branch;
+ fi
+ else
+ branch="master";
+ git checkout $branch;
+ fi
+ cd -;
}
function update_git ()
@@ -59,6 +78,27 @@ function update_git ()
rm -f /root/patches/*;
}
+function checkout_branch ()
+{
+ local ret=0;
+ git branch | grep $branch;
+ if [ $? -ne 0 ]; then
+ git checkout -b $branch origin/$branch;
+ if [ $? -ne 0 ]; then
+ ret=22;
+ fi
+ fi
+
+ if [ $ret -eq 0 ]; then
+ git checkout $branch;
+ if [ $? -ne 0 ]; then
+ ret=22;
+ fi
+ fi
+
+ return $ret;
+}
+
function dht_sanity ()
{
echo "DHT testing"
@@ -107,7 +147,6 @@ function dist_stripe_sanity ()
function main ()
{
-
update_git;
dht_sanity;
afr_sanity;