From aef3aa07b85cb3e9340cb2d95571aebf6f2638ab Mon Sep 17 00:00:00 2001 From: Martin Pärtel Date: Sun, 12 Mar 2017 01:05:20 +0000 Subject: Added Vagrant test runner, initially running some Ubuntus and CentOSes. --- .gitignore | 5 +++ ChangeLog | 2 + Makefile.am | 6 +++ README.md | 8 ++++ vagrant/centos6/Vagrantfile | 23 ++++++++++ vagrant/centos7/Vagrantfile | 23 ++++++++++ vagrant/precise64/Vagrantfile | 25 +++++++++++ vagrant/test.rb | 99 +++++++++++++++++++++++++++++++++++++++++++ vagrant/trusty64/Vagrantfile | 25 +++++++++++ vagrant/xenial64/Vagrantfile | 25 +++++++++++ 10 files changed, 241 insertions(+) create mode 100644 vagrant/centos6/Vagrantfile create mode 100644 vagrant/centos7/Vagrantfile create mode 100644 vagrant/precise64/Vagrantfile create mode 100755 vagrant/test.rb create mode 100644 vagrant/trusty64/Vagrantfile create mode 100644 vagrant/xenial64/Vagrantfile 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 * 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 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 = < (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 -- cgit v1.2.3