summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra Talur <rtalur@redhat.com>2015-12-30 18:15:04 +0530
committerRaghavendra Talur <rtalur@redhat.com>2016-01-06 00:43:09 -0800
commitcae9a5b3a1868a8bae25cd1ba9ebb41d698f39e5 (patch)
tree21a75e46bb23dc0efef3af01906755ba19769822
parenta2119ef0f18d51500f5b496caf8dfd8f192dd490 (diff)
vagrant-test: Exit on critical errors
There were quite a few places where exiting the script made more sense. More debug messages have been added. Move back to top directory after the script is complete. Change-Id: I2a66ee3a68c41a3acd0b7168c56b801fb5567e5f BUG: 1291537 Signed-off-by: Raghavendra Talur <rtalur@redhat.com> Reviewed-on: http://review.gluster.org/13175 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Michael Adam <obnox@samba.org>
-rwxr-xr-xrun-tests-in-vagrant.sh84
-rw-r--r--tests/vagrant/vagrant-template/roles/install-pkgs/tasks/main.yml4
2 files changed, 70 insertions, 18 deletions
diff --git a/run-tests-in-vagrant.sh b/run-tests-in-vagrant.sh
index 00ec99a..cf1bdc8 100755
--- a/run-tests-in-vagrant.sh
+++ b/run-tests-in-vagrant.sh
@@ -23,11 +23,12 @@ function force_location()
function vagrant_check()
{
- vagrant -v;
+ vagrant -v >/dev/null 2>&1;
if [ $? -ne 0 ]; then
echo "Aborting"
echo "Vagrant not found. Please install Vagrant and try again."
+ echo "On Fedora, run "dnf install vagrant vagrant-libvirt" "
exit 1
else
echo "Found Vagrant, continuing...."
@@ -37,11 +38,12 @@ function vagrant_check()
function ansible_check()
{
- ansible --version;
+ ansible --version >/dev/null 2>&1 ;
if [ $? -ne 0 ]; then
echo "Aborting"
echo "Ansible not found. Please install Ansible and try again."
+ echo "On Fedora, run "dnf install ansible" "
exit 1
else
echo "Found Ansible, continuing...."
@@ -49,7 +51,12 @@ function ansible_check()
fi
}
+ORIGIN_DIR=$PWD
+
+echo "Checking current dir...."
force_location
+echo
+echo
echo "Testing for Vagrant...."
vagrant_check
@@ -66,38 +73,69 @@ echo "Copying tests/vagrant/vagrant-template dir to tests/vagrant/$BRANCHNAME"
mkdir -p tests/vagrant/$BRANCHNAME
cp -R tests/vagrant/vagrant-template/* tests/vagrant/$BRANCHNAME
echo "Change dir to vagrant dir: tests/vagrant/$BRANCHNAME"
-cd tests/vagrant/$BRANCHNAME
-echo "Working directory is $PWD"
+echo "Vagrant directory is tests/vagrant/$BRANCHNAME"
echo
echo
+
+
+
echo "Doing vagrant up...."
-vagrant up || { echo "vagrant up failed, exiting...."; exit 1; }
+cd tests/vagrant/$BRANCHNAME
+vagrant up
+if [ $? -eq 0 ]
+then
+ echo "Vagrant up successful"
+ cd $ORIGIN_DIR
+else
+ echo "Vagrant up failed, exiting....";
+ cd $ORIGIN_DIR
+ exit 1
+fi
echo
echo
-echo "Vagrant up successfull"
+
+echo "Copying source code from host machine to VM"
+cd tests/vagrant/$BRANCHNAME
+vagrant ssh-config > ssh_config
+rsync -az -e "ssh -F ssh_config" --rsync-path="sudo rsync" "../../../." vagrant-testVM:/home/vagrant/glusterfs
+if [ $? -eq 0 ]
+then
+ echo "Copied."
+ cd $ORIGIN_DIR
+else
+ echo "Copy failed, exiting...."
+ cd $ORIGIN_DIR
+ exit 1
+fi
echo
echo
-vagrant ssh-config > ssh_config
-
-echo "Copying source code from host machine to VM"
-rsync -az -e "ssh -F ssh_config" "../../../." vagrant-testVM:/home/vagrant/glusterfs
-#scp -r -F ssh_config "./../../../." vagrant-testVM:/home/vagrant/glusterfs
-echo "Copied."
+cd tests/vagrant/$BRANCHNAME
+vagrant ssh -c 'cd /home/vagrant/glusterfs ; sudo make clean' -- -t
+cd $ORIGIN_DIR
echo
echo
-vagrant ssh -c 'cd /home/vagrant/glusterfs ; ./autogen.sh' -- -t
+cd tests/vagrant/$BRANCHNAME
+vagrant ssh -c 'cd /home/vagrant/glusterfs ; sudo ./autogen.sh' -- -t
+if [ $? -ne 0 ]
+then
+ echo "autogen failed, exiting...."
+ cd $ORIGIN_DIR
+ exit 1
+fi
+cd $ORIGIN_DIR
echo
echo
+cd tests/vagrant/$BRANCHNAME
vagrant ssh -c 'cd /home/vagrant/glusterfs ; \
CFLAGS="-g -O0 -Werror -Wall -Wno-error=cpp -Wno-error=maybe-uninitialized" \
- ./configure \
+ sudo ./configure \
--prefix=/usr \
--exec-prefix=/usr \
--bindir=/usr/bin \
@@ -113,14 +151,30 @@ vagrant ssh -c 'cd /home/vagrant/glusterfs ; \
--infodir=/usr/share/info \
--libdir=/usr/lib64 \
--enable-debug' -- -t
+if [ $? -ne 0 ]
+then
+ echo "configure failed, exiting...."
+ cd $ORIGIN_DIR
+ exit 1
+fi
+cd $ORIGIN_DIR
echo
echo
-
+cd tests/vagrant/$BRANCHNAME
vagrant ssh -c 'cd /home/vagrant/glusterfs; sudo make install' -- -t
+if [ $? -ne 0 ]
+then
+ echo "make failed, exiting...."
+ cd $ORIGIN_DIR
+ exit 1
+fi
+cd $ORIGIN_DIR
echo
echo
+cd tests/vagrant/$BRANCHNAME
vagrant ssh -c 'cd /home/vagrant/glusterfs; sudo ./run-tests.sh' -- -t
+cd $ORIGIN_DIR
echo
echo
diff --git a/tests/vagrant/vagrant-template/roles/install-pkgs/tasks/main.yml b/tests/vagrant/vagrant-template/roles/install-pkgs/tasks/main.yml
index a6656b6..38cfd6a 100644
--- a/tests/vagrant/vagrant-template/roles/install-pkgs/tasks/main.yml
+++ b/tests/vagrant/vagrant-template/roles/install-pkgs/tasks/main.yml
@@ -12,8 +12,7 @@
- autoconf
- automake
- bison
- - cmockery2
- - cmockery2-devel
+ - libcmocka-devel
- cifs-utils
- dbench
- dos2unix
@@ -47,7 +46,6 @@
- procps-ng
- psmisc
- python-devel
- - python-devel
- python-eventlet
- python-netifaces
- python-paste-deploy