6 # Vagrant for running libevent tests with:
7 # - timeout 30min, to avoid hungs
8 # - run tests in parallel under ctest (10 concurency)
9 # - if you have uncommited changes, you should commit them first to check
10 # - unix only, because of some tar'ing to avoid one vm affect another
14 # - NO_PKG -- do not install packages
15 # - NO_CMAKE -- do not run with cmake
16 # - NO_AUTOTOOLS -- do not run with autoconf/automake
18 Vagrant.configure("2") do |config|
19 # to allow running boxes provisions in parallel, we can't share the same dirs
20 # via virtualbox, however sometimes it is the only way, so instead let's
21 # create an archive of HEAD (this way we will not have any trash there) and
22 # extract it for every box to the separate folder.
24 # P.S. we will change this --prefix with tar(1) --trasnform
25 system('git archive --prefix=libevent/ --output=.vagrant/libevent.tar HEAD')
27 config.vm.provider "virtualbox" do |vb|
30 # otherwise osx fails, anyway we do not need this
31 vb.customize ["modifyvm", :id, "--usb", "off"]
32 vb.customize ["modifyvm", :id, "--usbehci", "off"]
35 # disable /vagrant share, in case we will not use default mount
36 config.vm.synced_folder ".", "/vagrant", disabled: true
38 config.vm.define "ubuntu" do |ubuntu|
39 system('tar --overwrite --transform=s/libevent/libevent-linux/ -xf .vagrant/libevent.tar -C .vagrant/')
41 ubuntu.vm.box = "ubuntu/xenial64"
42 ubuntu.vm.synced_folder ".vagrant/libevent-linux", "/vagrant",
45 if ENV['NO_PKG'] != "true"
46 ubuntu.vm.provision "shell", inline: <<-SHELL
48 apt-get install -y zlib1g-dev libssl-dev python2.7
49 apt-get install -y build-essential cmake ninja-build
50 apt-get install -y autoconf automake libtool
54 if ENV['NO_CMAKE'] != "true"
55 ubuntu.vm.provision "shell", privileged: false, inline: <<-SHELL
58 mkdir -p .cmake-vagrant
62 export CTEST_TEST_TIMEOUT=1800
63 export CTEST_OUTPUT_ON_FAILURE=1
64 export CTEST_PARALLEL_LEVEL=20
65 cmake --build . --target verify
69 if ENV['NO_AUTOTOOLS'] != "true"
70 ubuntu.vm.provision "shell", privileged: false, inline: <<-SHELL
79 config.vm.define "freebsd" do |freebsd|
80 system('tar --overwrite --transform=s/libevent/libevent-freebsd/ -xf .vagrant/libevent.tar -C .vagrant/')
82 freebsd.vm.box = "freebsd/FreeBSD-11.0-STABLE"
83 freebsd.vm.synced_folder ".vagrant/libevent-freebsd", "/vagrant",
84 type: "rsync", group: "wheel"
86 # otherwise reports error
87 freebsd.ssh.shell = "sh"
89 if ENV['NO_PKG'] != "true"
90 freebsd.vm.provision "shell", inline: <<-SHELL
91 pkg install --yes openssl cmake ninja automake autotools
95 if ENV['NO_CMAKE'] != "true"
96 freebsd.vm.provision "shell", privileged: false, inline: <<-SHELL
99 mkdir -p .cmake-vagrant
103 export CTEST_TEST_TIMEOUT=1800
104 export CTEST_OUTPUT_ON_FAILURE=1
105 export CTEST_PARALLEL_LEVEL=20
106 cmake --build . --target verify
110 if ENV['NO_AUTOTOOLS'] != "true"
111 freebsd.vm.provision "shell", privileged: false, inline: <<-SHELL
120 config.vm.define "netbsd" do |netbsd|
121 system('tar --overwrite --transform=s/libevent/libevent-netbsd/ -xf .vagrant/libevent.tar -C .vagrant/')
123 netbsd.vm.box = "kja/netbsd-7-amd64"
124 netbsd.vm.synced_folder ".vagrant/libevent-netbsd", "/vagrant",
125 type: "rsync", group: "wheel"
127 if ENV['NO_PKG'] != "true"
128 netbsd.vm.provision "shell", inline: <<-SHELL
129 export PKG_PATH="ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/x86_64/7.0_2016Q2/All/"
130 pkg_add ncurses ninja-build automake cmake libtool
134 if ENV['NO_CMAKE'] != "true"
135 netbsd.vm.provision "shell", privileged: false, inline: <<-SHELL
137 rm -fr .cmake-vagrant
138 mkdir -p .cmake-vagrant
142 export CTEST_TEST_TIMEOUT=1800
143 export CTEST_OUTPUT_ON_FAILURE=1
144 export CTEST_PARALLEL_LEVEL=20
145 cmake --build . --target verify
149 if ENV['NO_AUTOTOOLS'] != "true"
150 netbsd.vm.provision "shell", privileged: false, inline: <<-SHELL
159 config.vm.define "solaris" do |solaris|
160 system('tar --overwrite --transform=s/libevent/libevent-solaris/ -xf .vagrant/libevent.tar -C .vagrant/')
163 # - solaris do not have '-or' it only has '-o' for find(1), so we can't use
165 # - and autoconf(1) doesn't work on virtualbox share, ugh
166 solaris.vm.synced_folder ".vagrant/libevent-solaris", "/vagrant-vbox",
169 solaris.vm.box = "tnarik/solaris10-minimal"
170 if ENV['NO_PKG'] != "true"
171 # TODO: opencsw does not include ninja(1)
172 solaris.vm.provision "shell", inline: <<-SHELL
173 pkgadd -d http://get.opencsw.org/now
175 pkgutil -y -i libssl_dev cmake rsync python gmake gcc5core automake autoconf libtool
179 # copy from virtualbox mount to newly created folder
180 solaris.vm.provision "shell", privileged: false, inline: <<-SHELL
182 cp -r /vagrant-vbox ~/vagrant
185 if ENV['NO_CMAKE'] != "true"
186 # builtin compiler cc(1) is a wrapper, so we should use gcc5 manually,
187 # otherwise it will not work.
188 # Plus we should set some paths so that cmake/compiler can find tham.
189 solaris.vm.provision "shell", privileged: false, inline: <<-SHELL
190 export CMAKE_INCLUDE_PATH=/opt/csw/include
191 export CMAKE_LIBRARY_PATH=/opt/csw/lib
192 export CFLAGS=-I$CMAKE_INCLUDE_PATH
193 export LDFLAGS=-L$CMAKE_LIBRARY_PATH
196 rm -rf .cmake-vagrant
197 mkdir -p .cmake-vagrant
199 cmake -DCMAKE_C_COMPILER=gcc ..
201 export CTEST_TEST_TIMEOUT=1800
202 export CTEST_OUTPUT_ON_FAILURE=1
203 export CTEST_PARALLEL_LEVEL=20
204 cmake --build . --target verify
208 if ENV['NO_AUTOTOOLS'] != "true"
209 # and we should set MAKE for `configure` otherwise it will try to use
211 solaris.vm.provision "shell", privileged: false, inline: <<-SHELL
214 MAKE=gmake ./configure
221 # - sometimes vm hangs
222 config.vm.define "osx" do |osx|
223 system('tar --overwrite --transform=s/libevent/libevent-osx/ -xf .vagrant/libevent.tar -C .vagrant/')
225 osx.vm.synced_folder ".vagrant/libevent-osx", "/vagrant",
226 type: "rsync", group: "wheel"
228 osx.vm.box = "jhcook/osx-elcapitan-10.11"
229 if ENV['NO_PKG'] != "true"
230 osx.vm.provision "shell", privileged: false, inline: <<-SHELL
231 ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
233 brew uninstall libtool
234 brew install libtool openssl ninja cmake autoconf automake
238 if ENV['NO_CMAKE'] != "true"
239 # we should set some paths so that cmake/compiler can find tham
240 osx.vm.provision "shell", privileged: false, inline: <<-SHELL
241 export OPENSSL_ROOT=$(echo /usr/local/Cellar/openssl/*)
242 export CMAKE_INCLUDE_PATH=$OPENSSL_ROOT/include
243 export CMAKE_LIBRARY_PATH=$OPENSSL_ROOT/lib
246 mkdir -p .cmake-vagrant
250 export CTEST_TEST_TIMEOUT=1800
251 export CTEST_OUTPUT_ON_FAILURE=1
252 export CTEST_PARALLEL_LEVEL=20
253 cmake --build . --target verify
257 if ENV['NO_AUTOTOOLS'] != "true"
258 osx.vm.provision "shell", privileged: false, inline: <<-SHELL
259 export OPENSSL_ROOT=$(echo /usr/local/Cellar/openssl/*)
260 export CFLAGS=-I$OPENSSL_ROOT/include
261 export LDFLAGS=-L$OPENSSL_ROOT/lib
271 config.vm.define "centos" do |centos|
272 system('tar --overwrite --transform=s/libevent/libevent-centos/ -xf .vagrant/libevent.tar -C .vagrant/')
274 centos.vm.synced_folder ".vagrant/libevent-centos", "/vagrant",
275 type: "rsync", group: "wheel"
277 centos.vm.box = "centos/7"
278 if ENV['NO_PKG'] != "true"
279 centos.vm.provision "shell", inline: <<-SHELL
280 echo "[russianfedora]" > /etc/yum.repos.d/russianfedora.repo
281 echo name=russianfedora >> /etc/yum.repos.d/russianfedora.repo
282 echo baseurl=http://mirror.yandex.ru/fedora/russianfedora/russianfedora/free/el/releases/7/Everything/x86_64/os/ >> /etc/yum.repos.d/russianfedora.repo
283 echo enabled=1 >> /etc/yum.repos.d/russianfedora.repo
284 echo gpgcheck=0 >> /etc/yum.repos.d/russianfedora.repo
286 centos.vm.provision "shell", inline: <<-SHELL
287 yum -y install zlib-devel openssl-devel python
288 yum -y install gcc cmake ninja-build
289 yum -y install autoconf automake libtool
293 if ENV['NO_CMAKE'] != "true"
294 centos.vm.provision "shell", privileged: false, inline: <<-SHELL
296 rm -fr .cmake-vagrant
297 mkdir -p .cmake-vagrant
301 export CTEST_TEST_TIMEOUT=1800
302 export CTEST_OUTPUT_ON_FAILURE=1
303 export CTEST_PARALLEL_LEVEL=20
304 cmake --build . --target verify
308 if ENV['NO_AUTOTOOLS'] != "true"
309 centos.vm.provision "shell", privileged: false, inline: <<-SHELL
319 # - issues with timers (not enough allowed error)
320 config.vm.define "win" do |win|
321 system('tar --overwrite --transform=s/libevent/libevent-win/ -xf .vagrant/libevent.tar -C .vagrant/')
323 # 512MB not enough after libtool install, huh
324 win.vm.provider "virtualbox" do |vb|
328 # windows does not have rsync builtin, let's use virtualbox for now
329 win.vm.synced_folder ".vagrant/libevent-win", "/vagrant",
332 win.vm.box = "senglin/win-10-enterprise-vs2015community"
333 if ENV['NO_PKG'] != "true"
334 # box with vs2015 does not have C++ support, so let's install it manually
335 # plus chocolatey that includes in this box, can't handle sha1 checksum for
336 # cmake.install, so let's update it<
337 win.vm.provision "shell", inline: <<-SHELL
338 choco upgrade -y chocolatey -pre -f
339 choco install -y VisualStudioCommunity2013
340 choco install -y openssl.light
341 choco install -y cygwin cyg-get
342 choco install -y cmake
343 choco install -y cmake.install
344 choco install -y python2
347 # chocolatey openssl.light package does not contains headers
348 win.vm.provision "shell", inline: <<-SHELL
349 (new-object System.Net.WebClient).DownloadFile('http://strcpy.net/packages/Win32OpenSSL-1_0_2a.exe', '/openssl.exe')
350 /openssl.exe /silent /verysilent /sp- /suppressmsgboxes
354 # - cyg-get depends from cygwinsetup.exe
355 # https://github.com/chocolatey/chocolatey-coreteampackages/issues/200
356 # - cyg-get only downloads, do not installs them, ugh. so let's do not use
358 win.vm.provision "shell", privileged: false, inline: <<-SHELL
359 (new-object System.Net.WebClient).DownloadFile('https://cygwin.com/setup-x86_64.exe', '/tools/cygwin/cygwinsetup.exe')
361 $env:PATH="/tools/cygwin/bin;$($env:PATH);/tools/cygwin"
363 cygwinsetup --root c:/tools/cygwin/ --local-package-dir c:/tools/cygwin/packages/ --no-desktop --no-startmenu --verbose --quiet-mode --download --packages automake,autoconf,gcc-core,libtool,make,python,openssl-devel
364 cygwinsetup --root c:/tools/cygwin/ --local-package-dir c:/tools/cygwin/packages/ --no-desktop --no-startmenu --verbose --quiet-mode --local-install --packages automake,autoconf,gcc-core,libtool,make,python,openssl-devel
368 if ENV['NO_CMAKE'] != "true"
369 win.vm.provision "shell", privileged: false, inline: <<-SHELL
370 $env:PATH="/Program Files/CMake/bin;/tools/python2;$($env:PATH)"
373 Remove-Item -Recurse -Force .cmake-vagrant
374 mkdir -p .cmake-vagrant
376 cmake -G "Visual Studio 12" ..
378 $env:CTEST_TEST_TIMEOUT = "1800"
379 $env:CTEST_OUTPUT_ON_FAILURE = "1"
380 $env:CTEST_PARALLEL_LEVEL = "10"
381 cmake --build . --target verify
385 if ENV['NO_AUTOTOOLS'] != "true"
386 win.vm.provision "shell", privileged: false, inline: <<-SHELL
387 $env:PATH="/tools/cygwin/bin;$($env:PATH)"
389 bash -lc "echo 'C:/tools/mingw64 /mingw ntfs binary 0 0' > /etc/fstab"
390 bash -lc "echo 'C:/OpenSSL-Win32 /ssl ntfs binary 0 0' >> /etc/fstab"
391 bash -lc "echo 'C:/vagrant /vagrant ntfs binary 0 0' >> /etc/fstab"
393 bash -lc "exec 0</dev/null; exec 2>&1; cd /vagrant; bash -x ./autogen.sh && ./configure LDFLAGS='-L/ssl -L/ssl/lib -L/ssl/lib/MinGW' CFLAGS=-I/ssl/include && make -j20 verify"