← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/fix_bug_1187807 into lp:zorba

 

Sorin Marian Nasoi has proposed merging lp:~zorba-coders/zorba/fix_bug_1187807 into lp:zorba.

Commit message:
- temporary fix for lp:1187807: FOTS driver adds a base-uri in the prolog; the complete/clean fix requires lp:1133806 to be fixed.

Requested reviews:
  Chris Hillery (ceejatec)
  Sorin Marian Nasoi (sorin.marian.nasoi)
Related bugs:
  Bug #1187807 in Zorba: "fots driver should add as base-uri the URI of the FOTS file containg the test-case"
  https://bugs.launchpad.net/zorba/+bug/1187807

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fix_bug_1187807/+merge/168681
-- 
https://code.launchpad.net/~zorba-coders/zorba/fix_bug_1187807/+merge/168681
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'test/fots/CMakeLists.txt'
--- test/fots/CMakeLists.txt	2013-06-11 12:27:33 +0000
+++ test/fots/CMakeLists.txt	2013-06-11 14:33:41 +0000
@@ -129,6 +129,7 @@
 EXPECTED_FOTS_FAILURE (DISPUTED fn-format-dateTime format-dateTime-006 22282)
 EXPECTED_FOTS_FAILURE (DISPUTED misc-XMLEdition XML10-4ed-Excluded-char-1 13869)
 EXPECTED_FOTS_FAILURE (DISPUTED prod-ModuleImport modules-22 22317)
+EXPECTED_FOTS_FAILURE (DISPUTED app-CatalogCheck Catalog011 22327)
 
 # Next three possibly unique to old RQ machine, but they need to be
 # marked for the RQ to pass.
@@ -140,8 +141,6 @@
 # This test passes on the old and new RQ machines, but fails for Sorin.
 #EXPECTED_FOTS_FAILURE (fn-normalize-unicode fn-normalize-unicode-11 0)
 
-EXPECTED_FOTS_FAILURE (app-CatalogCheck Catalog010 1187807)
-EXPECTED_FOTS_FAILURE (app-CatalogCheck Catalog011 1187807)
 EXPECTED_FOTS_FAILURE (fn-fold-left fold-left-009 1187685)
 EXPECTED_FOTS_FAILURE (fn-fold-right fold-right-005 1187685)
 EXPECTED_FOTS_FAILURE (fn-fold-right fold-right-006 1187685)
@@ -170,10 +169,8 @@
 EXPECTED_FOTS_FAILURE (fn-normalize-space fn-normalize-space-25 1187802)
 EXPECTED_FOTS_FAILURE (fn-normalize-unicode cbcl-fn-normalize-unicode-001 1187813)
 EXPECTED_FOTS_FAILURE (fn-normalize-unicode cbcl-fn-normalize-unicode-006 1187813)
-EXPECTED_FOTS_FAILURE (fn-parse-xml parse-xml-001 1187807)
-EXPECTED_FOTS_FAILURE (fn-parse-xml parse-xml-010 1188260)
-EXPECTED_FOTS_FAILURE (fn-parse-xml parse-xml-011 1187807)
-EXPECTED_FOTS_FAILURE (fn-parse-xml-fragment parse-xml-fragment-001 1187807)
+EXPECTED_FOTS_FAILURE (fn-parse-xml parse-xml-010 1189927)
+EXPECTED_FOTS_FAILURE (fn-parse-xml parse-xml-011 1188260)
 EXPECTED_FOTS_FAILURE (fn-parse-xml-fragment parse-xml-fragment-016 1188269)
 EXPECTED_FOTS_FAILURE (fn-parse-xml-fragment parse-xml-fragment-017 1188269)
 EXPECTED_FOTS_FAILURE (fn-parse-xml-fragment parse-xml-fragment-020 1188269)
@@ -229,7 +226,7 @@
 EXPECTED_FOTS_FAILURE (prod-Annotation annotation-assertion-8 1172270)
 EXPECTED_FOTS_FAILURE (prod-Annotation annotation-assertion-9 1172270)
 EXPECTED_FOTS_FAILURE (prod-Annotation annotation-assertion-10 1172270)
-EXPECTED_FOTS_FAILURE (prod-BaseURIDecl K2-BaseURIProlog-5 1187807)
+EXPECTED_FOTS_FAILURE (prod-BaseURIDecl K2-BaseURIProlog-5 1133806)
 EXPECTED_FOTS_FAILURE (prod-CastableExpr K-SeqExprCastable-5a 1188281)
 EXPECTED_FOTS_FAILURE (prod-CastExpr CastAsNamespaceSensitiveType-11 1188279)
 EXPECTED_FOTS_FAILURE (prod-CastExpr CastAsNamespaceSensitiveType-12 1188279)

=== modified file 'test/fots_driver/environment.xq'
--- test/fots_driver/environment.xq	2013-05-17 23:57:15 +0000
+++ test/fots_driver/environment.xq	2013-06-11 14:33:41 +0000
@@ -82,16 +82,27 @@
  : @param $env the non-local environment of the test-case, if any. It is an
  :        environment specified either at the test-set level or at the catalog
  :        level and is referenced by the test-case.
+ : @param $test the raw query text.
+ : @param $testSetURI the URI of the directory that contains the file of the
+ :        associated test-set.
  : @param $envCase the local environment of the test-case, if any.
  : @return the declare base-uri prolog statement.
  :)
 declare function env:decl-base-uri(
-  $env      as element(fots:environment)?,
-  $envCase  as element(fots:environment)?
+  $env        as element(fots:environment)?,
+  $envCase    as element(fots:environment)?,
+  $test       as xs:string,
+  $testSetURI as xs:anyURI
 ) as xs:string?
 {
-  for $baseURI in ($env/fots:static-base-uri, $envCase/fots:static-base-uri)
-  return concat("declare base-uri '", $baseURI/@uri, "';")
+  if($env/fots:static-base-uri, $envCase/fots:static-base-uri) then
+    for $baseURI in ($env/fots:static-base-uri, $envCase/fots:static-base-uri)
+    return concat('declare base-uri "', $baseURI/@uri, '";')
+  else if(not(contains($test,"declare base-uri ") or
+              contains($test,"xquery version ") or
+              contains($test,"declare(::)base-uri"))) then
+    concat('declare base-uri "', $testSetURI, '";')
+  else ()
 };
 
 
@@ -161,7 +172,7 @@
   $test   as xs:string
 ) as xs:boolean
 {
-  contains($test, concat("import schema namespace ", $prefix))
+  contains($test, concat('import schema namespace ', $prefix))
 };
 
 

=== modified file 'test/fots_driver/fots-driver.xq'
--- test/fots_driver/fots-driver.xq	2013-05-17 23:57:15 +0000
+++ test/fots_driver/fots-driver.xq	2013-06-11 14:33:41 +0000
@@ -822,8 +822,8 @@
  : @param $deps the dependencies that should be checked for given test-case.
  :        These may be defined at test-set level and/or test-case level.
  : @param $testSetName the name of the test-set.
- : @param $testSetBaseURI the URI of the directory that contains the file of the
-          associated test-set.
+ : @param $testSetURI 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 $expFailureTC the 'Test' element from the ExpectedFailures.xml file.
@@ -834,17 +834,17 @@
  : @return an XML tree containing the result of running the test-case.
  :)
 declare %private %ann:sequential function driver:run-test-case(
-  $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,
-  $expFailureTC         as element(Test)?,
-  $ctestMode            as xs:boolean,
-  $cliMode              as xs:string,
-  $usePlanSerializer    as xs:boolean
+  $case               as element(fots:test-case),
+  $env                as element(fots:environment)?,
+  $envBaseURI         as xs:anyURI?,
+  $deps               as element(fots:dependency)*,
+  $testSetName        as xs:string,
+  $testSetURI         as xs:anyURI,
+  $verbose            as xs:boolean,
+  $expFailureTC       as element(Test)?,
+  $ctestMode          as xs:boolean,
+  $cliMode            as xs:string,
+  $usePlanSerializer  as xs:boolean
 ) as element(fots:test-case)?
 {
 (:TODO Cover the "(:%VARDECL%:)"when there are tests in FOTS that use it:)
@@ -858,7 +858,7 @@
 
     variable $queryName := $case/@name;
 
-    variable $test as xs:string := util:get-value($case, $testSetBaseURI, "test");
+    variable $test as xs:string := util:get-value($case, $testSetURI, "test");
 
     variable $envCase := $case/fots:environment;
 
@@ -868,7 +868,7 @@
       (
         env:add-xquery-version-decl(($deps, $case//fots:dependency), $test),
 
-        env:decl-base-uri($env, $envCase),
+        env:decl-base-uri($env, $envCase, $test, $testSetURI),
 
         env:decl-def-elem-namespace($env, $envCase),
 
@@ -877,7 +877,7 @@
         env:decl-decimal-formats(($env/fots:decimal-format,
                                   $envCase/fots:decimal-format)),
 
-        env:add-var-decl($env, $envCase, $envBaseURI, $testSetBaseURI),
+        env:add-var-decl($env, $envCase, $envBaseURI, $testSetURI),
 
         $test
       ),
@@ -888,7 +888,7 @@
                                                     $case,
                                                     $env,
                                                     $envBaseURI,
-                                                    $testSetBaseURI,
+                                                    $testSetURI,
                                                     $deps);
 
     (:if $verbose then print the query to a file:)
@@ -902,7 +902,7 @@
     variable $result := execute:xqxq-invoke($xqxqQuery,
                                             $case,
                                             $verbose,
-                                            $testSetBaseURI,
+                                            $testSetURI,
                                             $usePlanSerializer);
 
     variable $duration := (datetime:current-dateTime() - $startDateTime);
@@ -953,7 +953,7 @@
                            $case/fots:result/*,
                            $err:code,
                            $err:description,
-                           $testSetBaseURI),
+                           $testSetURI),
                 "fots-driver.xq:driver:test catch",
                 $testSetName,
                 $env,
@@ -975,7 +975,7 @@
  : @param $case the test case.
  : @param $env the environment.
  : @param $envBaseURI URI of the environment.
- : @param $testSetBaseURI the URI of the directory that contains the file of the
+ : @param $testSetURI the URI of the directory that contains the file of the
  :        associated test set.
  : @param $deps the dependencies that should be checked for given test-case.
  :        These may be defined at test-set level and/or test-case level.
@@ -986,18 +986,18 @@
   $case               as element(fots:test-case),
   $env                as element(fots:environment)?,
   $envBaseURI         as xs:anyURI?,
-  $testSetBaseURI     as xs:anyURI,
+  $testSetURI     as xs:anyURI,
   $deps               as element(fots:dependency)*
 ) as xs:string
 {
   let $resolver as xs:string? := env:resolver($case,
                                               $env,
                                               $envBaseURI,
-                                              $testSetBaseURI)
+                                              $testSetURI)
   let $mapper as xs:string? := env:mapper($case,
                                           $env,
                                           $envBaseURI,
-                                          $testSetBaseURI)
+                                          $testSetURI)
   let $needsDTDValidation := exists($deps[@type="feature" and @value="infoset-dtd"])
   return
     string-join
@@ -1063,9 +1063,9 @@
                 else "
);"),
 
     env:set-context-item($env, $envBaseURI, $needsDTDValidation),
-    env:set-context-item($case/fots:environment, $testSetBaseURI, $needsDTDValidation),
+    env:set-context-item($case/fots:environment, $testSetURI, $needsDTDValidation),
     env:set-variables($env, $envBaseURI),
-    env:set-variables($case/fots:environment, $testSetBaseURI),
+    env:set-variables($case/fots:environment, $testSetURI),
 
     "xqxq:evaluate($queryID),",
     "",


Follow ups