game_event.cpp detect any tag starting filter as valid

Made run_unit_tests.sh work when starting from cron

Added error detection to TestRunner class
This commit is contained in:
Pauli Nieminen 2008-08-09 07:13:44 +00:00
parent c2234ffe06
commit 03ba3a86cd
5 changed files with 19 additions and 4 deletions

View file

@ -208,7 +208,8 @@ namespace game_events {
(*itor->second)(eh, event_info, cfg);
return true;
}
return cmd == "filter" || cmd == "filter_second" || cmd == "filter_second_attack" || cmd == "filter_attack";
// Return true if we have /^filter.*/ tag
return cmd.compare(0, strlen("filter"),"filter");
}
static bool unit_matches_filter(const unit& u, const vconfig filter,const gamemap::location& loc);

View file

@ -96,6 +96,8 @@ BOOST_AUTO_TEST_CASE( test_config_cache_defaults )
BOOST_AUTO_TEST_CASE( test_load_config )
{
BOOST_CHECK_EQUAL(2,2);
}
/* vim: set ts=4 sw=4: */

View file

@ -2,5 +2,8 @@
FULL_PATH=`dirname $(readlink -f $0)`
source $FULL_PATH/path_settup.sh
export SSH_AUTH_SOCK=`find /tmp/keyring* -name ssh`
export DISPLAY=:0.0
cd $SVNDIR
nice php -f ${AUTOTESTDIR}/run_unit_tests.php $WEBDIR
nice php -f ${AUTOTESTDIR}/run_unit_tests.php $WEBDIR > $FULL_PATH/err.log

View file

@ -20,9 +20,10 @@ class SVNUpdater {
while(!$success && $tries--)
{
$svnlog = shell_exec('svn up 2>&1');
$success = preg_match('/At revision ([0-9]*)\./', $svnlog, $m);
echo $svnlog;
$success = preg_match('/At revision ([0-9]*)\./m', $svnlog, $m);
if (!$success)
sleep(15);
sleep(5);
}
if ($success)
$this->revision = (int)$m[1];

View file

@ -26,6 +26,14 @@ class TestRunner {
//test_cases_aborted="0"></TestSuite>
//</TestResult></UnitTest>';
$xml = simplexml_load_string($test_output);
if (!($xml instanceof SimpleXMLElement)
|| !isset($xml->TestLog[0]) )
{
global $db;
echo $test_output;
$db->FailTrans();
return;
}
foreach($xml->TestLog[0] as $name => $data)
{
$test_error = new TestError($name, $data, $build);