8 echo "You must give the testsuite to run :"
9 echo " - DEBDebian70Tests.php"
10 echo " - RPMCentosTests.php"
11 echo " - TarCentosTests.php"
13 if [ "x$testsuite" = "x" ]
15 echo "Forge test suite not found"
19 scriptdir=$(dirname $0)
20 FORGE_HOME=$(cd $scriptdir/../..; pwd)
22 [ ! -f tests/config/default ] || . tests/config/default
23 [ ! -f tests/config/phpunit ] || . tests/config/phpunit
24 SELENIUM_RC_DIR=/var/log
25 SELENIUM_RC_URL=${HUDSON_URL}job/${JOB_NAME}/ws/reports
26 SELENIUM_RC_HOST=`hostname -f`
28 CONFIG_PHP=func/config.php
29 export SELENIUM_RC_DIR SELENIUM_RC_URL SELENIUM_RC_HOST HOST DB_NAME DB_USER CONFIG_PHP
31 cat <<-EOF >tests/func/config.php
33 // Host where selenium-rc is running
34 define ('SELENIUM_RC_HOST', getenv('SELENIUM_RC_HOST'));
35 define ('SELENIUM_RC_DIR', getenv('SELENIUM_RC_DIR'));
37 // The forge's hostname
38 define ('HOST', getenv('HOST'));
40 // Base URL where FusionForge is installed
43 // Database connection parameters.
44 define('DB_NAME', getenv('DB_NAME'));
45 define('DB_USER', getenv('DB_USER'));
46 define('DB_PASSWORD', '@@FFDB_PASS@@');
47 define('DB_INIT_CMD', "$FORGE_HOME/tests/func/db_reload.sh >>/var/log/db_reload_selenium.log 2>&1");
49 // Cronjob wrapper script location
50 if (is_executable ("$FORGE_HOME/bin/forge_run_job")) {
51 define('RUN_JOB_PATH', "$FORGE_HOME/bin/");
52 } elseif (is_executable ("$FORGE_HOME/src/utils/forge_run_job")) {
53 define('RUN_JOB_PATH', "$FORGE_HOME/src/utils/");
55 print "Neither $FORGE_HOME/bin/forge_run_job nor $FORGE_HOME/src/utils/forge_run_job seem to be executable, dying.";
56 system ("ls -lha $FORGE_HOME $FORGE_HOME/bin $FORGE_HOME/src/utils");
60 // this should be an existing user of the forge together with its password
61 // (the password should be different from 'myadmin')
62 define ('FORGE_ADMIN_USERNAME', '$FORGE_ADMIN_USERNAME');
63 define ('FORGE_ADMIN_PASSWORD', '$FORGE_ADMIN_PASSWORD');
64 define ('FORGE_OTHER_PASSWORD', '$FORGE_OTHER_PASSWORD');
66 // Where CLI is installed
67 define ('CLI_CMD', '$FORGE_HOME/acde/tools/gforge-cli/gforge.php');
69 // Where Java CLI is installed
70 define ('JAGOSI_CMD', '$FORGE_HOME/acde/tools/gforge-java-cli/');
72 // Enter true when file is configured.
73 define('CONFIGURED', getenv('CONFIGURED'));
76 // DON'T MODIFY BELOW THIS LINE UNLESS YOU KNOW WHAT YOU DO
79 // These are deduced from the previous definitions.
81 // URL to access the application
82 define ('URL', 'http://'.HOST.'/');
84 // WSDL of the forges SOAP API
85 define ('WSDL_URL', URL.'soap/index.php?wsdl');
89 echo "Starting Selenium"
91 PATH=/usr/lib/iceweasel:$PATH LANG=C java -jar $FORGE_HOME/tests/selenium-server.jar -singleWindow >/dev/null &
94 while [ $i -lt $timeout ] && ! netstat -tnl 2>/dev/null | grep -q :4444 ; do
98 if [ $i = $timeout ] ; then
99 echo "Selenium failed to start within $timeout seconds"
103 echo "Running PHPunit tests"
106 phpunit --verbose --log-junit $SELENIUM_RC_DIR/phpunit-selenium.xml $@ $testsuite || retcode=$?
109 killall -9 firefox-bin