summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsanity/nightly_sanity/nightly_sanity.sh41
-rwxr-xr-xsanity/nightly_sanity/nightly_sanity_nfs.sh130
2 files changed, 142 insertions, 29 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;
diff --git a/sanity/nightly_sanity/nightly_sanity_nfs.sh b/sanity/nightly_sanity/nightly_sanity_nfs.sh
index cdc0b61..8af244c 100755
--- a/sanity/nightly_sanity/nightly_sanity_nfs.sh
+++ b/sanity/nightly_sanity/nightly_sanity_nfs.sh
@@ -1,54 +1,109 @@
#!/bin/bash
-#GIT_DIR="/opt/users/nfs_sanity/glusterfs.git"
-GIT_DIR="/root/sanity/glusterfs.git"
-GIT_FILE="/tmp/git_head_`date +%F`"
+function _init ()
+{
+ #GIT_DIR="/opt/users/nightly_sanity/glusterfs.git"
+ GIT_DIR="/root/sanity/glusterfs.git";
+ 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
-rm /tmp/git_head*
+ 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 ()
{
+ GIT_PATH=$(which git);
cd $GIT_DIR
echo $PWD >> $GIT_FILE
+ sleep 2;
echo "preveious head is at:"
- /usr/bin/git describe >> $GIT_FILE
+ $GIT_PATH describe >> $GIT_FILE
if [ $? -ne 0 ]; then
- echo "git describe failed. Exiting"
- return 11;
+ echo "git describe failed. Exiting"
+ return 11;
fi
echo "Doing git reset:"
- /usr/bin/git reset --hard >> $GIT_FILE
+ $GIT_PATH reset --hard >> $GIT_FILE
if [ $? -ne 0 ]; then
- echo "git reset failed. Exiting."
- return 11;
+ echo "git reset failed. Exiting."
+ return 11;
fi
echo "Doing git pull:"
- /usr/bin/git pull >> $GIT_FILE
+ $GIT_PATH pull >> $GIT_FILE
if [ $? -ne 0 ]; then
- echo "git pull failed"
- return 11;
+ echo "git pull failed"
+ return 11;
else
- echo "git pull succeeded"
+ echo "git pull succeeded"
fi
-
+
echo "Current head is at:"
- /usr/bin/git describe >> $GIT_FILE
+ $GIT_PATH describe >> $GIT_FILE
if [ $? -ne 0 ]; then
- echo "git describe failed, but continuing"
- return 0;
- else
- return 0;
+ echo "git describe failed, but continuing"
+ #return 0;
+ #else
+ #return 0;
fi
+
+ for i in $(ls /root/patches)
+ do
+ $GIT_PATH apply /root/patches/$i;
+ done
+
+ echo "========DIFF========";
+ $GIT_PATH diff >> $GIT_FILE;
+
+ 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"
sleep 1
- /opt/users/nightly_sanity/nightly_updated.sh -t dht -c 1 -m nfs 2>&1 | tee /mnt/runlog.dht
+ /opt/users/nightly_sanity/nightly_updated.sh -t dht -c 1 -m fuse 2>&1 | tee /mnt/runlog.dht
echo "DHT done"
sleep 1
return 0;
@@ -58,7 +113,7 @@ function afr_sanity ()
{
echo "AFR testing"
sleep 1
- /opt/users/nightly_sanity/nightly_updated.sh -t afr -c 1 -m nfs 2>&1 | tee /mnt/runlog.afr
+ /opt/users/nightly_sanity/nightly_updated.sh -t afr -c 1 -m fuse 2>&1 | tee /mnt/runlog.afr
echo "AFR done"
sleep 1
}
@@ -67,19 +122,38 @@ function stripe_sanity ()
{
echo "stripe testing"
sleep 1
- /opt/users/nightly_sanity/nightly_updated.sh -t stripe -c 1 -m nfs 2>&1 | tee /mnt/runlog.stripe
+ /opt/users/nightly_sanity/nightly_updated.sh -t stripe -c 1 -m fuse 2>&1 | tee /mnt/runlog.stripe
echo "stripe done"
sleep 1
}
-function main ()
+function dist_repl_sanity ()
+{
+ echo "distributes replicate testing";
+ sleep 1;
+ /opt/users/nightly_sanity/nightly_updated.sh -t disrep -c 1 -m fuse 2>&1 | tee /mnt/runlog.dist_repl
+ echo "distributed replicate done"
+ sleep 1
+}
+
+function dist_stripe_sanity ()
{
+ echo "distributes stripe testing";
+ sleep 1;
+ /opt/users/nightly_sanity/nightly_updated.sh -t dis-stripe -c 1 -m fuse 2>&1 | tee /mnt/runlog.dist_stripe
+ echo "distributed stripe done"
+ sleep 1
+}
+function main ()
+{
update_git;
dht_sanity;
- #afr_sanity;
- #stripe_sanity;
+ afr_sanity;
+ stripe_sanity;
+ dist_repl_sanity;
+ dist_stripe_sanity;
return 0;
}
-main "$@"
+_init "$@" && main "$@" \ No newline at end of file