diff --git a/.gitignore b/.gitignore index bccf00e5..85717893 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ dist/ MANIFEST tornado.egg-info _auto2to3* -.tox \ No newline at end of file +.tox +.vagrant diff --git a/maint/README b/maint/README new file mode 100644 index 00000000..9a9122b3 --- /dev/null +++ b/maint/README @@ -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. diff --git a/maint/vm/README b/maint/vm/README new file mode 100644 index 00000000..7660588c --- /dev/null +++ b/maint/vm/README @@ -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) diff --git a/maint/vm/freebsd/Vagrantfile b/maint/vm/freebsd/Vagrantfile new file mode 100644 index 00000000..1672492a --- /dev/null +++ b/maint/vm/freebsd/Vagrantfile @@ -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 \ No newline at end of file diff --git a/maint/vm/freebsd/setup.sh b/maint/vm/freebsd/setup.sh new file mode 100644 index 00000000..25003c21 --- /dev/null +++ b/maint/vm/freebsd/setup.sh @@ -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 + diff --git a/maint/vm/freebsd/tox.ini b/maint/vm/freebsd/tox.ini new file mode 100644 index 00000000..ef1c4bc4 --- /dev/null +++ b/maint/vm/freebsd/tox.ini @@ -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 diff --git a/maint/vm/shared-setup.sh b/maint/vm/shared-setup.sh new file mode 100755 index 00000000..32ef120d --- /dev/null +++ b/maint/vm/shared-setup.sh @@ -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 diff --git a/maint/vm/ubuntu10.04/Vagrantfile b/maint/vm/ubuntu10.04/Vagrantfile new file mode 100644 index 00000000..63520cb3 --- /dev/null +++ b/maint/vm/ubuntu10.04/Vagrantfile @@ -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 \ No newline at end of file diff --git a/maint/vm/ubuntu10.04/setup.sh b/maint/vm/ubuntu10.04/setup.sh new file mode 100644 index 00000000..f2381d76 --- /dev/null +++ b/maint/vm/ubuntu10.04/setup.sh @@ -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 diff --git a/maint/vm/ubuntu10.04/tox.ini b/maint/vm/ubuntu10.04/tox.ini new file mode 100644 index 00000000..a797f253 --- /dev/null +++ b/maint/vm/ubuntu10.04/tox.ini @@ -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 diff --git a/tox.ini b/tox.ini index 508a50b5..9d0ee7b8 100644 --- a/tox.ini +++ b/tox.ini @@ -27,6 +27,7 @@ changedir = {toxworkdir} #environment = PYTHONPATH= [testenv:py25] +basepython = python2.5 deps = simplejson [testenv:py25-full]