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

Proposed by Sorin Marian Nasoi
Status: Merged
Approved by: Sorin Marian Nasoi
Approved revision: 10708
Merged at revision: 10707
Proposed branch: lp:~zorba-coders/zorba/bug_871335
Merge into: lp:zorba
Diff against target: 249 lines (+77/-79)
5 files modified
modules/ExternalModules.conf (+1/-1)
modules/com/zorba-xquery/www/modules/debugger/dbgp-message-handler.xq (+17/-3)
test/rbkt/Queries/CMakeLists.txt (+0/-9)
test/rbkt/Queries/zorba/xqdoc/moduleDocumentation.spec (+1/-3)
test/rbkt/Queries/zorba/xqdoc/moduleDocumentation.xq (+58/-63)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug_871335
Reviewer Review Type Date Requested Status
Sorin Marian Nasoi Approve
Chris Hillery Approve
Review via email: mp+96307@code.launchpad.net

Commit message

- fixed the test 'moduleDocumentation': all modules that appear in ZorbaManifest.xml are checked for correct XQDoc documentation
- re-enabled the 'moduleDocumentation' test that was previously disabled.

Description of the change

- fixed the test 'moduleDocumentation': all modules that appear in ZorbaManifest.xml are checked for correct XQDoc documentation
- re-enabled the 'moduleDocumentation' test that was previously disabled.

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
Chris Hillery (ceejatec) wrote :

Change looks fine. Sorin, as mentioned in email, please change modules/ExternalModules.conf to download "1.0" of the XQXQ module on this branch - see the data-cleaning entry as an example. Also, don't mark this merge proposal "Approved" until I've tagged XQXQ.

review: Approve
Revision history for this message
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.

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 bug_871335-2012-03-07T10-21-07.939Z 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 'modules/ExternalModules.conf'
2--- modules/ExternalModules.conf 2012-02-28 20:45:43 +0000
3+++ modules/ExternalModules.conf 2012-03-07 10:20:34 +0000
4@@ -38,5 +38,5 @@
5 process bzr lp:zorba/process-module zorba-2.1
6 security bzr lp:zorba/security-module zorba-2.1
7 system bzr lp:zorba/system-module zorba-2.1
8-xqxq bzr lp:zorba/xqxq-module zorba-2.1
9+xqxq bzr lp:zorba/xqxq-module 1.0
10 email bzr lp:zorba/email-module zorba-2.1
11
12=== modified file 'modules/com/zorba-xquery/www/modules/debugger/dbgp-message-handler.xq'
13--- modules/com/zorba-xquery/www/modules/debugger/dbgp-message-handler.xq 2011-12-20 18:08:09 +0000
14+++ modules/com/zorba-xquery/www/modules/debugger/dbgp-message-handler.xq 2012-03-07 10:20:34 +0000
15@@ -15,6 +15,13 @@
16 : See the License for the specific language governing permissions and
17 : limitations under the License.
18 :)
19+
20+(:~
21+ : Zorba debugger module.
22+ :
23+ : @author Gabriel Petrovay
24+ : @project debugger
25+ :)
26 module namespace dmh = "http://www.zorba-xquery.com/modules/debugger/dbgp-message-handler";
27
28 import module namespace base64 = "http://www.zorba-xquery.com/modules/converters/base64";
29@@ -22,8 +29,10 @@
30 declare namespace ver = "http://www.zorba-xquery.com/options/versioning";
31 declare option ver:module-version "1.0";
32
33-
34-declare variable $dmh:endl as xs:string := "
35+(:~
36+ : Endline.
37+ :)
38+declare %private variable $dmh:endl as xs:string := "
39 ";
40
41 (:~
42@@ -236,7 +245,7 @@
43 return dmh:report-error(fn:concat("Command not implemented: ", $resp/@command))
44 };
45
46-declare function dmh:process-init($init as element(init))
47+declare %private function dmh:process-init($init as element(init))
48 {
49 fn:string-join(
50 ("Established connection with", $init/@language, "client", $init/@appid),
51@@ -244,6 +253,11 @@
52 )
53 };
54
55+(:~
56+ : Process one message received from the Zorba debugger server.
57+ : @param $message the message.
58+ : @return ().
59+ :)
60 declare function dmh:process($message as element())
61 {
62 let $nodeName := fn:local-name($message)
63
64=== modified file 'test/rbkt/Queries/CMakeLists.txt'
65--- test/rbkt/Queries/CMakeLists.txt 2012-03-05 16:01:59 +0000
66+++ test/rbkt/Queries/CMakeLists.txt 2012-03-07 10:20:34 +0000
67@@ -38,15 +38,6 @@
68
69 # crashes on Windows: 866978, 866742 (fix 866978 before 866742)
70 zorba/HigherOrder/hof-101.xq
71-
72- # fails because of the image external module's broken documentation
73- # If you try to submit something else to the external module, it will
74- # fail because of this test.
75- # If you try and mark it as expected failure here, the "expected failure"
76- # will fail because the image module will not be tested and therefore the
77- # module documentation test will succeed.
78- # Created bug 871335 for this.
79- zorba/xqdoc/moduleDocumentation.xq
80 )
81
82 # collect all chained test queries (suffix .cxq) in all subdirectories
83
84=== modified file 'test/rbkt/Queries/zorba/xqdoc/moduleDocumentation.spec'
85--- test/rbkt/Queries/zorba/xqdoc/moduleDocumentation.spec 2011-08-04 21:14:20 +0000
86+++ test/rbkt/Queries/zorba/xqdoc/moduleDocumentation.spec 2012-03-07 10:20:34 +0000
87@@ -1,5 +1,3 @@
88 Args:
89 -x
90-ZorbaPath:=xs:string($RBKT_SRC_DIR/../../)
91--x
92-ZorbaBuildPath:=xs:string($RBKT_BINARY_DIR/../..)
93+ZorbaManifestPath:=xs:string($RBKT_BINARY_DIR/../../ZorbaManifest.xml)
94
95=== modified file 'test/rbkt/Queries/zorba/xqdoc/moduleDocumentation.xq'
96--- test/rbkt/Queries/zorba/xqdoc/moduleDocumentation.xq 2011-08-19 17:04:48 +0000
97+++ test/rbkt/Queries/zorba/xqdoc/moduleDocumentation.xq 2012-03-07 10:20:34 +0000
98@@ -2,85 +2,81 @@
99
100 import module namespace file = "http://expath.org/ns/file";
101 import module namespace xqd = "http://www.zorba-xquery.com/modules/xqdoc";
102+import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch";
103
104 import schema namespace xqdoc = "http://www.xqdoc.org/1.0";
105
106 declare namespace ann = "http://www.zorba-xquery.com/annotations";
107 declare namespace err = "http://www.w3.org/2005/xqt-errors";
108+declare namespace zm = "http://www.zorba-xquery.com/manifest";
109
110 declare copy-namespaces preserve, inherit;
111
112
113 (:~
114- : This variable contains the path to Zorba directory
115- :)
116-declare variable $ZorbaPath as xs:string external;
117-
118-(:~
119- : This variable contains the path to Zorba directory
120- :)
121-declare variable $ZorbaBuildPath as xs:string external;
122-
123-(:
124- : This function returns a sequence of valid PATHS where modules can be found:
125- : this includes the Zorba core modules path and also all the paths to the external modules that are checked out
126- :)
127-declare %ann:nondeterministic function local:get-src-dirs() as xs:string*
128+ : This variable contains the path to ZorbaManifestPath.xml
129+ :)
130+declare variable $ZorbaManifestPath as xs:string external;
131+
132+declare %private %ann:nondeterministic function local:load-manifest()
133 {
134- (: set the path to the Zorba core modules :)
135- let $ZorbaCoreModules := fn:resolve-uri(concat($ZorbaPath,"modules"))
136-
137- (: read from CMakeCache.txt the path where the external modules are checked out (if any) :)
138- let $ZorbaCMakeCache := fn:resolve-uri(concat($ZorbaBuildPath, file:directory-separator(), "CMakeCache.txt"))
139- let $ZorbaModulesDir := substring-before(tokenize(file:read-text($ZorbaCMakeCache),"ZORBA_MODULES_DIR:PATH=")[2],"
140-")
141- let $resolved := fn:resolve-uri($ZorbaModulesDir)
142- return
143- if (file:exists($resolved))
144- then
145- let $dirs := file:list(fn:resolve-uri($ZorbaModulesDir))
146- return( $ZorbaCoreModules,
147- for $dir in $dirs
148- let $file := fn:resolve-uri(concat($ZorbaModulesDir,file:directory-separator(),$dir,file:directory-separator(),"CMakeLists.txt"))
149- let $text := file:read-text($file)
150- let $as := fn:analyze-string($text, "ADD_SUBDIRECTORY\((.*?)\)")
151- let $match := replace($as/fn:match/fn:group[@nr eq 1],'"',"")
152- return fn:resolve-uri(concat($ZorbaModulesDir,file:directory-separator(),$dir,file:directory-separator(),$match)))
153- else ()
154+ try
155+ {
156+ fn:parse-xml(file:read-text($ZorbaManifestPath))
157+ }
158+ catch *
159+ {
160+ fn:error(fn:concat("The file <",$ZorbaManifestPath,"> does not have the correct structure."))
161+ }
162 };
163
164 (:~
165- : This function generates the XQDoc XML for all the modules found in
166- : <pre>$modulesPath</pre> and tests it for validity.
167+ : This function generates the XQDoc XML for all correctly configured in Zorba
168+ : (in other words all modules present in ZorbaManifest.xml) and checks if the modules are correctly documented.
169 :
170- : @param $modulePath where to search for modules recursively.
171 :)
172-declare %ann:nondeterministic function local:testXQDoc($modulesPath as xs:string) as xs:string?
173+declare %ann:sequential function local:testXQDoc() as xs:string?
174 {
175- variable $res :=
176- for $file in file:list(fn:resolve-uri($modulesPath), fn:true(), "*.xq")
177- let $filePath := fn:concat($modulesPath, file:directory-separator(), $file)
178- return
179- try {
180- let $xqdoc := xqd:xqdoc(file:path-to-uri($filePath))/self::xqdoc:xqdoc
181- let $moduleUri := data($xqdoc/xqdoc:module/xqdoc:uri)
182- return string-join(
183- if(($moduleUri = "http://www.w3.org/2005/xpath-functions") or
184- ($moduleUri = "http://www.w3.org/2005/xpath-functions/math") or
185- ($moduleUri = "http://www.functx.com/") or
186- ($moduleUri = "http://www.w3.org/2005/xqt-errors") or
187- ($moduleUri = "http://www.zorba-xquery.com/errors") or
188- ($moduleUri = "http://www.zorba-xquery.com/warnings")) then ()
189- else(
190- local:test-module($xqdoc),
191- local:test-functions($xqdoc),
192- local:test-variables($xqdoc)
193- ),"")
194- } catch * {
195+ if(not(file:is-file($ZorbaManifestPath))) then
196+ {
197+ variable $message := fn:concat("The file <ZorbaManifest.xml> was not found: <", $ZorbaManifestPath, ">. Suggestion: run 'cmake' in your build folder such that ZorbaManifest.xml is regenerated.");
198+ fn:error($message)
199+ }
200+ else
201+ {
202+ variable $manifestXML := local:load-manifest();
203+ variable $moduleManifests := $manifestXML/zm:manifest/zm:module;
204+ variable $res :=
205+ if(count($moduleManifests) eq xs:integer(0)) then ()
206+ else
207+ {
208+ for $module in $moduleManifests
209+ let $moduleURI := if(ends-with(data($module/zm:uri),".xq")) then substring-before(data($module/zm:uri),".xq") else data($module/zm:uri)
210+ let $moduleFetched := fetch:content($moduleURI, "MODULE")
211+ return
212+ try {
213+ let $xqdoc := xqd:xqdoc-content($moduleFetched)/self::xqdoc:xqdoc
214+ let $moduleUri := data($xqdoc/xqdoc:module/xqdoc:uri)
215+ return string-join(
216+ if(($moduleUri = "http://www.w3.org/2005/xpath-functions") or
217+ ($moduleUri = "http://www.w3.org/2005/xpath-functions/math") or
218+ ($moduleUri = "http://www.functx.com/") or
219+ ($moduleUri = "http://www.w3.org/2005/xqt-errors") or
220+ ($moduleUri = "http://www.zorba-xquery.com/errors") or
221+ ($moduleUri = "http://www.zorba-xquery.com/warnings")) then ()
222+ else(
223+ local:test-module($xqdoc),
224+ local:test-functions($xqdoc),
225+ local:test-variables($xqdoc)
226+ ),"")
227+ } catch * {
228 fn:concat("ERROR: ", $err:code, " Message: ", $err:description, "
229-processing file: ", $filePath)
230- };
231- string-join($res,"")
232+processing module: ", $moduleURI)
233+ }
234+ };
235+
236+ fn:string-join($res,"")
237+ }
238 };
239
240 declare function local:test-module($xqdoc as element(xqdoc:xqdoc)) as xs:string?
241@@ -201,8 +197,7 @@
242 };
243
244
245-variable $errors as xs:string := string-join(for $complete-dir in local:get-src-dirs()
246- return local:testXQDoc($complete-dir),"");
247+variable $errors as xs:string := local:testXQDoc();
248
249 variable $errorsCount := count(fn:analyze-string($errors,"ERROR:")//fn:match);
250

Subscribers

People subscribed via source and target branches