[Fusionforge-commits] r13133 - in branches/Branch_5_1/tests: . code/syntax config func func/Testing lxc openvz preseed scripts

Christian Bayle cbayle at fusionforge.org
Thu Apr 14 22:14:06 CEST 2011


Author: cbayle
Date: 2011-04-14 22:14:06 +0200 (Thu, 14 Apr 2011)
New Revision: 13133

Added:
   branches/Branch_5_1/tests/config/
   branches/Branch_5_1/tests/config/christian
   branches/Branch_5_1/tests/config/default
   branches/Branch_5_1/tests/config/g-dellm65-1
   branches/Branch_5_1/tests/config/g-virtual05
   branches/Branch_5_1/tests/lxc/
   branches/Branch_5_1/tests/lxc/Makefile
   branches/Branch_5_1/tests/lxc/config.centos5
   branches/Branch_5_1/tests/lxc/config.debian6
   branches/Branch_5_1/tests/lxc/lxc-centos5
   branches/Branch_5_1/tests/lxc/lxc-debian6
   branches/Branch_5_1/tests/openvz/local.g-dellm65-1
   branches/Branch_5_1/tests/scripts/cdx40-build-and-test-source.sh
   branches/Branch_5_1/tests/scripts/phpunit.sh
   branches/Branch_5_1/tests/scripts/start_lxc.sh
   branches/Branch_5_1/tests/scripts/stop_lxc.sh
Removed:
   branches/Branch_5_1/tests/func/config.php.buildbotDEB
   branches/Branch_5_1/tests/openvz/config.christian
   branches/Branch_5_1/tests/openvz/config.default
   branches/Branch_5_1/tests/openvz/config.g-virtual05
Modified:
   branches/Branch_5_1/tests/code/syntax/SyntaxTest.php
   branches/Branch_5_1/tests/func/Testing/DEBSeleniumRemoteSuite.php
   branches/Branch_5_1/tests/func/Testing/RPMSeleniumRemoteSuite.php
   branches/Branch_5_1/tests/func/Testing/SeleniumRemoteSuite.php
   branches/Branch_5_1/tests/func/Testing/TarSeleniumRemoteSuite.php
   branches/Branch_5_1/tests/func/config.php.buildbot
   branches/Branch_5_1/tests/func/config.php.tests
   branches/Branch_5_1/tests/func/db_reload.php
   branches/Branch_5_1/tests/func/db_reload.sh
   branches/Branch_5_1/tests/openvz/Makefile
   branches/Branch_5_1/tests/preseed/postgresql
   branches/Branch_5_1/tests/scripts/fusionforge-build-and-test-deb.sh
   branches/Branch_5_1/tests/scripts/fusionforge-build-and-test-rpm.sh
   branches/Branch_5_1/tests/scripts/fusionforge-build-and-test-source.sh
   branches/Branch_5_1/tests/scripts/fusionforge-trunk-build-rpm.sh
   branches/Branch_5_1/tests/scripts/fusionforge-trunk-test-rpm.sh
   branches/Branch_5_1/tests/scripts/start_vm.sh
   branches/Branch_5_1/tests/scripts/stop_vm.sh
Log:
merge testsuite from trunk


Modified: branches/Branch_5_1/tests/code/syntax/SyntaxTest.php
===================================================================
--- branches/Branch_5_1/tests/code/syntax/SyntaxTest.php	2011-04-14 16:00:36 UTC (rev 13132)
+++ branches/Branch_5_1/tests/code/syntax/SyntaxTest.php	2011-04-14 20:14:06 UTC (rev 13133)
@@ -68,6 +68,18 @@
     }
 
     /**
+     * Ensure no scripts have SVN conflicts markers
+     */
+    public function testSVNConflicts()
+    {
+	    $root = dirname(dirname(dirname(dirname(__FILE__))));
+	    $output = `find $root/src $root/tests -type f | xargs grep -l '^<<<<<<'`;
+	    $this->assertEquals('', $output);
+	    $output = `find $root/src $root/tests -type f | xargs grep -l '^>>>>>>'`;
+	    $this->assertEquals('', $output);
+    }
+
+    /**
      * Ensure no script has an empty last line
      */
     public function testEmptyLastLine()

Copied: branches/Branch_5_1/tests/config/christian (from rev 13128, branches/Branch_5_1/tests/openvz/config.christian)
===================================================================
--- branches/Branch_5_1/tests/config/christian	                        (rev 0)
+++ branches/Branch_5_1/tests/config/christian	2011-04-14 20:14:06 UTC (rev 13133)
@@ -0,0 +1,23 @@
+#
+# In this file you can find vars that are useable 
+# both as an include in a Makefile or
+# be sourced in a shell
+# So it should only be stuffs like VAR=value
+#
+IPDEBBASE=192.168.50
+IPDEBDNS=192.168.50.5
+IPDEBMASK=255.255.255.0
+IPDEBGW=192.168.50.1
+
+IPCOSBASE=192.168.50
+IPCOSDNS=192.168.50.5
+IPCOSMASK=255.255.255.0
+IPCOSGW=192.168.50.1
+
+SSHPUBKEY=~/.ssh/id_rsa.pub
+
+DEBMIRROR=http://christian.bayle.eu/debian
+DEBMIRRORSEC=http://christian.bayle.eu/debian-security
+VMENGINE=lxc
+REMOTESELENIUM=true
+KEEPVM=true

Copied: branches/Branch_5_1/tests/config/default (from rev 13128, branches/Branch_5_1/tests/openvz/config.default)
===================================================================
--- branches/Branch_5_1/tests/config/default	                        (rev 0)
+++ branches/Branch_5_1/tests/config/default	2011-04-14 20:14:06 UTC (rev 13133)
@@ -0,0 +1,39 @@
+#
+# In this file you can find vars that are useable 
+# both as an include in a Makefile or
+# be sourced in a shell
+# So it should only be stuffs like VAR=value
+#
+VEIDDEB=105
+VEIDCOS=110
+VEIDSRC=115
+VEIDSEB=120
+
+DEBVERS=6.0
+COSVERS=5.5
+
+LXCDEBTEMPLATE=debian6
+LXCCOSTEMPLATE=centos5
+
+IPDEBBASE=192.168.222
+IPDEBDNS=192.168.222.1
+IPDEBMASK=255.255.255.0
+IPDEBGW=192.168.222.1
+
+IPCOSBASE=192.168.222
+IPCOSDNS=192.168.222.1
+IPCOSMASK=255.255.255.0
+IPCOSGW=192.168.222.1
+
+VZPRIVATEDIR=/var/lib/vz/private
+# You shouldn't change the next line, don't really work
+VZTEMPLATEDIR=/var/lib/vz/template
+
+SSHPUBKEY=~/.ssh/id_rsa.pub
+HOSTKEYDIR=~/ssh
+
+DIST=squeeze
+VMENGINE=vz
+REMOTESELENIUM=false
+KEEPVM=false
+DNSDOMAIN=local

Added: branches/Branch_5_1/tests/config/g-dellm65-1
===================================================================
--- branches/Branch_5_1/tests/config/g-dellm65-1	                        (rev 0)
+++ branches/Branch_5_1/tests/config/g-dellm65-1	2011-04-14 20:14:06 UTC (rev 13133)
@@ -0,0 +1,20 @@
+
+#
+# In this file you can find vars that are useable 
+# both as an include in a Makefile or
+# be sourced in a shell
+# So it should only be stuffs like VAR=value
+#
+IPDEBBASE=10.194.10
+IPDEBDNS=10.194.11.20
+IPDEBMASK=255.255.255.0
+IPDEBGW=10.194.10.1
+
+IPCOSBASE=10.194.10
+IPCOSDNS=10.194.11.20
+IPCOSMASK=255.255.255.0
+IPCOSGW=10.194.10.1
+
+SSHPUBKEY=~/.ssh/id_rsa.pub
+
+DEBMIRROR=http://127.0.0.1/debian

Copied: branches/Branch_5_1/tests/config/g-virtual05 (from rev 13128, branches/Branch_5_1/tests/openvz/config.g-virtual05)
===================================================================
--- branches/Branch_5_1/tests/config/g-virtual05	                        (rev 0)
+++ branches/Branch_5_1/tests/config/g-virtual05	2011-04-14 20:14:06 UTC (rev 13133)
@@ -0,0 +1,28 @@
+
+#
+# In this file you can find vars that are useable 
+# both as an include in a Makefile or
+# be sourced in a shell
+# So it should only be stuffs like VAR=value
+#
+
+IPDEBBASE=10.194.10
+IPDEBDNS=10.194.11.20
+IPDEBMASK=255.255.255.0
+IPDEBGW=10.194.10.1
+
+IPCOSBASE=10.194.10
+IPCOSDNS=10.194.11.20
+IPCOSMASK=255.255.255.0
+IPCOSGW=10.194.10.1
+
+SSHPUBKEY=~/.ssh/id_rsa.pub
+
+DEBMIRROR=http://g-rub.rd.francetelecom.fr:3142/debian
+DAG_RPMFORGE_REPO=http://g-virtual02.rd.francetelecom.fr/dag/redhat
+EPEL_REPO=http://g-virtual02.rd.francetelecom.fr/epel
+
+VMENGINE=lxc
+REMOTESELENIUM=true
+KEEPVM=true
+DNSDOMAIN=rd.francetelecom.fr

Modified: branches/Branch_5_1/tests/func/Testing/DEBSeleniumRemoteSuite.php
===================================================================
--- branches/Branch_5_1/tests/func/Testing/DEBSeleniumRemoteSuite.php	2011-04-14 16:00:36 UTC (rev 13132)
+++ branches/Branch_5_1/tests/func/Testing/DEBSeleniumRemoteSuite.php	2011-04-14 20:14:06 UTC (rev 13133)
@@ -7,30 +7,6 @@
 	protected function setUp()
 	{
 		parent::setUp();
-
-		system("scp -r ../tests/preseed root@".HOST.":/root/");
-		system("ssh root@".HOST." 'cat /root/preseed/* | LANG=C debconf-set-selections'");
-
-		/*
-		if (getenv('FFORGE_DEB_REPO')) {
-			system("ssh root@".HOST." 'echo \"deb ".getenv('FFORGE_DEB_REPO')." ".getenv('DIST')." main\" > /etc/apt/sources.list.d/fusionforge.list'");
-		}
-		*/
-		system("ssh root@".HOST." 'echo \"deb file:/debian ".getenv('DIST')." main\" > /etc/apt/sources.list.d/fusionforge.list'");
-		system("scp -r ".getenv('WORKSPACE')."/build/debian root@".HOST.":/");
-		system("gpg --export --armor | ssh root@".HOST." apt-key add -");
-
-		sleep(5);
-		
-		system("ssh root@".HOST." 'apt-get update'");
-		system("ssh root@".HOST." 'UCF_FORCE_CONFFNEW=yes DEBIAN_FRONTEND=noninteractive LANG=C apt-get -y --force-yes install postgresql-contrib fusionforge-full'");
-		system("ssh root@".HOST." 'LANG=C a2dissite default'");
-		system("ssh root@".HOST." 'LANG=C invoke-rc.d apache2 reload'");
-		system("ssh root@".HOST." 'LANG=C touch /tmp/fusionforge-use-pfo-rbac'");
-		system("scp ../tests/func/db_reload.sh root@".HOST.":");
-		system("ssh root@".HOST." '(echo [core];echo use_ssl=no) > /etc/gforge/config.ini.d/zzz-builbot.ini'");
-		system("ssh root@".HOST." 'su - postgres -c \"pg_dump -Fc gforge\" > /root/dump'") ;
-		system("ssh root@".HOST." 'invoke-rc.d cron stop'");
 	}
 }
 ?>

Modified: branches/Branch_5_1/tests/func/Testing/RPMSeleniumRemoteSuite.php
===================================================================
--- branches/Branch_5_1/tests/func/Testing/RPMSeleniumRemoteSuite.php	2011-04-14 16:00:36 UTC (rev 13132)
+++ branches/Branch_5_1/tests/func/Testing/RPMSeleniumRemoteSuite.php	2011-04-14 20:14:06 UTC (rev 13133)
@@ -7,33 +7,6 @@
 	protected function setUp()
 	{
 		parent::setUp();
-
-		system("scp -r ../tests root@".HOST.":/usr/share");
-		system("ssh root@".HOST." 'ln -s gforge /usr/share/src'");
-		
-		system("scp -rp ~/fusionforge_repo root@".HOST.":");
-		system("scp -rp ".dirname(__FILE__)."/../../../src/rpm-specific/dag-rpmforge.repo root@".HOST.":/etc/yum.repos.d/");
-
-//		system("scp -rp ".dirname(__FILE__)."/../../../src/rpm-specific/fusionforge-ci.repo root@".HOST.":/etc/yum.repos.d/");
-		if (getenv('FFORGE_RPM_REPO')) {
-			system("ssh root@".HOST." 'cd /etc/yum.repos.d/; wget ".getenv('FFORGE_RPM_REPO')."/fusionforge.repo'");
-		}
-
-		sleep(5);
-		
-		if (is_file("/tmp/timedhosts.txt")) {
-			system("scp -p /tmp/timedhosts.txt root@".HOST.":/var/cache/yum/timedhosts.txt");
-		}
-
-		system("ssh root@".HOST." 'yum install -y fusionforge fusionforge-plugin-scmsvn fusionforge-plugin-online_help fusionforge-plugin-extratabs fusionforge-plugin-ldapextauth fusionforge-plugin-scmgit fusionforge-plugin-blocks'");
-
-		system("scp -p root@".HOST.":/var/cache/yum/timedhosts.txt /tmp/timedhosts.txt");
-		system("ssh root@".HOST." '(echo [core];echo use_ssl=no) > /etc/gforge/config.ini.d/zzz-builbot.ini'");
-
-		// Install a fake sendmail to catch all outgoing emails.
-		system("ssh root@".HOST." 'perl -spi -e s#/usr/sbin/sendmail#/usr/share/tests/scripts/catch_mail.php# /etc/gforge/local.inc'");
-
-		system("ssh root@".HOST." 'service crond stop'");
 	}
 }
 ?>

Modified: branches/Branch_5_1/tests/func/Testing/SeleniumRemoteSuite.php
===================================================================
--- branches/Branch_5_1/tests/func/Testing/SeleniumRemoteSuite.php	2011-04-14 16:00:36 UTC (rev 13132)
+++ branches/Branch_5_1/tests/func/Testing/SeleniumRemoteSuite.php	2011-04-14 20:14:06 UTC (rev 13133)
@@ -13,23 +13,11 @@
 			$this->screenshotPath = getenv('SELENIUM_RC_DIR');
 			$this->screenshotUrl = getenv('SELENIUM_RC_URL');
 		}
-
-		system("cd scripts; ./start_vm.sh ".HOST);
-
-		//system("scp /usr/share/php/PHPUnit/Extensions/SeleniumTestCase/*pend.php root at centos52:/opt/tests");
-		//system("scp /usr/share/php/PHPUnit/Extensions/SeleniumTestCase/phpunit_coverage.php root at centos52:/opt/gforge/www");
-		//system("ssh root at centos52 'perl -spi -e \'s!^auto_prepend_file.*!auto_prepend_file=/opt/tests/prepend.php!\' /etc/php.ini');
-		//system("ssh root at centos52 'perl -spi -e \'s!^auto_append_file.*!auto_append_file=/opt/tests/append.php!\' /etc/php.ini');
-
-		system("ssh root at centos52 'service crond stop'");
 	}
 
 	protected function tearDown()
 	{
-		if (getenv('SELENIUM_RC_DIR')) {
-			system("scp -r root@".HOST.":/var/log ".getenv('SELENIUM_RC_DIR'));
-		}
-		system("cd scripts; ./stop_vm.sh ".HOST);
+		echo "tearDown\n";
 	}
 }
 ?>

Modified: branches/Branch_5_1/tests/func/Testing/TarSeleniumRemoteSuite.php
===================================================================
--- branches/Branch_5_1/tests/func/Testing/TarSeleniumRemoteSuite.php	2011-04-14 16:00:36 UTC (rev 13132)
+++ branches/Branch_5_1/tests/func/Testing/TarSeleniumRemoteSuite.php	2011-04-14 20:14:06 UTC (rev 13133)
@@ -7,29 +7,6 @@
 	protected function setUp()
 	{
 		parent::setUp();
-
-		system("scp -r ../tests root@".HOST.":/opt");
-
-		if (getenv('BUILDRESULT')) {
-			system("scp ".getenv('BUILDRESULT')."/fusionforge-*.tar.bz2 root@".HOST.":");
-		} else {
-			system("scp ../../build/packages/fusionforge-*.tar.bz2 root@".HOST.":");
-		}
-		system("ssh root at centos52 'tar jxf fusionforge-*.tar.bz2'");
-
-		if (is_file("/tmp/timedhosts.txt")) {
-			system("scp -p /tmp/timedhosts.txt root@".HOST.":/var/cache/yum/timedhosts.txt");
-		}
-
-		system("ssh root at centos52 'cd fusionforge-*; FFORGE_RPM_REPO=http://buildbot.fusionforge.org/job/fusionforge-Branch_5_1-build-and-test-rpm/ws/build/packages/ FFORGE_DB=fforge FFORGE_USER=gforge FFORGE_ADMIN_USER=ffadmin FFORGE_ADMIN_PASSWORD=ffadmin ./install.sh centos52.local'");
-
-		system("scp -p root@".HOST.":/var/cache/yum/timedhosts.txt /tmp/timedhosts.txt");
-		system("ssh root@".HOST." '(echo [core];echo use_ssl=no) > /etc/gforge/config.ini.d/zzzz-builbot.ini'");
-
-		// Install a fake sendmail to catch all outgoing emails.
-		system("ssh root@".HOST." 'perl -spi -e s#/usr/sbin/sendmail#/opt/tests/scripts/catch_mail.php# /etc/gforge/local.inc'");
-
-		system("ssh root@".HOST." 'service crond stop'");
 	}
 }
 ?>

Modified: branches/Branch_5_1/tests/func/config.php.buildbot
===================================================================
--- branches/Branch_5_1/tests/func/config.php.buildbot	2011-04-14 16:00:36 UTC (rev 13132)
+++ branches/Branch_5_1/tests/func/config.php.buildbot	2011-04-14 20:14:06 UTC (rev 13133)
@@ -24,7 +24,7 @@
 define('DB_NAME', getenv('DB_NAME'));
 define('DB_USER', 'gforge');
 define('DB_PASSWORD', '@@FFDB_PASS@@');
-define('DB_INIT_CMD', "ssh root@".HOST." 'cd /opt/tests/func 2>/dev/null || cd /usr/share/tests/func; CONFIGURED=true CONFIG_PHP=config.php.buildbot DB_NAME=".DB_NAME." php db_reload.php ; touch /tmp/fusionforge-use-pfo-rbac'");
+define('DB_INIT_CMD', "ssh root@".HOST." '/root/tests/func/db_reload.sh ".DB_NAME." >/dev/null;'");
 
 // this should be an existing user of the forge together with its password
 // (the password should be different from 'myadmin')

Deleted: branches/Branch_5_1/tests/func/config.php.buildbotDEB
===================================================================
--- branches/Branch_5_1/tests/func/config.php.buildbotDEB	2011-04-14 16:00:36 UTC (rev 13132)
+++ branches/Branch_5_1/tests/func/config.php.buildbotDEB	2011-04-14 20:14:06 UTC (rev 13133)
@@ -1,54 +0,0 @@
-<?php
-/*
- * DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER 
- * DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER 
- * 
- * Running the test suite will drop your current database, this is
- * to be used only on test environment.
- * 
- * DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER 
- * DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER DANGER 
- */
-
-// Host where selenium-rc is running
-define ('SELENIUM_RC_HOST', getenv('SELENIUM_RC_HOST'));
-define ('SELENIUM_RC_DIR', getenv('SELENIUM_RC_DIR'));
-
-// The forge's hostname
-define ('HOST', getenv('HOST'));
-
-// Base URL where FusionForge is installed
-define ('ROOT', '');
-
-// Database connection parameters.
-define('DB_NAME', getenv('DB_NAME'));
-define('DB_USER', 'gforge');
-define('DB_PASSWORD', '@@FFDB_PASS@@');
-define('DB_INIT_CMD', "ssh root@".HOST." '/root/db_reload.sh ; touch /tmp/fusionforge-use-pfo-rbac'");
-
-// this should be an existing user of the forge together with its password
-// (the password should be different from 'myadmin')
-define ('EXISTING_USER', 'admin');
-define ('PASSWD_OF_EXISTING_USER', 'myadmin');
-
-// Where CLI is installed
-define ('CLI_CMD', '/opt/gforge/acde/tools/gforge-cli/gforge.php');
-
-// Where Java CLI is installed
-define ('JAGOSI_CMD', '/opt/gforge/acde/tools/gforge-java-cli/');
-
-// Enter true when file is configured.
-define('CONFIGURED', getenv('CONFIGURED'));
-
-//
-// DON'T MODIFY BELOW THIS LINE UNLESS YOU KNOW WHAT YOU DO
-//
-
-// These are deduced from the previous definitions.
-
-// URL to access the application
-define ('URL', 'http://'.HOST.'/');
-
-// WSDL of the forges SOAP API
-define ('WSDL_URL', URL.'soap/index.php?wsdl');
-?>

Modified: branches/Branch_5_1/tests/func/config.php.tests
===================================================================
--- branches/Branch_5_1/tests/func/config.php.tests	2011-04-14 16:00:36 UTC (rev 13132)
+++ branches/Branch_5_1/tests/func/config.php.tests	2011-04-14 20:14:06 UTC (rev 13133)
@@ -13,6 +13,9 @@
 // Host where selenium-rc is running
 define ('SELENIUM_RC_HOST', '192.168.0.204');
 
+// The forge's hostname
+define ('HOST', getenv('HOST'));
+
 // URL to access the application
 define ('URL', 'http://centos52.local/');
 

Modified: branches/Branch_5_1/tests/func/db_reload.php
===================================================================
--- branches/Branch_5_1/tests/func/db_reload.php	2011-04-14 16:00:36 UTC (rev 13132)
+++ branches/Branch_5_1/tests/func/db_reload.php	2011-04-14 20:14:06 UTC (rev 13133)
@@ -66,8 +66,14 @@
 if (!file_exists($forge_root)) {
 	$forge_root = dirname(dirname(dirname(__FILE__))).'/gforge';
 	if (!file_exists($forge_root)) {
-		print "ERROR: Unable to guess location of fusionforge main directory (gforge), aborting.\n";
-		exit(1);
+		$forge_root = '/usr/share/gforge';
+		if (!file_exists($forge_root)) {
+			$forge_root = '/opt/gforge';
+			if (!file_exists($forge_root)) {
+				print "ERROR: Unable to guess location of fusionforge main directory (gforge), aborting.\n";
+				exit(1);
+			}
+		}
 	}
 }
 
@@ -102,7 +108,7 @@
 //
 $user = new GFUser();
 $user_id = $user->create('admin', 'Forge', 'Admin', $adminPassword, $adminPassword,
-	$adminEmail, 1, 1, 1,'GMT','',0,1,'', '','','','','','US',false, 'admin');
+	$adminEmail, 1, 1, 1,'GMT','',0,1,'', '','','','','','US',false);
 
 if (!$user_id) {
 	print "ERROR: Creating user: ".$user->getErrorMessage().':'.db_error()."\n";

Modified: branches/Branch_5_1/tests/func/db_reload.sh
===================================================================
--- branches/Branch_5_1/tests/func/db_reload.sh	2011-04-14 16:00:36 UTC (rev 13132)
+++ branches/Branch_5_1/tests/func/db_reload.sh	2011-04-14 20:14:06 UTC (rev 13133)
@@ -1,11 +1,34 @@
 #! /bin/sh
+if [ $# -eq 1 ]
+then
+	database=$1
+else
+	export PATH=$PATH:/usr/share/gforge/bin/:/usr/share/gforge/utils:/opt/gforge/utils
+	database=`forge_get_config database_name`
+fi
+if [ "x$database" = "x" ]
+then
+	echo "Forge database name not found"
+	exit 1
+fi
 
 echo "Cleaning up the database"
-invoke-rc.d apache2 stop
+if type invoke-rc.d 2>/dev/null
+then
+	invoke-rc.d apache2 stop
+	invoke-rc.d postgresql restart
+else
+	service httpd stop
+	service postgresql restart
+fi
 
-invoke-rc.d postgresql restart
-su - postgres -c "dropdb -e gforge"
+su - postgres -c "dropdb -e $database"
 echo "Executing: pg_restore -C -d template1 < /root/dump"
 su - postgres -c "pg_restore -C -d template1" < /root/dump
 
-invoke-rc.d apache2 start
+if type invoke-rc.d 2>/dev/null
+then
+	invoke-rc.d apache2 start
+else
+	service httpd start
+fi

Added: branches/Branch_5_1/tests/lxc/Makefile
===================================================================
--- branches/Branch_5_1/tests/lxc/Makefile	                        (rev 0)
+++ branches/Branch_5_1/tests/lxc/Makefile	2011-04-14 20:14:06 UTC (rev 13133)
@@ -0,0 +1,118 @@
+
+VMROOT=/var/lib/lxc/vmdebian6
+
+-include ../config/default
+-include ../config/$(shell hostname)
+
+#default: vmdebian6-config netstaticdeb installkey
+default: installtemplate
+	@echo "read the Makefile to see available targets"
+
+/cgroup: beroot
+	[ ! -d /cgroup ] || mkdir /cgroup
+
+checkmount: checkfstab /cgroup
+	grep -q 0 /cgroup/cpuset.cpu || mount /cgroup
+
+checkfstab:
+	grep ^cgroup /etc/fstab || (echo "You need to add cgroup entry to fstab \"cgroup        /cgroup        cgroup        defaults    0    0\"" && false)
+
+/var/lib/lxc/vmdebian6: beroot /usr/bin/lxc-info bridging
+	mkdir $@
+	LANG=C MIRROR=$(DEBMIRROR) SUITE=$(DIST) ./lxc-debian6 -p $@
+
+/usr/bin/lxc-info: beroot
+	apt-get install lxc bridge-utils
+
+bridging:
+	@grep -q '^iface br0 inet' /etc/network/interfaces || (echo "Please setup network bridging" && false)
+
+vmdebian6-config: beroot /var/lib/lxc/vmdebian6
+	@grep -q lxc.utsname /var/lib/lxc/vmdebian6/config || \
+	(sh -c "echo \"lxc.utsname = vmdebian6\" >> $(VMROOT)/config" ; \
+	sh -c "echo \"lxc.network.type = veth\" >> $(VMROOT)/config" ; \
+	sh -c "echo \"lxc.network.flags = up\" >> $(VMROOT)/config" ; \
+	sh -c "echo \"lxc.network.link = br0\" >> $(VMROOT)/config" ; \
+	)
+
+vmdebian6-ip: beroot
+	#sh -c "echo \"lxc.network.ipv4 = $(IPDEBBASE).$(VEIDDEB)/24\">> $(VMROOT)/config" ; \
+	#
+
+cleandeb6: beroot
+	lxc-stop -n vmdebian6 || true
+	lxc-destroy -n vmdebian6 || true
+
+netstaticdeb: beroot
+	@grep -q "iface eth0 inet static" $(VMROOT)/rootfs/etc/network/interfaces || \
+	(sh -c "echo \"auto lo\" > $(VMROOT)/rootfs/etc/network/interfaces" ; \
+	sh -c "echo \"iface lo inet loopback\" >> $(VMROOT)/rootfs/etc/network/interfaces" ; \
+	sh -c "echo \"auto eth0\" >> $(VMROOT)/rootfs/etc/network/interfaces" ; \
+	sh -c "echo \"iface eth0 inet static\" >> $(VMROOT)/rootfs/etc/network/interfaces" ; \
+	sh -c "echo \"	address $(IPDEBBASE).$(VEIDDEB)\" >> $(VMROOT)/rootfs/etc/network/interfaces" ; \
+	sh -c "echo \"	netmask 255.255.255.0\" >> $(VMROOT)/rootfs/etc/network/interfaces" ; \
+	sh -c "echo \"	gateway $(IPDEBBASE).1\" >> $(VMROOT)/rootfs/etc/network/interfaces" ; \
+	)
+
+netstaticdns: beroot
+	#sh -c "echo \"	dns-nameservers $(IPDEBDNS)\" >> $(VMROOT)/rootfs/etc/network/interfaces" ; \
+	#sh -c "echo \"	dns-search $(IPDEBDOMAIN)\" >> $(VMROOT)/rootfs/etc/network/interfaces" ; \
+	#
+
+installkey: beroot ssh
+	[ -d $(VMROOT)/root/.ssh ] || mkdir -p $(VMROOT)/rootfs/root/.ssh
+	cp $(SSHPUBKEY) $(VMROOT)/rootfs/root/.ssh/authorized_keys
+	[ -d $(VMROOT)/etc/ssh ] || mkdir -p $(VMROOT)/rootfs/etc/ssh
+	cp ssh/ssh_host_* $(VMROOT)/rootfs/etc/ssh/
+
+ssh:
+	[ -e ssh ] || (echo "You need a ssh dir containing host keys like /etc/ssh_host_*" && false)
+
+setname: beroot
+	echo "debian6.local" > $(VMROOT)/rootfs/etc/hostname
+	grep -q debian6.local $(VMROOT)/rootfs/etc/hosts || echo "$(IPDEBBASE).$(VEIDDEB)	debian6.local debian6" >> $(VMROOT)/rootfs/etc/hosts
+
+beroot:
+	@[ $(shell id -u) = "0" ] || (echo "you should be root to run this" ; exit 1)
+
+lxcstart: /cgroup/tasks
+	lxc-start -n vmdebian6 -d
+	sleep 5
+	lxc-info -n vmdebian6
+
+addrights: beroot
+	lxc-setcap
+
+delrights: beroot
+	lxc-setcap -d
+
+installtemplate: beroot
+	cat lxc-debian6 | sed 's!http://cdn.debian.net/debian/!$(DEBMIRROR)!' > /usr/lib/lxc/templates/lxc-debian6
+	chmod 755 /usr/lib/lxc/templates/lxc-debian6
+	cp lxc-centos5 /usr/lib/lxc/templates/
+
+createdeb: beroot
+	/usr/bin/lxc-create -n debian6.local -f config.debian6 -t debian6
+
+createcos: beroot
+	/usr/bin/lxc-create -n centos5.local -f config.centos5 -t centos5
+
+startdeb:
+	sudo LANG=C /usr/bin/lxc-start -n debian6.local -d
+
+stopdeb:
+	sudo LANG=C /usr/bin/lxc-stop -n debian6.local
+
+startcos:
+	sudo LANG=C /usr/bin/lxc-start -n centos5.local -d
+
+stopcos:
+	sudo LANG=C /usr/bin/lxc-stop -n centos5.local
+
+destroydeb: beroot
+	sudo LANG=C /usr/bin/lxc-stop -n debian6.local
+	sudo LANG=C /usr/bin/lxc-destroy -n debian6.local
+
+destroycos: beroot
+	sudo LANG=C /usr/bin/lxc-stop -n centos5.local
+	sudo LANG=C /usr/bin/lxc-destroy -n centos5.local

Added: branches/Branch_5_1/tests/lxc/config.centos5
===================================================================
--- branches/Branch_5_1/tests/lxc/config.centos5	                        (rev 0)
+++ branches/Branch_5_1/tests/lxc/config.centos5	2011-04-14 20:14:06 UTC (rev 13133)
@@ -0,0 +1,3 @@
+lxc.network.type = veth
+lxc.network.flags = up
+lxc.network.link = br0

Added: branches/Branch_5_1/tests/lxc/config.debian6
===================================================================
--- branches/Branch_5_1/tests/lxc/config.debian6	                        (rev 0)
+++ branches/Branch_5_1/tests/lxc/config.debian6	2011-04-14 20:14:06 UTC (rev 13133)
@@ -0,0 +1,3 @@
+lxc.network.type = veth
+lxc.network.flags = up
+lxc.network.link = br0

Added: branches/Branch_5_1/tests/lxc/lxc-centos5
===================================================================
--- branches/Branch_5_1/tests/lxc/lxc-centos5	                        (rev 0)
+++ branches/Branch_5_1/tests/lxc/lxc-centos5	2011-04-14 20:14:06 UTC (rev 13133)
@@ -0,0 +1,599 @@
+#!/bin/bash
+
+#
+# template script for generating centos container for LXC
+#
+
+#
+# lxc: linux Container library
+
+# Authors:
+# Daniel Lezcano <daniel.lezcano at free.fr>
+
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+DISTRO=centos-5
+
+configure_centos()
+{
+    path=$1
+    rootfs=$2
+    hostname=$3
+
+    # disable selinux in centos
+    mkdir -p $rootfs/selinux
+    echo 0 > $rootfs/selinux/enforce
+
+    if grep -q ^lxc.network.ipv4 $path/config
+    then
+        # configure static network
+        lxc_network_ipv4=`grep ^lxc.network.ipv4 $path/config | cut -d= -f2`
+        address=`echo $lxc_network_ipv4 | cut -d/ -f1`
+	netmask=`netmask -s $lxc_network_ipv4 | cut -d/ -f2`
+        if [ -e $rootfs/etc/sysconfig/network-scripts ]
+        then
+                cat <<EOF > $rootfs/etc/sysconfig/network-scripts/ifcfg-eth0
+DEVICE=eth0
+IPADDR=$address
+NETMASK=$netmask
+#NETWORK=
+#BROADCAST=
+ONBOOT=yes
+BOOTPROTO=none
+USERCTL=no
+EOF
+                cat <<EOF > $rootfs/etc/sysconfig/network
+NETWORKING=yes
+FORWARD_IPV4=yes
+HOSTNAME=$hostname
+#GATEWAY=
+GATEWAYDEV=eth0
+EOF
+                cat <<EOF >> $rootfs/etc/hosts
+$address        $hostname
+EOF
+                echo "Network configured with static ip"
+        else
+                exit 2
+        fi
+        
+    else
+        # configure the network using the dhcp
+        if [ -e $rootfs/etc/sysconfig/network-scripts ]
+        then
+                cat <<EOF > $rootfs/etc/sysconfig/network-scripts/ifcfg-eth0
+DEVICE=eth0
+ONBOOT=yes
+BOOTPROTO=dhcp
+USERCTL=no
+EOF
+                cat <<EOF > $rootfs/etc/sysconfig/network
+NETWORKING=yes
+FORWARD_IPV4=yes
+HOSTNAME=$hostname
+GATEWAYDEV=eth0
+EOF
+                cat <<EOF >> $rootfs/etc/hosts
+127.0.1.1       $hostname
+EOF
+                echo "Network configured with dhcp"
+        else
+                exit 3
+        fi
+        # When domain is not local, avahi completed by send hostname
+        hostnamebase=`echo $hostname | cut -d. -f1`
+        if [ "$hostnamebase.local" != "$hostname" ]
+        then
+                cat <<EOF > $rootfs/etc/dhclient.conf
+send host-name "$hostnamebase";
+EOF
+        fi
+    fi
+
+    # provide the lxc service
+#    cat <<EOF > $rootfs/etc/init/lxc.conf
+## fake some events needed for correct startup other services
+#
+#description     "Container Upstart"
+#
+#start on startup
+#
+#script
+#        rm -rf /var/run/*.pid
+#        rm -rf /var/run/network/*
+#        /sbin/initctl emit stopped JOB=udevtrigger --no-wait
+#        /sbin/initctl emit started JOB=udev --no-wait
+#end script
+#EOF
+
+#    cat <<EOF > $rootfs/etc/init/console.conf
+## console - getty
+##
+## This service maintains a console on tty1 from the point the system is
+## started until it is shut down again.
+#
+#start on stopped rc RUNLEVEL=[2345]
+#stop on runlevel [!2345]
+#
+#respawn
+#exec /sbin/getty -8 38400 /dev/console
+#EOF
+#sed -i -e '/getty/d' $rootfs/etc/inittab
+# Disable tty5 and tty6
+sed -i -e '/^5:/d' $rootfs/etc/inittab
+sed -i -e '/^6:/d' $rootfs/etc/inittab
+# Enable console
+cat <<EOF >> $rootfs/etc/inittab
+0:2345:respawn:/sbin/mingetty console
+EOF
+
+#    cat <<EOF > $rootfs/lib/init/fstab
+## /lib/init/fstab: lxc system fstab
+#none            /spu                      spufs           gid=spu,optional                  0 0
+#none            /tmp                      none            defaults                          0 0
+#none            /var/lock                 tmpfs           nodev,noexec,nosuid,showthrough   0 0
+#none            /lib/init/rw              tmpfs           mode=0755,nosuid,optional         0 0
+#EOF
+cat <<EOF > $rootfs/etc/fstab
+# NOT MOUNTING IN LXC
+#none /dev/pts devpts defaults 0 0
+#none /proc    proc   defaults 0 0
+#none /sys     sysfs  defaults 0 0
+#none /dev/shm tmpfs  defaults 0 0
+EOF
+
+    # reconfigure some services
+#    if [ -z "$LANG" ]; then
+#	chroot $rootfs locale-gen en_US.UTF-8
+#	chroot $rootfs update-locale LANG=en_US.UTF-8
+#    else
+#	chroot $rootfs locale-gen $LANG
+#	chroot $rootfs update-locale LANG=$LANG
+#    fi
+
+    # remove pointless services in a container
+#    chroot $rootfs /usr/sbin/update-rc.d -f ondemand remove
+
+#    chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls u*.conf); do mv $f $f.orig; done'
+#    chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls tty[2-9].conf); do mv $f $f.orig; done'
+#    chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls plymouth*.conf); do mv $f $f.orig; done'
+#    chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls hwclock*.conf); do mv $f $f.orig; done'
+#    chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls module*.conf); do mv $f $f.orig; done'
+mv $rootfs/sbin/hwclock $rootfs/sbin/hwclock.removed_by_lxc
+
+    echo "Please change root-password !"
+    echo "root:root" | chroot $rootfs chpasswd
+
+sed -i -e '/start_udev/d' $rootfs/etc/rc.d/rc.sysinit
+
+    # fix avahi
+    if [ -f $rootfs/etc/init.d/avahi-daemon ]
+    then
+	echo 'Fix avahi'
+        sed -i -e "s!-D!-D --no-rlimits!" $rootfs/etc/init.d/avahi-daemon
+    fi
+
+
+#rm -f $rootfs/etc/mtab
+#ln -s /proc/mounts $rootfs/etc/mtab
+
+mv $rootfs/dev $rootfs/dev.old
+mkdir $rootfs/dev
+test -e $rootfs/dev/null    || mknod -m 666 $rootfs/dev/null c 1 3
+test -e $rootfs/dev/zero    || mknod -m 666 $rootfs/dev/zero c 1 5
+test -e $rootfs/dev/random  || mknod -m 666 $rootfs/dev/random c 1 8
+test -e $rootfs/dev/urandom || mknod -m 666 $rootfs/dev/urandom c 1 9
+test -e $rootfs/dev/pts     || mkdir -m 755 $rootfs/dev/pts
+test -e $rootfs/dev/shm     || mkdir -m 1777 $rootfs/dev/shm
+test -e $rootfs/dev/tty     || mknod -m 666 $rootfs/dev/tty c 5 0
+test -e $rootfs/dev/console || mknod -m 600 $rootfs/dev/console c 5 1
+test -e $rootfs/dev/tty0    || mknod -m 666 $rootfs/dev/tty0 c 4 0
+test -e $rootfs/dev/full    || mknod -m 666 $rootfs/dev/full c 1 7
+test -e $rootfs/dev/initctl || mknod -m 600 $rootfs/dev/initctl p
+test -e $rootfs/dev/ptmx    || mknod -m 666 $rootfs/dev/ptmx c 5 2
+
+#test -e $rootfs/dev/pts/0 || mknod $rootfs/dev/pts/0 c 136 0
+test -e $rootfs/dev/tty1 || mknod -m 666 $rootfs/dev/tty1 c 4 1
+test -e $rootfs/dev/tty2 || mknod -m 666 $rootfs/dev/tty2 c 4 2
+test -e $rootfs/dev/tty3 || mknod -m 666 $rootfs/dev/tty3 c 4 3
+test -e $rootfs/dev/tty4 || mknod -m 666 $rootfs/dev/tty4 c 4 4
+test -e $rootfs/dev/tty5 || mknod -m 666 $rootfs/dev/tty5 c 4 5
+test -e $rootfs/dev/tty6 || mknod -m 666 $rootfs/dev/tty6 c 4 6
+
+#cp /etc/localtime $rootfs/etc/localtime
+#cp /etc/timezone $rootfs/etc/timezone
+
+    return 0
+}
+
+configure_pubkey(){
+	path=$1
+	rootfs=$2
+        if grep -q ^\#lxc.pubkey $path/config
+        then
+		pubkey=`grep ^\#lxc.pubkey $path/config | cut -d= -f2`
+	fi
+	if [ ! -e $rootfs/root/.ssh ]
+	then
+		mkdir $rootfs/root/.ssh
+	fi
+	if [ ! -z "$pubkey" ]
+	then
+		echo "Copying $pubkey -> $rootfs/root/.ssh/authorized_keys"
+		cp $pubkey $rootfs/root/.ssh/authorized_keys
+	fi
+}
+
+configure_hostkeydir(){
+	rootfs=$1
+	hostkeydir=$2
+	name=$3
+	if [ $# -ne 3 ]
+	then
+		exit 1
+	else
+		[ -d $rootfs/etc/ssh ] || mkdir -p $rootfs/etc/ssh
+		if [ -e $hostkeydir ]
+		then 
+			if [ ! -d $hostkeydir/$name ]
+			then
+				mkdir $hostkeydir/$name
+				echo "Creating SSH2 RSA key; this may take some time ..."
+				ssh-keygen -q -f $hostkeydir/$name/ssh_host_rsa_key -N '' -t rsa
+				echo "Creating SSH2 DSA key; this may take some time ..."
+				ssh-keygen -q -f $hostkeydir/$name/ssh_host_dsa_key -N '' -t dsa
+			fi
+			cp $hostkeydir/$name/ssh_host_* $rootfs/etc/ssh/
+		fi
+	fi
+}
+
+download_centos()
+{
+    cache=$1
+    arch=$2
+
+    # check the mini centos was not already downloaded
+    mkdir -p "$cache/partial-$arch"
+    if [ $? -ne 0 ]; then
+	echo "Failed to create '$cache/partial-$arch' directory"
+	return 1
+    fi
+
+    # download a mini centos into a cache
+    echo "Downloading centos minimal ..."
+    #febootstrap $DISTRO $cache/partial-$arch
+    rinsearch=`dpkg-architecture -qDEB_BUILD_ARCH`
+    pkglist="openssh-server man zsh bind-utils openssh-clients php wget avahi php-pear php-dom java-1.6.0-openjdk xorg-x11-xauth firefox"
+
+    cat <<EOF > /var/cache/rinse/$DISTRO-$arch.before_post_install
+echo "Rinse defines mirror=\$mirror in config"
+server=\`echo \$mirror | cut -d/ -f3\`
+echo "Disable mirrorlists"
+sed -i -e "s/^mirrorlist=/#mirrorlist=/" $cache/partial-$arch/etc/yum.repos.d/CentOS-Base.repo
+echo "Setup baseurl on server \$server"
+sed -i -e "s!#baseurl=http://mirror.centos.org!baseurl=http://\$server!" $cache/partial-$arch/etc/yum.repos.d/CentOS-Base.repo
+rm -f $cache/partial-$arch/etc/mtab
+ln -s /proc/mounts $cache/partial-$arch/etc/mtab
+EOF
+    chmod 755 /var/cache/rinse/$DISTRO-$arch.before_post_install
+
+    cat <<EOF > /var/cache/rinse/$DISTRO-$arch.after_post_install
+# MOUNT PROC
+echo "Mount /proc"
+chroot $cache/partial-$arch /bin/mount proc /proc -t proc
+# INSTALL PACKAGES
+echo "Install $pkglist"
+chroot $cache/partial-$arch /usr/bin/yum -y install $pkglist
+EOF
+
+if grep -q  ^http_proxy /etc/wgetrc
+then
+	PROXY=`grep ^http_proxy /etc/wgetrc | tail -1 | sed -e 's!.*http://!!' -e 's!/!!'`
+	export PROXY
+
+    cat <<EOF >> /var/cache/rinse/$DISTRO-$arch.after_post_install
+# PROXY CONF FROM WGET
+echo "Set up proxy $PROXY for pear"
+chroot $cache/partial-$arch /usr/bin/pear config-set http_proxy $PROXY
+EOF
+fi
+
+    cat <<EOF >> /var/cache/rinse/$DISTRO-$arch.after_post_install
+# INSTALL PHPUNIT
+# phpunit install, requires: php-pear php-dom
+echo "Updating pear.php.net pear channel"
+chroot $cache/partial-$arch /usr/bin/pear channel-update pear.php.net
+#optional?# chroot $cache/partial-$arch /usr/bin/pear channel-discover components.ez.no
+echo "Discovering pear.phpunit.de pear channel"
+chroot $cache/partial-$arch /usr/bin/pear channel-discover pear.phpunit.de
+echo "Discovering pear.symfony-project.com pear channel"
+chroot $cache/partial-$arch /usr/bin/pear channel-discover pear.symfony-project.com
+echo "Upgrading pear"
+chroot $cache/partial-$arch /usr/bin/pear upgrade-all
+chroot $cache/partial-$arch /usr/bin/pear upgrade --force PEAR
+echo "Installing phpunit/PHPUnit"
+chroot $cache/partial-$arch /usr/bin/pear install --alldeps phpunit/PHPUnit
+# UMOUNT PROC
+echo "Umount /proc"
+chroot $cache/partial-$arch /bin/umount /proc
+EOF
+    chmod 755 /var/cache/rinse/$DISTRO-$arch.after_post_install
+
+    rinse --config /etc/rinse/rinse.conf \
+	--arch $rinsearch \
+	--distribution $DISTRO \
+	--before-post-install /var/cache/rinse/$DISTRO-$arch.before_post_install  \
+	--after-post-install /var/cache/rinse/$DISTRO-$arch.after_post_install \
+	--directory $cache/partial-$arch
+    
+    if [ $? -ne 0 ]; then
+	echo "Failed to download the rootfs, aborting."
+	return 1
+    fi
+
+    mv "$1/partial-$arch" "$1/rootfs-$arch"
+    echo "Download complete."
+
+    return 0
+}
+
+copy_centos()
+{
+    cache=$1
+    arch=$2
+    rootfs=$3
+
+    # make a local copy of the minicentos
+    echo -n "Copying rootfs to $rootfs ..."
+    cp -a $cache/rootfs-$arch $rootfs || return 1
+    return 0
+}
+
+install_centos()
+{
+    cache="/var/cache/lxc/centos"
+    rootfs=$1
+    mkdir -p /var/lock/subsys/
+    (
+	flock -n -x 200
+	if [ $? -ne 0 ]; then
+	    echo "Cache repository is busy."
+	    return 1
+	fi
+
+	arch=$(arch)
+
+	echo "Checking cache download in $cache/rootfs-$arch ... "
+	if [ ! -e "$cache/rootfs-$arch" ]; then
+	    download_centos $cache $arch
+	    if [ $? -ne 0 ]; then
+		echo "Failed to download 'centos base'"
+		return 1
+	    fi
+	fi
+
+	echo "Copy $cache/rootfs-$arch to $rootfs ... "
+	copy_centos $cache $arch $rootfs
+	if [ $? -ne 0 ]; then
+	    echo "Failed to copy rootfs"
+	    return 1
+	fi
+
+	return 0
+
+	) 200>/var/lock/subsys/lxc
+
+    return $?
+}
+
+gen_mac()
+{
+	dd if=/dev/urandom bs=1 count=3 2>/dev/null | od -tx1 | head -1 | cut -d' ' -f2- | awk '{ print "00:16:3e:"$1":"$2":"$3 }'
+}
+
+copy_configuration()
+{
+    path=$1
+    rootfs=$2
+    name=$3
+    macdir=$4
+    
+    if [ ! -e "$macdir/$name" ]
+    then
+	gen_mac > $macdir/$name
+    fi
+    macaddr=`cat $macdir/$name`
+
+    cat <<EOF >> $path/config
+lxc.network.hwaddr = $macaddr
+# lxc.utsname = $name
+
+lxc.tty = 4
+lxc.pts = 1024
+lxc.rootfs = $rootfs
+# lxc.mount  = $path/fstab
+
+# lxc.console = /dev/console
+
+lxc.cgroup.devices.deny = a
+# /dev/null and zero
+lxc.cgroup.devices.allow = c 1:3 rwm
+lxc.cgroup.devices.allow = c 1:5 rwm
+# consoles
+lxc.cgroup.devices.allow = c 5:1 rwm
+lxc.cgroup.devices.allow = c 5:0 rwm
+lxc.cgroup.devices.allow = c 4:0 rwm
+lxc.cgroup.devices.allow = c 4:1 rwm
+# /dev/{,u}random
+lxc.cgroup.devices.allow = c 1:9 rwm
+lxc.cgroup.devices.allow = c 1:8 rwm
+lxc.cgroup.devices.allow = c 136:* rwm
+lxc.cgroup.devices.allow = c 5:2 rwm
+# rtc
+lxc.cgroup.devices.allow = c 254:0 rwm
+
+# mounts point
+lxc.mount.entry=proc $rootfs/proc proc nodev,noexec,nosuid 0 0
+lxc.mount.entry=devpts $rootfs/dev/pts devpts defaults 0 0
+lxc.mount.entry=sysfs $rootfs/sys sysfs defaults  0 0
+EOF
+
+#    cat <<EOF > $path/fstab
+#proc            $rootfs/proc         proc    nodev,noexec,nosuid 0 0
+#devpts          $rootfs/dev/pts      devpts defaults 0 0
+##sysfs           $rootfs/sys          sysfs defaults  0 0
+#tmpfs           $rootfs/dev/shm      tmpfs defaults 0 0
+#EOF
+
+    if [ $? -ne 0 ]; then
+	echo "Failed to add configuration"
+	return 1
+    fi
+
+    return 0
+}
+
+clean()
+{
+    cache="/var/cache/lxc/centos"
+
+    if [ ! -e $cache ]; then
+	exit 0
+    fi
+
+    # lock, so we won't purge while someone is creating a repository
+    (
+	flock -n -x 200
+	if [ $? != 0 ]; then
+	    echo "Cache repository is busy."
+	    exit 1
+	fi
+
+	echo -n "Purging the download cache..."
+	rm --preserve-root --one-file-system -rf $cache && echo "Done." || exit 1
+	exit 0
+
+    ) 200>/var/lock/subsys/lxc
+}
+
+usage()
+{
+    cat <<EOF
+$1 -h|--help -p|--path=<path> --clean
+EOF
+    return 0
+}
+
+options=$(getopt -o hp:n:c -l help,path:,name:,clean -- "$@")
+if [ $? -ne 0 ]; then
+    usage $(basename $0)
+    exit 1
+fi
+eval set -- "$options"
+
+while true
+do
+    case "$1" in
+	-h|--help)      usage $0 && exit 0;;
+	-p|--path)      path=$2; shift 2;;
+	-n|--name)      name=$2; shift 2;;
+	-c|--clean)     clean=$2; shift 2;;
+	--)             shift 1; break ;;
+        *)              break ;;
+    esac
+done
+
+if [ ! -z "$clean" -a -z "$path" ]; then
+    clean || exit 1
+    exit 0
+fi
+
+type netmask
+if [ $? -ne 0 ]; then
+    echo "'netmask' command is missing"
+    exit 1
+fi
+
+type rinse
+if [ $? -ne 0 ]; then
+    echo "'rinse' command is missing"
+    exit 1
+fi
+
+if [ -z "$path" ]; then
+    echo "'path' parameter is required"
+    exit 1
+fi
+
+if [ "$(id -u)" != "0" ]; then
+    echo "This script should be run as 'root'"
+    exit 1
+fi
+
+rootfs=$path/rootfs
+oldhostkeydir=/var/lib/lxc/ssh
+hostkeydir=/var/cache/lxc/ssh
+macdir=/var/cache/lxc/mac
+if [ -e $oldhostkeydir ]
+then
+    if [ ! -e $hostkeydir ]
+    then
+        mv $oldhostkeydir $hostkeydir
+    fi
+fi
+if [ ! -e $hostkeydir ]
+then
+    mkdir $hostkeydir
+fi
+if [ ! -e $macdir ]
+then
+    mkdir $macdir
+fi
+
+install_centos $rootfs
+if [ $? -ne 0 ]; then
+    echo "failed to install centos"
+    exit 1
+fi
+
+configure_centos $path $rootfs $name
+if [ $? -ne 0 ]; then
+    echo "failed to configure centos for a container"
+    exit 1
+fi
+
+copy_configuration $path $rootfs $name $macdir
+if [ $? -ne 0 ]; then
+    echo "failed write configuration file"
+    exit 1
+fi
+
+configure_pubkey $path $rootfs
+if [ $? -ne 0 ]; then
+    echo "failed to configure pubkey"
+    exit 1
+fi
+
+configure_hostkeydir $rootfs $hostkeydir $name
+if [ $? -ne 0 ]; then
+    echo "failed to configure hostkeydir"
+    exit 1
+fi
+
+if [ ! -z $clean ]; then
+    clean || exit 1
+    exit 0
+fi


Property changes on: branches/Branch_5_1/tests/lxc/lxc-centos5
___________________________________________________________________
Added: svn:executable
   + *

Added: branches/Branch_5_1/tests/lxc/lxc-debian6
===================================================================
--- branches/Branch_5_1/tests/lxc/lxc-debian6	                        (rev 0)
+++ branches/Branch_5_1/tests/lxc/lxc-debian6	2011-04-14 20:14:06 UTC (rev 13133)
@@ -0,0 +1,474 @@
+#!/bin/bash
+
+#
+# lxc: linux Container library
+
+# Authors:
+# Daniel Lezcano <daniel.lezcano at free.fr>
+
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+LANG=C
+SUITE=${SUITE:-squeeze}
+MIRROR=${MIRROR:-"http://cdn.debian.net/debian/"}
+
+configure_debian()
+{
+    rootfs=$1
+    hostname=$2
+
+    # Squeeze only has /dev/tty and /dev/tty0 by default,
+    # therefore creating missing device nodes for tty1-4.
+    test -e $rootfs/dev/tty1 || mknod $rootfs/dev/tty1 c 4 1
+    test -e $rootfs/dev/tty2 || mknod $rootfs/dev/tty2 c 4 2
+    test -e $rootfs/dev/tty3 || mknod $rootfs/dev/tty3 c 4 3
+    test -e $rootfs/dev/tty4 || mknod $rootfs/dev/tty4 c 4 4
+
+    # configure the inittab
+    cat <<EOF > $rootfs/etc/inittab
+id:3:initdefault:
+si::sysinit:/etc/init.d/rcS
+l0:0:wait:/etc/init.d/rc 0
+l1:1:wait:/etc/init.d/rc 1
+l2:2:wait:/etc/init.d/rc 2
+l3:3:wait:/etc/init.d/rc 3
+l4:4:wait:/etc/init.d/rc 4
+l5:5:wait:/etc/init.d/rc 5
+l6:6:wait:/etc/init.d/rc 6
+# Normally not reached, but fallthrough in case of emergency.
+z6:6:respawn:/sbin/sulogin
+1:2345:respawn:/sbin/getty 38400 console
+c1:12345:respawn:/sbin/getty 38400 tty1 linux
+c2:12345:respawn:/sbin/getty 38400 tty2 linux
+c3:12345:respawn:/sbin/getty 38400 tty3 linux
+c4:12345:respawn:/sbin/getty 38400 tty4 linux
+EOF
+
+    # disable selinux in debian
+    mkdir -p $rootfs/selinux
+    echo 0 > $rootfs/selinux/enforce
+
+    if grep -q ^lxc.network.ipv4 $path/config
+    then
+        # configure static network
+        lxc_network_ipv4=`grep ^lxc.network.ipv4 $path/config | cut -d= -f2`
+        address=`echo $lxc_network_ipv4 | cut -d/ -f1`
+        netmask=`netmask -s $lxc_network_ipv4 | cut -d/ -f2`
+	if [ -e $rootfs/etc/network/interfaces ]
+	then
+		cat <<EOF > $rootfs/etc/network/interfaces
+auto lo
+iface lo inet loopback
+
+auto eth0
+iface eth0 inet static
+	address $address
+	netmask $netmask
+
+EOF
+		cat <<EOF >> $rootfs/etc/hosts
+$address	$hostname
+EOF
+		echo "Network configured with static ip"
+	else
+		exit 2
+	fi
+    else
+        # configure the network using the dhcp
+	if [ -e $rootfs/etc/network/interfaces ]
+	then
+                cat <<EOF > $rootfs/etc/network/interfaces
+auto lo
+iface lo inet loopback
+
+auto eth0
+iface eth0 inet dhcp
+EOF
+		cat <<EOF >> $rootfs/etc/hosts
+127.0.1.1	$hostname
+EOF
+		echo "Network configured with dhcp"
+	else
+		exit 3
+	fi
+    fi
+    # When domain is not local, avahi completed by send hostname
+    hostnamebase=`echo $hostname | cut -d. -f1`
+    if [ "$hostnamebase.local" != "$hostname" ]
+        then
+            cat <<EOF >> $rootfs/etc/dhcp/dhclient.conf
+send host-name "$hostnamebase";
+EOF
+    fi
+
+    # set the hostname
+    cat <<EOF > $rootfs/etc/hostname
+$hostname
+EOF
+
+    # reconfigure some services
+    if [ -z "$LANG" ]; then
+	chroot $rootfs locale-gen en_US.UTF-8
+	chroot $rootfs update-locale LANG=en_US.UTF-8
+    else
+	chroot $rootfs locale-gen $LANG
+	chroot $rootfs update-locale LANG=$LANG
+    fi
+
+    # remove pointless services in a container
+    chroot $rootfs /usr/sbin/update-rc.d -f checkroot remove
+    chroot $rootfs /usr/sbin/update-rc.d -f umountfs remove
+    chroot $rootfs /usr/sbin/update-rc.d -f hwclock.sh remove
+    chroot $rootfs /usr/sbin/update-rc.d -f hwclockfirst.sh remove
+
+    # fix avahi
+    if [ -f $rootfs/etc/init.d/avahi-daemon ]
+    then
+	echo 'Fix avahi'
+	sed -i -e "s!-D!-D --no-rlimits!" $rootfs/etc/init.d/avahi-daemon 
+    fi
+
+    echo "root:root" | chroot $rootfs chpasswd
+    echo "Root password is 'root', please change !"
+
+    return 0
+}
+
+configure_pubkey(){
+	path=$1
+	rootfs=$2
+        if grep -q ^\#lxc.pubkey $path/config
+        then
+		pubkey=`grep ^\#lxc.pubkey $path/config | cut -d= -f2`
+	fi
+	if [ ! -e $rootfs/root/.ssh ]
+	then
+		mkdir $rootfs/root/.ssh
+	fi
+	if [ ! -z "$pubkey" ]
+	then
+		echo "Copying $pubkey -> $rootfs/root/.ssh/authorized_keys"
+		cp $pubkey $rootfs/root/.ssh/authorized_keys
+	fi
+}
+
+configure_hostkeydir(){
+	rootfs=$1
+	hostkeydir=$2
+	name=$3
+	if [ $# -ne 3 ]
+	then
+		exit 1
+	else
+		[ -d $rootfs/etc/ssh ] || mkdir -p $rootfs/etc/ssh
+		if [ -e $hostkeydir ]
+		then 
+			if [ ! -d $hostkeydir/$name ]
+			then
+				mkdir $hostkeydir/$name
+				echo "Creating SSH2 RSA key; this may take some time ..."
+				ssh-keygen -q -f $hostkeydir/$name/ssh_host_rsa_key -N '' -t rsa
+				echo "Creating SSH2 DSA key; this may take some time ..."
+				ssh-keygen -q -f $hostkeydir/$name/ssh_host_dsa_key -N '' -t dsa
+			fi
+			cp $hostkeydir/$name/ssh_host_* $rootfs/etc/ssh/
+		fi
+	fi
+}
+
+download_debian()
+{
+    packages=\
+ifupdown,\
+locales,\
+libui-dialog-perl,\
+dialog,\
+dhcp3-client,\
+netbase,\
+net-tools,\
+iproute,\
+iputils-ping,\
+vim,\
+less,\
+htop,\
+zsh,\
+debconf-utils,\
+avahi-utils,\
+openssh-server,\
+xbase-clients,\
+phpunit,\
+openjdk-6-jre,\
+iceweasel
+
+    cache=$1
+    arch=$2
+
+    # check the mini debian was not already downloaded
+    mkdir -p "$cache/partial-$SUITE-$arch"
+    if [ $? -ne 0 ]; then
+	echo "Failed to create '$cache/partial-$SUITE-$arch' directory"
+	return 1
+    fi
+
+    # download a mini debian into a cache
+    echo "Downloading debian minimal ..."
+    debootstrap --verbose --variant=minbase --arch=$arch \
+	--include $packages \
+	"$SUITE" "$cache/partial-$SUITE-$arch" $MIRROR
+    if [ $? -ne 0 ]; then
+	echo "Failed to download the rootfs, aborting."
+	return 1
+    fi
+
+    mv "$1/partial-$SUITE-$arch" "$1/rootfs-$SUITE-$arch"
+    echo "Download complete."
+
+    return 0
+}
+
+copy_debian()
+{
+    cache=$1
+    arch=$2
+    rootfs=$3
+
+    # make a local copy of the minidebian
+    echo -n "Copying rootfs to $rootfs..."
+    cp -a "$cache/rootfs-$SUITE-$arch" $rootfs || return 1
+    return 0
+}
+
+install_debian()
+{
+    cache="/var/cache/lxc/debian"
+    rootfs=$1
+    mkdir -p /var/lock/subsys/
+    (
+	flock -n -x 200
+	if [ $? -ne 0 ]; then
+	    echo "Cache repository is busy."
+	    return 1
+	fi
+
+	arch=$(arch)
+	if [ "$arch" == "x86_64" ]; then
+	    arch=amd64
+	fi
+
+	if [ "$arch" == "i686" ]; then
+	    arch=i386
+	fi
+
+	echo "Checking cache download in $cache/rootfs-$SUITE-$arch ... "
+	if [ ! -e "$cache/rootfs-$SUITE-$arch" ]; then
+	    download_debian $cache $arch
+	    if [ $? -ne 0 ]; then
+		echo "Failed to download 'debian base'"
+		return 1
+	    fi
+	fi
+
+	copy_debian $cache $arch $rootfs
+	if [ $? -ne 0 ]; then
+	    echo "Failed to copy rootfs"
+	    return 1
+	fi
+
+	return 0
+
+	) 200>/var/lock/subsys/lxc
+
+    return $?
+}
+
+gen_mac()
+{
+	dd if=/dev/urandom bs=1 count=3 2>/dev/null | od -tx1 | head -1 | cut -d' ' -f2- | awk '{ print "00:16:3e:"$1":"$2":"$3 }'
+}
+
+copy_configuration()
+{
+    path=$1
+    rootfs=$2
+    name=$3
+    macdir=$4
+
+    if [ ! -e "$macdir/$name" ]
+    then
+        gen_mac > $macdir/$name
+    fi
+    macaddr=`cat $macdir/$name`
+
+    cat <<EOF >> $path/config
+lxc.network.hwaddr = $macaddr
+lxc.tty = 4
+lxc.pts = 1024
+lxc.rootfs = $rootfs
+lxc.cgroup.devices.deny = a
+# /dev/null and zero
+lxc.cgroup.devices.allow = c 1:3 rwm
+lxc.cgroup.devices.allow = c 1:5 rwm
+# consoles
+lxc.cgroup.devices.allow = c 5:1 rwm
+lxc.cgroup.devices.allow = c 5:0 rwm
+lxc.cgroup.devices.allow = c 4:0 rwm
+lxc.cgroup.devices.allow = c 4:1 rwm
+# /dev/{,u}random
+lxc.cgroup.devices.allow = c 1:9 rwm
+lxc.cgroup.devices.allow = c 1:8 rwm
+lxc.cgroup.devices.allow = c 136:* rwm
+lxc.cgroup.devices.allow = c 5:2 rwm
+# rtc
+lxc.cgroup.devices.allow = c 254:0 rwm
+
+# mounts point
+lxc.mount.entry=proc $rootfs/proc proc nodev,noexec,nosuid 0 0
+lxc.mount.entry=devpts $rootfs/dev/pts devpts defaults 0 0
+lxc.mount.entry=sysfs $rootfs/sys sysfs defaults  0 0
+EOF
+
+    if [ $? -ne 0 ]; then
+	echo "Failed to add configuration"
+	return 1
+    fi
+
+    return 0
+}
+
+clean()
+{
+    cache="/var/cache/lxc/debian"
+
+    if [ ! -e $cache ]; then
+	exit 0
+    fi
+
+    # lock, so we won't purge while someone is creating a repository
+    (
+	flock -n -x 200
+	if [ $? != 0 ]; then
+	    echo "Cache repository is busy."
+	    exit 1
+	fi
+
+	echo -n "Purging the download cache..."
+	rm --preserve-root --one-file-system -rf $cache && echo "Done." || exit 1
+	exit 0
+
+    ) 200>/var/lock/subsys/lxc
+}
+
+usage()
+{
+    cat <<EOF
+$1 -h|--help -p|--path=<path> --clean
+EOF
+    return 0
+}
+
+options=$(getopt -o hp:n:c -l help,path:,name:,clean -- "$@")
+if [ $? -ne 0 ]; then
+        usage $(basename $0)
+	exit 1
+fi
+eval set -- "$options"
+
+while true
+do
+    case "$1" in
+        -h|--help)      usage $0 && exit 0;;
+        -p|--path)      path=$2; shift 2;;
+	-n|--name)      name=$2; shift 2;;
+	-c|--clean)     clean=$2; shift 2;;
+        --)             shift 1; break ;;
+        *)              break ;;
+    esac
+done
+
+if [ ! -z "$clean" -a -z "$path" ]; then
+    clean || exit 1
+    exit 0
+fi
+
+type debootstrap
+if [ $? -ne 0 ]; then
+    echo "'debootstrap' command is missing"
+    exit 1
+fi
+
+if [ -z "$path" ]; then
+    echo "'path' parameter is required"
+    exit 1
+fi
+
+if [ "$(id -u)" != "0" ]; then
+    echo "This script should be run as 'root'"
+    exit 1
+fi
+
+rootfs=$path/rootfs
+oldhostkeydir=/var/lib/lxc/ssh
+hostkeydir=/var/cache/lxc/ssh
+macdir=/var/cache/lxc/mac
+if [ -e $oldhostkeydir ]
+then
+    if [ ! -e $hostkeydir ]
+    then
+        mv $oldhostkeydir $hostkeydir
+    fi
+fi
+if [ ! -e $hostkeydir ]
+then
+    mkdir $hostkeydir
+fi
+if [ ! -e $macdir ]
+then
+    mkdir $macdir
+fi
+
+install_debian $rootfs
+if [ $? -ne 0 ]; then
+    echo "failed to install debian"
+    exit 1
+fi
+
+configure_debian $rootfs $name
+if [ $? -ne 0 ]; then
+    echo "failed to configure debian for a container"
+    exit 1
+fi
+
+copy_configuration $path $rootfs $name $macdir
+if [ $? -ne 0 ]; then
+    echo "failed write configuration file"
+    exit 1
+fi
+
+configure_pubkey $path $rootfs
+if [ $? -ne 0 ]; then
+    echo "failed to configure pubkey"
+    exit 1
+fi
+
+configure_hostkeydir $rootfs $hostkeydir $name
+if [ $? -ne 0 ]; then
+    echo "failed to configure hostkeydir"
+    exit 1
+fi
+
+if [ ! -z $clean ]; then
+    clean || exit 1
+    exit 0
+fi


Property changes on: branches/Branch_5_1/tests/lxc/lxc-debian6
___________________________________________________________________
Added: svn:executable
   + *

Modified: branches/Branch_5_1/tests/openvz/Makefile
===================================================================
--- branches/Branch_5_1/tests/openvz/Makefile	2011-04-14 16:00:36 UTC (rev 13132)
+++ branches/Branch_5_1/tests/openvz/Makefile	2011-04-14 20:14:06 UTC (rev 13133)
@@ -4,20 +4,19 @@
 RINSEBPI=
 RINSEPOSTINST=--after-post-install $(CURDIR)/local.rinse.api
 VEIDDEBTEMP=242
-VEIDCENTEMP=243
+VEIDCOSTEMP=243
 ARCH=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
 EXTRADEBPACKAGE=--include=ssh,less,htop,zsh,vim,debconf-utils
-EXTRACENTOSPACKAGE=openssh-server,man,zsh,bind-utils,openssh-clients,php,wget
+EXTRACOSPACKAGE=openssh-server,man,zsh,bind-utils,openssh-clients,php,wget
 VZCTL=/usr/sbin/vzctl
 DEBOOTSTRAP=/usr/sbin/debootstrap
-RINSE=extrapackage="$(EXTRACENTOSPACKAGE)" /usr/sbin/rinse
-SSHPUBKEY=~$(USERCLIENT)/.ssh/id_rsa.pub
+RINSE=extrapackage="$(EXTRACOSPACKAGE)" /usr/sbin/rinse
 
 # Default config
-include config.default
+include ../config/default
 
 # Optional local change
--include config.$(shell hostname)
+-include ../config/$(shell hostname)
 
 # Local customization can be done using a local.<hostname> file
 # This is convenient if you use local mirror
@@ -29,15 +28,15 @@
 	@echo " make net : this will setup a /etc/vz/vznet.conf to register new virtual host to vmbr0 bridge"
 	@echo "  See interfaces.sample to know how to setup a bridge"
 	@echo " make builddebiantemplate : build an openvz debian template (uses VEIDDEBTEMP=$(VEIDDEBTEMP))"
-	@echo " make buildcentostemplate : build an openvz centos template (uses VEIDCENTEMP=$(VEIDCENTEMP))"
+	@echo " make buildcentostemplate : build an openvz centos template (uses VEIDCOSTEMP=$(VEIDCOSTEMP))"
 	@echo ""
 	@echo " make createdeb   : build a debian openvz vm with ID=$(VEIDDEB) from the debian template"
 	@echo " make netdhcpdeb  : set dhcp network for debian openvz vm with ID=$(VEIDDEB)"
 	@echo " make netstaticdeb: set static network for debian openvz vm with ID=$(VEIDDEB)"
 	@echo ""
-	@echo " make createcentos   : build a centos openvz vm with ID=$(VEIDCEN) from the centos template"
-	@echo " make netdhcpcentos  : set dhcp network for centos openvz vm with ID=$(VEIDCEN)"
-	@echo " make netstaticcentos: set static network for centos openvz vm with ID=$(VEIDCEN)"
+	@echo " make createcentos   : build a centos openvz vm with ID=$(VEIDCOS) from the centos template"
+	@echo " make netdhcpcentos  : set dhcp network for centos openvz vm with ID=$(VEIDCOS)"
+	@echo " make netstaticcentos: set static network for centos openvz vm with ID=$(VEIDCOS)"
 	@echo ""
 	@echo "Read Makefile for other targets"
 
@@ -67,53 +66,53 @@
 	cd $(VZPRIVATEDIR)/$(VEIDDEBTEMP)/ ; tar --numeric-owner -zcf $(VZTEMPLATEDIR)/cache/debian-$(DEBVERS)-$(ARCH)-minimal.tar.gz .
 
 buildcentostemplate: beroot buildcentosvm
-	$(VZCTL) set $(VEIDCENTEMP) --ostemplate centos-$(CENTVERS) --applyconfig basic --save
-	#rm $(VZPRIVATEDIR)/$(VEIDCENTEMP)/etc/ssh/ssh_host_*
+	$(VZCTL) set $(VEIDCOSTEMP) --ostemplate centos-$(COSVERS) --applyconfig basic --save
+	#rm $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/etc/ssh/ssh_host_*
 	# Disable getty in /etc/inittab as openvz do not have that.
-	[ ! -f $(VZPRIVATEDIR)/$(VEIDCENTEMP)/etc/inittab ] || (grep -q getty $(VZPRIVATEDIR)/$(VEIDCENTEMP)/etc/inittab || \
-		sed -i -e '/getty/d' $(VZPRIVATEDIR)/$(VEIDCENTEMP)/etc/inittab)
+	[ ! -f $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/etc/inittab ] || (grep -q getty $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/etc/inittab || \
+		sed -i -e '/getty/d' $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/etc/inittab)
 	# Don't start_udev
-	sed -i -e '/start_udev/d' $(VZPRIVATEDIR)/$(VEIDCENTEMP)/etc/rc.d/rc.sysinit
+	sed -i -e '/start_udev/d' $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/etc/rc.d/rc.sysinit
 	# Link /etc/mtab to /proc/mtab to make mount work as expected.
-	rm -f $(VZPRIVATEDIR)/$(VEIDCENTEMP)/etc/mtab
-	ln -s /proc/mounts $(VZPRIVATEDIR)/$(VEIDCENTEMP)/etc/mtab
+	rm -f $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/etc/mtab
+	ln -s /proc/mounts $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/etc/mtab
 	# LocalTime
-	#ln -sf /usr/share/zoneinfo/Europe/Paris $(VZPRIVATEDIR)/$(VEIDCENTEMP)/etc/localtime
+	#ln -sf /usr/share/zoneinfo/Europe/Paris $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/etc/localtime
 	# Remove hostname
-	[ ! -f $(VZPRIVATEDIR)/$(VEIDCENTEMP)/etc/hostname ] || rm $(VZPRIVATEDIR)/$(VEIDCENTEMP)/etc/hostname
-	## NOW uses vzctl set $(VEIDCENTEMP) --hostname command
-	##echo "127.0.0.1 centos5.local localhost.localdomain localhost" > $(VZPRIVATEDIR)/$(VEIDCENTEMP)/etc/hosts
-	##echo "centos5.local" > $(VZPRIVATEDIR)/$(VEIDCENTEMP)/etc/hostname
-	##echo "HOSTNAME=centos5.local" >> $(VZPRIVATEDIR)/$(VEIDCENTEMP)/etc/sysconfig/network
+	[ ! -f $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/etc/hostname ] || rm $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/etc/hostname
+	## NOW uses vzctl set $(VEIDCOSTEMP) --hostname command
+	##echo "127.0.0.1 centos5.local localhost.localdomain localhost" > $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/etc/hosts
+	##echo "centos5.local" > $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/etc/hostname
+	##echo "HOSTNAME=centos5.local" >> $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/etc/sysconfig/network
 	#
-	[ -c $(VZPRIVATEDIR)/$(VEIDCENTEMP)/dev/ptmx ]     || chroot $(VZPRIVATEDIR)/$(VEIDCENTEMP) /bin/mknod /dev/ptmx c 5 2
-	[ -d $(VZPRIVATEDIR)/$(VEIDCENTEMP)/dev/pts ]      || chroot $(VZPRIVATEDIR)/$(VEIDCENTEMP) /bin/mkdir /dev/pts
-	[ -c $(VZPRIVATEDIR)/$(VEIDCENTEMP)/vz/private/50/dev/ttyp ] || chroot $(VZPRIVATEDIR)/$(VEIDCENTEMP) /sbin/MAKEDEV -d /vz/private/50/dev ttyp ptyp
-	-rm -f $(VZPRIVATEDIR)/$(VEIDCENTEMP)/dev/null
-	[ -c $(VZPRIVATEDIR)/$(VEIDCENTEMP)/dev/null ]     || chroot $(VZPRIVATEDIR)/$(VEIDCENTEMP) /bin/mknod /dev/null c 1 3
-	chmod ugo+w $(VZPRIVATEDIR)/$(VEIDCENTEMP)/dev/null
-	[ -c $(VZPRIVATEDIR)/$(VEIDCENTEMP)/dev/random ]   || chroot $(VZPRIVATEDIR)/$(VEIDCENTEMP) /bin/mknod -m 644 /dev/random c 1 8
-	-rm -f $(VZPRIVATEDIR)/$(VEIDCENTEMP)/dev/urandom 
-	[ -c $(VZPRIVATEDIR)/$(VEIDCENTEMP)/dev/urandom ]  || chroot $(VZPRIVATEDIR)/$(VEIDCENTEMP) /bin/mknod /dev/urandom c 1 9 
-	chmod ugo+w $(VZPRIVATEDIR)/$(VEIDCENTEMP)/dev/urandom
-	[ -d $(VZPRIVATEDIR)/$(VEIDCENTEMP)/var/lock/rpm ] || chroot $(VZPRIVATEDIR)/$(VEIDCENTEMP) /bin/mkdir /var/lock/rpm	
-	touch $(VZPRIVATEDIR)/$(VEIDCENTEMP)/etc/fstab
-	grep -q devpts $(VZPRIVATEDIR)/$(VEIDCENTEMP)/etc/fstab || \
-		echo "none /dev/pts devpts mode=0620 0 0" >> $(VZPRIVATEDIR)/$(VEIDCENTEMP)/etc/fstab
-	[ -d $(VZPRIVATEDIR)/$(VEIDCENTEMP)/root/.ssh ] || mkdir $(VZPRIVATEDIR)/$(VEIDCENTEMP)/root/.ssh
-	cp $(SSHPUBKEY) $(VZPRIVATEDIR)/$(VEIDCENTEMP)/root/.ssh/authorized_keys
-	cp ssh/ssh_host_* $(VZPRIVATEDIR)/$(VEIDCENTEMP)/etc/ssh/
-	cd $(VZPRIVATEDIR)/$(VEIDCENTEMP)/ ; tar --numeric-owner -zcf $(VZTEMPLATEDIR)/cache/centos-$(CENTVERS)-$(ARCH)-minimal.tar.gz .
+	[ -c $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/dev/ptmx ]     || chroot $(VZPRIVATEDIR)/$(VEIDCOSTEMP) /bin/mknod /dev/ptmx c 5 2
+	[ -d $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/dev/pts ]      || chroot $(VZPRIVATEDIR)/$(VEIDCOSTEMP) /bin/mkdir /dev/pts
+	[ -c $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/vz/private/50/dev/ttyp ] || chroot $(VZPRIVATEDIR)/$(VEIDCOSTEMP) /sbin/MAKEDEV -d /vz/private/50/dev ttyp ptyp
+	-rm -f $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/dev/null
+	[ -c $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/dev/null ]     || chroot $(VZPRIVATEDIR)/$(VEIDCOSTEMP) /bin/mknod /dev/null c 1 3
+	chmod ugo+w $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/dev/null
+	[ -c $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/dev/random ]   || chroot $(VZPRIVATEDIR)/$(VEIDCOSTEMP) /bin/mknod -m 644 /dev/random c 1 8
+	-rm -f $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/dev/urandom 
+	[ -c $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/dev/urandom ]  || chroot $(VZPRIVATEDIR)/$(VEIDCOSTEMP) /bin/mknod /dev/urandom c 1 9 
+	chmod ugo+w $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/dev/urandom
+	[ -d $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/var/lock/rpm ] || chroot $(VZPRIVATEDIR)/$(VEIDCOSTEMP) /bin/mkdir /var/lock/rpm	
+	touch $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/etc/fstab
+	grep -q devpts $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/etc/fstab || \
+		echo "none /dev/pts devpts mode=0620 0 0" >> $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/etc/fstab
+	[ -d $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/root/.ssh ] || mkdir $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/root/.ssh
+	cp $(SSHPUBKEY) $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/root/.ssh/authorized_keys
+	cp ssh/ssh_host_* $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/etc/ssh/
+	cd $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/ ; tar --numeric-owner -zcf $(VZTEMPLATEDIR)/cache/centos-$(COSVERS)-$(ARCH)-minimal.tar.gz .
 
 builddebianvm: beroot $(VZPRIVATEDIR)/$(VEIDDEBTEMP)/tmp/vzdebvm
 
 $(VZPRIVATEDIR)/$(VEIDDEBTEMP)/tmp/vzdebvm:
 	[ -d $(VZPRIVATEDIR)/$(VEIDDEBTEMP)/tmp/vzdebvm ] || ($(DEBOOTSTRAP) --arch $(ARCH) $(EXTRADEBPACKAGE) $(DIST) $(VZPRIVATEDIR)/$(VEIDDEBTEMP) $(DEBMIRROR) && touch $(VZPRIVATEDIR)/$(VEIDDEBTEMP)/tmp/vzdebvm)
 
-buildcentosvm: beroot $(VZPRIVATEDIR)/$(VEIDCENTEMP)/tmp/vzcentvm
+buildcentosvm: beroot $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/tmp/vzcentvm
 
-$(VZPRIVATEDIR)/$(VEIDCENTEMP)/tmp/vzcentvm:
-	[ -d $(VZPRIVATEDIR)/$(VEIDCENTEMP)/tmp/vzcentvm ] || ($(RINSE) $(RINSEBPI) $(RINSEPOSTINST) --config $(RINSECONF) --arch $(ARCH) --distribution centos-5 --directory $(VZPRIVATEDIR)/$(VEIDCENTEMP) && touch $(VZPRIVATEDIR)/$(VEIDCENTEMP)/tmp/vzcentvm)
+$(VZPRIVATEDIR)/$(VEIDCOSTEMP)/tmp/vzcentvm:
+	[ -d $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/tmp/vzcentvm ] || ($(RINSE) $(RINSEBPI) $(RINSEPOSTINST) --config $(RINSECONF) --arch $(ARCH) --distribution centos-5 --directory $(VZPRIVATEDIR)/$(VEIDCOSTEMP) && touch $(VZPRIVATEDIR)/$(VEIDCOSTEMP)/tmp/vzcentvm)
 
 cleanvz:
 	[ ! -d $(VZPRIVATEDIR)/$(VEID) ] || $(VZCTL) stop $(VEID)
@@ -121,7 +120,7 @@
 	-rm -f /etc/vz/conf/$(VEID).conf.destroyed
 
 cleancentos: beroot
-	make cleanvz VEID=$(VEIDCEN)
+	make cleanvz VEID=$(VEIDCOS)
 	
 cleandeb: beroot
 	make cleanvz VEID=$(VEIDDEB)
@@ -149,19 +148,19 @@
 
 netdhcpcentos: beroot
 	# Add eth0 interface
-	$(VZCTL) set $(VEIDCEN) --netif_add eth0 --save
+	$(VZCTL) set $(VEIDCOS) --netif_add eth0 --save
 	# Setup dhcp
-	echo "DEVICE=eth0" > $(VZPRIVATEDIR)/$(VEIDCEN)/etc/sysconfig/network-scripts/ifcfg-eth0
-	echo "BOOTPROTO=dhcp" >> $(VZPRIVATEDIR)/$(VEIDCEN)/etc/sysconfig/network-scripts/ifcfg-eth0
-	echo "ONBOOT=yes" >> $(VZPRIVATEDIR)/$(VEIDCEN)/etc/sysconfig/network-scripts/ifcfg-eth0
+	echo "DEVICE=eth0" > $(VZPRIVATEDIR)/$(VEIDCOS)/etc/sysconfig/network-scripts/ifcfg-eth0
+	echo "BOOTPROTO=dhcp" >> $(VZPRIVATEDIR)/$(VEIDCOS)/etc/sysconfig/network-scripts/ifcfg-eth0
+	echo "ONBOOT=yes" >> $(VZPRIVATEDIR)/$(VEIDCOS)/etc/sysconfig/network-scripts/ifcfg-eth0
 	# Setup dhclient extra
-	[ -f $(VZPRIVATEDIR)/$(VEIDCEN)/etc/dhclient.conf ] || \
-		echo "send host-name \"`hostname`-$(VEIDCEN)\";" > $(VZPRIVATEDIR)/$(VEIDCEN)/etc/dhclient.conf
+	[ -f $(VZPRIVATEDIR)/$(VEIDCOS)/etc/dhclient.conf ] || \
+		echo "send host-name \"`hostname`-$(VEIDCOS)\";" > $(VZPRIVATEDIR)/$(VEIDCOS)/etc/dhclient.conf
 	
 netstaticcentos: beroot
-	$(VZCTL) set $(VEIDCEN) --hostname `hostname`-$(VEIDCEN)  --save
-	$(VZCTL) set $(VEIDCEN) --ipadd $(IPCENTOSBASE).$(VEIDCEN) --save
-	$(VZCTL) set $(VEIDCEN) --nameserver $(IPCENTOSDNS) --save
+	$(VZCTL) set $(VEIDCOS) --hostname `hostname`-$(VEIDCOS)  --save
+	$(VZCTL) set $(VEIDCOS) --ipadd $(IPCOSBASE).$(VEIDCOS) --save
+	$(VZCTL) set $(VEIDCOS) --nameserver $(IPCOSDNS) --save
 
 netctl:
 	sysctl -w net.ipv4.ip_forward=1
@@ -187,7 +186,7 @@
 	make netstaticdeb
 	
 createcentos: beroot cleancentos
-	$(VZCTL) create $(VEIDCEN) --private $(VZPRIVATEDIR)/$(VEIDCEN) --ostemplate centos-$(CENTVERS)-$(ARCH)-minimal
+	$(VZCTL) create $(VEIDCOS) --private $(VZPRIVATEDIR)/$(VEIDCOS) --ostemplate centos-$(COSVERS)-$(ARCH)-minimal
 	make netstaticcentos
 	
 beroot:

Deleted: branches/Branch_5_1/tests/openvz/config.christian
===================================================================
--- branches/Branch_5_1/tests/openvz/config.christian	2011-04-14 16:00:36 UTC (rev 13132)
+++ branches/Branch_5_1/tests/openvz/config.christian	2011-04-14 20:14:06 UTC (rev 13133)
@@ -1,25 +0,0 @@
-#
-# In this file you can find vars that are useable 
-# both as an include in a Makefile or
-# be sourced in a shell
-# So it should only be stuffs like VAR=value
-#
-VEIDDEB=105
-VEIDCEN=110
-
-DEBVERS=6.0
-CENTVERS=5.5
-
-IPDEBBASE=192.168.0
-IPDEBDNS=192.168.0.5
-
-IPCENTOSBASE=192.168.0
-IPCENTOSDNS=192.168.0.5
-
-VZPRIVATEDIR=/data/openvz/private
-# You shouldn't change the next line, don't really work
-VZTEMPLATEDIR=/var/lib/vz/template
-
-USERCLIENT=chris
-
-DIST=squeeze

Deleted: branches/Branch_5_1/tests/openvz/config.default
===================================================================
--- branches/Branch_5_1/tests/openvz/config.default	2011-04-14 16:00:36 UTC (rev 13132)
+++ branches/Branch_5_1/tests/openvz/config.default	2011-04-14 20:14:06 UTC (rev 13133)
@@ -1,25 +0,0 @@
-#
-# In this file you can find vars that are useable 
-# both as an include in a Makefile or
-# be sourced in a shell
-# So it should only be stuffs like VAR=value
-#
-VEIDDEB=105
-VEIDCEN=110
-
-DEBVERS=6.0
-CENTVERS=5.5
-
-IPDEBBASE=192.168.222
-IPDEBDNS=192.168.222.1
-
-IPCENTOSBASE=192.168.222
-IPCENTOSDNS=192.168.222.1
-
-VZPRIVATEDIR=/var/lib/vz/private
-# You shouldn't change the next line, don't really work
-VZTEMPLATEDIR=/var/lib/vz/template
-
-USERCLIENT=root
-
-DIST=squeeze

Deleted: branches/Branch_5_1/tests/openvz/config.g-virtual05
===================================================================
--- branches/Branch_5_1/tests/openvz/config.g-virtual05	2011-04-14 16:00:36 UTC (rev 13132)
+++ branches/Branch_5_1/tests/openvz/config.g-virtual05	2011-04-14 20:14:06 UTC (rev 13133)
@@ -1,26 +0,0 @@
-
-#
-# In this file you can find vars that are useable 
-# both as an include in a Makefile or
-# be sourced in a shell
-# So it should only be stuffs like VAR=value
-#
-VEIDDEB=105
-VEIDCEN=110
-
-DEBVERS=6.0
-CENTVERS=5.5
-
-IPDEBBASE=10.194.10
-IPDEBDNS=10.194.11.20
-
-IPCENTOSBASE=10.194.10
-IPCENTOSDNS=10.194.11.20
-
-VZPRIVATEDIR=/var/lib/vz/private
-# You shouldn't change the next line, don't really work
-VZTEMPLATEDIR=/var/lib/vz/template
-
-SSHPUBKEY=~admrsc/.ssh/id_rsa.pub
-
-DIST=squeeze

Added: branches/Branch_5_1/tests/openvz/local.g-dellm65-1
===================================================================
--- branches/Branch_5_1/tests/openvz/local.g-dellm65-1	                        (rev 0)
+++ branches/Branch_5_1/tests/openvz/local.g-dellm65-1	2011-04-14 20:14:06 UTC (rev 13133)
@@ -0,0 +1,3 @@
+DEBMIRROR=http://10.194.10.128/debian
+RINSECONF=local.g-virtual05.rinse.conf
+RINSEBPI=--before-post-install $(CURDIR)/local.g-virtual05.rinse.bpi

Modified: branches/Branch_5_1/tests/preseed/postgresql
===================================================================
--- branches/Branch_5_1/tests/preseed/postgresql	2011-04-14 16:00:36 UTC (rev 13132)
+++ branches/Branch_5_1/tests/preseed/postgresql	2011-04-14 20:14:06 UTC (rev 13133)
@@ -1,2 +1,3 @@
 gforge-db-postgresql	fusionforge/shared/admin_password	password	myadmin
 gforge-db-postgresql	fusionforge/shared/admin_password_confirm	password	myadmin
+gforge-db-postgresql	fusionforge/shared/db_password	string

Added: branches/Branch_5_1/tests/scripts/cdx40-build-and-test-source.sh
===================================================================
--- branches/Branch_5_1/tests/scripts/cdx40-build-and-test-source.sh	                        (rev 0)
+++ branches/Branch_5_1/tests/scripts/cdx40-build-and-test-source.sh	2011-04-14 20:14:06 UTC (rev 13133)
@@ -0,0 +1,105 @@
+#! /bin/sh -e
+export CURDIR=`pwd`
+export WORKSPACE=${WORKSPACE:-$CURDIR}
+
+export CONFIG_PHP=func/config.php.buildbot
+export SELENIUM_RC_HOST=${SELENIUM_RC_HOST:-`hostname -i`}
+export SELENIUM_RC_DIR=$WORKSPACE/reports
+
+export DEBMIRROR
+
+# get config
+. tests/config/default
+if [ -f tests/config/`hostname` ] ; then . tests/config/`hostname`; fi
+export HOST=cdx40.$DNSDOMAIN
+
+export LXCTEMPLATE=$LXCCOSTEMPLATE
+
+export DIST
+export VMENGINE
+export SSHPUBKEY
+export HOSTKEYDIR
+
+CDXVERS=Codendi_4.0
+CDXIP=`hostname -i`
+
+# Unit tests
+#sh $WORKSPACE/$CDXVERS/codendi_tools/ci_build.sh $HOST $CDXIP $CDXVERS
+
+if $KEEPVM
+then
+        echo "Destroying vm $HOST"
+        (cd tests/scripts ; sh ./stop_vm.sh $HOST || true)
+fi
+(cd tests/scripts ; ./start_vm.sh $HOST)
+
+[ ! -d $WORKSPACE/build ] || rm -fr $WORKSPACE/build
+[ ! -d $WORKSPACE/reports ] || rm -fr $WORKSPACE/reports
+mkdir -p $WORKSPACE/build/packages $WORKSPACE/build/config $WORKSPACE/reports/coverage
+
+# EPEL
+cp src/rpm-specific/epel-short.repo $WORKSPACE/build/packages/epel.repo
+if [ ! -z "$EPEL_REPO" ] ; then
+        sed -i "s#http://download.fedoraproject.org/pub/epel#${EPEL_REPO}#" $WORKSPACE/build/packages/epel.repo
+fi
+scp $WORKSPACE/build/packages/epel.repo root@$HOST:/etc/yum.repos.d/ 
+
+# DAG
+cp src/rpm-specific/dag-rpmforge.repo $WORKSPACE/build/packages/dag-rpmforge.repo
+if [ ! -z "$DAG_RPMFORGE_REPO" ] ; then
+        sed -i "s#http://apt.sw.be/redhat#${DAG_RPMFORGE_REPO}#" $WORKSPACE/build/packages/dag-rpmforge.repo
+	# disable dag by default
+        sed -i "s#enabled = 1#enabled = 0#" $WORKSPACE/build/packages/dag-rpmforge.repo
+fi
+scp $WORKSPACE/build/packages/dag-rpmforge.repo root@$HOST:/etc/yum.repos.d/ 
+
+#================
+CDXPACKAGES="mod_ssl vsftpd perl-DBI perl-DBD-MySQL gd sendmail telnet bind bind-chroot caching-nameserver ntp perl-suidperl python-devel rcs sendmail-cf perl-URI perl-HTML-Tagset perl-Digest-SHA1 perl-Digest-HMAC perl-Socket6 perl-HTML-Parser perl-libwww-perl php-ldap php-mysql mysql-server mysql MySQL-python php-mbstring php-gd php-soap perl-DateManip sysstat gd-devel freetype-devel libpng-devel libjpeg-devel dump dejavu-lgc-fonts compat-libstdc++-33 policycoreutils selinux-policy selinux-policy-targeted zip unzip enscript xinetd mod_auth_mysql nscd"
+BUILDDEPS="libtool krb5-devel pam-devel byacc flex httpd-devel docbook-style-xsl doxygen gettext neon-devel openssl-devel sqlite-devel swig"
+MISSINGCVS="gcc"
+MISSINGHIL="gcc-c++"
+MISSINGMUNIN="which"
+#================
+# See http://wiki.centos.org/PackageManagement/Yum/Priorities
+#================
+ssh root@$HOST mkdir -p /usr/share/codendi/src
+ssh root@$HOST yum install -y rsync make rpm-build yum-priorities
+# Needed to build package, not working yet
+#rsync -rlptD $CDXVERS/rpm/ root@$HOST:/usr/src/redhat/
+#ssh root@$HOST yum install -y $BUILDDEPS $MISSINGCVS $MISSINGHIL $MISSINGMUNIN
+#ssh root@$HOST "cd /usr/src/redhat ; make"
+# Coping prebuilded
+rsync -rlptD CDROM/ root@$HOST:/root/
+# Next is done in codendi.tgz
+#rsync -a $CDXVERS/src/ root@$HOST:/usr/share/codendi/src/
+
+scp Codendi_4.0/codendi_tools/codendi_install.sh root@$HOST:
+scp localconf root@$HOST:
+ssh root@$HOST chmod +x codendi_install.sh
+ssh root@$HOST yum install -y $CDXPACKAGES
+
+ssh root@$HOST /root/codendi_install.sh
+ssh root at cdx40.local /usr/share/codendi/src/utils/generate_ssl_certificate.sh <<-FIN
+y
+FR
+ISERE
+GRENOBLE
+MYCOMPANY
+
+$HOST
+admin@$HOST
+
+
+
+
+
+FIN
+#================
+
+if $KEEPVM
+then
+        echo "Keeping vm $HOST alive"
+else
+        (cd tests/scripts ; sh ./stop_vm.sh $HOST)
+fi
+exit $retcode


Property changes on: branches/Branch_5_1/tests/scripts/cdx40-build-and-test-source.sh
___________________________________________________________________
Added: svn:executable
   + *

Modified: branches/Branch_5_1/tests/scripts/fusionforge-build-and-test-deb.sh
===================================================================
--- branches/Branch_5_1/tests/scripts/fusionforge-build-and-test-deb.sh	2011-04-14 16:00:36 UTC (rev 13132)
+++ branches/Branch_5_1/tests/scripts/fusionforge-build-and-test-deb.sh	2011-04-14 20:14:06 UTC (rev 13133)
@@ -3,42 +3,58 @@
 export CURDIR=`pwd`
 export WORKSPACE=${WORKSPACE:-$CURDIR}
 
-export CONFIG_PHP=func/config.php.buildbotDEB
+export CONFIG_PHP=func/config.php.buildbot
 export SELENIUM_RC_HOST=${SELENIUM_RC_HOST:-`hostname -i`}
 export SELENIUM_RC_DIR=$WORKSPACE/reports
+
+# get config 
+. tests/config/default
+if [ -f tests/config/`hostname` ] ; then . tests/config/`hostname`; fi
+if [ ! -z "$1" ]
+then
+	export HOST=$1
+else
+	export HOST=debian6.$DNSDOMAIN
+	export VEID=$VEIDDEB
+fi
+
+
+export LXCTEMPLATE=$LXCDEBTEMPLATE
+
+export IPBASE=$IPDEBBASE
+export IPDNS=$IPDEBDNS
+export IPMASK=$IPDEBMASK
+export IPGW=$IPDEBGW
+
+ARCH=`dpkg-architecture -qDEB_BUILD_ARCH`
+export VZTEMPLATE=debian-$DEBVERS-$ARCH-minimal
+export VZPRIVATEDIR
+export DEBMIRROR
+
+export DIST
+export VMENGINE
+export SSHPUBKEY
+export HOSTKEYDIR
+
 if [ "x${HUDSON_URL}" = "x" ]
 then
-	. tests/openvz/config.default
-	if [ -f tests/openvz/config.`hostname` ] ; then . tests/openvz/config.`hostname`; fi
-	export VEID=$VEIDDEB
-	export IPBASE=$IPDEBBASE
-	export IPDNS=$IPDEBDNS
-	ARCH=`dpkg-architecture -qDEB_BUILD_ARCH`
-	export VZTEMPLATE=debian-$DEBVERS-$ARCH-minimal
-	export VZPRIVATEDIR
-	export DIST
 	export BASEDIR=${BASEDIR:-/~`id -un`/ws}
+	export USEVZCTL=true
+	export SELENIUM_RC_HOST=localhost
 	export SELENIUM_RC_URL=http://`hostname -f`$BASEDIR/reports
 	export FFORGE_DEB_REPO=http://`hostname -f`$BASEDIR/build/debian
-	export HOST=debian6.local
-	export SELENIUM_RC_HOST=localhost
-	export USEVZCTL=true
 else
-	. tests/openvz/config.default
-	if [ -f tests/openvz/config.`hostname` ] ; then . tests/openvz/config.`hostname`; fi
-	ARCH=`dpkg-architecture -qDEB_BUILD_ARCH`
-	export VZTEMPLATE=debian-$DEBVERS-$ARCH-minimal
-	export VZPRIVATEDIR
-	export DIST
 	export SELENIUM_RC_URL=${HUDSON_URL}job/$JOB_NAME/ws/reports
 	export FFORGE_DEB_REPO=${HUDSON_URL}job/$JOB_NAME/ws/build/debian
-	export HOST=debian6.local
 fi
 export DB_NAME=gforge
 export CONFIGURED=true
 
 [ ! -d $WORKSPACE/build/packages ] || rm -fr $WORKSPACE/build/packages
 mkdir -p $WORKSPACE/build/packages
+[ ! -d $WORKSPACE/build/config ] || rm -fr $WORKSPACE/build/config
+mkdir -p $WORKSPACE/build/config
+
 # Comment out the next line when you don't want to rebuild all the time
 [ ! -d $WORKSPACE/build/debian ] || rm -fr $WORKSPACE/build/debian
 [ -d $WORKSPACE/build/debian ] || mkdir $WORKSPACE/build/debian
@@ -48,11 +64,67 @@
 make -f Makefile.debian BUILDRESULT=$WORKSPACE/build/packages LOCALREPODEB=$WORKSPACE/build/debian clean
 (cd 3rd-party/php-mail-mbox ; dpkg-source -x php-mail-mbox_0.6.3-1coclico1.dsc)
 (cd 3rd-party/php-mail-mbox ; make -f Makefile.debian BUILDRESULT=$WORKSPACE/build/packages LOCALREPODEB=$WORKSPACE/build/debian rsqueeze)
+(cd 3rd-party/selenium ; make getselenium)
 make -f Makefile.debian BUILDRESULT=$WORKSPACE/build/packages LOCALREPODEB=$WORKSPACE/build/debian rsqueeze
 
-cd tests
-phpunit --log-junit $WORKSPACE/reports/phpunit-selenium.xml DEBDebian60Tests.php
+if $KEEPVM 
+then
+	echo "Destroying vm $HOST"
+	(cd tests/scripts ; sh ./stop_vm.sh $HOST || true)
+fi
 
-cd ..
+(cd tests/scripts ; ./start_vm.sh $HOST)
+
+cat > $WORKSPACE/build/config/phpunit <<-EOF
+HUDSON_URL=$HUDSON_URL
+JOB_NAME=$JOB_NAME
+EOF
+
+scp -r tests root@$HOST:/root
+scp -r $WORKSPACE/build/config  root@$HOST:/root
+scp 3rd-party/selenium/binary/selenium-server-current/selenium-server.jar root@$HOST:/root
+ssh root@$HOST "cat /root/tests/preseed/* | LANG=C debconf-set-selections"
+if [ "x$DEBMIRROR" != "x" ]
+then
+	ssh root@$HOST "echo \"deb $DEBMIRROR $DIST main\" > /etc/apt/sources.list"
+fi
+if [ "x$DEBMIRRORSEC" != "x" ]
+then
+	ssh root@$HOST "echo \"deb $DEBMIRRORSEC $DIST/updates main\" > /etc/apt/sources.list.d/security.list"
+fi
+ssh root@$HOST "echo \"deb file:/debian $DIST main\" >> /etc/apt/sources.list"
+scp -r $WORKSPACE/build/debian root@$HOST:/ 
+gpg --export --armor | ssh root@$HOST "apt-key add -"
+sleep 5
+ssh root@$HOST "apt-get update"
+ssh root@$HOST "UCF_FORCE_CONFFNEW=yes DEBIAN_FRONTEND=noninteractive LANG=C apt-get -y --force-yes install postgresql-contrib fusionforge-plugin-forumml fusionforge-full"
+echo "Set forge admin password"
+ssh root@$HOST "/usr/share/gforge/bin/forge_set_password admin myadmin"
+ssh root@$HOST "LANG=C a2dissite default ; LANG=C invoke-rc.d apache2 reload ; LANG=C touch /tmp/fusionforge-use-pfo-rbac"
+ssh root@$HOST "(echo [core];echo use_ssl=no) > /etc/gforge/config.ini.d/zzz-builbot.ini"
+ssh root@$HOST "su - postgres -c \"pg_dump -Fc $DB_NAME\" > /root/dump"
+ssh root@$HOST "invoke-rc.d cron stop" || true
+
+retcode=0
+if $REMOTESELENIUM
+then
+	echo "Run phpunit test on $HOST"
+	ssh -X root@$HOST "tests/scripts/phpunit.sh DEBDebian60Tests.php" || retcode=$?
+else
+	cd tests
+	phpunit --log-junit $WORKSPACE/reports/phpunit-selenium.xml DEBDebian60Tests.php || retcode=$?
+	cd .. 
+fi
+if [ "x$SELENIUM_RC_DIR" != "x" ]
+then
+	rsync -av root@$HOST:/var/log/ $SELENIUM_RC_DIR/
+fi
 cp $WORKSPACE/reports/phpunit-selenium.xml $WORKSPACE/reports/phpunit-selenium.xml.org
 xalan -in $WORKSPACE/reports/phpunit-selenium.xml.org -xsl fix_phpunit.xslt -out $WORKSPACE/reports/phpunit-selenium.xml
+if $KEEPVM 
+then
+	echo "Keeping vm $HOST alive"
+else
+	(cd tests/scripts ; sh ./stop_vm.sh $HOST)
+fi
+exit $retcode

Modified: branches/Branch_5_1/tests/scripts/fusionforge-build-and-test-rpm.sh
===================================================================
--- branches/Branch_5_1/tests/scripts/fusionforge-build-and-test-rpm.sh	2011-04-14 16:00:36 UTC (rev 13132)
+++ branches/Branch_5_1/tests/scripts/fusionforge-build-and-test-rpm.sh	2011-04-14 20:14:06 UTC (rev 13133)
@@ -1,4 +1,4 @@
-#!/bin/sh -xe
+#!/bin/sh -ex
 
 export CURDIR=`pwd`
 export WORKSPACE=${WORKSPACE:-$CURDIR}
@@ -6,27 +6,46 @@
 export CONFIG_PHP=func/config.php.buildbot
 export SELENIUM_RC_HOST=${SELENIUM_RC_HOST:-`hostname -i`}
 export SELENIUM_RC_DIR=$WORKSPACE/reports
+
+# get config 
+. tests/config/default
+if [ -f tests/config/`hostname` ] ; then . tests/config/`hostname`; fi
+if [ ! -z "$1" ]
+then
+	export HOST="$1"
+else
+	export HOST=centos5.$DNSDOMAIN
+	export VEID=$VEIDCOS
+fi
+
+
+export LXCTEMPLATE=$LXCCOSTEMPLATE
+
+export IPBASE=$IPCOSBASE
+export IPDNS=$IPCOSDNS
+export IPMASK=$IPCOSMASK
+export IPGW=$IPCOSGW
+
+ARCH=`dpkg-architecture -qDEB_BUILD_ARCH`
+export VZTEMPLATE=centos-$COSVERS-$ARCH-minimal
+export VZPRIVATEDIR
+export DEBMIRROR
+
+export DIST
+export VMENGINE
+export SSHPUBKEY
+export HOSTKEYDIR
+
 if [ "x${HUDSON_URL}" = "x" ]
 then
-	. tests/openvz/config.default
-	if [ -f tests/openvz/config.`hostname` ] ; then . tests/openvz/config.`hostname`; fi
-	export VEID=$VEIDCEN
-	export IPBASE=$IPCENTOSBASE
-	export IPDNS=$IPCENTOSDNS
-	ARCH=`dpkg-architecture -qDEB_BUILD_ARCH`
-	export VZTEMPLATE=centos-$CENTVERS-$ARCH-minimal
-	export VZPRIVATEDIR
-	export DIST
 	export BASEDIR=${BASEDIR:-/~`id -un`/ws}
+	export USEVZCTL=true
+	export SELENIUM_RC_HOST=localhost
 	export SELENIUM_RC_URL=http://`hostname -f`$BASEDIR/reports
 	export FFORGE_RPM_REPO=http://`hostname -f`$BASEDIR/build/packages
-	export HOST=centos5.local
-	export SELENIUM_RC_HOST=localhost
-	export USEVZCTL=true
 else
 	export SELENIUM_RC_URL=${HUDSON_URL}job/$JOB_NAME/ws/reports
 	export FFORGE_RPM_REPO=${HUDSON_URL}job/$JOB_NAME/ws/build/packages
-	export HOST=centos52.local
 	export VZTEMPLATE=centos-5-x86
 fi
 export DB_NAME=gforge
@@ -34,17 +53,78 @@
 
 [ ! -d $WORKSPACE/build ] || rm -fr $WORKSPACE/build
 [ ! -d $WORKSPACE/reports ] || rm -fr $WORKSPACE/reports
-mkdir -p $WORKSPACE/build/packages $WORKSPACE/reports/coverage
+mkdir -p $WORKSPACE/build/packages $WORKSPACE/build/config $WORKSPACE/reports/coverage
 
+if $KEEPVM
+then
+	echo "Destroying vm $HOST"
+	(cd tests/scripts ; sh ./stop_vm.sh $HOST || true)
+fi
+
 make -f Makefile.rh BUILDRESULT=$WORKSPACE/build/packages all
 
-cp gforge/rpm-specific/fusionforge.repo $WORKSPACE/build/packages/fusionforge.repo
+(cd tests/scripts ; sh ./start_vm.sh $HOST)
+
+# FUSIONFORGE REPO
+cp src/rpm-specific/fusionforge.repo $WORKSPACE/build/packages/fusionforge.repo
 sed -i "s#http://fusionforge.org/#${HUDSON_URL}#" $WORKSPACE/build/packages/fusionforge.repo
-sed -i "s#baseurl = .*#baseurl = $FFORGE_RPM_REPO/#" $WORKSPACE/build/packages/fusionforge.repo
+if [ ! -z "$FFORGE_RPM_REPO" ]
+then
+	sed -i "s#baseurl = .*#baseurl = ${FFORGE_RPM_REPO}/#" $WORKSPACE/build/packages/fusionforge.repo
+fi
+scp $WORKSPACE/build/packages/fusionforge.repo root@$HOST:/etc/yum.repos.d/
+[ ! -e ~/fusionforge_repo ] || scp -rp ~/fusionforge_repo root@$HOST:
 
-cd tests
-phpunit --log-junit $WORKSPACE/reports/phpunit-selenium.xml RPMCentos52Tests.php
+# DAG
+cp src/rpm-specific/dag-rpmforge.repo $WORKSPACE/build/packages/dag-rpmforge.repo
+if [ ! -z "$DAG_RPMFORGE_REPO" ] ; then
+	sed -i "s#http://apt.sw.be/redhat#${DAG_RPMFORGE_REPO}#" $WORKSPACE/build/packages/dag-rpmforge.repo
+fi
+scp $WORKSPACE/build/packages/dag-rpmforge.repo root@$HOST:/etc/yum.repos.d/
 
-cd ..
+cat > $WORKSPACE/build/config/phpunit <<-EOF
+HUDSON_URL=$HUDSON_URL
+JOB_NAME=$JOB_NAME
+EOF
+
+scp -r tests root@$HOST:/root
+scp -r $WORKSPACE/build/config  root@$HOST:/root
+scp 3rd-party/selenium/binary/selenium-server-current/selenium-server.jar root@$HOST:/root
+ssh root@$HOST "ln -s gforge /usr/share/src"
+
+sleep 5
+[ ! -e "/tmp/timedhosts.txt" ] || scp -p /tmp/timedhosts.txt root@$HOST:/var/cache/yum/timedhosts.txt
+ssh root@$HOST "yum install -y fusionforge fusionforge-plugin-scmsvn fusionforge-plugin-online_help fusionforge-plugin-extratabs fusionforge-plugin-authldap fusionforge-plugin-scmgit fusionforge-plugin-blocks"
+scp -p root@$HOST:/var/cache/yum/timedhosts.txt /tmp/timedhosts.txt || true
+ssh root@$HOST '(echo [core];echo use_ssl=no) > /etc/gforge/config.ini.d/zzz-builbot.ini'
+ssh root@$HOST "cd /root/tests/func; CONFIGURED=true CONFIG_PHP=config.php.buildbot DB_NAME=$DB_NAME php db_reload.php"
+ssh root@$HOST "su - postgres -c \"pg_dump -Fc $DB_NAME\" > /root/dump"
+# Install a fake sendmail to catch all outgoing emails.
+# ssh root@".HOST." 'perl -spi -e s#/usr/sbin/sendmail#/usr/share/tests/scripts/catch_mail.php# /etc/gforge/local.inc'
+ssh root@$HOST "service crond stop" || true
+
+retcode=0
+if $REMOTESELENIUM
+then
+	echo "Run phpunit test on $HOST"
+	ssh -X root@$HOST "tests/scripts/phpunit.sh RPMCentos52Tests.php"|| retcode=$?
+else
+	cd tests
+	phpunit --log-junit $WORKSPACE/reports/phpunit-selenium.xml RPMCentos52Tests.php || retcode=$?
+	cd ..
+fi
+
+if [ "x$SELENIUM_RC_DIR" != "x" ]
+then
+	rsync -av root@$HOST:/var/log/ $SELENIUM_RC_DIR/
+fi
 cp $WORKSPACE/reports/phpunit-selenium.xml $WORKSPACE/reports/phpunit-selenium.xml.org
 xalan -in $WORKSPACE/reports/phpunit-selenium.xml.org -xsl fix_phpunit.xslt -out $WORKSPACE/reports/phpunit-selenium.xml
+
+if $KEEPVM 
+then
+	echo "Keeping vm $HOST alive"
+else
+	(cd tests/scripts ; sh ./stop_vm.sh $HOST)
+fi
+exit $retcode

Modified: branches/Branch_5_1/tests/scripts/fusionforge-build-and-test-source.sh
===================================================================
--- branches/Branch_5_1/tests/scripts/fusionforge-build-and-test-source.sh	2011-04-14 16:00:36 UTC (rev 13132)
+++ branches/Branch_5_1/tests/scripts/fusionforge-build-and-test-source.sh	2011-04-14 20:14:06 UTC (rev 13133)
@@ -1,30 +1,141 @@
-#!/bin/sh -xe
+#!/bin/sh -ex
 
+export CURDIR=`pwd`
+export WORKSPACE=${WORKSPACE:-$CURDIR}
+
 export CONFIG_PHP=func/config.php.buildbot
 export SELENIUM_RC_HOST=${SELENIUM_RC_HOST:-`hostname -i`}
 export SELENIUM_RC_DIR=$WORKSPACE/reports
-export SELENIUM_RC_URL=${HUDSON_URL}job/$JOB_NAME/ws/reports
-export HOST=centos52.local
-export VZTEMPLATE=centos-5-x86
+
+# get config 
+. tests/config/default
+if [ -f tests/config/`hostname` ] ; then . tests/config/`hostname`; fi
+if [ ! -z "$1" ]
+then
+	export HOST="$1"
+else
+	export HOST=centos5src.$DNSDOMAIN
+	export VEID=$VEIDSRC
+fi
+
+
+export LXCTEMPLATE=$LXCCOSTEMPLATE
+
+export IPBASE=$IPCOSBASE
+export IPDNS=$IPCOSDNS
+export IPMASK=$IPCOSMASK
+export IPGW=$IPCOSGW
+
+ARCH=`dpkg-architecture -qDEB_BUILD_ARCH`
+export VZTEMPLATE=centos-$COSVERS-$ARCH-minimal
+export VZPRIVATEDIR
+export DEBMIRROR
+
+export DIST
+export VMENGINE
+export SSHPUBKEY
+export HOSTKEYDIR
+
+if [ "x${HUDSON_URL}" = "x" ]
+then
+	export BASEDIR=${BASEDIR:-/~`id -un`/ws}
+	export USEVZCTL=true
+	export SELENIUM_RC_HOST=localhost
+	export SELENIUM_RC_URL=http://`hostname -f`$BASEDIR/reports
+	export FFORGE_RPM_REPO=http://`hostname -f`$BASEDIR/build/packages
+else
+	export SELENIUM_RC_URL=${HUDSON_URL}job/$JOB_NAME/ws/reports
+	export FFORGE_RPM_REPO=${HUDSON_URL}job/$JOB_NAME/ws/build/packages
+	export VZTEMPLATE=centos-5-x86
+fi
 export DB_NAME=fforge
 export CONFIGURED=true
 
 export BUILDRESULT=$WORKSPACE/build/packages
 
-rm -fr $WORKSPACE/build/packages $WORKSPACE/reports $WORKSPACE/apidocs
-mkdir -p $WORKSPACE/build/packages $WORKSPACE/reports/coverage $WORKSPACE/apidocs
+[ ! -d $WORKSPACE/build/packages ] || rm -fr $WORKSPACE/build/packages
+[ ! -d $WORKSPACE/build/config ] || rm -fr $WORKSPACE/build/config
+[ ! -d $WORKSPACE/reports ] || rm -fr $WORKSPACE/reports
+[ ! -d $WORKSPACE/apidocs ] || rm -fr $WORKSPACE/apidocs
+mkdir -p $WORKSPACE/build/packages $WORKSPACE/build/config $WORKSPACE/reports/coverage $WORKSPACE/apidocs
 
-make build-doc DOCSDIR=$WORKSPACE/apidocs DOXYGEN=$HOME/doxygen-1.6.3/bin/doxygen
+[ ! -e $HOME/doxygen-1.6.3/bin/doxygen ] || make build-doc DOCSDIR=$WORKSPACE/apidocs DOXYGEN=$HOME/doxygen-1.6.3/bin/doxygen
+
 make BUILDRESULT=$WORKSPACE/build/packages buildtar
 
-cp gforge/rpm-specific/fusionforge.repo $WORKSPACE/build/packages/fusionforge.repo
+make -f Makefile.rh BUILDRESULT=$WORKSPACE/build/packages src
+
+(cd 3rd-party/selenium ; make getselenium)
+
+if $KEEPVM
+then
+	echo "Destroying vm $HOST"
+	(cd tests/scripts ; sh ./stop_vm.sh $HOST || true)
+fi
+
+(cd tests/scripts ; ./start_vm.sh $HOST)
+
+# FUSIONFORGE REPO
+cp src/rpm-specific/fusionforge.repo $WORKSPACE/build/packages/fusionforge.repo
 sed -i "s#http://fusionforge.org/#${HUDSON_URL}#" $WORKSPACE/build/packages/fusionforge.repo
-sed -i "s#baseurl = .*#baseurl = $FFORGE_RPM_REPO/#" $WORKSPACE/build/packages/fusionforge.repo
+if [ ! -z "$FFORGE_RPM_REPO" ]
+then
+	sed -i "s#baseurl = .*#baseurl = ${FFORGE_RPM_REPO}/#" $WORKSPACE/build/packages/fusionforge.repo
+fi
+scp $WORKSPACE/build/packages/fusionforge.repo root@$HOST:/etc/yum.repos.d/
 
-cd tests
-phpunit --log-junit $WORKSPACE/reports/phpunit-selenium.xml TarCentos52Tests.php
+# DAG
+cp src/rpm-specific/dag-rpmforge.repo $WORKSPACE/build/packages/dag-rpmforge.repo
+if [ ! -z "$DAG_RPMFORGE_REPO" ] ; then
+        sed -i "s#http://apt.sw.be/redhat#${DAG_RPMFORGE_REPO}#" $WORKSPACE/build/packages/dag-rpmforge.repo
+fi
+scp $WORKSPACE/build/packages/dag-rpmforge.repo root@$HOST:/etc/yum.repos.d/
 
-cd ..
+cat > $WORKSPACE/build/config/phpunit <<-EOF
+HUDSON_URL=$HUDSON_URL
+JOB_NAME=$JOB_NAME
+EOF
+
+scp -r tests root@$HOST:/root
+scp -r $WORKSPACE/build/config  root@$HOST:/root
+scp 3rd-party/selenium/binary/selenium-server-current/selenium-server.jar root@$HOST:/root
+if [ "x$BUILDRESULT" != "x" ]
+then
+	scp $BUILDRESULT/fusionforge-*.tar.bz2 root@$HOST:
+else
+	scp ../build/packages/fusionforge-*.tar.bz2 root@$HOST:
+fi
+ssh root@$HOST 'tar jxf fusionforge-*.tar.bz2'
+[ ! -e "/tmp/timedhosts.txt" ] || scp -p /tmp/timedhosts.txt root@$HOST:/var/cache/yum/timedhosts.txt
+ssh root@$HOST 'cd fusionforge-*; FFORGE_RPM_REPO=http://buildbot.fusionforge.org/job/fusionforge-trunk-build-and-test-rpm/ws/build/packages/ FFORGE_DB=fforge FFORGE_USER=gforge FFORGE_ADMIN_USER=ffadmin FFORGE_ADMIN_PASSWORD=ffadmin ./install.sh centos52.local'
+scp -p root@$HOST:/var/cache/yum/timedhosts.txt /tmp/timedhosts.txt || true
+ssh root@$HOST "(echo [core];echo use_ssl=no) > /etc/gforge/config.ini.d/zzz-builbot.ini"
+ssh root@$HOST "cd /root/tests/func; CONFIGURED=true CONFIG_PHP=config.php.buildbot DB_NAME=$DB_NAME php db_reload.php"
+ssh root@$HOST "su - postgres -c \"pg_dump -Fc $DB_NAME\" > /root/dump"
+#  Install a fake sendmail to catch all outgoing emails.
+# ssh root@$HOST "perl -spi -e s#/usr/sbin/sendmail#/opt/tests/scripts/catch_mail.php# /etc/gforge/local.inc"
+ssh root@$HOST "service crond stop" || true
+
+retcode=0
+if $REMOTESELENIUM
+then
+	echo "Run phpunit test on $HOST"
+	ssh -X root@$HOST "tests/scripts/phpunit.sh TarCentos52Tests.php" || retcode=$?
+else
+	cd tests
+	phpunit --log-junit $WORKSPACE/reports/phpunit-selenium.xml TarCentos52Tests.php || retcode=$?
+	cd ..
+fi
+if [ "x$SELENIUM_RC_DIR" != "x" ]
+then
+	rsync -av root@$HOST:/var/log/ $SELENIUM_RC_DIR/
+fi
 cp $WORKSPACE/reports/phpunit-selenium.xml $WORKSPACE/reports/phpunit-selenium.xml.org
 xalan -in $WORKSPACE/reports/phpunit-selenium.xml.org -xsl fix_phpunit.xslt -out $WORKSPACE/reports/phpunit-selenium.xml
-
+if $KEEPVM 
+then
+	echo "Keeping vm $HOST alive"
+else
+	(cd tests/scripts ; sh ./stop_vm.sh $HOST)
+fi
+exit $retcode

Modified: branches/Branch_5_1/tests/scripts/fusionforge-trunk-build-rpm.sh
===================================================================
--- branches/Branch_5_1/tests/scripts/fusionforge-trunk-build-rpm.sh	2011-04-14 16:00:36 UTC (rev 13132)
+++ branches/Branch_5_1/tests/scripts/fusionforge-trunk-build-rpm.sh	2011-04-14 20:14:06 UTC (rev 13133)
@@ -5,7 +5,7 @@
 rm -fr $WORKSPACE/build
 mkdir -p $WORKSPACE/build/packages
 
-cp source/gforge/rpm-specific/fusionforge.repo $WORKSPACE/build/packages/fusionforge.repo
+cp source/src/rpm-specific/fusionforge.repo $WORKSPACE/build/packages/fusionforge.repo
 sed -i "s#http://fusionforge.org/#${HUDSON_URL}#" $WORKSPACE/build/packages/fusionforge.repo
 sed -i "s#baseurl = .*#baseurl = $FFORGE_RPM_REPO/#" $WORKSPACE/build/packages/fusionforge.repo
 

Modified: branches/Branch_5_1/tests/scripts/fusionforge-trunk-test-rpm.sh
===================================================================
--- branches/Branch_5_1/tests/scripts/fusionforge-trunk-test-rpm.sh	2011-04-14 16:00:36 UTC (rev 13132)
+++ branches/Branch_5_1/tests/scripts/fusionforge-trunk-test-rpm.sh	2011-04-14 20:14:06 UTC (rev 13133)
@@ -12,7 +12,7 @@
 rm -fr build/ reports/
 mkdir -p build/packages reports/coverage
 
-cp gforge/rpm-specific/fusionforge.repo build/packages/fusionforge.repo
+cp src/rpm-specific/fusionforge.repo build/packages/fusionforge.repo
 sed -i "s#http://fusionforge.org/#${HUDSON_URL}#" build/packages/fusionforge.repo
 sed -i "s#baseurl = .*#baseurl = $FFORGE_RPM_REPO/#" build/packages/fusionforge.repo
 

Added: branches/Branch_5_1/tests/scripts/phpunit.sh
===================================================================
--- branches/Branch_5_1/tests/scripts/phpunit.sh	                        (rev 0)
+++ branches/Branch_5_1/tests/scripts/phpunit.sh	2011-04-14 20:14:06 UTC (rev 13133)
@@ -0,0 +1,86 @@
+#! /bin/sh
+if [ $# -eq 1 ]
+then
+        testsuite=$1
+else
+        echo "You must give the testsuite to run :"
+	echo "	- DEBDebian60Tests.php"
+	echo "	- RPMCentos52Tests.php"
+	echo "	- TarCentos52Tests.php"
+fi
+if [ "x$testsuite" = "x" ]
+then
+        echo "Forge test suite not found"
+        exit 1
+fi
+
+WORKSPACE=/root
+[ ! -f $WORKSPACE/config/phpunit ] || . $WORKSPACE/config/phpunit 
+SELENIUM_RC_DIR=/var/log
+SELENIUM_RC_URL=${HUDSON_URL}job/${JOB_NAME}/ws/reports
+SELENIUM_RC_HOST=`hostname -f`
+HOST=`hostname -f`
+CONFIG_PHP=func/config.php
+export SELENIUM_RC_DIR WORKSPACE SELENIUM_RC_URL SELENIUM_RC_HOST HOST DB_NAME CONFIG_PHP
+
+cat <<-EOF >tests/func/config.php
+<?php
+// Host where selenium-rc is running
+define ('SELENIUM_RC_HOST', getenv('SELENIUM_RC_HOST'));
+define ('SELENIUM_RC_DIR', getenv('SELENIUM_RC_DIR'));
+
+// The forge's hostname
+define ('HOST', getenv('HOST'));
+
+// Base URL where FusionForge is installed
+define ('ROOT', '');
+
+// Database connection parameters.
+define('DB_NAME', getenv('DB_NAME'));
+define('DB_USER', 'gforge');
+define('DB_PASSWORD', '@@FFDB_PASS@@');
+define('DB_INIT_CMD', "/root/tests/func/db_reload.sh >/var/log/db_reload.log 2>/var/log/db_reload.errlog");
+
+// this should be an existing user of the forge together with its password
+// (the password should be different from 'myadmin')
+define ('EXISTING_USER', 'admin');
+define ('PASSWD_OF_EXISTING_USER', 'myadmin');
+
+// Where CLI is installed
+define ('CLI_CMD', '/opt/gforge/acde/tools/gforge-cli/gforge.php');
+
+// Where Java CLI is installed
+define ('JAGOSI_CMD', '/opt/gforge/acde/tools/gforge-java-cli/');
+
+// Enter true when file is configured.
+define('CONFIGURED', getenv('CONFIGURED'));
+
+//
+// DON'T MODIFY BELOW THIS LINE UNLESS YOU KNOW WHAT YOU DO
+//
+
+// These are deduced from the previous definitions.
+
+// URL to access the application
+define ('URL', 'http://'.HOST.'/');
+
+// WSDL of the forges SOAP API
+define ('WSDL_URL', URL.'soap/index.php?wsdl');
+?>
+EOF
+
+retcode=0
+echo "This will run phpunit tests"
+killall -9 java
+LANG=C java -jar selenium-server.jar -browserSessionReuse -singleWindow >/dev/null &
+#LANG=C java -jar selenium-server.jar -singleWindow >/dev/null &
+cd tests
+phpunit --log-junit $SELENIUM_RC_DIR/phpunit-selenium.xml $testsuite || retcode=$?
+cd ..
+# on debian
+killall -9 firefox-bin
+# on centos
+killall -9 firefox
+# kill java stuffs
+killall -QUIT java
+exit $retcode


Property changes on: branches/Branch_5_1/tests/scripts/phpunit.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: branches/Branch_5_1/tests/scripts/start_lxc.sh
===================================================================
--- branches/Branch_5_1/tests/scripts/start_lxc.sh	                        (rev 0)
+++ branches/Branch_5_1/tests/scripts/start_lxc.sh	2011-04-14 20:14:06 UTC (rev 13133)
@@ -0,0 +1,105 @@
+#! /bin/sh
+
+# You need to allow current user to sudo on /usr/bin/lxc-create /usr/bin/lxc-start /usr/lib/lxc/templates/lxc-debian6.postinst
+configdir=`dirname $0`/../config
+lxcdir=`dirname $0`/../lxc
+
+if [ -z "$LXCTEMPLATE" ]
+then
+	. $configdir/default
+	if [ -f $configdir/`hostname` ] ; then . $configdir/`hostname`; fi
+fi
+
+if [ -z "$HOST" ]
+then
+	if [ -z "$1" ]
+	then
+		echo "usage : $0 <hostname>"
+		exit 1
+	else
+		HOST=$1
+		# When HOST is given as an arg, I have to guesse which data to take
+		# depending on the host name
+		case $HOST in
+			deb*src*)
+				LXCTEMPLATE=$LXCDEBTEMPLATE
+				IPBASE=$IPDEBBASE
+				VEID=$VEIDSEB
+				IPMASK=$IPDEBMASK
+				IPGW=$IPDEBGW
+				;;
+			deb*)
+				LXCTEMPLATE=$LXCDEBTEMPLATE
+				IPBASE=$IPDEBBASE
+				VEID=$VEIDDEB
+				IPMASK=$IPDEBMASK
+				IPGW=$IPDEBGW
+				;;
+			centos*src*)
+				LXCTEMPLATE=$LXCCOSTEMPLATE
+				IPBASE=$IPCOSBASE
+				VEID=$VEIDSRC
+				IPMASK=$IPCOSMASK
+				IPGW=$IPCOSGW
+				;;
+			centos*)
+				LXCTEMPLATE=$LXCCOSTEMPLATE
+				IPBASE=$IPCOSBASE
+				VEID=$VEIDCOS
+				IPMASK=$IPCOSMASK
+				IPGW=$IPCOSGW
+				;;
+			fgdeb*)
+				LXCTEMPLATE=$LXCDEBTEMPLATE
+				VEID=""
+				;;
+			fgcos*)
+				LXCTEMPLATE=$LXCCOSTEMPLATE
+				VEID=""
+				;;
+			cd*)
+				LXCTEMPLATE=$LXCCOSTEMPLATE
+				VEID=""
+				;;
+		esac
+	fi
+fi
+
+if [ ! -e /usr/lib/lxc/templates/lxc-$LXCTEMPLATE ]
+then 
+	echo "/usr/lib/lxc/templates/lxc-$LXCTEMPLATE not found"
+	echo "you need to install template"
+	echo "run: (cd $lxcdir ; sudo make)"
+else
+	tmpconf=`mktemp`
+	cat $lxcdir/config.$LXCTEMPLATE > $tmpconf
+	if [ ! -z "$VEID" ] 
+	then
+		CIDRMASK=`netmask -c $IPBASE.$VEID/$IPMASK | cut -d/ -f2`
+		echo "lxc.network.ipv4 = $IPBASE.$VEID/$CIDRMASK" >> $tmpconf
+	fi
+	# Next is a bit hacky, the only way I found to pass pubkey to the template
+	# LXC don't allow to pass extra args
+	echo "#lxc.pubkey = $SSHPUBKEY" >> $tmpconf
+	sudo /usr/bin/lxc-create -n $HOST -f $tmpconf -t $LXCTEMPLATE
+	rm -f $tmpconf
+	sudo /usr/bin/lxc-start -n $HOST -d
+fi
+
+ssh -o 'StrictHostKeyChecking=no' "root@$HOST" uname -a
+ret=$?
+for loop in 1 2 3 4 5 6 7 8 9
+do
+
+	if [ $ret -ne 0 ];then
+		echo -n $loop
+		sleep 20;
+		ssh -o 'StrictHostKeyChecking=no' "root@$HOST" uname -a
+		ret=$?
+	fi
+done
+
+#ssh -X root@$IPBASE.$VEID "LANG=C java -jar selenium-server.jar -interactive &"
+
+sleep 1
+exit $ret


Property changes on: branches/Branch_5_1/tests/scripts/start_lxc.sh
___________________________________________________________________
Added: svn:executable
   + *

Modified: branches/Branch_5_1/tests/scripts/start_vm.sh
===================================================================
--- branches/Branch_5_1/tests/scripts/start_vm.sh	2011-04-14 16:00:36 UTC (rev 13132)
+++ branches/Branch_5_1/tests/scripts/start_vm.sh	2011-04-14 20:14:06 UTC (rev 13133)
@@ -1,3 +1,3 @@
 #!/bin/sh
 
-exec ./start_vz.sh "$@"
+exec ./start_${VMENGINE}.sh "$@"

Added: branches/Branch_5_1/tests/scripts/stop_lxc.sh
===================================================================
--- branches/Branch_5_1/tests/scripts/stop_lxc.sh	                        (rev 0)
+++ branches/Branch_5_1/tests/scripts/stop_lxc.sh	2011-04-14 20:14:06 UTC (rev 13133)
@@ -0,0 +1,14 @@
+#! /bin/sh
+
+if [ -z "$HOST" ]
+then
+        if [ -z "$1" ]
+        then
+                echo "usage : $0 <hostname>"
+                exit 1
+        else
+                HOST=$1
+        fi
+fi
+sudo /usr/bin/lxc-stop -n $HOST
+sudo /usr/bin/lxc-destroy -n $HOST


Property changes on: branches/Branch_5_1/tests/scripts/stop_lxc.sh
___________________________________________________________________
Added: svn:executable
   + *

Modified: branches/Branch_5_1/tests/scripts/stop_vm.sh
===================================================================
--- branches/Branch_5_1/tests/scripts/stop_vm.sh	2011-04-14 16:00:36 UTC (rev 13132)
+++ branches/Branch_5_1/tests/scripts/stop_vm.sh	2011-04-14 20:14:06 UTC (rev 13133)
@@ -1,3 +1,3 @@
 #!/bin/sh
 
-exec ./stop_vz.sh "$@"
+exec ./stop_${VMENGINE}.sh "$@"




More information about the Fusionforge-commits mailing list