aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore5
-rw-r--r--ChangeLog2
-rw-r--r--Makefile.am6
-rw-r--r--README.md8
-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
10 files changed, 241 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 76cad8c..d81bad5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -45,3 +45,8 @@ tests/internals/test_rate_limiter
tests/internals/*.log
tests/internals/*.trs
+# Vagrant
+
+vagrant/*/*.log
+vagrant/*/.vagrant
+
diff --git a/ChangeLog b/ChangeLog
index e98fd91..3066cfe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
2017-03-12 Martin Pärtel <martin dot partel at gmail dot com>
* Made tests work with Ruby 1.8.7 and FUSE 2.8 again (issue #49).
+ * Added Vagrant test runner, initially running some Ubuntus and
+ CentOSes.
2017-02-04 Martin Pärtel <martin dot partel at gmail dot com>
diff --git a/Makefile.am b/Makefile.am
index 527ba9d..9d47e04 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,2 +1,8 @@
SUBDIRS = src tests
+vagrant-clean:
+ -for i in vagrant/*/Vagrantfile; do cd `dirname $$i` && (vagrant destroy -f || true) ; cd $$OLDPWD; done
+ -rm -Rf vagrant/*/.vagrant vagrant/*/*.log
+
+vagrant-test:
+ -vagrant/test.rb
diff --git a/README.md b/README.md
index 601aa7b..1d1030d 100644
--- a/README.md
+++ b/README.md
@@ -60,6 +60,14 @@ The test suite requires Ruby 1.8.7+. If you're using [RVM](https://rvm.io/)
then you may need to use `rvmsudo` instead of plain `sudo` to run the root
tests.
+### Vagrant test runner ###
+
+There is also a set of Vagrant configs for running the test suite on a variety
+of systems. Run them with `vagrant/test.rb` (add `--help` for extra options).
+
+You can destroy all bindfs Vagrant machines (but not the downloaded images)
+with `make vagrant-clean`.
+
## License ##
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