[Fusionforge-commits] r13776 - in branches/Branch_5_1/tests: func scripts

Christian Bayle cbayle at fusionforge.org
Thu Jul 14 22:42:41 CEST 2011


Author: cbayle
Date: 2011-07-14 22:42:40 +0200 (Thu, 14 Jul 2011)
New Revision: 13776

Modified:
   branches/Branch_5_1/tests/func/db_reload.sh
   branches/Branch_5_1/tests/scripts/phpunit.sh
Log:
Merge from trunk


Modified: branches/Branch_5_1/tests/func/db_reload.sh
===================================================================
--- branches/Branch_5_1/tests/func/db_reload.sh	2011-07-13 15:45:54 UTC (rev 13775)
+++ branches/Branch_5_1/tests/func/db_reload.sh	2011-07-14 20:42:40 UTC (rev 13776)
@@ -4,30 +4,46 @@
 	database=$1
 else
 	export PATH=$PATH:/usr/share/gforge/bin/:/usr/share/gforge/utils:/opt/gforge/utils
-	database=`forge_get_config database_name`
+	database=`FUSIONFORGE_NO_PLUGINS=true forge_get_config database_name`
 fi
 if [ "x$database" = "x" ]
 then
 	echo "Forge database name not found"
 	exit 1
+else
+	echo "Forge database is $database"
 fi
 
-echo "Cleaning up the database"
+echo "Stopping apache"
 if type invoke-rc.d 2>/dev/null
 then
 	invoke-rc.d apache2 stop
+else
+	service httpd stop
+fi
+
+echo "Starting the database"
+if type invoke-rc.d 2>/dev/null
+then
 	invoke-rc.d postgresql restart
 else
-	service httpd stop
 	service postgresql restart
 fi
 
+echo "Droping database $database"
 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
-#echo "Executing: psql < /root/dump"
-#su - postgres -c "psql" < /root/dump
 
+if [ -f /root/dump ]
+then
+	echo "Restore database from dump file: psql -f- < /root/dump"
+	su - postgres -c "psql -f-" < /root/dump > /var/log/pg_restore.log 2>/var/log/pg_restore.err
+else
+	# TODO: reinit the db from scratch and create the dump
+	echo "Couldn't restore the database: No /root/dump found"
+	exit 2
+fi
+
+echo "Starting apache"
 if type invoke-rc.d 2>/dev/null
 then
 	invoke-rc.d apache2 start

Modified: branches/Branch_5_1/tests/scripts/phpunit.sh
===================================================================
--- branches/Branch_5_1/tests/scripts/phpunit.sh	2011-07-13 15:45:54 UTC (rev 13775)
+++ branches/Branch_5_1/tests/scripts/phpunit.sh	2011-07-14 20:42:40 UTC (rev 13776)
@@ -1,7 +1,8 @@
 #! /bin/sh
-if [ $# -eq 1 ]
+if [ $# -ge 1 ]
 then
         testsuite=$1
+	shift
 else
         echo "You must give the testsuite to run :"
 	echo "	- DEBDebian60Tests.php"
@@ -21,7 +22,7 @@
 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
+export SELENIUM_RC_DIR WORKSPACE SELENIUM_RC_URL SELENIUM_RC_HOST HOST DB_NAME DB_USER CONFIG_PHP
 
 cat <<-EOF >tests/func/config.php
 <?php
@@ -37,9 +38,9 @@
 
 // Database connection parameters.
 define('DB_NAME', getenv('DB_NAME'));
-define('DB_USER', 'gforge');
+define('DB_USER', getenv('DB_USER'));
 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");
+define('DB_INIT_CMD', "/root/tests/func/db_reload.sh >>/var/log/db_reload_selenium.log 2>>/var/log/db_reload_selenium.errlog");
 
 // this should be an existing user of the forge together with its password
 // (the password should be different from 'myadmin')
@@ -75,7 +76,7 @@
 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=$?
+phpunit --log-junit $SELENIUM_RC_DIR/phpunit-selenium.xml $@ $testsuite || retcode=$?
 cd ..
 # on debian
 killall -9 firefox-bin




More information about the Fusionforge-commits mailing list