Skip to content

Instantly share code, notes, and snippets.

@clue clue/README.md
Last active Aug 29, 2015

Embed
What would you like to do?
Running Ratchet test suite in a clean schroot

This gist demonstrates how to use a transient (temporary) schroot environment to set up a controlled environment to run the Ratchet test suite. It assumes you're running this on a recent version of Ubuntu (a virtual machine will do as well).

  • We want to run the test suite in isolation without installing the required tools on our host.
  • Instead, all tools will be installed in a transient schroot that will be reset whenever we leave it.
  • The schroot is a convenient wrapper to set up a blank system in a chroot, but still provides access to your home directory where the workspace (Ratchet) is installed.
  • This allows us to easily hack the source code on the host system and running exactly the same code in the schroot test environment.
  • As such, you can read/write to your home directory from within your schroot, which is convenient in our case. Obviously, this is not a safe option if you're running untrusted code.
  • We use debootstrap to set up a new Ubuntu Precise (12.04 LTS) VM.
# setup ratchet
host $ cd ~/workspace
host $ git clone https://github.com/cboden/Ratchet.git
host $ cd Ratchet
host $ composer install
# set up a clean precise chroot under /chroot-precise once
host $ sudo apt-get install schroot debootstrap
host $ sudo debootstrap precise /chroot-precise http://archive.ubuntu.com/ubuntu/
# configure schroot access for our current user and make sure all changes are transient
host $ sudoedit /etc/schroot/chroot.d/precise
host $ cat /etc/schroot/chroot.d/precise
[precise]
type=directory
directory=/chroot-precise
union-type=aufs
users=myusername
# start schroot session
# all following changes will be temporary and will be discarded when leaving this session
host $ schroot -c precise
# install the required tools to run the test suite
schroot $ sudo apt-get install php5-cli build-essential python-setuptools python-dev
schroot $ sudo easy_install autobahn==0.5.14 autobahntestsuite==0.5.2
schroot $ make abtest
# wait a few minutes for the tests to finish
# all test results will be written to reports/rfc/
# and are accessible from both within and outside the chroot
# then browse the reports/rfc/index.html file using your normal browser on your host
# end schroot session (all changes will be discarded)
schroot $ exit
host $ #
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.