[Fusionforge-commits] r11570 - trunk/tests/func

Alain Peyrat aljeux at libremir.placard.fr.eu.org
Thu Nov 18 21:31:04 CET 2010


Author: aljeux
Date: 2010-11-18 21:31:04 +0100 (Thu, 18 Nov 2010)
New Revision: 11570

Modified:
   trunk/tests/func/config.php.buildbot
   trunk/tests/func/config.php.buildbotDEB
   trunk/tests/func/config.php.ffsandbox
   trunk/tests/func/config.php.sample
   trunk/tests/func/config.php.tests
   trunk/tests/func/db_reload.php
Log:
Tests: drop DB_TYPE, not used
Fix to allow tests to be run directly from phpunit (phpunit <file>).

Modified: trunk/tests/func/config.php.buildbot
===================================================================
--- trunk/tests/func/config.php.buildbot	2010-11-18 17:30:55 UTC (rev 11569)
+++ trunk/tests/func/config.php.buildbot	2010-11-18 20:31:04 UTC (rev 11570)
@@ -21,7 +21,6 @@
 define ('ROOT', '');
 
 // Database connection parameters.
-define('DB_TYPE', 'pgsql');         // Values: mysql, pgsql
 define('DB_NAME', getenv('DB_NAME'));
 define('DB_USER', 'gforge');
 define('DB_PASSWORD', '@@FFDB_PASS@@');

Modified: trunk/tests/func/config.php.buildbotDEB
===================================================================
--- trunk/tests/func/config.php.buildbotDEB	2010-11-18 17:30:55 UTC (rev 11569)
+++ trunk/tests/func/config.php.buildbotDEB	2010-11-18 20:31:04 UTC (rev 11570)
@@ -21,7 +21,6 @@
 define ('ROOT', '');
 
 // Database connection parameters.
-define('DB_TYPE', 'pgsql');         // Values: mysql, pgsql
 define('DB_NAME', getenv('DB_NAME'));
 define('DB_USER', 'gforge');
 define('DB_PASSWORD', '@@FFDB_PASS@@');

Modified: trunk/tests/func/config.php.ffsandbox
===================================================================
--- trunk/tests/func/config.php.ffsandbox	2010-11-18 17:30:55 UTC (rev 11569)
+++ trunk/tests/func/config.php.ffsandbox	2010-11-18 20:31:04 UTC (rev 11570)
@@ -21,7 +21,6 @@
 define ('ROOT', '');
 
 // Database connection parameters.
-define('DB_TYPE', 'pgsql');         // Values: mysql, pgsql
 define('DB_NAME', getenv('DB_NAME'));
 define('DB_INIT_CMD', "/root/scripts/reload-db.sh > /dev/null 2> /dev/null");
 

Modified: trunk/tests/func/config.php.sample
===================================================================
--- trunk/tests/func/config.php.sample	2010-11-18 17:30:55 UTC (rev 11569)
+++ trunk/tests/func/config.php.sample	2010-11-18 20:31:04 UTC (rev 11570)
@@ -21,7 +21,6 @@
 define ('ROOT', '');
 
 // Database connection parameters.
-define('DB_TYPE', 'pgsql');         // Values: mysql, pgsql
 define('DB_NAME', 'fforge');
 define('DB_USER', 'gforge');
 define('DB_PASSWORD', '@@FFDB_PASS@@');

Modified: trunk/tests/func/config.php.tests
===================================================================
--- trunk/tests/func/config.php.tests	2010-11-18 17:30:55 UTC (rev 11569)
+++ trunk/tests/func/config.php.tests	2010-11-18 20:31:04 UTC (rev 11570)
@@ -20,7 +20,6 @@
 define ('ROOT', '');
 
 // Database connection parameters.
-define('DB_TYPE', 'pgsql');         // Values: mysql, pgsql
 define('DB_NAME', 'fforge');
 define('DB_USER', 'gforge');
 define('DB_PASSWORD', '@@FFDB_PASS@@');

Modified: trunk/tests/func/db_reload.php
===================================================================
--- trunk/tests/func/db_reload.php	2010-11-18 17:30:55 UTC (rev 11569)
+++ trunk/tests/func/db_reload.php	2010-11-18 20:31:04 UTC (rev 11570)
@@ -76,31 +76,21 @@
 	}
 }
 
-if ( DB_TYPE == 'mysql') {
-	// Reload a fresh database before running this test suite.
-	system("mysqladmin -f -u".DB_USER." -p".DB_PASSWORD." drop ".DB_NAME." &>/dev/null");
-	system("mysqladmin -u".DB_USER." -p".DB_PASSWORD." create ".DB_NAME);
-	system("mysql -u".DB_USER." -p".DB_PASSWORD." ".DB_NAME." < $forge_root/db/gforge-struct-mysql.sql");
-	system("mysql -u".DB_USER." -p".DB_PASSWORD." ".DB_NAME." < $forge_root/db/gforge-data-mysql.sql");
-} elseif ( DB_TYPE == 'pgsql') {
-	if (!function_exists('pg_connect')) {
-		print "ERROR: Missing pgsql on PHP to run tests on PostgreSQL, aborting.\n";
-		exit;
-	}
-	// Drop & create a fresh database before running this test suite.
-	if ($opt_restart) {
-		system("service httpd restart 2>&1 >/dev/null");
-	}
-	system("service postgresql restart 2>&1 >/dev/null");
-	system("su - postgres -c 'dropdb -q ".DB_NAME."'");
-	system("su - postgres -c 'createdb -q --encoding UNICODE ".DB_NAME."'");
-	system("psql -q -U".DB_USER." ".DB_NAME." -f $forge_root/db/gforge.sql >> /var/log/gforge-import.log 2>&1");
-	system("php $forge_root/db/upgrade-db.php >> /var/log/gforge-upgrade-db.log 2>&1");
-} else {
-	print "ERROR: Unsupported database type: ".DB_TYPE.", aborting.\n";
+if (!function_exists('pg_connect')) {
+	print "ERROR: Missing pgsql on PHP to run tests on PostgreSQL, aborting.\n";
 	exit;
 }
 
+// Drop & create a fresh database before running this test suite.
+if ($opt_restart) {
+	system("service httpd restart 2>&1 >/dev/null");
+}
+system("service postgresql restart 2>&1 >/dev/null");
+system("su - postgres -c 'dropdb -q ".DB_NAME."'");
+system("su - postgres -c 'createdb -q --encoding UNICODE ".DB_NAME."'");
+system("psql -q -U".DB_USER." ".DB_NAME." -f $forge_root/db/gforge.sql >> /var/log/gforge-import.log 2>&1");
+system("php $forge_root/db/upgrade-db.php >> /var/log/gforge-upgrade-db.log 2>&1");
+
 $sitename = 'ACOS Forge';
 $adminPassword = 'myadmin';
 $adminEmail = 'nobody at nowhere.com';
@@ -109,7 +99,7 @@
 
 //set_include_path(".:/opt/gforge/:/opt/gforge/www/include/:/etc/gforge/");
 
-require_once '../../gforge/www/env.inc.php';    
+require_once $forge_root.'/www/env.inc.php';
 require_once $gfwww.'include/pre.php';
 
 // Install tsearch2 for phpwiki & patch it for safe backups.
@@ -133,7 +123,7 @@
 	$adminEmail, 1, 1, 1,'GMT','',0,1,'', '','','','','','US',false, 'admin');
 
 if (!$user_id) {
-	print "ERROR: Creating user: ".$user->getErrorMessage()."\n";
+	print "ERROR: Creating user: ".$user->getErrorMessage().':'.db_error()."\n";
 	exit(1);
 }
 




More information about the Fusionforge-commits mailing list