Patchwork tests: add Vagrantfile to automate running them on virtual machines

login
register
mail settings
Submitter anatoly techtonik
Date July 5, 2014, 4:42 p.m.
Message ID <65a3d892ee2f147d536f.1404578575@BlackBox>
Download mbox | patch
Permalink /patch/5105/
State Superseded
Headers show

Comments

anatoly techtonik - July 5, 2014, 4:42 p.m.
# HG changeset patch
# User anatoly techtonik <techtonik@gmail.com>
# Date 1404567148 -10800
#      Sat Jul 05 16:32:28 2014 +0300
# Branch stable
# Node ID 65a3d892ee2f147d536ffc5a0af84432fc18eb48
# Parent  2392b9e1936628faeec818368169a68b1fadd95f
tests: add Vagrantfile to automate running them on virtual machines

Now running tests is as easy as:
1. install vagrant
2. $ vagrant up
3. $ vagrant ssh -c ./run-tests
Matt Mackall - July 11, 2014, 10:43 p.m.
On Sat, 2014-07-05 at 19:42 +0300, anatoly techtonik wrote:
> # HG changeset patch
> # User anatoly techtonik <techtonik@gmail.com>
> # Date 1404567148 -10800
> #      Sat Jul 05 16:32:28 2014 +0300
> # Branch stable
> # Node ID 65a3d892ee2f147d536ffc5a0af84432fc18eb48
> # Parent  2392b9e1936628faeec818368169a68b1fadd95f
> tests: add Vagrantfile to automate running them on virtual machines
> 
> Now running tests is as easy as:
> 1. install vagrant
> 2. $ vagrant up
> 3. $ vagrant ssh -c ./run-tests
> 
> diff -r 2392b9e19366 -r 65a3d892ee2f Vagrantfile
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/Vagrantfile	Sat Jul 05 16:32:28 2014 +0300

Is there a reason for this to be in the root rather than contrib/?
anatoly techtonik - July 15, 2014, 5:37 p.m.
On Sat, Jul 12, 2014 at 6:22 AM, Kevin Bullock
<kbullock+mercurial@ringworld.org> wrote:
> On Jul 11, 2014, at 5:43 PM, Matt Mackall <mpm@selenic.com> wrote:
>
>> On Sat, 2014-07-05 at 19:42 +0300, anatoly techtonik wrote:
>>> # HG changeset patch
>>> # User anatoly techtonik <techtonik@gmail.com>
>>> # Date 1404567148 -10800
>>> #      Sat Jul 05 16:32:28 2014 +0300
>>> # Branch stable
>>> # Node ID 65a3d892ee2f147d536ffc5a0af84432fc18eb48
>>> # Parent  2392b9e1936628faeec818368169a68b1fadd95f
>>> tests: add Vagrantfile to automate running them on virtual machines
>>>
>>> Now running tests is as easy as:
>>> 1. install vagrant
>>> 2. $ vagrant up
>>> 3. $ vagrant ssh -c ./run-tests
>>>
>>> diff -r 2392b9e19366 -r 65a3d892ee2f Vagrantfile
>>> --- /dev/null        Thu Jan 01 00:00:00 1970 +0000
>>> +++ b/Vagrantfile    Sat Jul 05 16:32:28 2014 +0300
>>
>> Is there a reason for this to be in the root rather than contrib/?
>
> We may want to put it in a 'contrib/vagrant/' directory and set an ignore rule on '^contrib/vagrant/.vagrant/'. Vagrant is one of those tools that likes to leave turds in its "project root".

Fixed - see version 2:
[x] moved everything to contrib/vagrant/
[x] renamed scripts to provision.sh and run-tests.sh
[x] added README.md
[x] added .vagrant to .hgignore
[x] mounted repo root at /hgshared in guest
anatoly techtonik - July 15, 2014, 5:38 p.m.
On Sat, Jul 12, 2014 at 6:28 AM, Kevin Bullock
<kbullock+mercurial@ringworld.org> wrote:
> On Jul 5, 2014, at 11:42 AM, anatoly techtonik <techtonik@gmail.com> wrote:
>> +
>> +Vagrant.configure('2') do |config|
>> +  # Debian 7.4 32-bit i386 without configuration management software
>> +  config.vm.box = "puppetlabs/debian-7.4-32-nocm"
>> +  #config.vm.box = "pnd/debian-wheezy32-basebox"
>> +  config.vm.hostname = "tests"
>> +
>> +  config.vm.define "tests" do |conf|
>> +    conf.vm.provision :file, source: "contrib/test.run-tests", destination:"run-tests"
>
> Why not just make VirtualBox mount the repo root so that we can run tests the normal way? Make the provisioning script create the ramdisk (and export TMPDIR=/tmp/ram ?).

I am not sure that ramdisk will persist between reboots. Provisioning
is done only once.

Patch

diff -r 2392b9e19366 -r 65a3d892ee2f Vagrantfile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Vagrantfile	Sat Jul 05 16:32:28 2014 +0300
@@ -0,0 +1,18 @@ 
+# -*- mode: ruby -*-
+
+# Usage:
+#
+# $ vagrant up
+# $ vagrant ssh -c ./run-tests
+
+Vagrant.configure('2') do |config|
+  # Debian 7.4 32-bit i386 without configuration management software
+  config.vm.box = "puppetlabs/debian-7.4-32-nocm"
+  #config.vm.box = "pnd/debian-wheezy32-basebox"
+  config.vm.hostname = "tests"
+
+  config.vm.define "tests" do |conf|
+    conf.vm.provision :file, source: "contrib/test.run-tests", destination:"run-tests"
+    conf.vm.provision :shell, path: "contrib/test.provision"
+  end
+end
diff -r 2392b9e19366 -r 65a3d892ee2f contrib/test.provision
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/test.provision	Sat Jul 05 16:32:28 2014 +0300
@@ -0,0 +1,10 @@ 
+#!/bin/sh
+# This scripts is used to install dependencies for
+# testing Mercurial. Mainly used by Vagrant (see
+# Vagrantfile for details).
+
+export DEBIAN_FRONTEND=noninteractive
+apt-get update
+apt-get install -y -q python-dev unzip
+# run-tests is added by Vagrantfile
+chmod +x run-tests
diff -r 2392b9e19366 -r 65a3d892ee2f contrib/test.run-tests
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/test.run-tests	Sat Jul 05 16:32:28 2014 +0300
@@ -0,0 +1,12 @@ 
+#!/bin/sh
+# This scripts is used to setup temp directory in memory
+# for running Mercurial tests in vritual machine managed
+# by Vagrant (see Vagrantfile for details).
+
+cd /vagrant
+make local
+cd tests
+mkdir /tmp/ram
+sudo mount -t tmpfs -o size=100M tmpfs /tmp/ram
+./run-tests.py -l --tmpdir=/tmp/ram/delme --time
+