function do_remote_execution(&$dbHandler, $context) { $debugMsg = "File:" . __FILE__ . " Function: " . __FUNCTION__; $tables = array(); $tables['executions'] = DB_TABLE_PREFIX . 'executions'; $resultsCfg = config_get('results'); $tc_status = $resultsCfg['status_code']; $tree_mgr = new tree($dbHandler); $cfield_mgr = new cfield_mgr($dbHandler); $ret = null; $executionResults = array(); $myResult = array(); $sql = " /* {$debugMsg} */ INSERT INTO {$tables['executions']} " . " (testplan_id,platform_id,build_id,tester_id,execution_type," . " tcversion_id,execution_ts,status,notes) " . " VALUES ({$context['tplan_id']}, {$context['platform_id']}, {$context['build_id']}," . " {$context['user_id']}," . testcase::EXECUTION_TYPE_AUTO . ","; // have we got multiple test cases to execute ? $target =& $context['target']; foreach ($target['tc_versions'] as $version_id => $tcase_id) { $ret[$version_id] = array("verboseID" => null, "status" => null, "notes" => null, "system" => null, "scheduled" => null, "timestamp" => null); $tcaseInfo = $tree_mgr->get_node_hierarchy_info($tcase_id); $tcaseInfo['version_id'] = $version_id; // For each test case version we can have a different server config $serverCfg = $cfield_mgr->getXMLRPCServerParams($version_id, $target['feature_id'][$version_id]); $execResult[$version_id] = executeTestCase($tcaseInfo, $serverCfg, $context['context']); // RPC call $tryWrite = false; switch ($execResult[$version_id]['system']['status']) { case 'configProblems': $tryWrite = false; break; case 'connectionFailure': $tryWrite = false; break; case 'ok': $tryWrite = true; break; } if ($tryWrite) { $trun =& $execResult[$version_id]['execution']; if ($trun['scheduled'] == 'now') { $ret[$version_id]["status"] = strtolower($trun['result']); $ret[$version_id]["notes"] = trim($trun['notes']); $notes = $dbHandler->prepare_string($ret[$version_id]["notes"]); if ($ret[$version_id]["status"] != $tc_status['passed'] && $ret[$version_id]["status"] != $tc_status['failed'] && $ret[$version_id]["status"] != $tc_status['blocked']) { $ret[$version_id]["status"] = $tc_status['blocked']; } // $sql2exec = $sql . $version_id . "," . $dbHandler->db_now() . ", '{$ret[$version_id]["status"]}', '{$notes}' )"; $dbHandler->exec_query($sql2exec); } else { $ret[$version_id]["notes"] = trim($execResult[$version_id]['notes']); $ret[$version_id]["scheduled"] = $execResult[$version_id]['scheduled']; $ret[$version_id]["timestamp"] = $execResult[$version_id]['timestampISO']; } } else { $ret[$version_id]["system"] = $execResult[$version_id]['system']; } } return $ret; }