zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #18323
[Merge] lp:~zorba-coders/zorba/fix_bug_1131002 into lp:zorba
Sorin Marian Nasoi has proposed merging lp:~zorba-coders/zorba/fix_bug_1131002 into lp:zorba.
Commit message:
Fix bug lp:1131002: added a new mode in FOTS driver that allows running a single test set.
Requested reviews:
Sorin Marian Nasoi (sorin.marian.nasoi)
Related bugs:
Bug #1131002 in Zorba: "FOTS driver cannot always run exactly one test set"
https://bugs.launchpad.net/zorba/+bug/1131002
For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fix_bug_1131002/+merge/150017
Fix bug lp:1131002.
--
https://code.launchpad.net/~zorba-coders/zorba/fix_bug_1131002/+merge/150017
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'test/fots/ImportFOTS.cmake'
--- test/fots/ImportFOTS.cmake 2013-02-21 00:50:33 +0000
+++ test/fots/ImportFOTS.cmake 2013-02-22 11:15:28 +0000
@@ -74,9 +74,9 @@
"ZORBA_ADD_TEST (FOTS/${_testset} zorbacmd -f -q "
"${CMAKE_CURRENT_LIST_DIR}/../fots_driver/cli.xq "
"-e fotsPath:=${_outdir}/2011/QT3-test-suite/catalog.xml "
- "-e mode:=run-test-sets -e testSetPrefixes:=${_testset} "
+ "-e mode:=run-test-set -e testSetName:=${_testset} "
"-e expectedFailuresPath:=${BUILDDIR}/FOTSExpectedFailures.xml "
- "-e verbose:=true "
+ "-e verbose:=false "
"--disable-http-resolution --indent "
"-z \"cdata-section-elements=${FOTS_CDATA_ELEMENTS}\")\n"
"ZORBA_SET_TEST_PROPERTY (FOTS/${_testset} "
=== modified file 'test/fots_driver/README.TXT'
--- test/fots_driver/README.TXT 2013-02-09 12:25:16 +0000
+++ test/fots_driver/README.TXT 2013-02-22 11:15:28 +0000
@@ -43,14 +43,14 @@
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-test-cases -e dependency:=higherOrderFunctions -e assertions:=assert-count
-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 expectedFailuresPath:=ExpectedFailures.xml -o result.xml --indent
+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 expectedFailuresPath:=ExpectedFailures.xml -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 -e assertions:=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-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-sets -e testSetPrefixes:=prod-Literal -e verbose:=true -o result.xml --indent
+zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=run-test-set -e testSetName:=fn-matches -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-and-report -o results_Zorba_XQ30.xml --indent --disable-http-resolution
zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=report -e resultsFilePath:=results.xml -o results_Zorba_XQ30.xml --indent
zorba -f -q /path/to/cli.xq -e mode:=generate-expected-failures -e resultsFilePath:=failures.xml -o ExpectedFailures.xml --indent
-
=== modified file 'test/fots_driver/cli.xq'
--- test/fots_driver/cli.xq 2013-02-19 14:06:08 +0000
+++ test/fots_driver/cli.xq 2013-02-22 11:15:28 +0000
@@ -200,7 +200,8 @@
"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 expectedFailuresPath:=ExpectedFailures.xml -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 -e assertions:=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-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-sets -e testSetPrefixes:=prod-Literal -e verbose:=true -o result.xml --indent",
+ "zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=run-test-set -e testSetName:=fn-matches -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-and-report -o results_Zorba_XQ30.xml --indent --disable-http-resolution",
"zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=report -e resultsFilePath:=results.xml -o results_Zorba_XQ30.xml --indent",
@@ -262,7 +263,7 @@
(
(
d:list-test-cases($fotsPath,
- local:tokenize($testSetPrefixes),
+ d:list-test-sets($fotsPath, local:tokenize($testSetPrefixes)),
$dependency,
$assertions)
),
@@ -309,6 +310,28 @@
$mode)
}
+case "run-test-set"
+return
+{
+ trace($testSetName, $testSetNameMsg);
+ trace($dependency, "'dependency' set to:");
+ trace($assertions, "'assertions' set to: ");
+ trace($verbose, "'verbose' set to:");
+ trace($mode, "Cli command was set to:");
+
+ d:run-test-set($fotsPath,
+ $fotsZorbaManifestPath,
+ $testSetName,
+ $exceptedTestSets,
+ (),
+ $exceptedTestCases,
+ $dependency,
+ $assertions,
+ xs:boolean($verbose),
+ $expectedFailuresPath,
+ $mode)
+}
+
case "run-test-case"
return
{
=== modified file 'test/fots_driver/fots-driver.xq'
--- test/fots_driver/fots-driver.xq 2013-02-21 00:52:02 +0000
+++ test/fots_driver/fots-driver.xq 2013-02-22 11:15:28 +0000
@@ -93,15 +93,14 @@
(:~
: Returns the names of all qualifying test cases.
:
- : A test case qualifies if (a) it belongs to a qualifing test set, and (b)
+ : A test case qualifies if (a) it belongs to a qualifing test-set, and (b)
: its applicable dependencies include a user-provided dependency, or no
: dependency was provided by the user, and (c) its expected-result assertions
: include at least one of the assertions in a user-provided set of assertions,
: or no expected-result assertions were provided by the user.
:
- : A test set qualifies if its name starts with one of the prefixes listed in
- : $testSetPrefixes. If $testSetPrefixes is the empty sequence, then all test
- : sets qualify.
+ : A test-set qualifies if its name is specified in $testSetNames.
+ : If $testSetNames is the empty sequence, then all test-sets qualify.
:
: The filtering dependency is given as a string, which may be empty (signifying
: no dependency) or of the form "depValue_depSatisfied" (e.g., "XQ30+_true"),
@@ -116,7 +115,7 @@
: filtering set.
:
: @param $fotsPath path to the FOTS catalog file.
- : @param $testSetPrefixes name criteria for the test sets
+ : @param $testSetNames name criteria for the test sets
: (empty sequence means all test sets).
: @param $dependency dependency used to filter test-cases.
: (empty string means no filtering).
@@ -125,24 +124,24 @@
: @return names of qualifying FOTS test cases.
:)
declare %ann:nondeterministic function driver:list-test-cases(
- $fotsPath as xs:string,
- $testSetPrefixes as xs:string*,
- $dependency as xs:string,
- $assert as xs:string*
+ $fotsPath as xs:string,
+ $testSetNames as xs:string*,
+ $dependency as xs:string,
+ $assert as xs:string*
) as xs:string*
{
let $doc := doc(resolve-uri($fotsPath))
let $baseUri:= resolve-uri(util:parent-folder($fotsPath))
return
- if (empty($testSetPrefixes))
+ if (empty($testSetNames))
then
for $testSet in $doc/fots:catalog/fots:test-set
let $testSetDoc := doc(resolve-uri($testSet/@file, $baseUri))
return driver:list-test-cases($testSetDoc, $dependency, $assert)
else
- for $prefix in $testSetPrefixes
- for $testSet in $doc/fots:catalog/fots:test-set[starts-with(@name, $prefix)]
+ for $testSet in $doc/fots:catalog/fots:test-set
let $testSetDoc := doc(resolve-uri($testSet/@file, $baseUri))
+ where exists(index-of($testSet/@name, $testSetNames))
return driver:list-test-cases($testSetDoc, $dependency, $assert)
};
@@ -378,59 +377,212 @@
else
{
let $testCaseNames := driver:list-test-cases($fotsPath,
- $testSetPrefixes,
- $dependency,
- $assertions)
- return
- if (empty($testCaseNames)) then
- {
- exit returning <fots:test-cases/>;
- ()
- }
- else if (empty($testCasePrefixes)) then
- {
- $testCaseNames
- }
- else
- {
- for $name in $testCaseNames
- where some $prefix in $testCasePrefixes satisfies starts-with($name, $prefix)
- return $name
- }
- }
- }
-
- let $expectedFailures :=
- {
- if ($expectedFailuresPath eq '')
- then ()
- else doc($expectedFailuresPath)
- }
-
- return driver:run-fots($FOTSCatalog,
- resolve-uri(util:parent-folder($fotsPath)),
- $zorbaManifest,
- $testSetNames,
- $testCaseNames,
- $exceptedTestCases,
- $verbose,
- $expectedFailures,
- $cliMode)
- }
- catch *
- {
- error($err:code,
- concat("
Please make sure the passed 'fotsPath' points to the",
- " exact location of the FOTS catalog.xml:
",
- resolve-uri($fotsPath),
- "
 that the passed 'fotsZorbaManifestPath' points to",
- " a file in the same folder as cli.xq:
",
- resolve-uri($zorbaManifestPath),
- "
 that the passed 'expectedFailuresPath' points to",
- " the ExpectedFailures.xml file:
",
- $expectedFailuresPath))
- }
-};
+ $testSetNames,
+ $dependency,
+ $assertions)
+ return
+ if (empty($testCaseNames)) then
+ {
+ exit returning <fots:test-cases/>;
+ ()
+ }
+ else if (empty($testCasePrefixes)) then
+ {
+ $testCaseNames
+ }
+ else
+ {
+ for $name in $testCaseNames
+ where some $prefix in $testCasePrefixes satisfies starts-with($name, $prefix)
+ return $name
+ }
+ }
+ }
+
+ let $expectedFailures :=
+ {
+ if ($expectedFailuresPath eq '')
+ then ()
+ else doc($expectedFailuresPath)
+ }
+
+ return driver:run-fots($FOTSCatalog,
+ resolve-uri(util:parent-folder($fotsPath)),
+ $zorbaManifest,
+ $testSetNames,
+ $testCaseNames,
+ $exceptedTestCases,
+ $verbose,
+ $expectedFailures,
+ $cliMode)
+ }
+ catch *
+ {
+ error($err:code,
+ concat("
Please make sure the passed 'fotsPath' points to the",
+ " exact location of the FOTS catalog.xml:
",
+ resolve-uri($fotsPath),
+ "
 that the passed 'fotsZorbaManifestPath' points to",
+ " a file in the same folder as cli.xq:
",
+ resolve-uri($zorbaManifestPath),
+ "
 that the passed 'expectedFailuresPath' points to",
+ " the ExpectedFailures.xml file:
",
+ $expectedFailuresPath))
+ }
+};
+
+(:~
+ : This function is just a thin wrapper over the driver:run() function. See
+ : driver:run() for more info.
+ :
+ : Process a specified test set and report the outcome for each containing
+ : test case.
+ :
+ : Processing a test-case results in one of the following outcomes:
+ : 1. Pass: the query was evaluated and its result matched the expected result.
+ : 2. Fail: the query was evaluated and its result did not match the expected
+ : result.
+ : 3. Non-applicable: the query was not evaluated because at least one of its
+ : applicable dependencies was violated.
+ : 4. Not-run: the query was not evaluated because the name of the test-case
+ : appears in the $exceptedTestCases parameter.
+ :
+ : The subset of test-cases to process is specified via the $exceptedTestSets,
+ : $testSetName, $exceptedTestCases, $testCaseName, $dependency,
+ : and $assertions parameters.
+ : A test-case will be processed only if it satisfies all of the following
+ : conditions:
+ : (a) it belongs to a test-set whose name is not among the ones listed in the
+ : $exceptedTestSets parameter,
+ : (b) the test-case belongs to a test-set whose name is $testSetName,
+ : (c) the name of the test-case is $testCaseName.
+ : (d) $dependency is equal to the empty string or the dependencies applicable
+ : to the test-case include a user-provided dependency.
+ : (e) $assertions is empty or the expected-result assertions of the test-case
+ : include at least one of the assertions in $assertions.
+ :
+ : @param $fotsPath path to the FOTS catalog file.
+ : @param $zorbaManifestPath the path to the file that describes optional
+ : features and implementation-defined items in Zorba.
+ : @param $testSetName exact name of the test-set.
+ : @param $exceptedTestSets names of test sets that should NOT be precessed.
+ : @param $testCasePrefixes prefixes to filter the test cases to process
+ : (empty seq means no filtering).
+ : @param $exceptedTestCases names of test cases that should NOT be run.
+ : @param $dependency dependency used to filter test-cases.
+ : (empty string means no filtering).
+ : @param $assertions set of expected-result assertions used to filter test-cases.
+ : (empty sequence means no filtering).
+ : @param $verbose if true, the resulting XML tree will contain more details
+ : about each processed test-case.
+ : @param $expectedFailures the root node of the ExpectedFailures.xml file.
+ : @param $cliMode the cli command.
+ : @return an XML tree containing info about all the processed tests-cases
+ :)
+declare %ann:sequential function driver:run-test-set(
+ $fotsPath as xs:string,
+ $zorbaManifestPath as xs:string,
+ $testSetName as xs:string*,
+ $exceptedTestSets as xs:string*,
+ $testCasePrefixes as xs:string*,
+ $exceptedTestCases as xs:string*,
+ $dependency as xs:string,
+ $assertions as xs:string*,
+ $verbose as xs:boolean,
+ $expectedFailuresPath as xs:string,
+ $cliMode as xs:string
+) as element(fots:test-cases)
+{
+ trace($fotsPath, "Path to FOTS catalog.xml was set to: ");
+ trace($zorbaManifestPath, "Path to FOTSZorbaManifest set to :");
+ trace($expectedFailuresPath, "Path to ExpectedFailures.xml set to:");
+
+ try
+ {
+ let $FOTSCatalog := doc(resolve-uri($fotsPath))
+
+ let $zorbaManifest := doc(resolve-uri($zorbaManifestPath))
+
+ let $testSetNames :=
+ if(empty($testSetName))
+ then
+ {
+ if(empty($exceptedTestSets))
+ then ()
+ else for $testSet in $FOTSCatalog//fots:test-set
+ where empty(index-of($testSet/@name, $exceptedTestSets))
+ return xs:string($testSet/@name)
+ }
+ else
+ {
+ if(empty($exceptedTestSets))
+ then $testSetName
+ else functx:value-except($testSetName, $exceptedTestSets)
+ }
+
+ let $testCaseNames :=
+ {
+ if (empty($testCasePrefixes) and $dependency eq '' and empty($assertions)) then
+ {
+ ()
+ }
+ else
+ {
+ let $testCaseNames := driver:list-test-cases($fotsPath,
+ $testSetNames,
+ $dependency,
+ $assertions)
+ return
+ if (empty($testCaseNames)) then
+ {
+ exit returning <fots:test-cases/>;
+ ()
+ }
+ else if (empty($testCasePrefixes)) then
+ {
+ $testCaseNames
+ }
+ else
+ {
+ for $name in $testCaseNames
+ where some $prefix in $testCasePrefixes satisfies starts-with($name, $prefix)
+ return $name
+ }
+ }
+ }
+
+ let $expectedFailures :=
+ {
+ if ($expectedFailuresPath eq '')
+ then ()
+ else doc($expectedFailuresPath)
+ }
+
+ return driver:run-fots($FOTSCatalog,
+ resolve-uri(util:parent-folder($fotsPath)),
+ $zorbaManifest,
+ $testSetNames,
+ $testCaseNames,
+ $exceptedTestCases,
+ $verbose,
+ $expectedFailures,
+ $cliMode)
+ }
+ catch *
+ {
+ error($err:code,
+ concat("
Please make sure the passed 'fotsPath' points to the",
+ " exact location of the FOTS catalog.xml:
",
+ resolve-uri($fotsPath),
+ "
 that the passed 'fotsZorbaManifestPath' points to",
+ " a file in the same folder as cli.xq:
",
+ resolve-uri($zorbaManifestPath),
+ "
 that the passed 'expectedFailuresPath' points to",
+ " the ExpectedFailures.xml file:
",
+ $expectedFailuresPath))
+ }
+};
+
(:~
Follow ups
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1131002 into lp:zorba
From: noreply, 2013-02-22
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1131002 into lp:zorba
From: Zorba Build Bot, 2013-02-22
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1131002 into lp:zorba
From: Zorba Build Bot, 2013-02-22
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1131002 into lp:zorba
From: Chris Hillery, 2013-02-22
-
Re: [Merge] lp:~zorba-coders/zorba/fix_bug_1131002 into lp:zorba
From: Chris Hillery, 2013-02-22
-
Re: [Merge] lp:~zorba-coders/zorba/fix_bug_1131002 into lp:zorba
From: Chris Hillery, 2013-02-22
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1131002 into lp:zorba
From: Zorba Build Bot, 2013-02-22
-
Re: [Merge] lp:~zorba-coders/zorba/fix_bug_1131002 into lp:zorba
From: Zorba Build Bot, 2013-02-22
-
Re: [Merge] lp:~zorba-coders/zorba/fix_bug_1131002 into lp:zorba
From: Sorin Marian Nasoi, 2013-02-22
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1131002 into lp:zorba
From: Zorba Build Bot, 2013-02-22
-
[Merge] lp:~zorba-coders/zorba/fix_bug_1131002 into lp:zorba
From: Sorin Marian Nasoi, 2013-02-22