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

Proposed by Sorin Marian Nasoi
Status: Merged
Approved by: Chris Hillery
Approved revision: 11302
Merged at revision: 11304
Proposed branch: lp:~zorba-coders/zorba/fix_bug_1123842
Merge into: lp:zorba
Diff against target: 239 lines (+60/-58)
3 files modified
test/fots/CMakeLists.txt (+0/-32)
test/fots_driver/environment.xq (+16/-6)
test/fots_driver/fots-driver.xq (+44/-20)
To merge this branch: bzr merge lp:~zorba-coders/zorba/fix_bug_1123842
Reviewer Review Type Date Requested Status
Chris Hillery Approve
Sorin Marian Nasoi Approve
Review via email: mp+154671@code.launchpad.net

Commit message

Added DTD validation for the document that is bound to the context item in the cases where this is needed.
Because there is no Dependency for DTD validation inside the testsuite, FOTS driver needs to look for specific test case names.

Description of the change

Added DTD validation for the document that is bound to the context item in the cases where this is needed.
Because there is no Dependency for DTD validation inside the testsuite, FOTS driver needs to look for specific test case names.

To post a comment you must log in.
Revision history for this message
Sorin Marian Nasoi (sorin.marian.nasoi) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job fix_bug_1123842-2013-03-21T11-37-51.535Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1, Needs Information < 1, Resubmit < 1. Got: 1 Approve.

11301. By Sorin Marian Nasoi <email address hidden>

Improved the test-case search.

11302. By Sorin Marian Nasoi <email address hidden>

Merged lp:zorba trunk.

Revision history for this message
Chris Hillery (ceejatec) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job fix_bug_1123842-2013-03-21T21-21-48.177Z 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-03-21 18:22:40 +0000
3+++ test/fots/CMakeLists.txt 2013-03-21 18:46:22 +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-FunctxFunctx functx-functx-id-from-element-1 0)
9 EXPECTED_FOTS_FAILURE (fn-adjust-date-to-timezone cbcl-adjust-date-to-timezone-002 0)
10 EXPECTED_FOTS_FAILURE (fn-adjust-date-to-timezone cbcl-adjust-date-to-timezone-003 0)
11 EXPECTED_FOTS_FAILURE (fn-adjust-dateTime-to-timezone cbcl-adjust-dateTime-to-timezone-001 0)
12@@ -289,37 +288,6 @@
13 EXPECTED_FOTS_FAILURE (fn-generate-id generate-id-015 0)
14 EXPECTED_FOTS_FAILURE (fn-generate-id generate-id-017 0)
15 EXPECTED_FOTS_FAILURE (fn-generate-id generate-id-018 0)
16-EXPECTED_FOTS_FAILURE (fn-id fn-id-dtd-5 0)
17-EXPECTED_FOTS_FAILURE (fn-id fn-id-dtd-7 0)
18-EXPECTED_FOTS_FAILURE (fn-id fn-id-dtd-8 0)
19-EXPECTED_FOTS_FAILURE (fn-id fn-id-dtd-9 0)
20-EXPECTED_FOTS_FAILURE (fn-id fn-id-dtd-12 0)
21-EXPECTED_FOTS_FAILURE (fn-id fn-id-dtd-13 0)
22-EXPECTED_FOTS_FAILURE (fn-id fn-id-dtd-15 0)
23-EXPECTED_FOTS_FAILURE (fn-id fn-id-dtd-16 0)
24-EXPECTED_FOTS_FAILURE (fn-id fn-id-dtd-17 0)
25-EXPECTED_FOTS_FAILURE (fn-id fn-id-dtd-18 0)
26-EXPECTED_FOTS_FAILURE (fn-id fn-id-dtd-19 0)
27-EXPECTED_FOTS_FAILURE (fn-id fn-id-dtd-20 0)
28-EXPECTED_FOTS_FAILURE (fn-id fn-id-dtd-21 0)
29-EXPECTED_FOTS_FAILURE (fn-id fn-id-dtd-23 0)
30-EXPECTED_FOTS_FAILURE (fn-idref fn-idref-dtd-5 0)
31-EXPECTED_FOTS_FAILURE (fn-idref fn-idref-dtd-7 0)
32-EXPECTED_FOTS_FAILURE (fn-idref fn-idref-dtd-8 0)
33-EXPECTED_FOTS_FAILURE (fn-idref fn-idref-dtd-9 0)
34-EXPECTED_FOTS_FAILURE (fn-idref fn-idref-dtd-12 0)
35-EXPECTED_FOTS_FAILURE (fn-idref fn-idref-dtd-13 0)
36-EXPECTED_FOTS_FAILURE (fn-idref fn-idref-dtd-14 0)
37-EXPECTED_FOTS_FAILURE (fn-idref fn-idref-dtd-15 0)
38-EXPECTED_FOTS_FAILURE (fn-idref fn-idref-dtd-16 0)
39-EXPECTED_FOTS_FAILURE (fn-idref fn-idref-dtd-17 0)
40-EXPECTED_FOTS_FAILURE (fn-idref fn-idref-dtd-18 0)
41-EXPECTED_FOTS_FAILURE (fn-idref fn-idref-dtd-19 0)
42-EXPECTED_FOTS_FAILURE (fn-idref fn-idref-dtd-20 0)
43-EXPECTED_FOTS_FAILURE (fn-idref fn-idref-dtd-21 0)
44-EXPECTED_FOTS_FAILURE (fn-idref fn-idref-dtd-23 0)
45-EXPECTED_FOTS_FAILURE (fn-idref fn-idref-dtd-24 0)
46-EXPECTED_FOTS_FAILURE (fn-idref fn-idref-dtd-25 0)
47 EXPECTED_FOTS_FAILURE (fn-iri-to-uri fn-iri-to-uri-18A 0)
48 EXPECTED_FOTS_FAILURE (fn-last last-24 0)
49 EXPECTED_FOTS_FAILURE (fn-matches cbcl-matches-038 1131304)
50
51=== modified file 'test/fots_driver/environment.xq'
52--- test/fots_driver/environment.xq 2013-03-15 18:25:44 +0000
53+++ test/fots_driver/environment.xq 2013-03-21 18:46:22 +0000
54@@ -391,11 +391,14 @@
55 : test case.
56 : @param $envBaseURI The absolute pathname of the directory containing the
57 : file that defines the environment.
58+ : @param $needsDTDValidation If true then the document that is bound as
59+ : context item needs to be DTD validated.
60 : @return the string for setting the context item if needed.
61 :)
62 declare function env:set-context-item(
63- $env as element(fots:environment)?,
64- $envBaseURI as xs:anyURI?
65+ $env as element(fots:environment)?,
66+ $envBaseURI as xs:anyURI?,
67+ $needsDTDValidation as xs:boolean
68 ) as xs:string?
69 {
70 if (exists($env/fots:source[@role = "."]))
71@@ -403,7 +406,7 @@
72 string-join
73 (
74 (
75- env:compute-context-item($env, $envBaseURI),
76+ env:compute-context-item($env, $envBaseURI, $needsDTDValidation),
77 "",
78 'xqxq:bind-context-item($queryID, $contextItem);'
79 )
80@@ -416,15 +419,22 @@
81
82
83 declare %private function env:compute-context-item(
84- $env as element(fots:environment)?,
85- $envBaseURI as xs:anyURI?
86+ $env as element(fots:environment)?,
87+ $envBaseURI as xs:anyURI?,
88+ $needsDTDValidation as xs:boolean
89 ) as xs:string
90 {
91 let $ciURI := resolve-uri($env/fots:source[@role = "."]/@file, $envBaseURI)
92 return
93 if (empty($env/fots:source[@validation = "strict"]))
94 then
95- concat('variable $contextItem := doc("', $ciURI, '");')
96+ {
97+ if($needsDTDValidation)
98+ then concat('variable $contextItem := zorba-xml:parse(fn:unparsed-text("',
99+ $ciURI,
100+ '"),<opt:options><opt:DTD-validate/></opt:options> );')
101+ else concat('variable $contextItem := doc("', $ciURI, '");')
102+ }
103 else
104 string-join
105 (
106
107=== modified file 'test/fots_driver/fots-driver.xq'
108--- test/fots_driver/fots-driver.xq 2013-03-20 23:33:11 +0000
109+++ test/fots_driver/fots-driver.xq 2013-03-21 18:46:22 +0000
110@@ -690,6 +690,8 @@
111
112 let $depMet := env:check-dependencies($testCase/fots:dependency,
113 $FOTSZorbaManifest)
114+ (: the following 3 test sets contain some test cases that need DTD validation for the document bound as context item :)
115+ let $mayNeedDTDValidation := exists(index-of(('fn-id', 'fn-idref', 'app-FunctxFunctx'), $testSetName))
116
117 where empty($testCaseNames) or $testCaseNames[. eq $testCase/@name]
118
119@@ -727,7 +729,8 @@
120 $testSetURI,
121 $verbose,
122 $expectedFailures//TestSet[@name eq $testSetName]/Test[@name eq $testCase/@name],
123- $cliMode)
124+ $cliMode,
125+ $mayNeedDTDValidation)
126 }
127 else
128 {
129@@ -740,7 +743,8 @@
130 $testSetURI,
131 $verbose,
132 $expectedFailures//TestSet[@name eq $testSetName]/Test[@name eq $testCase/@name],
133- $cliMode)
134+ $cliMode,
135+ $mayNeedDTDValidation)
136 }
137 }
138 }
139@@ -770,18 +774,21 @@
140 : about the test-case.
141 : @param $expectedFailure the Test element from the ExpectedFailures.xml file.
142 : @param $cliMode the cli command.
143+ : @param $mayNeedDTDValidation true if the test case may need DTD validation
144+ : for the document bound as context item.
145 : @return an XML tree containing info about the result of running the test case.
146 :)
147 declare %ann:sequential function driver:test(
148- $case as element(fots:test-case),
149- $env as element(fots:environment)?,
150- $envBaseURI as xs:anyURI?,
151- $deps as element(fots:dependency)*,
152- $testSetName as xs:string?,
153- $testSetBaseURI as xs:anyURI,
154- $verbose as xs:boolean,
155- $expectedFailure as element(Test)?,
156- $cliMode as xs:string
157+ $case as element(fots:test-case),
158+ $env as element(fots:environment)?,
159+ $envBaseURI as xs:anyURI?,
160+ $deps as element(fots:dependency)*,
161+ $testSetName as xs:string?,
162+ $testSetBaseURI as xs:anyURI,
163+ $verbose as xs:boolean,
164+ $expectedFailure as element(Test)?,
165+ $cliMode as xs:string,
166+ $mayNeedDTDValidation as xs:boolean
167 ) as element(fots:test-case)?
168 {
169 (:TODO Cover the "(:%VARDECL%:)"when there are tests in FOTS that use it:)
170@@ -822,12 +829,21 @@
171 ),
172 "&#xA;"
173 );
174+ variable $needsDTDValidation :=
175+ if (not($mayNeedDTDValidation))
176+ then fn:false()
177+ else if (($testSetName = 'app-FunctxFunctx') and (xs:string($case/@name) = 'functx-functx-id-from-element-1'))
178+ then fn:true()
179+ else if(($testSetName = 'fn-id') and starts-with(xs:string($case/@name), 'fn-id-dtd-'))
180+ then fn:true()
181+ else (($testSetName = 'fn-idref') and starts-with(xs:string($case/@name), 'fn-idref-dtd-'));
182
183 variable $xqxqQuery := driver:create-XQXQ-query($query,
184 $case,
185 $env,
186 $envBaseURI,
187- $testSetBaseURI);
188+ $testSetBaseURI,
189+ $needsDTDValidation);
190
191 (:if $verbose then print the query to a file:)
192 if ($verbose and
193@@ -895,14 +911,17 @@
194 : @param $envBaseURI URI of the environment.
195 : @param $testSetBaseURI the URI of the directory that contains the file of the
196 associated test set.
197+ : @param $needsDTDValidation true if the test case needs DTD validation
198+ : for the document bound as context item.
199 : @return the query that will be evaluated.
200 :)
201 declare %private function driver:create-XQXQ-query(
202- $queryText as xs:string,
203- $case as element(fots:test-case),
204- $env as element(fots:environment)?,
205- $envBaseURI as xs:anyURI?,
206- $testSetBaseURI as xs:anyURI
207+ $queryText as xs:string,
208+ $case as element(fots:test-case),
209+ $env as element(fots:environment)?,
210+ $envBaseURI as xs:anyURI?,
211+ $testSetBaseURI as xs:anyURI,
212+ $needsDTDValidation as xs:boolean
213 ) as xs:string
214 {
215 let $resolver as xs:string? := env:resolver($case,
216@@ -919,7 +938,12 @@
217 (
218 "",
219 "import module namespace xqxq = 'http://www.zorba-xquery.com/modules/xqxq';",
220-
221+
222+ if ($needsDTDValidation)
223+ then ("import module namespace zorba-xml = 'http://www.zorba-xquery.com/modules/xml#2.1';",
224+ "import schema namespace opt = 'http://www.zorba-xquery.com/modules/xml-options';")
225+ else (),
226+
227 if (exists($resolver))
228 then "declare namespace resolver = 'http://www.zorba-xquery.com/modules/xqxq/url-resolver';"
229 else (),
230@@ -971,8 +995,8 @@
231 then ", (), mapper:uri-mapper#2&#xA;);"
232 else "&#xA;);"),
233
234- env:set-context-item($env, $envBaseURI),
235- env:set-context-item($case/fots:environment, $testSetBaseURI),
236+ env:set-context-item($env, $envBaseURI, $needsDTDValidation),
237+ env:set-context-item($case/fots:environment, $testSetBaseURI, $needsDTDValidation),
238 env:set-variables($env, $envBaseURI),
239 env:set-variables($case/fots:environment, $testSetBaseURI),
240

Subscribers

People subscribed via source and target branches