Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaef3aa0

Browse files
committed
Added Vagrant test runner, initially running some Ubuntus and CentOSes.
1 parent8437e3f commitaef3aa0

File tree

10 files changed

+241
-0
lines changed

10 files changed

+241
-0
lines changed

‎.gitignore‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,8 @@ tests/internals/test_rate_limiter
4545
tests/internals/*.log
4646
tests/internals/*.trs
4747

48+
# Vagrant
49+
50+
vagrant/*/*.log
51+
vagrant/*/.vagrant
52+

‎ChangeLog‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
2017-03-12 Martin Pärtel <martin dot partel at gmail dot com>
22

33
* Made tests work with Ruby 1.8.7 and FUSE 2.8 again (issue #49).
4+
* Added Vagrant test runner, initially running some Ubuntus and
5+
CentOSes.
46

57
2017-02-04 Martin Pärtel <martin dot partel at gmail dot com>
68

‎Makefile.am‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
SUBDIRS = src tests
22

3+
vagrant-clean:
4+
-for iin vagrant/*/Vagrantfile;docd`dirname$$i`&& (vagrant destroy -f|| true);cd$$OLDPWD;done
5+
-rm -Rf vagrant/*/.vagrant vagrant/*/*.log
6+
7+
vagrant-test:
8+
-vagrant/test.rb

‎README.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ The test suite requires Ruby 1.8.7+. If you're using [RVM](https://rvm.io/)
6060
then you may need to use`rvmsudo` instead of plain`sudo` to run the root
6161
tests.
6262

63+
###Vagrant test runner ###
64+
65+
There is also a set of Vagrant configs for running the test suite on a variety
66+
of systems. Run them with`vagrant/test.rb` (add`--help` for extra options).
67+
68+
You can destroy all bindfs Vagrant machines (but not the downloaded images)
69+
with`make vagrant-clean`.
70+
6371

6472
##License ##
6573

‎vagrant/centos6/Vagrantfile‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
Vagrant.configure("2")do |config|
5+
config.vm.box="centos/6"
6+
7+
config.vm.synced_folder".","/vagrant",disabled:true
8+
config.vm.synced_folder"../../","/bindfs",
9+
type:"rsync",
10+
rsync__auto:false,
11+
rsync__exclude:["vagrant"],
12+
rsync__args:["-av","--delete-after"]
13+
14+
config.vm.provider"virtualbox"do |v|
15+
v.name="bindfs-centos6"
16+
end
17+
18+
config.vm.provision"shell",inline:<<-SHELL
19+
yum install -y fuse fuse-devel gcc make pkg-config ruby valgrind
20+
usermod -G fuse -a vagrant
21+
echo user_allow_other > /etc/fuse.conf
22+
SHELL
23+
end

‎vagrant/centos7/Vagrantfile‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
Vagrant.configure("2")do |config|
5+
config.vm.box="centos/7"
6+
7+
config.vm.synced_folder".","/vagrant",disabled:true
8+
config.vm.synced_folder"../../","/bindfs",
9+
type:"rsync",
10+
rsync__auto:false,
11+
rsync__exclude:["vagrant"],
12+
rsync__args:["-av","--delete-after"]
13+
14+
config.vm.provider"virtualbox"do |v|
15+
v.name="bindfs-centos7"
16+
end
17+
18+
config.vm.provision"shell",inline:<<-SHELL
19+
yum install -y fuse fuse-devel gcc make pkg-config ruby valgrind
20+
usermod -G fuse -a vagrant
21+
echo user_allow_other > /etc/fuse.conf
22+
SHELL
23+
end

‎vagrant/precise64/Vagrantfile‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
Vagrant.configure("2")do |config|
5+
config.vm.box="ubuntu/precise64"
6+
7+
config.vm.synced_folder".","/vagrant",disabled:true
8+
config.vm.synced_folder"../../","/bindfs",
9+
type:"rsync",
10+
rsync__auto:false,
11+
rsync__exclude:["vagrant"],
12+
rsync__args:["-av","--delete-after"]
13+
14+
config.vm.provider"virtualbox"do |v|
15+
v.name="bindfs-precise64"
16+
end
17+
18+
config.vm.provision"shell",inline:<<-SHELL
19+
apt-get update
20+
apt-get install -y fuse libfuse-dev build-essential pkg-config ruby1.9.3 valgrind
21+
apt-get clean
22+
adduser vagrant fuse
23+
echo user_allow_other > /etc/fuse.conf
24+
SHELL
25+
end

‎vagrant/test.rb‎

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#!/usr/bin/env ruby
2+
HELP=<<EOS
3+
Runs the bindfs test suite in all vagrant boxes in parallel.
4+
5+
Usage: test.rb [--nohalt] [vm1 [...]]
6+
Options:
7+
-h --help Print this and exit.
8+
--nohalt Don't halt VMs when done.
9+
10+
If VM names are given, only those are tested.
11+
12+
Bugs:
13+
- Spurious "Connection to 127.0.0.1 closed." messages can appear, and the
14+
terminal may need a `reset` after this command finishes.
15+
EOS
16+
17+
require'fileutils'
18+
19+
Dir.chdir(File.dirname(__FILE__))
20+
21+
halt_vms=true
22+
specifically_selected_vms=[]
23+
ARGV.eachdo |arg|
24+
ifarg =='-h' ||arg =='--help'
25+
putsHELP
26+
exit
27+
elsifarg =='--nohalt'
28+
halt_vms=false
29+
elsif !arg.start_with?('-')
30+
specifically_selected_vms <<arg
31+
else
32+
raise"Unknown option:#{arg}"
33+
end
34+
end
35+
36+
dirs=Dir.glob('*/Vagrantfile').map{ |path|File.dirname(path)}
37+
unlessspecifically_selected_vms.empty?
38+
dirs=dirs.select{ |dir|ARGV.include?(dir)}
39+
end
40+
41+
puts"Running#{dirs.size} VMs in parallel:#{dirs.join(' ')}"
42+
puts"Note: if your terminal goes wonky after this command, type 'reset'"
43+
mutex=Thread::Mutex.new# protects `$stdout` and `errors`
44+
errors=[]
45+
threads=dirs.mapdo |dir|
46+
Thread.newdo
47+
begin
48+
File.open(dir +"/test.log","wb")do |logfile|
49+
run_and_log=->(command)do
50+
logfile.puts""
51+
logfile.puts"######{command} #####"
52+
logfile.flush
53+
pid=Process.spawn(command,chdir:dir,out:logfile,err::out)
54+
Process.waitpid(pid)
55+
$?.success?
56+
end
57+
unlessrun_and_log.call"vagrant up"
58+
raise"vagrant up failed"
59+
end
60+
unlessrun_and_log.call"vagrant rsync"
61+
raise"vagrant rsync failed"
62+
end
63+
unlessrun_and_log.call"vagrant ssh -c 'cd /bindfs && sudo rm -Rf tests/tmp_test_bindfs && ./configure && make clean && make && make check && sudo make check'"
64+
mutex.synchronizedo
65+
errors <<"VM#{dir} tests failed."
66+
end
67+
end
68+
ifhalt_vms
69+
unlessrun_and_log.call"vagrant halt"
70+
raise"vagrant halt failed"
71+
end
72+
end
73+
end
74+
rescue
75+
mutex.synchronizedo
76+
errors <<"VM#{dir} error:#{$!}"
77+
end
78+
ensure
79+
mutex.synchronizedo
80+
puts"Finished VM:#{dir}"
81+
end
82+
end
83+
end
84+
end
85+
86+
threads.each(&:join)
87+
88+
iferrors.empty?
89+
puts"OK"
90+
else
91+
unlesserrors.empty?
92+
puts
93+
puts"Errors:"
94+
errors.each{ |err|puts"#{err}"}
95+
puts
96+
puts"See test.log in a failed VM's directory for more information"
97+
puts
98+
end
99+
end

‎vagrant/trusty64/Vagrantfile‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
Vagrant.configure("2")do |config|
5+
config.vm.box="ubuntu/trusty64"
6+
7+
config.vm.synced_folder".","/vagrant",disabled:true
8+
config.vm.synced_folder"../../","/bindfs",
9+
type:"rsync",
10+
rsync__auto:false,
11+
rsync__exclude:["vagrant"],
12+
rsync__args:["-av","--delete-after"]
13+
14+
config.vm.provider"virtualbox"do |v|
15+
v.name="bindfs-trusty64"
16+
end
17+
18+
config.vm.provision"shell",inline:<<-SHELL
19+
apt-get update
20+
apt-get install -y fuse libfuse-dev build-essential pkg-config ruby1.9 valgrind
21+
apt-get clean
22+
adduser vagrant fuse
23+
echo user_allow_other > /etc/fuse.conf
24+
SHELL
25+
end

‎vagrant/xenial64/Vagrantfile‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
Vagrant.configure("2")do |config|
5+
config.vm.box="ubuntu/xenial64"
6+
7+
config.vm.synced_folder".","/vagrant",disabled:true
8+
config.vm.synced_folder"../../","/bindfs",
9+
type:"rsync",
10+
rsync__auto:false,
11+
rsync__exclude:["vagrant"],
12+
rsync__args:["-av","--delete-after"]
13+
14+
config.vm.provider"virtualbox"do |v|
15+
v.name="bindfs-xenial64"
16+
end
17+
18+
config.vm.provision"shell",inline:<<-SHELL
19+
apt-get update
20+
apt-get install -y fuse libfuse-dev build-essential pkg-config ruby valgrind
21+
apt-get clean
22+
adduser vagrant fuse
23+
echo user_allow_other > /etc/fuse.conf
24+
SHELL
25+
end

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp