@@ -10,14 +10,14 @@ $testQueue = array();
1010$ testInfoJson = null ;
1111
1212/**
13- * Get the status of the given test ID (and return the info in an array)
14- *
15- */
13+ * Get the status of the given test ID (and return the info in an array)
14+ *
15+ */
1616function GetTestStatus ($ id , $ includePosition = true )
1717{
1818 $ testServer = GetServerForTest ($ id );
1919 if (isset ($ testServer )) {
20- // Proxy the status through the server that actually owns the test
20+ // Proxy the status through the server that actually owns the test
2121 $ pos = $ includePosition ? '1 ' : '0 ' ;
2222 $ status = json_decode (http_fetch ("{$ testServer }testStatus.php?test= $ id&pos= $ pos " ), true );
2323 if (is_array ($ status ) && isset ($ status ['data ' ])) {
@@ -30,7 +30,7 @@ function GetTestStatus($id, $includePosition = true)
3030 }
3131 $ testPath = './ ' . GetTestPath ($ id );
3232
33- // Fast-path for pending tests when we don't need to know the queue position (avoid test and location locks)
33+ // Fast-path for pending tests when we don't need to know the queue position (avoid test and location locks)
3434 if (file_exists ("$ testPath/test.scheduled " ) && !file_exists ("$ testPath/.archived " )) {
3535 $ ret = array ('statusCode ' => 101 , 'statusText ' => 'Test pending ' , 'id ' => $ id );
3636 $ status = GetSchedulerTestStatus ($ id );
@@ -47,10 +47,12 @@ function GetTestStatus($id, $includePosition = true)
4747 $ ret ['statusText ' ] = "Waiting at the front of the queue... " ;
4848 }
4949 } else {
50- $ ret = array ('statusCode ' => 100 ,
51- 'statusText ' => 'Test just started ' ,
52- 'startTime ' => gmdate ("m/d/y G:i:s " ),
53- 'id ' => $ id );
50+ $ ret = array (
51+ 'statusCode ' => 100 ,
52+ 'statusText ' => 'Test just started ' ,
53+ 'startTime ' => gmdate ("m/d/y G:i:s " ),
54+ 'id ' => $ id
55+ );
5456 }
5557 }
5658 return $ ret ;
@@ -71,10 +73,12 @@ function GetTestStatus($id, $includePosition = true)
7173 @unlink ("$ testPath/test.requeued " );
7274 @unlink ("$ testPath/test.running " );
7375 } else {
74- $ ret = array ('statusCode ' => 100 ,
75- 'statusText ' => 'Test just started ' ,
76- 'startTime ' => gmdate ("m/d/y G:i:s " , filemtime ("$ testPath/test.running " )),
77- 'id ' => $ id );
76+ $ ret = array (
77+ 'statusCode ' => 100 ,
78+ 'statusText ' => 'Test just started ' ,
79+ 'startTime ' => gmdate ("m/d/y G:i:s " , filemtime ("$ testPath/test.running " )),
80+ 'id ' => $ id
81+ );
7882 $ testInfoJson = GetTestInfo ($ id );
7983 PopulateTestInfoJson ($ ret , $ testInfoJson );
8084 if ($ elapsed == 0 ) {
@@ -98,10 +102,12 @@ function GetTestStatus($id, $includePosition = true)
98102 return $ ret ;
99103 }
100104 } elseif (is_file ("$ testPath/test.complete " ) || file_exists ("$ testPath/.archived " )) {
101- $ ret = array ('statusCode ' => 200 ,
102- 'statusText ' => 'Test Complete ' ,
103- 'id ' => $ id ,
104- 'completeTime ' => gmdate ("m/d/y G:i:s " , filemtime ("$ testPath/test.complete " )));
105+ $ ret = array (
106+ 'statusCode ' => 200 ,
107+ 'statusText ' => 'Test Complete ' ,
108+ 'id ' => $ id ,
109+ 'completeTime ' => gmdate ("m/d/y G:i:s " , filemtime ("$ testPath/test.complete " ))
110+ );
105111 $ testInfoJson = GetTestInfo ($ id );
106112 PopulateTestInfoJson ($ ret , $ testInfoJson );
107113 return $ ret ;
@@ -152,7 +158,7 @@ function GetTestStatus($id, $includePosition = true)
152158 }
153159 if (
154160 (array_key_exists ('started ' , $ testInfoJson ) &&
155- $ testInfoJson ['started ' ]) ||
161+ $ testInfoJson ['started ' ]) ||
156162 isset ($ test ['test ' ]['completeTime ' ])
157163 ) {
158164 $ ret ['startTime ' ] = isset ($ test ['test ' ]['startTime ' ]) ? $ test ['test ' ]['startTime ' ] : $ now ;
@@ -174,9 +180,9 @@ function GetTestStatus($id, $includePosition = true)
174180 } else {
175181 $ ret ['statusCode ' ] = 100 ;
176182 if ($ elapsed == 0 ) {
177- $ ret ['statusText ' ] = "Test just started " ;
183+ $ ret ['statusText ' ] = "Test just started " ;
178184 } elseif ($ elapsed == 1 ) {
179- $ ret ['statusText ' ] = "Test Started $ elapsed second ago " ;
185+ $ ret ['statusText ' ] = "Test Started $ elapsed second ago " ;
180186 } elseif ($ elapsed < 60 ) {
181187 $ ret ['statusText ' ] = "Test Started $ elapsed seconds ago " ;
182188 } else {
@@ -241,7 +247,7 @@ function GetTestStatus($id, $includePosition = true)
241247 $ rvRuns = 0 ;
242248 for ($ run = 1 ; $ run <= $ runs ; $ run ++) {
243249 if (gz_is_file ("$ testPath/ {$ run }_IEWPG.txt " ) || gz_is_file ("$ testPath/ {$ run }_devtools.json.txt " )) {
244- $ fvRuns ++;
250+ $ fvRuns ++;
245251 }
246252 if (gz_is_file ("$ testPath/ {$ run }_Cached_IEWPG.txt " ) || gz_is_file ("$ testPath/ {$ run }_Cached_devtools.json.txt " )) {
247253 $ rvRuns ++;
@@ -261,14 +267,14 @@ function GetTestStatus($id, $includePosition = true)
261267 $ ret ['statusText ' ] = "Completed {$ ret ['testsCompleted ' ]} of {$ ret ['testsExpected ' ]} tests " ;
262268 }
263269
264- // TODO: Add actual summary-result information
270+ // TODO: Add actual summary-result information
265271 }
266272 } else {
267273 if ($ includePosition && array_key_exists ('workdir ' , $ testInfoJson )) {
268274 $ count = FindJobPosition ($ testInfoJson ['location ' ], $ testInfoJson ['workdir ' ], $ id );
269275 if ($ count >= 0 ) {
270- $ ret ['statusCode ' ] = 101 ;
271- $ ret ['behindCount ' ] = $ count ;
276+ $ ret ['statusCode ' ] = 101 ;
277+ $ ret ['behindCount ' ] = $ count ;
272278 if ($ count > 1 ) {
273279 $ ret ['statusText ' ] = "Waiting behind $ count other tests... " ;
274280 } elseif ($ count == 1 ) {
@@ -286,7 +292,7 @@ function GetTestStatus($id, $includePosition = true)
286292 $ ret ['statusCode ' ] = 401 ;
287293 $ ret ['statusText ' ] = 'Test request not found ' ;
288294
289- // Force the test to end - something went Very Wrong (tm)
295+ // Force the test to end - something went Very Wrong (tm)
290296 $ lock = LockTest ($ id );
291297 if ($ lock ) {
292298 $ testInfoJson = GetTestInfo ($ id );
@@ -295,7 +301,7 @@ function GetTestStatus($id, $includePosition = true)
295301 $ test = file_get_contents ("$ testPath/testinfo.ini " );
296302 $ date = gmdate ("m/d/y G:i:s " , $ now );
297303
298- // Update the completion time if it isn't already set
304+ // Update the completion time if it isn't already set
299305 if (!strpos ($ test , 'completeTime ' )) {
300306 $ complete = "[test] \r\ncompleteTime= $ date " ;
301307 $ out = str_replace ('[test] ' , $ complete , $ test );
@@ -334,10 +340,10 @@ function GetTestStatusText($id)
334340}
335341
336342/**
337- * Check the status of a batch test
338- *
339- * @param mixed $status
340- */
343+ * Check the status of a batch test
344+ *
345+ * @param mixed $status
346+ */
341347function GetBatchStatus (&$ status )
342348{
343349 $ dirty = false ;
@@ -469,7 +475,7 @@ function array2xml($array, $xml = false)
469475
470476 foreach ($ array as $ key => $ value ) {
471477 if (is_array ($ value )) {
472- //get children
478+ //get children
473479 array2xml ($ value , $ xml ->addChild ($ key ));
474480 } else {
475481 $ xml ->addChild ($ key , $ value );
0 commit comments