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

login
register
mail settings
Submitter anatoly techtonik
Date July 15, 2014, 1:34 a.m.
Message ID <d99d19868789854abe6a.1405388095@BlackBox>
Download mbox | patch
Permalink /patch/5166/
State Accepted
Headers show

Comments

anatoly techtonik - July 15, 2014, 1:34 a.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 d99d19868789854abe6a421cbdb66935bf441cd9
# Parent  92666a869ea4e39d31b836831ef9f7abdf72bc1a
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.sh

Review fixes:
[x] move everything to contrib/vagrant/
[x] rename scripts to provision.sh and run-tests.sh
[x] add README.md
[x] add .vagrant to .hgignore
[x] mount repo root at /hgshared

Patch

diff -r 92666a869ea4 -r d99d19868789 .hgignore
--- a/.hgignore	Tue Jul 08 14:45:55 2014 -0500
+++ b/.hgignore	Sat Jul 05 16:32:28 2014 +0300
@@ -25,6 +25,7 @@ 
 tests/htmlcov
 build
 contrib/hgsh/hgsh
+contrib/vagrant/.vagrant
 dist
 doc/common.txt
 doc/*.[0-9]
diff -r 92666a869ea4 -r d99d19868789 contrib/vagrant/README.md
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/vagrant/README.md	Sat Jul 05 16:32:28 2014 +0300
@@ -0,0 +1,4 @@ 
+Run Mercurial tests with Vagrant:
+
+$ vagrant up
+$ vagrant ssh -c ./run-tests.sh
diff -r 92666a869ea4 -r d99d19868789 contrib/vagrant/Vagrantfile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/vagrant/Vagrantfile	Sat Jul 05 16:32:28 2014 +0300
@@ -0,0 +1,14 @@ 
+# -*- mode: ruby -*-
+
+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: "run-tests.sh", destination:"run-tests.sh"
+    conf.vm.provision :shell, path: "provision.sh"
+    conf.vm.synced_folder "../..", "/hgshared"
+  end
+end
diff -r 92666a869ea4 -r d99d19868789 contrib/vagrant/provision.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/vagrant/provision.sh	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.sh is added by Vagrantfile
+chmod +x run-tests.sh
diff -r 92666a869ea4 -r d99d19868789 contrib/vagrant/run-tests.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/vagrant/run-tests.sh	Sat Jul 05 16:32:28 2014 +0300
@@ -0,0 +1,13 @@ 
+#!/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 /hgshared
+make local
+cd tests
+mkdir /tmp/ram
+sudo mount -t tmpfs -o size=100M tmpfs /tmp/ram
+export TMPDIR=/tmp/ram
+./run-tests.py -l --time
+