aboutsummaryrefslogtreecommitdiffstats
path: root/vagrant
diff options
context:
space:
mode:
Diffstat (limited to 'vagrant')
-rw-r--r--vagrant/centos6/Vagrantfile23
-rw-r--r--vagrant/centos7/Vagrantfile23
-rw-r--r--vagrant/precise64/Vagrantfile25
-rwxr-xr-xvagrant/test.rb99
-rw-r--r--vagrant/trusty64/Vagrantfile25
-rw-r--r--vagrant/xenial64/Vagrantfile25
6 files changed, 220 insertions, 0 deletions
diff --git a/vagrant/centos6/Vagrantfile b/vagrant/centos6/Vagrantfile
new file mode 100644
index 0000000..7ad975e
--- /dev/null
+++ b/vagrant/centos6/Vagrantfile
@@ -0,0 +1,23 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+Vagrant.configure("2") do |config|
+ config.vm.box = "centos/6"
+
+ config.vm.synced_folder ".", "/vagrant", disabled: true
+ config.vm.synced_folder "../../", "/bindfs",
+ type: "rsync",
+ rsync__auto: false,
+ rsync__exclude: ["vagrant"],
+ rsync__args: ["-av", "--delete-after"]
+
+ config.vm.provider "virtualbox" do |v|
+ v.name = "bindfs-centos6"
+ end
+
+ config.vm.provision "shell", inline: <<-SHELL
+ yum install -y fuse fuse-devel gcc make pkg-config ruby valgrind
+ usermod -G fuse -a vagrant
+ echo user_allow_other > /etc/fuse.conf
+ SHELL
+end
diff --git a/vagrant/centos7/Vagrantfile b/vagrant/centos7/Vagrantfile
new file mode 100644
index 0000000..aa2ea0b
--- /dev/null
+++ b/vagrant/centos7/Vagrantfile
@@ -0,0 +1,23 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+Vagrant.configure("2") do |config|
+ config.vm.box = "centos/7"
+
+ config.vm.synced_folder ".", "/vagrant", disabled: true
+ config.vm.synced_folder "../../", "/bindfs",
+ type: "rsync",
+ rsync__auto: false,
+ rsync__exclude: ["vagrant"],
+ rsync__args: ["-av", "--delete-after"]
+
+ config.vm.provider "virtualbox" do |v|
+ v.name = "bindfs-centos7"
+ end
+
+ config.vm.provision "shell", inline: <<-SHELL
+ yum install -y fuse fuse-devel gcc make pkg-config ruby valgrind
+ usermod -G fuse -a vagrant
+ echo user_allow_other > /etc/fuse.conf
+ SHELL
+end
diff --git a/vagrant/precise64/Vagrantfile b/vagrant/precise64/Vagrantfile
new file mode 100644
index 0000000..22acd58
--- /dev/null
+++ b/vagrant/precise64/Vagrantfile
@@ -0,0 +1,25 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+Vagrant.configure("2") do |config|
+ config.vm.box = "ubuntu/precise64"
+
+ config.vm.synced_folder ".", "/vagrant", disabled: true
+ config.vm.synced_folder "../../", "/bindfs",
+ type: "rsync",
+ rsync__auto: false,
+ rsync__exclude: ["vagrant"],
+ rsync__args: ["-av", "--delete-after"]
+
+ config.vm.provider "virtualbox" do |v|
+ v.name = "bindfs-precise64"
+ end
+
+ config.vm.provision "shell", inline: <<-SHELL
+ apt-get update
+ apt-get install -y fuse libfuse-dev build-essential pkg-config ruby1.9.3 valgrind
+ apt-get clean
+ adduser vagrant fuse
+ echo user_allow_other > /etc/fuse.conf
+ SHELL
+end
diff --git a/vagrant/test.rb b/vagrant/test.rb
new file mode 100755
index 0000000..3d14776
--- /dev/null
+++ b/vagrant/test.rb
@@ -0,0 +1,99 @@
+#!/usr/bin/env ruby
+HELP = <<EOS
+Runs the bindfs test suite in all vagrant boxes in parallel.
+
+Usage: test.rb [--nohalt] [vm1 [...]]
+Options:
+ -h --help Print this and exit.
+ --nohalt Don't halt VMs when done.
+
+If VM names are given, only those are tested.
+
+Bugs:
+ - Spurious "Connection to 127.0.0.1 closed." messages can appear, and the
+ terminal may need a `reset` after this command finishes.
+EOS
+
+require 'fileutils'
+
+Dir.chdir(File.dirname(__FILE__))
+
+halt_vms = true
+specifically_selected_vms = []
+ARGV.each do |arg|
+ if arg == '-h' || arg == '--help'
+ puts HELP
+ exit
+ elsif arg == '--nohalt'
+ halt_vms = false
+ elsif !arg.start_with?('-')
+ specifically_selected_vms << arg
+ else
+ raise "Unknown option: #{arg}"
+ end
+end
+
+dirs = Dir.glob('*/Vagrantfile').map { |path| File.dirname(path) }
+unless specifically_selected_vms.empty?
+ dirs = dirs.select { |dir| ARGV.include?(dir) }
+end
+
+puts "Running #{dirs.size} VMs in parallel: #{dirs.join(' ')}"
+puts "Note: if your terminal goes wonky after this command, type 'reset'"
+mutex = Thread::Mutex.new # protects `$stdout` and `errors`
+errors = []
+threads = dirs.map do |dir|
+ Thread.new do
+ begin
+ File.open(dir + "/test.log", "wb") do |logfile|
+ run_and_log = -> (command) do
+ logfile.puts ""
+ logfile.puts "##### #{command} #####"
+ logfile.flush
+ pid = Process.spawn(command, chdir: dir, out: logfile, err: :out)
+ Process.waitpid(pid)
+ $?.success?
+ end
+ unless run_and_log.call "vagrant up"
+ raise "vagrant up failed"
+ end
+ unless run_and_log.call "vagrant rsync"
+ raise "vagrant rsync failed"
+ end
+ unless run_and_log.call "vagrant ssh -c 'cd /bindfs && sudo rm -Rf tests/tmp_test_bindfs && ./configure && make clean && make && make check && sudo make check'"
+ mutex.synchronize do
+ errors << "VM #{dir} tests failed."
+ end
+ end
+ if halt_vms
+ unless run_and_log.call "vagrant halt"
+ raise "vagrant halt failed"
+ end
+ end
+ end
+ rescue
+ mutex.synchronize do
+ errors << "VM #{dir} error: #{$!}"
+ end
+ ensure
+ mutex.synchronize do
+ puts "Finished VM: #{dir}"
+ end
+ end
+ end
+end
+
+threads.each(&:join)
+
+if errors.empty?
+ puts "OK"
+else
+ unless errors.empty?
+ puts
+ puts "Errors:"
+ errors.each { |err| puts " #{err}" }
+ puts
+ puts "See test.log in a failed VM's directory for more information"
+ puts
+ end
+end
diff --git a/vagrant/trusty64/Vagrantfile b/vagrant/trusty64/Vagrantfile
new file mode 100644
index 0000000..e7652f6
--- /dev/null
+++ b/vagrant/trusty64/Vagrantfile
@@ -0,0 +1,25 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+Vagrant.configure("2") do |config|
+ config.vm.box = "ubuntu/trusty64"
+
+ config.vm.synced_folder ".", "/vagrant", disabled: true
+ config.vm.synced_folder "../../", "/bindfs",
+ type: "rsync",
+ rsync__auto: false,
+ rsync__exclude: ["vagrant"],
+ rsync__args: ["-av", "--delete-after"]
+
+ config.vm.provider "virtualbox" do |v|
+ v.name = "bindfs-trusty64"
+ end
+
+ config.vm.provision "shell", inline: <<-SHELL
+ apt-get update
+ apt-get install -y fuse libfuse-dev build-essential pkg-config ruby1.9 valgrind
+ apt-get clean
+ adduser vagrant fuse
+ echo user_allow_other > /etc/fuse.conf
+ SHELL
+end
diff --git a/vagrant/xenial64/Vagrantfile b/vagrant/xenial64/Vagrantfile
new file mode 100644
index 0000000..2e79925
--- /dev/null
+++ b/vagrant/xenial64/Vagrantfile
@@ -0,0 +1,25 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+Vagrant.configure("2") do |config|
+ config.vm.box = "ubuntu/xenial64"
+
+ config.vm.synced_folder ".", "/vagrant", disabled: true
+ config.vm.synced_folder "../../", "/bindfs",
+ type: "rsync",
+ rsync__auto: false,
+ rsync__exclude: ["vagrant"],
+ rsync__args: ["-av", "--delete-after"]
+
+ config.vm.provider "virtualbox" do |v|
+ v.name = "bindfs-xenial64"
+ end
+
+ config.vm.provision "shell", inline: <<-SHELL
+ apt-get update
+ apt-get install -y fuse libfuse-dev build-essential pkg-config ruby valgrind
+ apt-get clean
+ adduser vagrant fuse
+ echo user_allow_other > /etc/fuse.conf
+ SHELL
+end