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 print "Looking for forge_run_job script...\n";
51 if (is_executable ("$FORGE_HOME/bin/forge_run_job")) {
52 print "Found in $FORGE_HOME/bin/\n";
53 define('RUN_JOB_PATH', "$FORGE_HOME/bin/");
54 } elseif (is_executable ("$FORGE_HOME/utils/forge_run_job")) {
55 print "Found in $FORGE_HOME/utils/\n";
56 define('RUN_JOB_PATH', "$FORGE_HOME/utils/");
57 } elseif (is_executable ("$FORGE_HOME/src/utils/forge_run_job")) {
58 print "Found in $FORGE_HOME/src/utils/\n";
59 define('RUN_JOB_PATH', "$FORGE_HOME/src/utils/");
61 print "Neither $FORGE_HOME/bin/forge_run_job, nor $FORGE_HOME/utils/forge_run_job, nor $FORGE_HOME/src/utils/forge_run_job seem to be executable, strange.\n";
65 // this should be an existing user of the forge together with its password
66 // (the password should be different from 'myadmin')
67 define ('FORGE_ADMIN_USERNAME', '$FORGE_ADMIN_USERNAME');
68 define ('FORGE_ADMIN_PASSWORD', '$FORGE_ADMIN_PASSWORD');
69 define ('FORGE_OTHER_PASSWORD', '$FORGE_OTHER_PASSWORD');
71 // Where CLI is installed
72 define ('CLI_CMD', '$FORGE_HOME/acde/tools/gforge-cli/gforge.php');
74 // Where Java CLI is installed
75 define ('JAGOSI_CMD', '$FORGE_HOME/acde/tools/gforge-java-cli/');
77 // Enter true when file is configured.
78 define('CONFIGURED', getenv('CONFIGURED'));
81 // DON'T MODIFY BELOW THIS LINE UNLESS YOU KNOW WHAT YOU DO
84 // These are deduced from the previous definitions.
86 // URL to access the application
87 define ('URL', 'http://'.HOST.'/');
89 // WSDL of the forges SOAP API
90 define ('WSDL_URL', URL.'soap/index.php?wsdl');
94 echo "Starting Selenium"
96 PATH=/usr/lib/iceweasel:$PATH LANG=C java -jar $FORGE_HOME/tests/selenium-server.jar -singleWindow >/dev/null &
99 while [ $i -lt $timeout ] && ! netstat -tnl 2>/dev/null | grep -q :4444 ; do
103 if [ $i = $timeout ] ; then
104 echo "Selenium failed to start within $timeout seconds"
108 echo "Running PHPunit tests"
111 phpunit --verbose --stop-on-failure --log-junit $SELENIUM_RC_DIR/phpunit-selenium.xml $@ $testsuite || retcode=$?
114 killall -9 firefox-bin