Add configs for testing on Vagrant-managed VMs.

This commit is contained in:
Ben Darnell 2011-10-07 01:06:01 -07:00
parent 6dd03c06f6
commit 970b43bddf
11 changed files with 153 additions and 1 deletions

3
.gitignore vendored
View File

@ -6,4 +6,5 @@ dist/
MANIFEST
tornado.egg-info
_auto2to3*
.tox
.tox
.vagrant

3
maint/README Normal file
View File

@ -0,0 +1,3 @@
This directory contains tools and scripts that are used in the development
and maintainance of Tornado itself, but are probably not of interest to
Tornado users.

23
maint/vm/README Normal file
View File

@ -0,0 +1,23 @@
This directory contains virtual machine setup scripts for testing Tornado.
Requirements:
Vagrant (http://vagrantup.com) and VirtualBox (http://virtualbox.org).
Vagrant provides an easy download for Ubuntu 10.04 (aka lucid64); base
images for other platforms are harder to find and can be built with
VeeWee (https://github.com/jedi4ever/veewee).
Usage:
cd to the appropriate directory and run `vagrant up`, then `vagrant ssh`.
From there, simply run `tox` to run the full test suite, or cd to /tornado
and test manually. Afterwards, use `vagrant suspend` or `vagrant destroy`
to clean up.
Notes:
Python distutils (and therefore tox) assume that if the platform
supports hard links, they can be used in the Tornado source directory.
VirtualBox's shared folder filesystem does not support hard links (or
symlinks), so we have to use NFS shared folders instead. (which has
the unfortunate side effect of requiring sudo on the host machine)

27
maint/vm/freebsd/Vagrantfile vendored Normal file
View File

@ -0,0 +1,27 @@
require 'vagrant/systems/freebsd'
Vagrant::Config.run do |config|
# A freebsd image can be created with veewee
# https://github.com/jedi4ever/veewee
#
# vagrant basebox define freebsd freebsd-8.2-pcbsd-i386-netboot
# vagrant basebox build freebsd
# vagrant basebox export freebsd
# vagrant box add freebsd freebsd.box
config.vm.box = "freebsd"
config.vm.system = :freebsd
# Note that virtualbox shared folders don't work with freebsd, so
# we'd need nfs shared folders here even if virtualbox gains
# support for symlinks.
config.vm.network "172.19.1.3"
config.vm.share_folder("tornado", "/tornado", "../../..", :nfs => true)
# This doesn't seem to get mounted by default for freebsd,
# but that's actually a good thing since there are apparently issues
# when one nfs export is a subfolder of another.
#config.vm.share_folder("v-root", "/vagrant", ".", :nfs => true)
config.vm.provision :shell, :path => "setup.sh"
end

30
maint/vm/freebsd/setup.sh Normal file
View File

@ -0,0 +1,30 @@
#!/bin/sh
chsh -s bash vagrant
# This doesn't get created automatically for freebsd since virtualbox
# shared folders don't work.
ln -snf /tornado/maint/vm/freebsd /vagrant
PORTS="
lang/python27
devel/py-pip
devel/py-virtualenv
ftp/curl
"
PIP_PACKAGES="
tox
pycurl
"
cd /usr/ports
for port in $PORTS; do
make -C $port -DBATCH install
done
pip install $PIP_PACKAGES
/tornado/maint/vm/shared-setup.sh

13
maint/vm/freebsd/tox.ini Normal file
View File

@ -0,0 +1,13 @@
[tox]
envlist=py27-full, py27
setupdir=/tornado
# /home is a symlink to /usr/home, but tox doesn't like symlinks here
toxworkdir=/usr/home/vagrant/tox-tornado
[testenv]
commands = python -m tornado.test.runtests {posargs:}
[testenv:py27-full]
# other dependencies aren't really worth the install time
deps =
pycurl

7
maint/vm/shared-setup.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
# Run at the end of each vm's provisioning script
# Link tox.ini into the home directory so you can run tox immediately
# after ssh'ing in without cd'ing to /vagrant (since cd'ing to /tornado
# gets the wrong config)
ln -sf /vagrant/tox.ini ~vagrant/tox.ini

9
maint/vm/ubuntu10.04/Vagrantfile vendored Normal file
View File

@ -0,0 +1,9 @@
Vagrant::Config.run do |config|
config.vm.box = "lucid64"
config.vm.box_url = "http://files.vagrantup.com/lucid64.box"
config.vm.network "172.19.1.2"
config.vm.share_folder("tornado", "/tornado", "../../..", :nfs=> true)
config.vm.provision :shell, :path => "setup.sh"
end

View File

@ -0,0 +1,25 @@
#!/bin/sh
# libcurl4-gnutls-dev is the default if you ask for libcurl4-dev, but it
# has bugs that make our tests deadlock (the relevant tests detect this and
# disable themselves, but it means that to get full coverage we have to use
# the openssl version)
APT_PACKAGES="
python-pip
python-virtualenv
python-dev
libmysqlclient-dev
libcurl4-openssl-dev
"
PIP_PACKAGES="
tox
MySQL-python
pycurl
twisted
"
apt-get -y install $APT_PACKAGES
pip install $PIP_PACKAGES
/tornado/maint/vm/shared-setup.sh

View File

@ -0,0 +1,13 @@
[tox]
envlist=py26-full, py26
setupdir=/tornado
toxworkdir=/home/vagrant/tox-tornado
[testenv]
commands = python -m tornado.test.runtests {posargs:}
[testenv:py26-full]
deps =
MySQL-python
pycurl
twisted

View File

@ -27,6 +27,7 @@ changedir = {toxworkdir}
#environment = PYTHONPATH=
[testenv:py25]
basepython = python2.5
deps = simplejson
[testenv:py25-full]