tests:vagrant: create roles/compile-gluster/files in the branch dir
[obnox/glusterfs.git] / run-tests-in-vagrant.sh
1 #!/bin/bash
2
3 function force_location()
4 {
5     current_dir=$(dirname $0);
6
7     if [ ! -f ${current_dir}/tests/vagrant/vagrant-template/Vagrantfile ]; then
8             echo "Aborting."
9             echo
10             echo "The tests/vagrant subdirectory seems to be missing."
11             echo
12             echo "Please correct the problem and try again."
13             echo
14             exit 1
15         fi
16 }
17
18
19 force_location
20
21 echo "Testing for Vagrant.... (TODO)"
22 echo "Testing for Ansible.... (TODO)"
23
24 echo "Copy vagrant-template dir to a new workdir based on git branch"
25 BRANCHNAME=`git rev-parse --abbrev-ref HEAD`
26 echo $BRANCHNAME
27 mkdir -p tests/vagrant/$BRANCHNAME
28 cp -R tests/vagrant/vagrant-template/* tests/vagrant/$BRANCHNAME
29
30 echo "Creating tar of source...."
31 mkdir -p tests/vagrant/$BRANCHNAME/roles/compile-gluster/files
32 tar chf tests/vagrant/$BRANCHNAME/roles/compile-gluster/files/glusterfs-vagrant-test.tar.gz  --exclude=*glusterfs-vagrant-test.tar.gz .
33
34 echo "change dir to new vagrant dir"
35 cd tests/vagrant/$BRANCHNAME
36
37 vagrant up --provision