zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #15999
[Merge] lp:~zorba-coders/zorba/fix_bug_1081678 into lp:zorba
Sorin Marian Nasoi has proposed merging lp:~zorba-coders/zorba/fix_bug_1081678 into lp:zorba.
Commit message:
Added a new option in the FOTS driver that allows running only the test cases that have a certain dependency defined.
Requested reviews:
Sorin Marian Nasoi (sorin.marian.nasoi)
Related bugs:
Bug #1081678 in Zorba: "FOTS: add 'dependency type' option in the driver"
https://bugs.launchpad.net/zorba/+bug/1081678
For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fix_bug_1081678/+merge/136367
Added a new option in the FOTS driver that allows running only the test cases that have a certain dependency defined.
--
https://code.launchpad.net/~zorba-coders/zorba/fix_bug_1081678/+merge/136367
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'test/fots_driver/README.TXT'
--- test/fots_driver/README.TXT 2012-11-19 07:08:11 +0000
+++ test/fots_driver/README.TXT 2012-11-27 11:11:35 +0000
@@ -37,12 +37,13 @@
zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=list-test-sets
zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=list-test-sets -e testSetPrefixes:=prod,app
zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=list-test-cases -e testSetPrefixes:=prod-Literal
+zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=list-test-cases -e dependency:=higherOrderFunctions
zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=list-matching-test-cases -e pattern:=catch
zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=run-test-sets -e testSetPrefixes:=prod -o result.xml --indent
+zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=run-test-sets -e testSetPrefixes:=prod -e dependency:=higherOrderFunctions_false -o result.xml --indent
zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=run-test-sets -e testSetPrefixes:=prod-Literal -e verbose:=false -o result.xml --indent
zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=run-test-case -e testSetName:=prod-Literal -e testCaseName:=Literals001 -o result.xml --indent
zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=run-test-case -e assertType:=assert-count -e testSetName:=fn-innermost -o result.xml --indent
zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=run-test-case -e assertType:=assert-count -o result.xml --indent
zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=run-and-report -o report.xml --indent
zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=report -e failuresFilePath:=failures.xml -e verbose:=false -o report.xml --indent
-
=== modified file 'test/fots_driver/cli.xq'
--- test/fots_driver/cli.xq 2012-11-19 07:08:11 +0000
+++ test/fots_driver/cli.xq 2012-11-27 11:11:35 +0000
@@ -31,7 +31,7 @@
declare variable $fotsZorbaManifestPath as xs:string external :=
"FOTSZorbaManifest.xml";
-(:~ The path to the results from a previous run :)
+(:~ Path to the results from a previous run :)
declare variable $failuresFilePath as xs:string external := "";
(:~ choose the CLI option you want to run :)
@@ -58,9 +58,12 @@
:)
declare variable $showResult as xs:string external := "true";
-(:~ list of assertion types :)
+(:~ assertion type :)
declare variable $assertType as xs:string external := "";
+(:~ dependency: used in 'list-test-cases' and 'run-test-sets' modes:)
+declare variable $dependency as xs:string external := "";
+
(:~ regex for the tests in the 'list-matching-test-cases' option :)
declare variable $pattern as xs:string external := "";
@@ -93,8 +96,10 @@
"zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=list-test-sets",
"zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=list-test-sets -e testSetPrefixes:=prod,app",
"zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=list-test-cases -e testSetPrefixes:=prod-Literal",
+ "zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=list-test-cases -e dependency:=higherOrderFunctions",
"zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=list-matching-test-cases -e pattern:=catch",
"zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=run-test-sets -e testSetPrefixes:=prod -o result.xml --indent",
+ "zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=run-test-sets -e testSetPrefixes:=prod -e dependency:=higherOrderFunctions_false -o result.xml --indent",
"zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=run-test-sets -e testSetPrefixes:=prod-Literal -e verbose:=false -o result.xml --indent",
"zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=run-test-case -e testSetName:=prod-Literal -e testCaseName:=Literals001 -o result.xml --indent",
"zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=run-test-case -e assertType:=assert-count -e testSetName:=fn-innermost -o result.xml --indent",
@@ -120,25 +125,27 @@
case "list-test-sets"
return
string-join(
- (d:list-test-sets(trace($fotsPath,
- "The path to FOTS catalog.xml was set to: "),
- local:tokenize(trace($testSetPrefixes,
- "'testSetPrefixes' was set to: ")))),
+ (d:list-test-sets(
+ trace($fotsPath, "Path to FOTS catalog.xml set to: "),
+ local:tokenize(trace($testSetPrefixes, "'testSetPrefixes' set to: ")))),
"
")
case "list-test-cases"
return
- string-join((d:list-test-cases(
- trace($fotsPath,
- "The path to FOTS catalog.xml was set to: "),
- local:tokenize(trace($testSetPrefixes,
- "'testSetPrefixes' was set to: "))), ""),
- "
")
+ string-join(
+ (d:list-test-cases( trace($fotsPath,
+ "Path to FOTS catalog.xml set to: "),
+ local:tokenize(trace($testSetPrefixes,
+ "'testSetPrefixes' set to: ")),
+ "",
+ trace($dependency,
+ "'dependency' set to:"))),
+ "
")
case "list-matching-test-cases"
return string-join((d:list-matching-test-cases(
trace($fotsPath,
- "The path to FOTS catalog.xml was set to: "),
+ "Path to FOTS catalog.xml set to: "),
trace($pattern,
- "pattern was set to: "),
+ "pattern set to: "),
trace($flags,
"flags were set to: ")), ""),
"
")
@@ -147,11 +154,13 @@
$fotsZorbaManifestPath,
d:list-test-sets($fotsPath,
local:tokenize(trace($testSetPrefixes,
- "'testSetPrefixes' was set to: "))),
+ "'testSetPrefixes' set to: "))),
d:list-test-cases($fotsPath,
local:tokenize($testSetPrefixes),
local:tokenize(trace($testCasePrefixes,
- "'$testCasePrefixes' was set to: "))),
+ "'$testCasePrefixes' set to: ")),
+ trace($dependency,
+ "'dependency' set to:")),
$exceptedTestCases,
$exceptedTestSets,
$assertType,
@@ -160,11 +169,11 @@
case "run-test-case"
return d:run-fots($fotsPath,
$fotsZorbaManifestPath,
- trace($testSetName,"'testSetName' was set to: "),
- trace($testCaseName,"'testCaseName' was set to: "),
+ trace($testSetName,"'testSetName' set to: "),
+ trace($testCaseName,"'testCaseName' set to: "),
$exceptedTestCases,
$exceptedTestSets,
- trace($assertType,"'assertType' was set to: "),
+ trace($assertType,"'assertType' set to: "),
xs:boolean($verbose),
xs:boolean($showResult))
case "run-and-report"
=== modified file 'test/fots_driver/fots-driver.xq'
--- test/fots_driver/fots-driver.xq 2012-11-20 07:32:15 +0000
+++ test/fots_driver/fots-driver.xq 2012-11-27 11:11:35 +0000
@@ -72,16 +72,65 @@
return data($testSet/@name)
};
+declare %private function driver:matches-dependency(
+ $dependencies as element(fots:dependency)*,
+ $filter as xs:string
+) as xs:boolean {
+ let $filter := tokenize($filter, '_')
+ let $depValue := $filter[1]
+ let $depSatisfied as xs:string := if(exists($filter[2]) and
+ ($filter[2] = 'true' or $filter[2]='false'))
+ then $filter[2]
+ else 'true'
+ return
+ if(xs:boolean($depSatisfied))
+
+ (: $depSatisfied = 'true' :)
+ then (exists($dependencies[@value = $depValue and
+ @satisfied = $depSatisfied]) or
+ exists($dependencies[@value = $depValue and empty(@satisfied)]))
+
+ (: $depSatisfied = 'false' :)
+ else exists($dependencies[@value = $depValue and
+ @satisfied = $depSatisfied])
+};
+
+(:~
+ : Loops through the given test set and returns the test cases that have the
+ : given dependencies defined.
+ : @param $testSet test set document.
+ : @param $dependency defined dependency
+ : (empty string means all test cases).
+ : @return matching test case names.
+ :)
+declare %private function driver:list-test-cases(
+ $testSetDoc as document-node(),
+ $dependency as xs:string*
+) as xs:string* {
+ if(string-join($dependency,'') = '')
+ then $testSetDoc//fots:test-case/@name
+ else for $testCase in $testSetDoc//fots:test-case
+ let $cond := driver:matches-dependency(($testSetDoc/fots:test-set/fots:dependency,
+ $testCase/fots:dependency),
+ $dependency)
+ where $cond
+ return$testCase/@name
+
+};
+
(:~
: Loops through the given test sets and returns the corresponding test cases.
: @param $fotsPath path to the FOTS catalog file.
: @param $testSetPrefixes name/criteria for the test sets
- : (empty string means all).
+ : (empty string means all test cases).
+ : @param $dependency type of dependency that has to be met
+ : (empty string means all test cases).
: @return available FOTS test cases.
:)
declare %ann:nondeterministic function driver:list-test-cases(
$fotsPath as xs:string,
- $testSetPrefixes as xs:string*
+ $testSetPrefixes as xs:string*,
+ $dependency as xs:string*
) as xs:string* {
let $doc := doc(resolve-uri($fotsPath)),
$baseUri:= resolve-uri(util:parent-folder($fotsPath))
@@ -90,31 +139,36 @@
then
for $testSet in $doc/fots:catalog/fots:test-set
let $testSetDoc := doc(resolve-uri($testSet/@file, $baseUri))
- return data($testSetDoc//fots:test-case/@name)
+ return driver:list-test-cases($testSetDoc, $dependency)
else
for $prefix in $testSetPrefixes
for $testSet in $doc/fots:catalog/fots:test-set[starts-with(@name, $prefix)]
let $testSetDoc := doc(resolve-uri($testSet/@file, $baseUri))
- return data($testSetDoc//fots:test-case/@name)
+ return driver:list-test-cases($testSetDoc, $dependency)
};
(:~
: Loops through the given test sets and returns the corresponding test cases.
: @param $fotsPath path to the FOTS catalog file.
: @param $testSetPrefixes name/criteria for the test sets
- : (empty string means all).
+ : (empty string means all test cases).
: @param $testCasePrefixes name/criteria for the test cases
- : (empty string means all).
+ : (empty string means all test cases).
+ : @param $dependency type of dependency that has to be met
+ : (empty string means all test cases).
: @return available FOTS test cases.
:)
declare %ann:nondeterministic function driver:list-test-cases(
$fotsPath as xs:string,
$testSetPrefixes as xs:string*,
- $testCasePrefixes as xs:string*
+ $testCasePrefixes as xs:string*,
+ $dependency as xs:string*
) as xs:string* {
let $doc := doc(resolve-uri($fotsPath)),
$baseUri:= resolve-uri(util:parent-folder($fotsPath)),
- $testCaseNames := driver:list-test-cases($fotsPath, $testSetPrefixes)
+ $testCaseNames := driver:list-test-cases($fotsPath,
+ $testSetPrefixes,
+ $dependency)
return
for $prefix in $testCasePrefixes
return
@@ -197,9 +251,9 @@
) as element(fots:test-cases) {
try {
let $FOTSCatalog := doc(trace(resolve-uri($FOTSCatalogFilePath),
- "Path to FOTS catalog.xml was set to: ")),
+ "Path to FOTS catalog.xml set to: ")),
$FOTSZorbaManifest := doc(trace(resolve-uri($FOTSZorbaManifestPath),
- "Path to FOTSZorbaManifest was set to:"))
+ "Path to FOTSZorbaManifest set to:"))
return driver:run($FOTSCatalog,
resolve-uri(util:parent-folder($FOTSCatalogFilePath)),
$FOTSZorbaManifest,
@@ -207,8 +261,8 @@
$testCasePrefixes,
$exceptedTestCases,
$exceptedTestSets,
- trace($assert, "The filter for 'assert name' was set to: "),
- trace($verbose, "'Verbose' parameter was set to: "),
+ trace($assert, "The filter for 'assert name' set to: "),
+ trace($verbose, "'Verbose' parameter set to: "),
$showResult)
}
catch * {
=== modified file 'test/fots_driver/reporting.xq'
--- test/fots_driver/reporting.xq 2012-11-19 07:08:11 +0000
+++ test/fots_driver/reporting.xq 2012-11-27 11:11:35 +0000
@@ -73,12 +73,12 @@
try {
{
variable $FOTSCatalog := doc(trace(resolve-uri($FOTSCatalogFilePath),
- "Path to FOTS catalog.xml was set to: "));
+ "Path to FOTS catalog.xml set to: "));
variable $catalogBaseURI := resolve-uri(util:parent-folder($FOTSCatalogFilePath));
variable $FOTSZorbaManifest := doc(trace(resolve-uri($FOTSZorbaManifestPath),
- "Path to FOTSZorbaManifest was set to:"));
+ "Path to FOTSZorbaManifest set to:"));
variable $failures := <fots:FOTS-test-suite-result>{
( $FOTSZorbaManifest//fots:implementation,
@@ -154,7 +154,7 @@
variable $failures := parse-xml(file:read-text($pathFailures));
variable $FOTSCatalog := doc(trace(resolve-uri($FOTSCatalogFilePath),
- "Path to FOTS catalog.xml was set to: "));
+ "Path to FOTS catalog.xml set to: "));
variable $catalogBaseURI := resolve-uri(util:parent-folder($FOTSCatalogFilePath));
Follow ups
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1081678 into lp:zorba
From: noreply, 2012-11-28
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1081678 into lp:zorba
From: Zorba Build Bot, 2012-11-28
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1081678 into lp:zorba
From: Zorba Build Bot, 2012-11-28
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1081678 into lp:zorba
From: Sorin Marian Nasoi, 2012-11-28
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1081678 into lp:zorba
From: Zorba Build Bot, 2012-11-28
-
Re: [Merge] lp:~zorba-coders/zorba/fix_bug_1081678 into lp:zorba
From: Zorba Build Bot, 2012-11-28
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1081678 into lp:zorba
From: Zorba Build Bot, 2012-11-28
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1081678 into lp:zorba
From: Sorin Marian Nasoi, 2012-11-28
-
Re: [Merge] lp:~zorba-coders/zorba/fix_bug_1081678 into lp:zorba
From: Nicolae Brinza, 2012-11-28
-
Re: [Merge] lp:~zorba-coders/zorba/fix_bug_1081678 into lp:zorba
From: Sorin Marian Nasoi, 2012-11-27