Merge lp:~zorba-coders/zorba/fix_assert_xml into lp:zorba

Proposed by Sorin Marian Nasoi on 2013-02-25
Status: Merged
Approved by: Chris Hillery on 2013-02-26
Approved revision: 11257
Merged at revision: 11257
Proposed branch: lp:~zorba-coders/zorba/fix_assert_xml
Merge into: lp:zorba
Diff against target: 431 lines (+107/-75)
6 files modified
test/fots/CMakeLists.txt (+0/-38)
test/fots_driver/evaluate.xq (+48/-23)
test/fots_driver/fots-driver.xq (+5/-6)
test/fots_driver/tools/list_node_names_with_file_attribute.xq (+45/-0)
test/fots_driver/tools/process.xq (+2/-1)
test/fots_driver/util.xq (+7/-7)
To merge this branch: bzr merge lp:~zorba-coders/zorba/fix_assert_xml
Reviewer Review Type Date Requested Status
Chris Hillery 2013-02-25 Approve on 2013-02-26
Sorin Marian Nasoi Approve on 2013-02-25
Review via email: mp+150353@code.launchpad.net

Commit message

Fix FOTS driver bug that caused <assert-xml file="SOME_URI"/> to be interpreted as <assert-xml/>.
This fixes 37 test cases.

Description of the change

Fix FOTS driver bug that caused <assert-xml file="SOME_URI"/> to be interpreted as <assert-xml/>.
This fixes 37 test cases.

To post a comment you must log in.
review: Approve
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/fix_assert_xml into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job fix_assert_xml-2013-02-25T15-49-41.664Z is finished.
  The final status was:

  8 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

review: Approve
Zorba Build Bot (zorba-buildbot) wrote :

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

review: Approve
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/fix_assert_xml into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job fix_assert_xml-2013-02-25T16-22-43.29Z is finished.
  The final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Chris Hillery (ceejatec) :
review: Approve
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job fix_assert_xml-2013-02-26T01-02-48.091Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'test/fots/CMakeLists.txt'
2--- test/fots/CMakeLists.txt 2013-02-22 07:31:48 +0000
3+++ test/fots/CMakeLists.txt 2013-02-25 16:22:31 +0000
4@@ -121,7 +121,6 @@
5 EXPECTED_FOTS_FAILURE (app-CatalogCheck Catalog010 0)
6 EXPECTED_FOTS_FAILURE (app-CatalogCheck Catalog011 0)
7 EXPECTED_FOTS_FAILURE (app-CatalogCheck Catalog012 0)
8-EXPECTED_FOTS_FAILURE (app-Demos sudoku 0)
9 EXPECTED_FOTS_FAILURE (app-Demos currencysvg 0)
10 EXPECTED_FOTS_FAILURE (app-Demos itunes 0)
11 EXPECTED_FOTS_FAILURE (app-FunctxFn functx-fn-number-all 0)
12@@ -133,25 +132,7 @@
13 EXPECTED_FOTS_FAILURE (app-FunctxFunctx functx-functx-sort-all 0)
14 EXPECTED_FOTS_FAILURE (app-UseCaseNS ns-queries-results-q5 0)
15 EXPECTED_FOTS_FAILURE (app-UseCaseNS ns-queries-results-q8 0)
16-EXPECTED_FOTS_FAILURE (app-UseCaseSTRING string-queries-results-q1 0)
17-EXPECTED_FOTS_FAILURE (app-UseCaseSTRING string-queries-results-q2 0)
18-EXPECTED_FOTS_FAILURE (app-UseCaseSTRING string-queries-results-q4 0)
19-EXPECTED_FOTS_FAILURE (app-UseCaseSTRING string-queries-results-q5 0)
20-EXPECTED_FOTS_FAILURE (app-XMark XMark-Q2 0)
21 EXPECTED_FOTS_FAILURE (app-XMark XMark-Q3 0)
22-EXPECTED_FOTS_FAILURE (app-XMark XMark-Q8 0)
23-EXPECTED_FOTS_FAILURE (app-XMark XMark-Q9 0)
24-EXPECTED_FOTS_FAILURE (app-XMark XMark-Q10 0)
25-EXPECTED_FOTS_FAILURE (app-XMark XMark-Q11 0)
26-EXPECTED_FOTS_FAILURE (app-XMark XMark-Q12 0)
27-EXPECTED_FOTS_FAILURE (app-XMark XMark-Q13 0)
28-EXPECTED_FOTS_FAILURE (app-XMark XMark-Q14 0)
29-EXPECTED_FOTS_FAILURE (app-XMark XMark-Q15 0)
30-EXPECTED_FOTS_FAILURE (app-XMark XMark-Q16 0)
31-EXPECTED_FOTS_FAILURE (app-XMark XMark-Q17 0)
32-EXPECTED_FOTS_FAILURE (app-XMark XMark-Q18 0)
33-EXPECTED_FOTS_FAILURE (app-XMark XMark-Q19 0)
34-EXPECTED_FOTS_FAILURE (app-XMark XMark-Q20 0)
35 EXPECTED_FOTS_FAILURE (app-XMark XMark-All 0)
36 EXPECTED_FOTS_FAILURE (fn-adjust-date-to-timezone cbcl-adjust-date-to-timezone-002 0)
37 EXPECTED_FOTS_FAILURE (fn-adjust-date-to-timezone cbcl-adjust-date-to-timezone-003 0)
38@@ -793,14 +774,7 @@
39 EXPECTED_FOTS_FAILURE (prod-DefaultNamespaceDecl defaultnamespacedeclerr-8 0)
40 EXPECTED_FOTS_FAILURE (prod-DirAttributeList Constr-attr-nsprein-3 0)
41 EXPECTED_FOTS_FAILURE (prod-DirAttributeList Constr-attr-nsprein-4 0)
42-EXPECTED_FOTS_FAILURE (prod-DirAttributeList K2-DirectConElemAttr-75 0)
43 EXPECTED_FOTS_FAILURE (prod-DirAttributeList DirectConElemAttr-1 0)
44-EXPECTED_FOTS_FAILURE (prod-DirectConstructor K2-DirectConOther-49 0)
45-EXPECTED_FOTS_FAILURE (prod-DirectConstructor K2-DirectConOther-50 0)
46-EXPECTED_FOTS_FAILURE (prod-DirectConstructor K2-DirectConOther-51 0)
47-EXPECTED_FOTS_FAILURE (prod-DirectConstructor K2-DirectConOther-52 0)
48-EXPECTED_FOTS_FAILURE (prod-DirectConstructor K2-DirectConOther-53 0)
49-EXPECTED_FOTS_FAILURE (prod-DirectConstructor K2-DirectConOther-54 0)
50 EXPECTED_FOTS_FAILURE (prod-DirectConstructor K2-DirectConOther-66 0)
51 EXPECTED_FOTS_FAILURE (prod-DirElemConstructor K2-DirectConElem-38 0)
52 EXPECTED_FOTS_FAILURE (prod-DirElemConstructor K2-DirectConElem-48 0)
53@@ -819,21 +793,10 @@
54 EXPECTED_FOTS_FAILURE (prod-DirElemContent.namespace Constr-inscope-12 0)
55 EXPECTED_FOTS_FAILURE (prod-DirElemContent.namespace Constr-inscope-21 0)
56 EXPECTED_FOTS_FAILURE (prod-DirElemContent.namespace Constr-inscope-22 0)
57-EXPECTED_FOTS_FAILURE (prod-DirElemContent.whitespace Constr-ws-enclexpr-15 0)
58-EXPECTED_FOTS_FAILURE (prod-DirElemContent.whitespace Constr-ws-enclexpr-16 0)
59-EXPECTED_FOTS_FAILURE (prod-DirElemContent.whitespace Constr-ws-enclexpr-17 0)
60-EXPECTED_FOTS_FAILURE (prod-DirElemContent.whitespace Constr-ws-enclexpr-18 0)
61-EXPECTED_FOTS_FAILURE (prod-DirElemContent.whitespace Constr-ws-enclexpr-19 0)
62-EXPECTED_FOTS_FAILURE (prod-DirElemContent.whitespace Constr-ws-enclexpr-20 0)
63-EXPECTED_FOTS_FAILURE (prod-DirElemContent.whitespace Constr-ws-enclexpr-21 0)
64-EXPECTED_FOTS_FAILURE (prod-DirElemContent.whitespace Constr-ws-enclexpr-22 0)
65-EXPECTED_FOTS_FAILURE (prod-DirElemContent.whitespace Constr-ws-enclexpr-23 0)
66-EXPECTED_FOTS_FAILURE (prod-DirElemContent.whitespace Constr-ws-enclexpr-24 0)
67 EXPECTED_FOTS_FAILURE (prod-EQName eqname-017 0)
68 EXPECTED_FOTS_FAILURE (prod-FLWORExpr step-expr-si-2 0)
69 EXPECTED_FOTS_FAILURE (prod-FLWORExpr step-expr-si-3 0)
70 EXPECTED_FOTS_FAILURE (prod-ForClause ForExpr004 0)
71-EXPECTED_FOTS_FAILURE (prod-ForClause ForExpr013 0)
72 EXPECTED_FOTS_FAILURE (prod-FunctionCall FunctionCall-003 0)
73 EXPECTED_FOTS_FAILURE (prod-FunctionCall FunctionCall-005 0)
74 EXPECTED_FOTS_FAILURE (prod-FunctionCall FunctionCall-009 0)
75@@ -993,7 +956,6 @@
76 EXPECTED_FOTS_FAILURE (prod-ValidateExpr validate-as-105 0)
77 EXPECTED_FOTS_FAILURE (prod-ValidateExpr validate-as-106 0)
78 EXPECTED_FOTS_FAILURE (prod-VarDecl.external K2-ExternalVariablesWithout-18 0)
79-EXPECTED_FOTS_FAILURE (prod-VarDecl.external extvardeclwithtype-23 0)
80 EXPECTED_FOTS_FAILURE (prod-VarDecl.external K2-ExternalVariablesWith-22 0)
81 EXPECTED_FOTS_FAILURE (prod-VarDefaultValue extvardef-003a 0)
82 EXPECTED_FOTS_FAILURE (prod-VarDefaultValue extvardef-006b 0)
83
84=== modified file 'test/fots_driver/evaluate.xq'
85--- test/fots_driver/evaluate.xq 2013-02-22 07:31:48 +0000
86+++ test/fots_driver/evaluate.xq 2013-02-25 16:22:31 +0000
87@@ -51,17 +51,21 @@
88 : Checks if the result matches the assertions.
89 : @param $result actual result.
90 : @param $expResult expected result.
91+ : @param $testSetBaseURI the URI of the directory that contains the file of the
92+ associated test set.
93 : @return the results of assertion evaluations.
94 :)
95 declare %ann:sequential function eval:result(
96- $result as item()*,
97- $expResult as element()
98+ $result as item()*,
99+ $expResult as element(),
100+ $testSetBaseURI as xs:anyURI
101 ) as element()*
102 {
103 let $err := eval:check-assertion($result,
104 $expResult,
105 (),
106- "")
107+ "",
108+ $testSetBaseURI)
109 return if (empty($err))
110 then ()
111 else
112@@ -78,20 +82,24 @@
113 : @param $expResult expected result.
114 : @param $code err:code.
115 : @param $errorDescription err:description.
116+ : @param $testSetBaseURI the URI of the directory that contains the file of the
117+ associated test set.
118 : @return the results of error evaluation.
119 :)
120 declare %ann:sequential function eval:error(
121 $result as item()*,
122 $expResult as element(),
123 $code as xs:QName?,
124- $errorDescription as xs:string?
125+ $errorDescription as xs:string?,
126+ $testSetBaseURI as xs:anyURI
127 ) as element()*
128 {
129 if (empty($result))
130 then
131 let $err := eval:error-code($code,
132 $errorDescription,
133- $expResult)
134+ $expResult,
135+ $testSetBaseURI)
136 return
137 if (empty($err))
138 then ()
139@@ -114,7 +122,8 @@
140 declare %private %ann:sequential function eval:error-code(
141 $code as xs:QName?,
142 $errorDescription as xs:string?,
143- $expResult as element()
144+ $expResult as element(),
145+ $testSetBaseURI as xs:anyURI
146 ) as xs:string*
147 {
148 let $assertName := local-name($expResult)
149@@ -136,7 +145,8 @@
150 then eval:check-assertion((),
151 $expResult,
152 $code,
153- $errorDescription)
154+ $errorDescription,
155+ $testSetBaseURI)
156 else concat("Expected result, found error ",
157 local-name-from-QName($code),
158 " - ",
159@@ -147,7 +157,8 @@
160 $result as item()*,
161 $expResult as element(),
162 $code as xs:QName?,
163- $errorDescription as xs:string?
164+ $errorDescription as xs:string?,
165+ $testSetBaseURI as xs:anyURI
166 ) as xs:string*
167 {
168 let $test := local-name($expResult)
169@@ -156,12 +167,14 @@
170 return eval:assert-all-of($result,
171 $expResult,
172 $code,
173- $errorDescription)
174+ $errorDescription,
175+ $testSetBaseURI)
176 case 'any-of'
177 return eval:assert-any-of($result,
178 $expResult,
179 $code,
180- $errorDescription)
181+ $errorDescription,
182+ $testSetBaseURI)
183 case 'assert'
184 return eval:assert($result,
185 $expResult)
186@@ -183,10 +196,12 @@
187 $expResult)
188 case 'assert-xml'
189 return eval:assert-xml($result,
190- $expResult)
191+ $expResult,
192+ $testSetBaseURI)
193 case 'assert-serialization-error'
194 return eval:assert-serialization-error($result,
195- $expResult)
196+ $expResult,
197+ $testSetBaseURI)
198 case 'assert-string-value'
199 return eval:assert-string-value($result,
200 $expResult)
201@@ -202,7 +217,8 @@
202 return eval:error($result,
203 $expResult,
204 $code,
205- $errorDescription)
206+ $errorDescription,
207+ $testSetBaseURI)
208 default
209 return error($fots-err:errNA,
210 "&#xA;The requested assertion type is not implemented.")
211@@ -213,7 +229,8 @@
212 $result as item()*,
213 $expResult as element(),
214 $code as xs:QName?,
215- $errorDescription as xs:string?
216+ $errorDescription as xs:string?,
217+ $baseURI as xs:anyURI
218 ) as xs:string?
219 {
220 let $results :=
221@@ -222,7 +239,8 @@
222 for $r in eval:check-assertion($result,
223 $tmp,
224 $code,
225- $errorDescription)
226+ $errorDescription,
227+ $baseURI)
228 return <item>{$r}</item>
229 } </result>
230 where every $result in $results satisfies $result/item
231@@ -235,14 +253,16 @@
232 $result as item()*,
233 $expResult as element(),
234 $code as xs:QName?,
235- $errorDescription as xs:string?
236+ $errorDescription as xs:string?,
237+ $baseURI as xs:anyURI
238 ) as xs:string*
239 {
240 for $tmp in $expResult/*
241 return eval:check-assertion($result,
242 $tmp,
243 $code,
244- $errorDescription)
245+ $errorDescription,
246+ $baseURI)
247 };
248
249 (: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert :)
250@@ -417,17 +437,19 @@
251 (: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-xml :)
252 declare %private function eval:assert-xml(
253 $result as item()*,
254- $expResult as element()
255+ $expResult as element(),
256+ $baseURI as xs:anyURI
257 )
258 {
259 (:TODO call xml-canonicalization after bug #1076919 is implemented.:)
260 try {
261 let $serRes := util:serialize-result($result),
262 $result1 as xs:string := string-join($serRes,''),
263- $result2 as xs:string := string-join($serRes,' ')
264+ $result2 as xs:string := string-join($serRes,' '),
265+ $expectedResult as xs:string := util:get-value($expResult, $baseURI, "assert-xml")
266 return
267- if ((normalize-space($result1) eq normalize-space(string($expResult))) or
268- (normalize-space($result2) eq normalize-space(string($expResult))))
269+ if ((normalize-space($result1) eq normalize-space(string($expectedResult))) or
270+ (normalize-space($result2) eq normalize-space(string($expectedResult))))
271 then ()
272 else "'assert-xml' returned: result is different from the expected result."
273 } catch * {
274@@ -439,7 +461,9 @@
275 (: http://dev.w3.org/2011/QT3-test-suite/catalog-schema.html#elem_assert-serialization-error :)
276 declare %private %ann:sequential function eval:assert-serialization-error(
277 $result as item()*,
278- $expResult as element()
279+ $expResult as element(),
280+ $baseURI as xs:anyURI
281+
282 ) as xs:string?
283 {
284 try {
285@@ -451,7 +475,8 @@
286 eval:error((),
287 $expResult,
288 $err:code,
289- $err:description)
290+ $err:description,
291+ $baseURI)
292 }
293 };
294
295
296=== modified file 'test/fots_driver/fots-driver.xq'
297--- test/fots_driver/fots-driver.xq 2013-02-22 10:41:13 +0000
298+++ test/fots_driver/fots-driver.xq 2013-02-25 16:22:31 +0000
299@@ -872,7 +872,8 @@
300 eval:error((),
301 $case/fots:result/*,
302 $err:code,
303- $err:description),
304+ $err:description,
305+ $testSetBaseURI),
306 "fots-driver.xq:driver:test catch",
307 $testSetName,
308 $env,
309@@ -1005,12 +1006,9 @@
310
311 variable $queryResult := xqxq:evaluate-sequential($queryKey);
312
313- (:TODO check if this works:)
314- (:variable $expResult := util:get-value($case, $testSetBaseURI, "result");:)
315-
316 xqxq:delete-query($queryKey);
317
318- eval:result($queryResult, $case/fots:result/*)
319+ eval:result($queryResult, $case/fots:result/*, $testSetBaseURI)
320 }
321 }
322 catch *
323@@ -1018,6 +1016,7 @@
324 eval:error((),
325 $case/fots:result/*,
326 $err:code,
327- $err:description)
328+ $err:description,
329+ $testSetBaseURI)
330 }
331 };
332
333=== added file 'test/fots_driver/tools/list_node_names_with_file_attribute.xq'
334--- test/fots_driver/tools/list_node_names_with_file_attribute.xq 1970-01-01 00:00:00 +0000
335+++ test/fots_driver/tools/list_node_names_with_file_attribute.xq 2013-02-25 16:22:31 +0000
336@@ -0,0 +1,45 @@
337+(:
338+ : Copyright 2006-2011 The FLWOR Foundation.
339+ :
340+ : Licensed under the Apache License, Version 2.0 (the "License");
341+ : you may not use this file except in compliance with the License.
342+ : You may obtain a copy of the License at
343+ :
344+ : http://www.apache.org/licenses/LICENSE-2.0
345+ :
346+ : Unless required by applicable law or agreed to in writing, software
347+ : distributed under the License is distributed on an "AS IS" BASIS,
348+ : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
349+ : See the License for the specific language governing permissions and
350+ : limitations under the License.
351+ :)
352+
353+(:~
354+ : list all node-names of the nodes that contain a child with a 'file' attribute.
355+ : At the moment this is the list: "source", "schema", "assert-xml", "module", "test"
356+ :
357+ : @author Sorin Nasoi
358+ :)
359+
360+import module namespace util =
361+ "http://www.zorba-xquery.com/fots-driver/util" at "../util.xq";
362+
363+declare namespace fots =
364+ "http://www.w3.org/2010/09/qt-fots-catalog";
365+
366+let $fotsPath := "../../../build/test/fots/2011/QT3-test-suite/catalog.xml"
367+let $doc := doc(resolve-uri($fotsPath))
368+let $baseUri:= resolve-uri(util:parent-folder($fotsPath))
369+return
370+distinct-values(
371+ for $testSet in $doc/fots:catalog/fots:test-set
372+ let $testSetDoc := doc(resolve-uri($testSet/@file, $baseUri))
373+ let $testSetName := xs:string($testSet/@name)
374+ return
375+ distinct-values(for $case in $testSetDoc//fots:test-case
376+ return distinct-values(for $node in $case/descendant-or-self::*
377+ where exists($node/@file)
378+ return local-name-from-QName(node-name($node))
379+ )
380+ )
381+)
382
383=== modified file 'test/fots_driver/tools/process.xq'
384--- test/fots_driver/tools/process.xq 2012-12-18 14:13:20 +0000
385+++ test/fots_driver/tools/process.xq 2013-02-25 16:22:31 +0000
386@@ -36,7 +36,8 @@
387 declare namespace fots =
388 "http://www.w3.org/2010/09/qt-fots-catalog";
389
390-declare variable $fotsPath as xs:string external := "";
391+declare variable $fotsPath as xs:string external :=
392+ "../../../build/test/fots/2011/QT3-test-suite/catalog.xml";
393 declare variable $dependency as xs:string external := "";
394 declare variable $testSetPrefixes as xs:string external := "";
395
396
397=== modified file 'test/fots_driver/util.xq'
398--- test/fots_driver/util.xq 2013-02-19 14:06:08 +0000
399+++ test/fots_driver/util.xq 2013-02-25 16:22:31 +0000
400@@ -71,24 +71,24 @@
401 : or
402 : (b) the typed value of the node (assuming it is promotable to string).
403 :
404- : @param $case test-case element.
405+ : @param $parentNode
406+ : @param $baseURI
407 : @param $node-name
408- : @param $envBaseURI
409- : @return the query text.
410+ : @return the content of the node with name 'node-name'.
411 :)
412 declare %ann:nondeterministic function util:get-value(
413- $case as element(fots:test-case),
414- $envBaseURI as xs:anyURI,
415+ $parentNode as element(),
416+ $baseURI as xs:anyURI,
417 $node-name as xs:string
418 ) as xs:string
419 {
420 try
421 {
422- for $node in $case/descendant-or-self::*
423+ for $node in $parentNode/descendant-or-self::*
424 where (fn:local-name-from-QName(fn:node-name($node)) eq $node-name)
425 return
426 if ($node/@file)
427- then fn:unparsed-text(resolve-uri($node/@file, $envBaseURI))
428+ then fn:unparsed-text(resolve-uri($node/@file, $baseURI))
429 else fn:string($node)
430 }
431 catch *

Subscribers

People subscribed via source and target branches