Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add initial laptop test using precise

  • Loading branch information...
commit d2f4f5e4890ed372cd348bc3fb1d9a09f8e999ae 1 parent 28fac68
@pbrisbin pbrisbin authored
Showing with 59 additions and 0 deletions.
  1. +7 −0 test/Vagrantfile.precise
  2. +52 −0 test/runner.sh
View
7 test/Vagrantfile.precise
@@ -0,0 +1,7 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+Vagrant.configure('2') do |config|
+ box_name = "precise32-desktop"
+ config.vm.box = box_name
+ config.vm.box_url = "https://laptop-boxes.s3.amazonaws.com/#{box_name}.box"
+end
View
52 test/runner.sh
@@ -0,0 +1,52 @@
+#!/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() {
+ vagrant destroy --force &>/dev/null
+}
+
+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

0 comments on commit d2f4f5e

Please sign in to comment.
Something went wrong with that request. Please try again.