]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Add configs for testing on Vagrant-managed VMs.
authorBen Darnell <ben@bendarnell.com>
Fri, 7 Oct 2011 08:06:01 +0000 (01:06 -0700)
committerBen Darnell <ben@bendarnell.com>
Fri, 7 Oct 2011 08:08:14 +0000 (01:08 -0700)
.gitignore
maint/README [new file with mode: 0644]
maint/vm/README [new file with mode: 0644]
maint/vm/freebsd/Vagrantfile [new file with mode: 0644]
maint/vm/freebsd/setup.sh [new file with mode: 0644]
maint/vm/freebsd/tox.ini [new file with mode: 0644]
maint/vm/shared-setup.sh [new file with mode: 0755]
maint/vm/ubuntu10.04/Vagrantfile [new file with mode: 0644]
maint/vm/ubuntu10.04/setup.sh [new file with mode: 0644]
maint/vm/ubuntu10.04/tox.ini [new file with mode: 0644]
tox.ini

index bccf00e54c654d38ff1dee2f20b696d81e1684fd..857178931384c06eb3f6f547afeccd474c34da91 100644 (file)
@@ -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 (file)
index 0000000..9a9122b
--- /dev/null
@@ -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 (file)
index 0000000..7660588
--- /dev/null
@@ -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 (file)
index 0000000..1672492
--- /dev/null
@@ -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 (file)
index 0000000..25003c2
--- /dev/null
@@ -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 (file)
index 0000000..ef1c4bc
--- /dev/null
@@ -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 (executable)
index 0000000..32ef120
--- /dev/null
@@ -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 (file)
index 0000000..63520cb
--- /dev/null
@@ -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 (file)
index 0000000..f2381d7
--- /dev/null
@@ -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 (file)
index 0000000..a797f25
--- /dev/null
@@ -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 508a50b51e914f8c5afcbe4bb1cdce8ec5d2dac4..9d0ee7b80c6023353f5d69b463eacf4b188c8106 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -27,6 +27,7 @@ changedir = {toxworkdir}
 #environment = PYTHONPATH=
 
 [testenv:py25]
+basepython = python2.5
 deps = simplejson
 
 [testenv:py25-full]