Changeset 22
Author: gaffu
(2011/11/01 12:20) 7 months ago
Fix supplied via Bromine forum: Re: RedHat(Bromine) -> WinXP(SeleniumServer) Issue Postby mastert14 ยป Mon Oct 31, 2011 11:09 pm I figured out the solution to my problem. I was missing the testruns/ directory that's supposed to be under the app/tmp/logs/ directory.
class JobsController extends AppController {class JobsController extends AppController {public $helpers = array('Html', 'Form', 'Time');public $helpers = array('Html', 'Form', 'Time');public $timeout = 120; //Secondsfunction beforeFilter() {function beforeFilter() {while ($nextPossible != false && $count < 100) {while ($nextPossible != false && $count < 100) {//$output .= date("m.d.y @ H:i:s") . ': Job ID:'.$nextPossible['jobs']['id'] . ' started test: \'' . $nextPossible['testcases']['name'] . '('.$nextPossible['testcases']['id'].')\' in ' . $nextPossible['browsers']['name'] . ' on ' . $nextPossible['operatingsystems']['name'] . "<br />";//$output .= date("m.d.y @ H:i:s") . ': Job ID:'.$nextPossible['jobs']['id'] . ' started test: \'' . $nextPossible['testcases']['name'] . '('.$nextPossible['testcases']['id'].')\' in ' . $nextPossible['browsers']['name'] . ' on ' . $nextPossible['operatingsystems']['name'] . "<br />";if ($nextPossible['suites']['id'] != $old_suite_id) {if ($nextPossible['suites']['id'] != $old_suite_id) {$nodes = $this->Node->find('all', array($nodes = $this->Node->find('all', array('contain' => array('Seleniumserver')foreach ($nodes as $node) {foreach ($nodes as $node) {if (empty($node['Seleniumserver'])) {if (empty($node['Seleniumserver'])) {$online = implode(',', $online);$online = implode("','", $online);$nextPossible = $this->Job->query("$nextPossible = $this->Job->query("nodes.id IN ($online)nodes.id IN ('$online')private function run($nextPossible) {private function run($nextPossible) {//$this->log("function run called with nextPossible: ".print_r($nextPossible, true), 'jobs');//$this->log("function run called with nextPossible: ".print_r($nextPossible, true), 'jobs');//Sets up the selenium-server in the DB, puts together the command line string$this->loadModel('Test');$this->loadModel('Test');private function execute($cmd, $test_id) {private function execute($cmd, $test_id) {$this->log("Executing: $cmd", 'jobs');$this->log("Executing: $cmd", 'jobs');$this->log("Output printed to " . '"' . LOGS . "$test_id.log" . '"', 'jobs');!mkdir(dirname($test_run_log_file))) {$this->log("Directory for job logs doesn't exist and an attempt to create it failed: " . dirname($test_run_log_file));if (!is_writable(dirname($test_run_log_file))) {$this->log("Cannot write to jobs log directory: " . dirname($test_run_log_file));$this->log("Output printed to {$test_run_log_file}.", 'jobs');if (substr(php_uname(), 0, 7) == "Windows") { //Windowsif (substr(php_uname(), 0, 7) == "Windows") { //Windowspclose(popen("start /B " . $cmd . ' > ' . '"' . LOGS . "testruns" . DS . "$test_id.log" . '"' . " && exit", "r"));pclose(popen("start /B {$cmd} > \"{$test_run_log_file}\" && exit", "r"));} else { //Unix.} else { //Unix.exec($cmd . " > " . LOGS . "testruns" . DS . "$test_id.log &");exec("{$cmd} > {$test_run_log_file}", $output, $return_var);