zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #17511
[Merge] lp:~zorba-coders/zorba/fots_driver into lp:zorba
Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/fots_driver into lp:zorba.
Commit message:
More comments, cosmetic changes, and minor performance improvements in FOTS test driver.
Requested reviews:
Markos Zaharioudakis (markos-za)
For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fots_driver/+merge/145128
More comments, cosmetic changes, and minor performance improvements in FOTS test driver.
--
https://code.launchpad.net/~zorba-coders/zorba/fots_driver/+merge/145128
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'modules/xqxq/xqxq.xq.src/xqxq.cpp'
--- modules/xqxq/xqxq.xq.src/xqxq.cpp 2013-01-08 08:34:08 +0000
+++ modules/xqxq/xqxq.xq.src/xqxq.cpp 2013-01-28 08:42:25 +0000
@@ -489,8 +489,8 @@
lQuery = NULL;
std::ostringstream err;
err << "The query compiled using xqxq:prepare-main-module raised an error at"
- << " line " << xe.source_line() << " column " << xe.source_column()
- << ": " << xe.what();
+ << " file " << xe.source_uri() << " line " << xe.source_line() << " column " << xe.source_column()
+ << ": " << xe.what(); // << " -- Query string : " << std::endl << lQueryString;
Item errQName = XQXQModule::getItemFactory()->createQName(
xe.diagnostic().qname().ns(),
=== modified file 'test/fots_driver/cli.xq'
--- test/fots_driver/cli.xq 2013-01-24 07:06:35 +0000
+++ test/fots_driver/cli.xq 2013-01-28 08:42:25 +0000
@@ -27,108 +27,67 @@
(:~
- Path to the FOTS catalog.xml file. If the path is relative, it will be
- resolved relative to the directory containing this cli.xq file.
-:)
+ : Path to the FOTS catalog.xml file. If the path is relative, it will be
+ : resolved relative to the directory containing this cli.xq file.
+ :)
declare variable $fotsPath as xs:string external := "";
(:~
- Path to the FOTSZorbaManifest.xml file. If the path is relative, it will be
- resolved relative to the diractory containing this cli.xq file
-:)
+ : Path to the FOTSZorbaManifest.xml file. If the path is relative, it will be
+ : resolved relative to the diractory containing this cli.xq file
+ :)
declare variable $fotsZorbaManifestPath as xs:string external :=
"FOTSZorbaManifest.xml";
(:~
- Path to the results from a previous run. Used when we just want to generate
- a report based on some previous run, i.e., without running the tests again.
-:)
-declare variable $failuresFilePath as xs:string external := "";
+ : Path to the results XML file generated by a previous run. Used when we just
+ : want to generate a report based on some previous run, i.e., without running
+ : the tests again.
+ :)
+declare variable $resultsFilePath as xs:string external := "";
(:~
- Path to the ExpectedFailures file.
-:)
-declare variable $expectedFailuresPath as xs:string external :="";
+ : Path to the ExpectedFailures file.
+ :)
+declare variable $expectedFailuresPath as xs:string external :="";
(:~
- The CLI command you want to run.
-:)
+ : The CLI command you want to run.
+ :)
declare variable $mode as xs:string external := "";
(:~
- A list of comma-seperated prefixes. Only test-sets whose name starts with
- a prefix in this list are going to be proccesed. An empty string means no
- filtering of test-sets.
-:)
+ : A list of comma-seperated prefixes that acts as a filter for the test-sets
+ : to be processed: a test-set is going to be proccesed only if its name starts
+ : with a prefix in this list. An empty string means no filtering.
+ :
+ : Used by the list-test-sets, list-test-cases, and run-test-sets commands.
+ :)
declare variable $testSetPrefixes as xs:string external := "";
(:~
- A list of comma-seperated prefixes. Only test-cases whose name starts with
- a prefix in this list are going to be proccesed. An empty string means no
- filtering of test-cases.
-:)
+ : A list of comma-seperated prefixes that acts as a filter for the test-cases
+ : to be processed: a test-case is going to be proccesed only if its name starts
+ : with a prefix in this list. An empty string means no filtering.
+ :
+ : Used by the list-test-cases, and run-test-sets commands.
+ :)
declare variable $testCasePrefixes as xs:string external := "";
(:~
- : Name of the test-set containing a test-case to process. Used only for the
- : "run-test-case" command.
-:)
-declare variable $testSetName as xs:string external := "";
-
-
-(:~
- : Name of the test-case to process. Used only for the "run-test-case" command.
-:)
-declare variable $testCaseName as xs:string external := "";
-
-
-(:~
- A dependency used in the 'list-test-cases' and 'run-test-sets' commands to
- filter the test-cases that will actually be listed/run. Only test-cases whose
- applicable dependencies contain at least one dependency the matches this
- user-specified dependency will be processed. The filtering dependency is
- given as a string of the form "depValue_depSatisfied" (for example,
- "XQ30+_true"), or just "depValue" (in which case "true" is assumed as the
- value of the satisfied attribute). If $dependency is set to the empty string,
- no filtering is done.
-:)
-declare variable $dependency as xs:string external := "";
-
-
-(:~
- List of assertion types used in the 'list-test-cases' and 'run-test-sets'
- commands to filter the test-cases that will actually be listed/run. A test
- case qualifies if there is at least one element node under the <result>
- node of the <test-case> whose local name is equal to one of the strings
- in the filtering set. If $assrtType is set to the empty sequence, no
- filtering is done.
-:)
-declare variable $assertType as xs:string* external := ();
-
-
-(:~
- Regex to be used by the 'list-matching-test-cases' command.
-:)
-declare variable $pattern as xs:string external := "";
-
-
-(:~
- Flags to be used by the 'list-matching-test-cases' command.
-:)
-declare variable $flags as xs:string external := "";
-
-
-(:~
- The test cases in this list have bugs assigned and should not be run.
-:)
-declare variable $exceptedTestCases := (
+ : The test cases in this list should not have their queries evaluated at all
+ : (because they segfault, or hang, or take too long, etc).
+ :
+ : Used by the run-test-sets, run-and-report, and report commands.
+ :)
+declare variable $exceptedTestCases as xs:string* := (
"cbcl-subsequence-011",
"cbcl-subsequence-012",
"cbcl-subsequence-013",
@@ -141,15 +100,70 @@
(:~
- The test in this list have bugs assigned already and should not be run
-:)
-declare variable $exceptedTestSets := ();
-
-
-(:~
- Enable or disable verbose output. When this is set to true the exact query
- that is run by XQXQ is also written down into a query_*.xq file.
-:)
+ : The test sets in this list should not be not be processed at all.
+ :
+ : Used by the run-test-sets, run-and-report, and report commands.
+ :)
+declare variable $exceptedTestSets as xs:string* := ();
+
+
+(:~
+ : Name of the test-set containing a test-case to process. Used only for the
+ : "run-test-case" command.
+ :)
+declare variable $testSetName as xs:string external := "";
+
+
+(:~
+ : Name of the test-case to process. Used only for the "run-test-case" command.
+ :)
+declare variable $testCaseName as xs:string external := "";
+
+
+(:~
+ : A dependency used in the 'list-test-cases' and 'run-test-sets' commands to
+ : filter the test-cases that will actually be listed/run. Only test-cases whose
+ : applicable dependencies contain at least one dependency the matches this
+ : user-specified dependency will be listed/run. The filtering dependency is
+ : given as a string of the form "depValue_depSatisfied" (for example,
+ : "XQ30+_true"), or just "depValue" (in which case "true" is assumed as the
+ : value of the satisfied attribute). If $dependency is set to the empty string,
+ : no filtering is done.
+ :
+ : Used in the list-test-cases and run-test-sets commands.
+ :)
+declare variable $dependency as xs:string external := "";
+
+
+(:~
+ : List of assertion types used in the 'list-test-cases' and 'run-test-sets'
+ : commands to filter the test-cases that will actually be listed/run. A test
+ : case qualifies if there is at least one element node under the <result>
+ : node of the <test-case> whose local name is equal to one of the strings
+ : in the filtering set. If $assrtType is set to the empty sequence, no
+ : filtering is done.
+ :
+ : Used in the list-test-cases and run-test-sets commands.
+ :)
+declare variable $assertions as xs:string* external := ();
+
+
+(:~
+ : Regex to be used by the 'list-matching-test-cases' command.
+ :)
+declare variable $pattern as xs:string external := "";
+
+
+(:~
+ : Flags to be used by the 'list-matching-test-cases' command.
+ :)
+declare variable $flags as xs:string external := "";
+
+
+(:~
+ : Enable or disable verbose output. When this is set to true the exact query
+ : that is run by XQXQ is also written down into a query_*.xq file.
+ :)
declare variable $verbose as xs:string external := "false";
@@ -175,32 +189,31 @@
"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-test-cases -e dependency:=higherOrderFunctions -e assertType:=assert-count",
+ "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:=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 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-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-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 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",
- "zorba -f -q /path/to/cli.xq -e mode:=generate-expected-failures -e failuresFilePath:=failures.xml -o ExpectedFailures.xml --indent",
+ "zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=report -e resultsFilePath:=failures.xml -e verbose:=false -o report.xml --indent",
+ "zorba -f -q /path/to/cli.xq -e mode:=generate-expected-failures -e resultsFilePath:=failures.xml -o ExpectedFailures.xml --indent",
""
), "
")
};
(:~
- Tokenize a string that contains a comma-separated list of tokens.
- Note: if the input string is empty, the function returns the empty string.
-:)
+ : Tokenize a string that contains a comma-separated list of tokens.
+ : Note: if the input string is empty, the function returns the empty sequence.
+ :)
declare %private function local:tokenize(
$input as xs:string
) as xs:string*
{
- let $tokens := tokenize($input, ",")
- return if (exists($tokens)) then $tokens else ""
+ tokenize($input, ",")
};
@@ -215,89 +228,116 @@
case "list-test-sets"
return
+{
+ trace($fotsPath, $fotsPathMsg);
+ trace($testSetPrefixes, $testSetPrefixesMsg);
+
string-join
(
(
- d:list-test-sets(trace($fotsPath, $fotsPathMsg),
- local:tokenize(trace($testSetPrefixes, $testSetPrefixesMsg)))
+ d:list-test-sets($fotsPath, local:tokenize($testSetPrefixes))
),
"
"
)
+}
case "list-test-cases"
return
+{
+ trace($fotsPath, $fotsPathMsg);
+ trace($testSetPrefixes, $testSetPrefixesMsg);
+ trace($dependency, "'dependency' set to:");
+ trace($assertions, "'assertions' set to: ");
+
string-join
(
(
- d:list-test-cases(trace($fotsPath, $fotsPathMsg),
- local:tokenize(trace($testSetPrefixes, $testSetPrefixesMsg)),
- trace($dependency, "'dependency' set to:"),
- trace($assertType, "'assertType' set to: "))
+ d:list-test-cases($fotsPath,
+ local:tokenize($testSetPrefixes),
+ $dependency,
+ $assertions)
),
"
"
)
+}
case "list-matching-test-cases"
return
+{
+ trace($fotsPath, $fotsPathMsg);
+ trace($pattern, "pattern set to: ");
+ trace($flags, "flags were set to: ");
+
string-join
(
(
- d:list-matching-test-cases(trace($fotsPath, $fotsPathMsg),
- trace($pattern, "pattern set to: "),
- trace($flags, "flags were set to: ")), ""
+ d:list-matching-test-cases($fotsPath, $pattern, $flags), ""
),
"
"
)
+}
case "run-test-sets"
-return
+return
+{
+ trace($testSetPrefixes, $testSetPrefixesMsg);
+ trace($testCasePrefixes, $testCasePrefixesMsg);
+ trace($dependency, "'dependency' set to:");
+ trace($assertions, "'assertions' set to: ");
+
d:run-fots($fotsPath,
$fotsZorbaManifestPath,
- d:list-test-sets($fotsPath,
- local:tokenize(trace($testSetPrefixes,
- $testSetPrefixesMsg))),
- d:list-test-cases($fotsPath,
- local:tokenize($testSetPrefixes),
- local:tokenize(trace($testCasePrefixes,
- $testCasePrefixesMsg)),
- trace($dependency, "'dependency' set to:"),
- trace($assertType, "'assertType' set to: ")),
+ local:tokenize($testSetPrefixes),
+ $exceptedTestSets,
+ local:tokenize($testCasePrefixes),
$exceptedTestCases,
- $exceptedTestSets,
+ $dependency,
+ $assertions,
xs:boolean($verbose),
$expectedFailuresPath)
+}
case "run-test-case"
-return
+return
+{
d:run-fots($fotsPath,
$fotsZorbaManifestPath,
trace($testSetName, "'testSetName' set to: "),
trace($testCaseName,"'testCaseName' set to: "),
$exceptedTestCases,
$exceptedTestSets,
+ "",
+ (),
xs:boolean($verbose),
$expectedFailuresPath)
+}
case "run-and-report"
-return
+return
+{
r:run-and-report($fotsPath,
$fotsZorbaManifestPath,
$exceptedTestCases,
$exceptedTestSets,
(: the reports to W3C are always generated with verbose set to false:)
fn:false())
+}
case "report"
return
+{
r:report($fotsPath,
- $failuresFilePath,
+ $resultsFilePath,
$exceptedTestCases,
$exceptedTestSets,
xs:boolean($verbose))
+}
case "generate-expected-failures"
return
- r:generate-expected-failures($failuresFilePath)
+{
+ r:generate-expected-failures($resultsFilePath)
+}
default
return
=== modified file 'test/fots_driver/environment.xq'
--- test/fots_driver/environment.xq 2012-12-11 22:48:47 +0000
+++ test/fots_driver/environment.xq 2013-01-28 08:42:25 +0000
@@ -506,57 +506,41 @@
(:~
- : Checks the dependencies according to the Zorba manifest.
+ : Checks that a set of dependencies (associated with some test-set or test-case)
+ : are met by Zorba's capabilities and implementation-defined features (as
+ : specified in the Zorba manifest).
:
- : @param $deps the dependencies of the test set and test case
+ : @param $deps the dependencies of the test set or test case
: @param $zorbaManifest Zorba manifest document.
- : @return if true empty string, otherwise returns a string with the
- : dependencies that were not matched.
+ : @return a sequence of strings containing one string for each dependency
+ : that was not met, describing the dependency. If all dependencies
+ : are met, the empty sequence is returned.
:)
declare function env:check-dependencies(
$deps as element(fots:dependency)*,
- $zorbaManifest
+ $zorbaManifest as node()
) as xs:string*
{
- if(empty($deps))
- then ()
+ if (empty($deps)) then
+ {
+ ()
+ }
else
+ {
for $dep in $deps
- let $satisfied := if(exists($dep/@satisfied))
+
+ let $satisfied := if ($dep/@satisfied)
then data($dep/@satisfied)
else "true"
- let $zorbaDep := $zorbaManifest//fots:dependency[ @type = $dep/@type and
- @value = $dep/@value and
- @satisfied = $satisfied]
+
+ let $zorbaDep := $zorbaManifest//fots:dependency[@type eq $dep/@type and
+ @value eq $dep/@value and
+ @satisfied eq $satisfied]
return
- if(empty($zorbaDep))
- then concat("Dependency (type=",
- $dep/@type,
- ", value=",
- $dep/@value,
- ", satisfied=",
- $satisfied,
- ") was not met. ")
+ if (empty($zorbaDep))
+ then
+ concat("Dependency (type=", $dep/@type, ", value=", $dep/@value,
+ ", satisfied=", $satisfied, ") was not met. ")
else ()
-};
-
-
-(:~
- : Retrieves the environment from a test-set/catalog given an environment name.
- : @param $catalog FOTS catalog file.
- : @param $testSet test set.
- : @param $envName name of the environment.
- : @return the environment with the given name.
- :)
-declare function env:get-environment (
- $catalog,
- $testSet as element (fots:test-set),
- $envName as xs:string
-) as element(fots:environment)?
-{
- let $envTestSet := $testSet/test-set//environment[@name = $envName]
- return
- if (empty($envTestSet))
- then $catalog/catalog//environment[@name = $envName]
- else $envTestSet
+ }
};
=== modified file 'test/fots_driver/feedback.xq'
--- test/fots_driver/feedback.xq 2012-12-21 13:28:10 +0000
+++ test/fots_driver/feedback.xq 2013-01-28 08:42:25 +0000
@@ -36,7 +36,8 @@
$testCaseName as xs:string?,
$testSetName as xs:string?,
$expectedFailure as element(Test)?
-) as xs:boolean {
+) as xs:boolean
+{
(: if the exact error code was not found, report the test as 'Pass'
with an attribute correctError=false :)
let $resultTestRun as xs:boolean :=
@@ -56,6 +57,7 @@
return ($resultTestRun eq not($expectedFailure))
};
+
declare %ann:sequential function feedback:pass(
$case as element(fots:test-case),
$result as item()*,
@@ -64,7 +66,8 @@
$duration as xs:dayTimeDuration,
$verbose as xs:boolean,
$expectedFailure as xs:boolean
-) as element(fots:test-case)? {
+) as element(fots:test-case)?
+{
if ($expectedFailure)
then feedback:pass-expected-FOTS-failure( $case,
$result,
@@ -79,6 +82,7 @@
$verbose)
};
+
(:~
: Feedback on a test case that failed but is marked as EXPECTED_FOTS_FAILURE.
:
@@ -91,7 +95,8 @@
$zorbaQuery as xs:string,
$env as element(fots:environment)?,
$verbose as xs:boolean
-) as element(fots:test-case)? {
+) as element(fots:test-case)?
+{
variable $info := "Test case failed but it is marked with EXPECTED_FOTS_FAILURE in test/fots/CMakeLists.txt";
if($verbose)
@@ -127,6 +132,8 @@
result="pass"
comment="{$info}" />
};
+
+
(:~
: Gives feedback on a test case run with success.
:
@@ -140,7 +147,8 @@
$env as element(fots:environment)?,
$duration as xs:dayTimeDuration,
$verbose as xs:boolean
-) as element(fots:test-case)? {
+) as element(fots:test-case)?
+{
if($verbose)
then {
let $tmp := $case
@@ -190,6 +198,7 @@
executionTime="{$duration}" />
};
+
(:~
: Gives feedback on a test case run without success.
:
@@ -205,7 +214,8 @@
$duration as xs:dayTimeDuration,
$verbose as xs:boolean,
$expectedFailure as xs:boolean
-) as element(fots:test-case)? {
+) as element(fots:test-case)?
+{
trace($testSetName, "test set name");
trace("above test case failed", "result");
@@ -254,8 +264,10 @@
executionTime="{$duration}"/>
};
+
(:~
- : Gives feedback on a test case that is not run (because it Seg Faults, hangs).
+ : Gives feedback on a test case that is not run (because its name is listed
+ : in the $exceptedTestCases global var).
:
: @param $case test case.
: @return the test case.
@@ -263,29 +275,29 @@
declare %ann:sequential function feedback:not-run(
$case as element(fots:test-case),
$verbose as xs:boolean
-) as element(fots:test-case)? {
+) as element(fots:test-case)?
+{
trace(data($case/@name), "processing test case :");
trace("Above test case was not run.","");
- if($verbose)
- then {
- let $tmp := $case
- return {
- insert node
- attribute result{'notRun'}
- as last into $tmp;
-
- delete node $tmp/fots:description;
- delete node $tmp/fots:created;
-
- $tmp
- }
+ if ($verbose)
+ then
+ {
+ {
+ (insert node attribute result {'notRun'} as last into $case,
+ delete node $case/fots:description,
+ delete node $case/fots:created);
+
+ $case
+ }
}
else
- <fots:test-case name="{data($case/@name)}"
- result="notRun" />
+ {
+ <fots:test-case name="{$case/@name}" result="notRun" />
+ }
};
+
(:~
: Gives feedback on a test case that is not run when dependencies are not met.
:
=== modified file 'test/fots_driver/fots-driver.xq'
--- test/fots_driver/fots-driver.xq 2013-01-24 07:06:35 +0000
+++ test/fots_driver/fots-driver.xq 2013-01-28 08:42:25 +0000
@@ -102,9 +102,9 @@
: 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"),
: or just "depValue" (in which case "true" is assumed as the value of the
- : satisfied attribute). A test-case qualifies if it has at least one dependency
- : whose @value and @satisfied attributes are equal to the filtering depValue
- : and depSatisfied.
+ : satisfied attribute). A test-case qualifies only if it has at least one
+ : dependency whose @value and @satisfied attributes are equal to the filtering
+ : depValue and depSatisfied.
:
: A filtering set of assertions is given as a sequence of strings. A test-case
: qualifies if there is at least one element node under the <result> node of
@@ -144,57 +144,12 @@
(:~
- : Returns the names of all qualifying test cases.
- :
- : This function is similar to the driver:list-test-cases() defined above. It
- : just adds the following condition to the list of conditions that must be
- : satisfied by each qualifying test case: (d) its name starts with one of the
- : prefixes in $testCasePrefixes.
- :
- : @param $fotsPath path to the FOTS catalog file.
- : @param $testSetPrefixes name criteria for the test sets
- : (empty sequence means all test sets).
- : @param $testCasePrefixes name criteria for the test cases
- : @param $dependency dependency used to filter test-cases.
- : (empty string means no filtering).
- : @param $assert set of expected-result assertions used to filter test-cases.
- : (empty sequence means no filtering).
- : @return names of qualifying FOTS test cases.
- :)
-declare %ann:nondeterministic function driver:list-test-cases(
- $fotsPath as xs:string,
- $testSetPrefixes as xs:string*,
- $testCasePrefixes as xs:string*,
- $dependency as xs:string ,
- $assert as xs:string*
-) as xs:string*
-{
- if (empty($testCasePrefixes))
- then
- ()
- else
- let $doc := doc(resolve-uri($fotsPath))
- let $baseUri:= resolve-uri(util:parent-folder($fotsPath))
- let $testCaseNames := driver:list-test-cases($fotsPath,
- $testSetPrefixes,
- $dependency,
- $assert)
- return
- for $prefix in $testCasePrefixes
- return
- for $name in $testCaseNames
- where starts-with($name, $prefix)
- return $name
-};
-
-
-(:~
: Helper function. Returns the names of all qualifying test cases within a
: given test set. A test case qualifies if (a) its applicable dependencies
: include a user-provided dependency, or no dependency was provided by the
: user, and (b) 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 b the user.
+ : assertions were provided by the user.
:
: @param $testSetDoc root node of the xml document the specifies the test set.
: @param $dependency dependency used to filter test-cases.
@@ -279,8 +234,8 @@
(:~
- : For each qualifying test case, this functions returns its name and the full
- : filepath of its associated test-set file.
+ : For each qualifying test case, this functions returns a string containing
+ : the test-case name and the full filepath of its associated test-set file.
:
: A test case qualifies if its <test> node (which contains the query text)
: matches the given pattern using the given flags.
@@ -304,9 +259,7 @@
let $uri := resolve-uri($testSet/@file, $baseUri)
let $testSetDoc := doc($uri)
for $testCase in $testSetDoc//fots:test-case
- where matches(util:get-value($testCase,
- util:parent-folder($uri),
- "test"),
+ where matches(util:get-value($testCase, util:parent-folder($uri), "test"),
$pattern,
$flags)
return
@@ -320,66 +273,152 @@
: This function is just a thin wrapper over the driver:run() function. See
: driver:run() for more info.
:
- : @param $FOTSCatalogFilePath path to the FOTS catalog file.
- : @param $FOTSZorbaManifestPath the path to the file that describes optional
+ : Process a specified subset of all test-cases and report the outcome for
+ : each such 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,
+ : $testSetPrefixes, $testCasePrefixes, $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) $testSetPrefixes is the empty sequence, or the test-case belongs to a
+ : test-set whose name starts with a prefix listed in $testSetPrefixes,
+ : (c) $testCasePrefixes is the empty sequence, or the name of the test-case
+ : starts with a prefix listed in $testCaseNames.
+ : (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 $testSetNames names of the test sets to run (empty seq means all)
- : @param $testCaseNames names of the test sets to run (empty seq means all)
- : @param $exceptedTestCases names of test cases that should be excepted from
- : running
- : @param $exceptedTestSets names of test sets that should be excepted from
- : running
- : @param $verbose if set to TRUE it will also output the actual failures.
- : @param $expectedFailuresPath path to the ExpectedFailures.xml file.
- : @return an element containing all failed tests
+ : @param $testSetPrefixes prefixes to filter the test sets to process
+ : (empty seq means no filtering).
+ : @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.
+ : @return an XML tree containing info about all the processed tests-cases
:)
declare %ann:sequential function driver:run-fots(
- $FOTSCatalogFilePath as xs:string,
- $FOTSZorbaManifestPath as xs:string,
- $testSetNames as xs:string*,
- $testCaseNames as xs:string*,
+ $fotsPath as xs:string,
+ $zorbaManifestPath as xs:string,
+ $testSetPrefixes as xs:string*,
+ $exceptedTestSets as xs:string*,
+ $testCasePrefixes as xs:string*,
$exceptedTestCases as xs:string*,
- $exceptedTestSets as xs:string*,
+ $dependency as xs:string,
+ $assertions as xs:string*,
$verbose as xs:boolean,
$expectedFailuresPath as xs:string
) as element(fots:test-cases)
{
- variable $fotsPathMsg := "The path to FOTS catalog.xml was set to: ";
- variable $zorbaManifestMsg := "Path to FOTSZorbaManifest set to :";
- variable $expectedFailuresPathMsg := "Path to ExpectedFailures.xml set to:";
+ trace($fotsPath, "The path to FOTS catalog.xml was set to: ");
+ trace($zorbaManifestPath, "The path to FOTSZorbaManifest set to :");
+ trace($expectedFailuresPath, "the path to ExpectedFailures.xml set to:");
try
{
- let $FOTSCatalog :=
- doc(trace(resolve-uri($FOTSCatalogFilePath), $fotsPathMsg))
-
- let $FOTSZorbaManifest :=
- doc(trace(resolve-uri($FOTSZorbaManifestPath), $zorbaManifestMsg))
+ let $FOTSCatalog := doc(resolve-uri($fotsPath))
+
+ let $zorbaManifest := doc(resolve-uri($zorbaManifestPath))
+
+ let $testSetNames :=
+ {
+ if (empty($testSetPrefixes) and empty($exceptedTestSets)) then
+ {
+ ()
+ }
+ else
+ {
+ let $testSetNames := driver:list-test-sets($fotsPath, $testSetPrefixes)
+ return
+ if (empty($testSetNames)) then
+ {
+ exit returning <fots:test-cases/>;
+ ()
+ }
+ else
+ {
+ functx:value-except($testSetNames, $exceptedTestSets)
+ }
+ }
+ }
+
+ let $testCaseNames :=
+ {
+ if (empty($testCasePrefixes) and $dependency eq '' and empty($assertions)) then
+ {
+ ()
+ }
+ 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(trace($expectedFailuresPath, $expectedFailuresPathMsg))
+ else doc($expectedFailuresPath)
+ }
- return driver:run($FOTSCatalog,
- resolve-uri(util:parent-folder($FOTSCatalogFilePath)),
- $FOTSZorbaManifest,
- $testSetNames,
- $testCaseNames,
- $exceptedTestCases,
- $exceptedTestSets,
- trace($verbose, "'Verbose' parameter set to: "),
- $expectedFailures)
+ return driver:run-fots($FOTSCatalog,
+ resolve-uri(util:parent-folder($fotsPath)),
+ $zorbaManifest,
+ $testSetNames,
+ $testCaseNames,
+ $exceptedTestCases,
+ $verbose,
+ $expectedFailures)
}
catch *
{
error($err:code,
concat("
Please make sure the passed 'fotsPath' points to the",
" exact location of the FOTS catalog.xml:
",
- resolve-uri($FOTSCatalogFilePath),
+ resolve-uri($fotsPath),
"
 that the passed 'fotsZorbaManifestPath' points to",
" a file in the same folder as cli.xq:
",
- resolve-uri($FOTSZorbaManifestPath),
+ resolve-uri($zorbaManifestPath),
"
 that the passed 'expectedFailuresPath' points to",
" the ExpectedFailures.xml file:
",
$expectedFailuresPath))
@@ -388,27 +427,25 @@
(:~
- : Process a specified subset of all test-cases. The subsetting is done in 2
- : orthogonal ways:
- :
- : (a) Explicit enumeration of qualifying test-sets and test-cases.
- : The params $testSetNames and $testCaseNames contain the names of test-sets
- : and test-cases to process. A test-case will be processed only if it
- : belongs to a test-set whose name is in $testSetNames, and the name of
- : the test-case itself appears in $testCaseNames. If $testSetNames and/or
- : $testCaseNames is the empty sequence, then no filtering is done based
- : on these params.
- :
- : (b) Explicit enumeration of disqualifying test-sets and test-cases.
- : The params $exceptedTestSets and $exceptedTestCases contain the names
- : of test-sets and test-cases that should not be processed. If a test-case
- : belongs to a test-set whose name appears in $exceptedTestSets, or the
- : name of the test-case itself appears in $exceptedTestCases, then the
- : test-case will NOT be processed.
- :
- : "processing" a test-case means either evaluating the corresponding query
- : and reporting whether it result matches the expected result, or reporting
- : the test-case as "non-applicable" because it violates some dependency.
+ : A helper functrion to process a specified subset of all test-cases and
+ : report the outcome for each such 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 $testSetNames
+ : and $testCaseNames parameters. A test-case will be processed only if it
+ : satisfies all of the following conditions:
+ : (a) $testSetNames is the empty sequence, or the test-case belongs to a
+ : test-set whose name is listed in $testSetNames,
+ : (b) $testCaseNames is the empty sequence, or the name of the test-case
+ : appears in $testCaseNames.
:
: @param $FOTSCatalog the root node of the FOTS catalog doc.
: @param $catalogBaseURI the URI of the directory containing the catalog.xml file
@@ -416,50 +453,39 @@
: features and implementation-defined items in Zorba.
: @param $testSetNames names of the test sets to run (empty seq means all)
: @param $testCaseNames names of the test sets to run (empty seq means all)
- : @param $exceptedTestCases names of test cases that should be excepted from
- : running
- : @param $exceptedTestSets names of test sets that should be excepted from
- : running
- : @param $verbose if set to TRUE it will also output the actual failures.
+ : @param $exceptedTestCases names of test cases that should NOT be run
+ : @param $exceptedTestSets names of test sets that should NOT be run
+ : @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.
- : @return an element containing all failed tests
+ : @return an XML tree containing info about all the processed tests-cases
:)
-declare %ann:sequential function driver:run(
+declare %private %ann:sequential function driver:run-fots(
$FOTSCatalog as document-node(),
$catalogBaseURI as xs:anyURI,
$FOTSZorbaManifest as document-node(),
$testSetNames as xs:string*,
$testCaseNames as xs:string*,
$exceptedTestCases as xs:string*,
- $exceptedTestSets as xs:string*,
$verbose as xs:boolean,
$expectedFailures as document-node()?
) as element(fots:test-cases)
{
<fots:test-cases>
{
- let $catalogTestSetNames := $FOTSCatalog//fots:test-set/@name
-
- let $testSetNames :=
- {
- if (empty($testSetNames))
- then
- functx:value-except($catalogTestSetNames, $exceptedTestSets)
- else
- functx:value-except(functx:value-intersect($testSetNames,
- $catalogTestSetNames),
- $exceptedTestSets)
- }
-
- for $testSetName in $testSetNames
-
- let $testSet := $FOTSCatalog//fots:test-set[@name=$testSetName]
+ let $testSets := if (empty($testSetNames))
+ then $FOTSCatalog//fots:test-set
+ else $FOTSCatalog//fots:test-set[@name = $testSetNames]
+
+ for $testSet in $testSets
+
+ let $testSetName := $testSet/@name
let $testSetURI := resolve-uri($testSet/@file, $catalogBaseURI)
let $testSetDoc := doc($testSetURI)
- let $depMet as xs:string*:=
+ let $depMet :=
env:check-dependencies($testSetDoc/fots:test-set/fots:dependency,
$FOTSZorbaManifest)
@@ -472,9 +498,9 @@
let $envName := data($testCase/fots:environment/@ref)
- let $envTestSet := $testSetDoc/fots:test-set/fots:environment[@name = $envName]
+ let $envTestSet := $testSetDoc/fots:test-set/fots:environment[@name eq $envName]
- let $envCatalog := $FOTSCatalog/fots:catalog/fots:environment[@name = $envName]
+ let $envCatalog := $FOTSCatalog/fots:catalog/fots:environment[@name eq $envName]
let $isExcepted := $exceptedTestCases[. eq $testCase/@name]
@@ -482,11 +508,13 @@
return
if ($isExcepted)
- then feedback:not-run($testCase, $verbose)
- else feedback:not-applicable($testCase,
- $envTestSet,
- string-join($depMet,''),
- $verbose)
+ then
+ feedback:not-run($testCase, $verbose)
+ else
+ feedback:not-applicable($testCase,
+ $envTestSet,
+ string-join($depMet,''),
+ $verbose)
}
</fots:test-set>
}
@@ -498,15 +526,19 @@
let $envName := data($testCase/fots:environment/@ref)
- let $envTestSet := $testSetDoc/fots:test-set/fots:environment[@name = $envName]
+ let $envTestSet := $testSetDoc/fots:test-set/fots:environment[@name eq $envName]
- let $envCatalog := $FOTSCatalog/fots:catalog/fots:environment[@name = $envName]
+ let $envCatalog := $FOTSCatalog/fots:catalog/fots:environment[@name eq $envName]
let $isExcepted := $exceptedTestCases[. eq $testCase/@name]
+ let $depMet := env:check-dependencies($testCase/fots:dependency,
+ $FOTSZorbaManifest)
+
where empty($testCaseNames) or $testCaseNames[. eq $testCase/@name]
return
+ {
if ($isExcepted) then
{
if (exists($expectedFailures) and
@@ -523,35 +555,38 @@
else
feedback:not-run($testCase, $verbose)
}
- else if (exists(env:check-dependencies($testCase/fots:dependency,
- $FOTSZorbaManifest)))
- then feedback:not-applicable($testCase,
- $envTestSet,
- string-join(distinct-values(env:check-dependencies($testCase/fots:dependency,
- $FOTSZorbaManifest)),
- ''),
- $verbose)
- else if (empty($envTestSet))
- then driver:test( $FOTSZorbaManifest,
- $testCase,
- $envCatalog,
- $catalogBaseURI,
- ($testCase/fots:dependency,
- $testSetDoc/fots:test-set/fots:dependency),
- $testSetName,
- $testSetURI,
- $verbose,
- $expectedFailures/failures/TestSet[@name=$testSetName]/Test[@name=xs:string($testCase/@name)])
- else driver:test( $FOTSZorbaManifest,
- $testCase,
- $envTestSet,
- $testSetURI,
- ($testCase/fots:dependency,
- $testSetDoc/fots:test-set/fots:dependency),
- $testSetName,
- $testSetURI,
- $verbose,
- $expectedFailures/failures/TestSet[@name=$testSetName]/Test[@name=xs:string($testCase/@name)])
+ else if (exists($depMet)) then
+ {
+ feedback:not-applicable($testCase,
+ $envTestSet,
+ string-join($depMet, ''),
+ $verbose)
+ }
+ else if (empty($envTestSet)) then
+ {
+ driver:test($testCase,
+ $envCatalog,
+ $catalogBaseURI,
+ ($testCase/fots:dependency,
+ $testSetDoc/fots:test-set/fots:dependency),
+ $testSetName,
+ $testSetURI,
+ $verbose,
+ $expectedFailures//TestSet[@name eq $testSetName]/Test[@name eq $testCase/@name])
+ }
+ else
+ {
+ driver:test($testCase,
+ $envTestSet,
+ $testSetURI,
+ ($testCase/fots:dependency,
+ $testSetDoc/fots:test-set/fots:dependency),
+ $testSetName,
+ $testSetURI,
+ $verbose,
+ $expectedFailures//TestSet[@name eq $testSetName]/Test[@name eq $testCase/@name])
+ }
+ }
}
</fots:test-set>
}
@@ -561,14 +596,138 @@
(:~
- : Creates the complete query that will be evaluated by adding the necessary
- : XQXQ URL resolvers.
+ : Runs a single test case.
+ :
+ : @param $case the test case to run.
+ : @param $env the environment to use. It is specified either in the test-set
+ : file associated with the test-case, or in the catalog file.
+ : @param $envBaseURI the URI of the directory containing the file where the
+ : envoronment is specified in. It is used to calculate the full URI
+ : for the different children of the <environment> that have a @file
+ : attribute.
+ : @param $deps the dependencies that should be checked for given test case.
+ : @param $testSetName the name of the environment test set.
+ : @param $testSetBaseURI the URI of the directory that contains the file of the
+ associated test set.
+ : @param $verbose if true, the resulting XML tree will contain more details
+ : about the test-case.
+ : @param $expectedFailure the Test element from the ExpectedFailures.xml file.
+ : @return an XML tree containing info about the result of running the test case.
+ :)
+declare %ann:sequential function driver:test(
+ $case as element(fots:test-case),
+ $env as element(fots:environment)?,
+ $envBaseURI as xs:anyURI?,
+ $deps as element(fots:dependency)*,
+ $testSetName as xs:string?,
+ $testSetBaseURI as xs:anyURI,
+ $verbose as xs:boolean,
+ $expectedFailure as element(Test)?
+) as element(fots:test-case)?
+{
+(:TODO Cover the "(:%VARDECL%:)"when there are tests in FOTS that use it:)
+ try
+ {
+ {
+ variable $queryName := trace(data($case/@name), "processing test case :");
+
+ variable $test := util:get-value($case, $testSetBaseURI, "test");
+
+ variable $enableHOF := env:enable-HOF-feature(($deps, $case//fots:dependency),
+ $test);
+
+ variable $query :=
+ string-join
+ (
+ (
+ env:add-xquery-version-decl(($deps, $case//fots:dependency), $test),
+
+ env:decl-def-elem-namespace($env, $case/fots:environment),
+
+ env:decl-base-uri($env, $case/fots:environment),
+
+ env:decl-namespaces($env, $case, $testSetBaseURI),
+
+ $enableHOF,
+
+ env:decl-decimal-formats(($env/fots:decimal-format,
+ $case/fots:environment/fots:decimal-format)),
+
+ env:add-var-decl($env, $case, $envBaseURI, $testSetBaseURI),
+
+ $test
+ ),
+ "
"
+ );
+
+ variable $xqxqQuery := driver:create-XQXQ-query($query,
+ $case,
+ $env,
+ $envBaseURI,
+ $testSetBaseURI);
+
+ (: if $verbose then print the query to a file
+ if ($verbose)
+ then util:write-query-to-file($xqxqQuery, $queryName);
+ else ();
+ :)
+ variable $startDateTime := datetime:current-dateTime();
+
+ variable $result := driver:xqxq-invoke($xqxqQuery,
+ $case,
+ $verbose,
+ $testSetBaseURI);
+
+ variable $duration := (datetime:current-dateTime() - $startDateTime);
+
+ if (feedback:check-pass($result, $queryName, $testSetName, $expectedFailure))
+ then
+ feedback:pass($case,
+ $result,
+ $xqxqQuery,
+ $env,
+ $duration,
+ $verbose,
+ exists($expectedFailure))
+ else
+ feedback:fail($case,
+ $result,
+ $xqxqQuery,
+ $testSetName,
+ $env,
+ $duration,
+ $verbose,
+ exists($expectedFailure))
+ }
+ }
+ catch *
+ {
+ feedback:fail($case,
+ eval:error((),
+ $case/fots:result/*,
+ $err:code,
+ $err:description),
+ "fots-driver.xq:driver:test catch",
+ $testSetName,
+ $env,
+ xs:dayTimeDuration("PT0S"),
+ $verbose,
+ exists($expectedFailure))
+ }
+};
+
+
+(:~
+ : Creates the complete query that will be evaluated via XQXQ by the fots
+ : test driver.
+ :
: @param $queryText the test-case/test after all the additional prolog
- : statements were added.
+ : statements were added.
: @param $case the test case.
: @param $env the environment.
: @param $envBaseURI URI of the environment.
- : @param $testSetBaseURI URI of the test set that defines the test case.
+ : @param $testSetBaseURI the URI of the directory that contains the file of the
+ associated test set.
: @return the query that will be evaluated.
:)
declare %private function driver:create-XQXQ-query(
@@ -583,29 +742,39 @@
$env,
$envBaseURI,
$testSetBaseURI)
- return string-join(
- ("import module namespace xqxq = 'http://www.zorba-xquery.com/modules/xqxq';",
- if (exists($resolver))
- then $resolver
- else (),
- (concat("variable $queryID := xqxq:prepare-main-module('",
- "
",
- replace($queryText,"'","''"),
- "'",
- "
",
- if (exists($resolver))
- then ", resolver:url-resolver#2, ());"
- else ");")),
- env:set-context-item($env, $envBaseURI),
- env:set-context-item($case/fots:environment,
- $testSetBaseURI),
- env:set-variables($env,
- $envBaseURI),
- env:set-variables($case/fots:environment,
- $testSetBaseURI),
- "xqxq:evaluate($queryID)"
- ),
- "
")
+ return
+ string-join
+ (
+ (
+ "",
+ "import module namespace xqxq = 'http://www.zorba-xquery.com/modules/xqxq';",
+ "",
+ if (exists($resolver))
+ then ($resolver, "")
+ else (),
+
+ concat("variable $queryID := xqxq:prepare-main-module(",
+ "
",
+ "'",
+ "
",
+ replace($queryText,"'","''"),
+ "
",
+ "'",
+ "
",
+ if (exists($resolver))
+ then ", resolver:url-resolver#2, ());"
+ else ");"),
+
+ env:set-context-item($env, $envBaseURI),
+ env:set-context-item($case/fots:environment, $testSetBaseURI),
+ env:set-variables($env, $envBaseURI),
+ env:set-variables($case/fots:environment, $testSetBaseURI),
+
+ "xqxq:evaluate($queryID)",
+ " "
+ ),
+ "
"
+ )
};
@@ -614,7 +783,8 @@
: @param $xqxqQueryText the query that will be run.
: @param $case the test case.
: @param $verbose if set to TRUE it will also output the actual result.
- : @param $testSetBaseURI the URI of the test set.
+ : @param $testSetBaseURI the URI of the directory that contains the file of the
+ associated test set.
: @return the result of running the query with XQXQ.
:)
declare %private %ann:sequential function driver:xqxq-invoke(
@@ -624,130 +794,24 @@
$testSetBaseURI as xs:anyURI
)
{
- try {
+ try
+ {
{
variable $queryKey := xqxq:prepare-main-module($xqxqQueryText);
+
variable $queryResult := xqxq:evaluate-sequential($queryKey);
+
(:TODO check if this works:)
(:variable $expResult := util:get-value($case, $testSetBaseURI, "result");:)
- eval:result($queryResult,
- $case/fots:result/*)
+
+ eval:result($queryResult, $case/fots:result/*)
}
- } catch * {
+ }
+ catch *
+ {
eval:error((),
$case/fots:result/*,
$err:code,
$err:description)
}
};
-
-
-(:~
- : Runs a single test case.
- :
- : @param $FOTSZorbaManifest the file that describes optional features and
- : implementation defined items in Zorba.
- : @param $case test case.
- : @param $env the environment.
- : @param $envBaseURI the relative URI used to calculate the full URI for the
- : different children of the environment that have a "file" attribute.
- : @param $deps the dependencies that should be checked for given test case.
- : @param $testSetName the name of the test set.
- : @param $testSetBaseURI the URI of the test set.
- : @param $verbose if set to TRUE it will also output the actual failures.
- : @param $expectedFailures the Test element from the ExpectedFailures.xml file.
- : @return the result of running the test case depending on $verbose.
- :)
-declare %ann:sequential function driver:test(
- $FOTSZorbaManifest as document-node(),
- $case as element(fots:test-case),
- $env as element(fots:environment)?,
- $envBaseURI as xs:anyURI?,
- $deps as element(fots:dependency)*,
- $testSetName as xs:string?,
- $testSetBaseURI as xs:anyURI,
- $verbose as xs:boolean,
- $expectedFailure as element(Test)?
-) as element(fots:test-case)? {
-(:TODO Cover the "(:%VARDECL%:)"when there are tests in FOTS that use it:)
-try {
-{
- variable $queryName := trace(data($case/@name),
- "processing test case :");
-
- variable $test := util:get-value($case,
- $testSetBaseURI,
- "test");
- variable $enableHOF := env:enable-HOF-feature(($deps, $case//fots:dependency),
- $test);
- variable $query := string-join((env:add-xquery-version-decl(($deps, $case//fots:dependency),
- $test),
- env:decl-def-elem-namespace($env,
- $case/fots:environment),
- env:decl-base-uri($env,
- $case/fots:environment),
- env:decl-namespaces($env,
- $case,
- $testSetBaseURI),
- $enableHOF,
- env:decl-decimal-formats(($env/fots:decimal-format,
- $case/fots:environment/fots:decimal-format)),
- env:add-var-decl($env,
- $case,
- $envBaseURI,
- $testSetBaseURI),
- $test
- ),"
"),
- $xqxqQuery := driver:create-XQXQ-query($query,
- $case,
- $env,
- $envBaseURI,
- $testSetBaseURI);
-
- (: if $verbose then print the query to a file :)
- if($verbose)
- then util:write-query-to-file($xqxqQuery, $queryName);
- else ();
-
- variable $startDateTime := datetime:current-dateTime (),
- $result := driver:xqxq-invoke($xqxqQuery,
- $case,
- $verbose,
- $testSetBaseURI),
- $duration := (datetime:current-dateTime () - $startDateTime);
-
- if(feedback:check-pass($result,
- $queryName,
- $testSetName,
- $expectedFailure))
- then feedback:pass($case,
- $result,
- $xqxqQuery,
- $env,
- $duration,
- $verbose,
- exists($expectedFailure))
- else
- feedback:fail($case,
- $result,
- $xqxqQuery,
- $testSetName,
- $env,
- $duration,
- $verbose,
- exists($expectedFailure))
-}
-} catch * {
- feedback:fail($case,
- eval:error((),
- $case/fots:result/*,
- $err:code,
- $err:description),
- "fots-driver.xq:driver:test catch",
- $testSetName,
- $env,
- xs:dayTimeDuration("PT0S"),
- $verbose,
- exists($expectedFailure))
-}
-};
=== modified file 'test/fots_driver/reporting.xq'
--- test/fots_driver/reporting.xq 2012-12-19 13:34:27 +0000
+++ test/fots_driver/reporting.xq 2013-01-28 08:42:25 +0000
@@ -77,15 +77,16 @@
variable $failures := <fots:FOTS-test-suite-result>{
( $FOTSZorbaManifest//fots:implementation,
$FOTSZorbaManifest//fots:dependencies-satisfied,
- driver:run($FOTSCatalog,
- $catalogBaseURI,
- $FOTSZorbaManifest,
- '',
- '',
- $exceptedTestCases,
- $exceptedTestSets,
- $verbose,
- ())
+ driver:run-fots($FOTSCatalogFilePath,
+ $FOTSZorbaManifestPath,
+ (),
+ $exceptedTestSets,
+ (),
+ $exceptedTestCases,
+ '',
+ (),
+ $verbose,
+ '')
)
}</fots:FOTS-test-suite-result>;
@@ -243,10 +244,12 @@
:)
declare %ann:nondeterministic function reporting:generate-expected-failures(
$pathResults as xs:string
-) as element(failures) {
- try {
+) as element(failures)
+{
+ try
+ {
{
- if(not(file:is-file($pathResults)))
+ if (not(file:is-file($pathResults)))
then
{
error($fots-err:errNA,
Follow ups
-
[Merge] lp:~zorba-coders/zorba/fots_driver into lp:zorba
From: noreply, 2013-01-30
-
[Merge] lp:~zorba-coders/zorba/fots_driver into lp:zorba
From: Zorba Build Bot, 2013-01-30
-
[Merge] lp:~zorba-coders/zorba/fots_driver into lp:zorba
From: Zorba Build Bot, 2013-01-30
-
[Merge] lp:~zorba-coders/zorba/fots_driver into lp:zorba
From: Markos Zaharioudakis, 2013-01-30
-
[Merge] lp:~zorba-coders/zorba/fots_driver into lp:zorba
From: Zorba Build Bot, 2013-01-30
-
Re: [Merge] lp:~zorba-coders/zorba/fots_driver into lp:zorba
From: Zorba Build Bot, 2013-01-30
-
[Merge] lp:~zorba-coders/zorba/fots_driver into lp:zorba
From: Zorba Build Bot, 2013-01-30
-
[Merge] lp:~zorba-coders/zorba/fots_driver into lp:zorba
From: Markos Zaharioudakis, 2013-01-30
-
Re: [Merge] lp:~zorba-coders/zorba/fots_driver into lp:zorba
From: Markos Zaharioudakis, 2013-01-30
-
[Merge] lp:~zorba-coders/zorba/fots_driver into lp:zorba
From: Markos Zaharioudakis, 2013-01-30
-
[Merge] lp:~zorba-coders/zorba/fots_driver into lp:zorba
From: Markos Zaharioudakis, 2013-01-30