Permalink
Browse files

Adding and testing code to read skipif.inc files to enable whole dire…

…ctory skips
  • Loading branch information...
1 parent 5b5cec2 commit 68730ea02f1d723b6bfa75055365add8fad7ebc0 zoe slattery committed Feb 27, 2013
View
@@ -32,7 +32,7 @@
</target>
<target name="lint" description="Lint check all PHP files.">
- <phplint haltonfailure="true">
+ <phplint haltonfailure="true" level="debug">
<fileset dir="src">
<include name="*.php"/>
<include name="**/*.php"/>
@@ -0,0 +1,8 @@
+--TEST--
+Try a sample test
+--FILE--
+<?php
+ echo "Hello world\n";
+?>
+--EXPECT--
+Hello world
@@ -0,0 +1,3 @@
+<?php
+ echo "skip me please \n";
+?>
View
@@ -20,8 +20,6 @@ function rtExceptionHandler(Exception $e) {
set_exception_handler('rtExceptionHandler');
-
-
/*
* check the version of the running php-executable and
* ensure that is 5.3 or higher
@@ -98,7 +98,7 @@ public function write($filename=null)
* @param integer $processCount
* @return string
*/
- public function getOverview($parallelGroups = 0, $serialGroups= 0, $processCount)
+ public function getOverview($parallelGroups = 0, $serialGroups= 0, $processCount, $skippedGroups)
{
// if the overview was already created retun it
if (!is_null($this->overview)) {
@@ -134,6 +134,12 @@ public function getOverview($parallelGroups = 0, $serialGroups= 0, $processCount
$str = '';
$str .= "\n\n----------------------------------------\n";
+ $str .= "Number of skipped groups:";
+ $blanks = 30 - strlen("Number of skipped groups:") - strlen(count($skippedGroups));
+ $str = $this->writeBlanks($str, $blanks);
+ $str .= count($skippedGroups);
+ $str .= "\n----------------------------------------\n";
+
$str .= "Tests:";
$blanks = 30 - strlen("Tests:") - strlen($count);
$str = $this->writeBlanks($str, $blanks);
@@ -194,9 +200,9 @@ public function getOverview($parallelGroups = 0, $serialGroups= 0, $processCount
}
- public function printOverview($parallelGroups=NULL, $serialGroups = NULL, $processCount=NULL) {
+ public function printOverview($parallelGroups=NULL, $serialGroups = NULL, $processCount=NULL, $skippedGroups=null) {
- print $this->getOverview($parallelGroups, $serialGroups, $processCount);
+ print $this->getOverview($parallelGroups, $serialGroups, $processCount, $skippedGroups);
flush();
}
@@ -21,6 +21,8 @@ class rtGroupConfiguration
protected $isRedirect=false;
protected $serialGroup=false;
protected $redirectFromID = null;
+ protected $skipFile = "";
+ protected $hasSkipCode = false;
public function __construct($directory)
@@ -29,8 +31,7 @@ public function __construct($directory)
}
public function parseRedirect(rtPHPTest $redirectedTest) {
- //Going to assume that we have already parsed the SKIPIF (if it exists)
- //var_dump($redirectedTest->getSection('REDIRECTTEST')->getContents());
+
$name = $redirectedTest->getName();
$code = implode($redirectedTest->getSection('REDIRECTTEST')->getContents(), "\n");
@@ -75,7 +76,7 @@ public function parseRedirect(rtPHPTest $redirectedTest) {
//Find the key in the full name of the test contains the redirect
$position = strpos($name, $key);
- //Take the root strng from before the key
+ //Take the root string from before the key
$root=substr($name, 0, $position);
$title = $redirectedTest->getSection('TEST')->getContents();
@@ -94,14 +95,22 @@ public function parseRedirect(rtPHPTest $redirectedTest) {
}
- public function parse() {
- //Here insert code to read a config file from the test directory that determines whether the set of tests shoudl be run
+ public function parseConfiguration() {
+ //Here insert code to read a config file from the test directory that determines whether the set of tests should be run
//in parallel or not?
$this->serialGroup = false;
+
+
+ //Code to read the directory skipif, run it and skip the directory
+ if(file_exists($this->testDirectory. "/skipif.inc")) {
+ $this->hasSkipCode = true;
+ $this->skipFile = $this->testDirectory."/skipif.inc";
+ }
return;
}
+
public function getEnvironmentVariables() {
return $this->environmentVariables;
}
@@ -116,6 +125,12 @@ public function isSerial() {
}
public function getRedirectFromID() {
return $this->redirectFromID;
- }
+ }
+ public function hasSkipCode() {
+ return $this->hasSkipCode;
+ }
+ public function getSkipFile() {
+ return $this->skipFile;
+ }
}
@@ -22,6 +22,7 @@ class rtGroupResults
protected $runOrder;
protected $runByProcessor = 0;
protected $absTime;
+ protected $isSkipGroup = false;
public function __construct($gn) {
$this->groupName = $gn;
@@ -68,6 +69,10 @@ public function setCount($c) {
public function setProc($p) {
$this->runByProcessor = $p;
}
+ public function setSkip($s) {
+ $this->isSkipGroup = $s;
+ }
+
public function getTime() {
return $this->timeToRun;
}
@@ -82,6 +87,9 @@ public function getProcessorId() {
public function getAbsTime() {
return $this->absTime;
}
+ public function isSkipGroup() {
+ return $this->isSkipGroup;
+ }
}
Oops, something went wrong.

0 comments on commit 68730ea

Please sign in to comment.