-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
runner.sh
executable file
·54 lines (41 loc) · 1.45 KB
/
runner.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env sh
message() {
printf "\e[1;34m:: \e[1;37m%s\e[0m\n" "$*"
}
failure() {
printf "\n\e[1;31mFAILURE\e[0m: \e[1;37m%s\e[0m\n\n" "$*" >&2;
continue
}
vagrant_destroy() {
if [ -z "$KEEP_VM" ]; then
vagrant destroy --force &>/dev/null
fi
}
message "Building latest scripts"
./bin/build.sh
for vagrantfile in test/Vagrantfile.*; do
message "Testing with $vagrantfile"
ln -sf "$vagrantfile" ./Vagrantfile || failure 'Unable to link Vagrantfile'
message 'Destroying and recreating virtual machine'
vagrant_destroy
vagrant up || failure 'Unable to start virtual machine'
# TODO: Create a Vagrantfile.mac that uses VMWare Fusion to run OSX
if echo "$vagrantfile" | grep -q '\.mac$'; then
vagrant ssh -c 'echo vagrant | zsh /vagrant/mac' \
|| failure 'Installation script failed to run'
else
vagrant ssh -c 'echo vagrant | sh /vagrant/linux-prerequisites' \
|| failure 'Prerequisite script failed to run'
vagrant ssh -c 'zsh /vagrant/linux' \
|| failure 'Installation script failed to run'
fi
[ "$(vagrant ssh -c 'echo $SHELL')" = '/usr/bin/zsh' ] \
|| failure 'Installation did not set $SHELL to ZSH'
ruby="$(vagrant ssh -c 'zsh -i -l -c "ruby --version" | cut -d" " -f 1-2')"
[ "$ruby" = 'ruby 2.0.0p247' ] \
|| failure 'Installation did not install the correct ruby'
message "$vagrantfile tested successfully, shutting down VM"
vagrant halt
vagrant_destroy
done
rm -f ./Vagrantfile