zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #05936
[Merge] lp:~zorba-coders/zorba/bug_871335 into lp:zorba
Sorin Marian Nasoi has proposed merging lp:~zorba-coders/zorba/bug_871335 into lp:zorba.
Requested reviews:
Chris Hillery (ceejatec)
Sorin Marian Nasoi (sorin.marian.nasoi)
Related bugs:
Bug #871062 in Zorba: "test/rbkt/zorba/xqdoc/moduleDocumentation failing on Windows"
https://bugs.launchpad.net/zorba/+bug/871062
Bug #871335 in Zorba: "correct moduleDocumentation for image modules"
https://bugs.launchpad.net/zorba/+bug/871335
For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug_871335/+merge/96307
- 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.
--
https://code.launchpad.net/~zorba-coders/zorba/bug_871335/+merge/96307
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'modules/com/zorba-xquery/www/modules/debugger/dbgp-message-handler.xq'
--- modules/com/zorba-xquery/www/modules/debugger/dbgp-message-handler.xq 2011-12-20 18:08:09 +0000
+++ modules/com/zorba-xquery/www/modules/debugger/dbgp-message-handler.xq 2012-03-07 08:35:24 +0000
@@ -15,6 +15,13 @@
: See the License for the specific language governing permissions and
: limitations under the License.
:)
+
+(:~
+ : Zorba debugger module.
+ :
+ : @author Gabriel Petrovay
+ : @project debugger
+ :)
module namespace dmh = "http://www.zorba-xquery.com/modules/debugger/dbgp-message-handler";
import module namespace base64 = "http://www.zorba-xquery.com/modules/converters/base64";
@@ -22,8 +29,10 @@
declare namespace ver = "http://www.zorba-xquery.com/options/versioning";
declare option ver:module-version "1.0";
-
-declare variable $dmh:endl as xs:string := "
+(:~
+ : Endline.
+ :)
+declare %private variable $dmh:endl as xs:string := "
";
(:~
@@ -236,7 +245,7 @@
return dmh:report-error(fn:concat("Command not implemented: ", $resp/@command))
};
-declare function dmh:process-init($init as element(init))
+declare %private function dmh:process-init($init as element(init))
{
fn:string-join(
("Established connection with", $init/@language, "client", $init/@appid),
@@ -244,6 +253,11 @@
)
};
+(:~
+ : Process one message received from the Zorba debugger server.
+ : @param $message the message.
+ : @return ().
+ :)
declare function dmh:process($message as element())
{
let $nodeName := fn:local-name($message)
=== modified file 'test/rbkt/Queries/CMakeLists.txt'
--- test/rbkt/Queries/CMakeLists.txt 2012-03-05 16:01:59 +0000
+++ test/rbkt/Queries/CMakeLists.txt 2012-03-07 08:35:24 +0000
@@ -38,15 +38,6 @@
# crashes on Windows: 866978, 866742 (fix 866978 before 866742)
zorba/HigherOrder/hof-101.xq
-
- # fails because of the image external module's broken documentation
- # If you try to submit something else to the external module, it will
- # fail because of this test.
- # If you try and mark it as expected failure here, the "expected failure"
- # will fail because the image module will not be tested and therefore the
- # module documentation test will succeed.
- # Created bug 871335 for this.
- zorba/xqdoc/moduleDocumentation.xq
)
# collect all chained test queries (suffix .cxq) in all subdirectories
=== modified file 'test/rbkt/Queries/zorba/xqdoc/moduleDocumentation.spec'
--- test/rbkt/Queries/zorba/xqdoc/moduleDocumentation.spec 2011-08-04 21:14:20 +0000
+++ test/rbkt/Queries/zorba/xqdoc/moduleDocumentation.spec 2012-03-07 08:35:24 +0000
@@ -1,5 +1,3 @@
Args:
-x
-ZorbaPath:=xs:string($RBKT_SRC_DIR/../../)
--x
-ZorbaBuildPath:=xs:string($RBKT_BINARY_DIR/../..)
+ZorbaManifestPath:=xs:string($RBKT_BINARY_DIR/../../ZorbaManifest.xml)
=== modified file 'test/rbkt/Queries/zorba/xqdoc/moduleDocumentation.xq'
--- test/rbkt/Queries/zorba/xqdoc/moduleDocumentation.xq 2011-08-19 17:04:48 +0000
+++ test/rbkt/Queries/zorba/xqdoc/moduleDocumentation.xq 2012-03-07 08:35:24 +0000
@@ -2,85 +2,81 @@
import module namespace file = "http://expath.org/ns/file";
import module namespace xqd = "http://www.zorba-xquery.com/modules/xqdoc";
+import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch";
import schema namespace xqdoc = "http://www.xqdoc.org/1.0";
declare namespace ann = "http://www.zorba-xquery.com/annotations";
declare namespace err = "http://www.w3.org/2005/xqt-errors";
+declare namespace zm = "http://www.zorba-xquery.com/manifest";
declare copy-namespaces preserve, inherit;
(:~
- : This variable contains the path to Zorba directory
- :)
-declare variable $ZorbaPath as xs:string external;
-
-(:~
- : This variable contains the path to Zorba directory
- :)
-declare variable $ZorbaBuildPath as xs:string external;
-
-(:
- : This function returns a sequence of valid PATHS where modules can be found:
- : this includes the Zorba core modules path and also all the paths to the external modules that are checked out
- :)
-declare %ann:nondeterministic function local:get-src-dirs() as xs:string*
+ : This variable contains the path to ZorbaManifestPath.xml
+ :)
+declare variable $ZorbaManifestPath as xs:string external;
+
+declare %private %ann:nondeterministic function local:load-manifest()
{
- (: set the path to the Zorba core modules :)
- let $ZorbaCoreModules := fn:resolve-uri(concat($ZorbaPath,"modules"))
-
- (: read from CMakeCache.txt the path where the external modules are checked out (if any) :)
- let $ZorbaCMakeCache := fn:resolve-uri(concat($ZorbaBuildPath, file:directory-separator(), "CMakeCache.txt"))
- let $ZorbaModulesDir := substring-before(tokenize(file:read-text($ZorbaCMakeCache),"ZORBA_MODULES_DIR:PATH=")[2],"
-")
- let $resolved := fn:resolve-uri($ZorbaModulesDir)
- return
- if (file:exists($resolved))
- then
- let $dirs := file:list(fn:resolve-uri($ZorbaModulesDir))
- return( $ZorbaCoreModules,
- for $dir in $dirs
- let $file := fn:resolve-uri(concat($ZorbaModulesDir,file:directory-separator(),$dir,file:directory-separator(),"CMakeLists.txt"))
- let $text := file:read-text($file)
- let $as := fn:analyze-string($text, "ADD_SUBDIRECTORY\((.*?)\)")
- let $match := replace($as/fn:match/fn:group[@nr eq 1],'"',"")
- return fn:resolve-uri(concat($ZorbaModulesDir,file:directory-separator(),$dir,file:directory-separator(),$match)))
- else ()
+ try
+ {
+ fn:parse-xml(file:read-text($ZorbaManifestPath))
+ }
+ catch *
+ {
+ fn:error(fn:concat("The file <",$ZorbaManifestPath,"> does not have the correct structure."))
+ }
};
(:~
- : This function generates the XQDoc XML for all the modules found in
- : <pre>$modulesPath</pre> and tests it for validity.
+ : This function generates the XQDoc XML for all correctly configured in Zorba
+ : (in other words all modules present in ZorbaManifest.xml) and checks if the modules are correctly documented.
:
- : @param $modulePath where to search for modules recursively.
:)
-declare %ann:nondeterministic function local:testXQDoc($modulesPath as xs:string) as xs:string?
+declare %ann:sequential function local:testXQDoc() as xs:string?
{
- variable $res :=
- for $file in file:list(fn:resolve-uri($modulesPath), fn:true(), "*.xq")
- let $filePath := fn:concat($modulesPath, file:directory-separator(), $file)
- return
- try {
- let $xqdoc := xqd:xqdoc(file:path-to-uri($filePath))/self::xqdoc:xqdoc
- let $moduleUri := data($xqdoc/xqdoc:module/xqdoc:uri)
- return string-join(
- if(($moduleUri = "http://www.w3.org/2005/xpath-functions") or
- ($moduleUri = "http://www.w3.org/2005/xpath-functions/math") or
- ($moduleUri = "http://www.functx.com/") or
- ($moduleUri = "http://www.w3.org/2005/xqt-errors") or
- ($moduleUri = "http://www.zorba-xquery.com/errors") or
- ($moduleUri = "http://www.zorba-xquery.com/warnings")) then ()
- else(
- local:test-module($xqdoc),
- local:test-functions($xqdoc),
- local:test-variables($xqdoc)
- ),"")
- } catch * {
+ if(not(file:is-file($ZorbaManifestPath))) then
+ {
+ 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.");
+ fn:error($message)
+ }
+ else
+ {
+ variable $manifestXML := local:load-manifest();
+ variable $moduleManifests := $manifestXML/zm:manifest/zm:module;
+ variable $res :=
+ if(count($moduleManifests) eq xs:integer(0)) then ()
+ else
+ {
+ for $module in $moduleManifests
+ let $moduleURI := if(ends-with(data($module/zm:uri),".xq")) then substring-before(data($module/zm:uri),".xq") else data($module/zm:uri)
+ let $moduleFetched := fetch:content($moduleURI, "MODULE")
+ return
+ try {
+ let $xqdoc := xqd:xqdoc-content($moduleFetched)/self::xqdoc:xqdoc
+ let $moduleUri := data($xqdoc/xqdoc:module/xqdoc:uri)
+ return string-join(
+ if(($moduleUri = "http://www.w3.org/2005/xpath-functions") or
+ ($moduleUri = "http://www.w3.org/2005/xpath-functions/math") or
+ ($moduleUri = "http://www.functx.com/") or
+ ($moduleUri = "http://www.w3.org/2005/xqt-errors") or
+ ($moduleUri = "http://www.zorba-xquery.com/errors") or
+ ($moduleUri = "http://www.zorba-xquery.com/warnings")) then ()
+ else(
+ local:test-module($xqdoc),
+ local:test-functions($xqdoc),
+ local:test-variables($xqdoc)
+ ),"")
+ } catch * {
fn:concat("ERROR: ", $err:code, " Message: ", $err:description, "
-processing file: ", $filePath)
- };
- string-join($res,"")
+processing module: ", $moduleURI)
+ }
+ };
+
+ fn:string-join($res,"")
+ }
};
declare function local:test-module($xqdoc as element(xqdoc:xqdoc)) as xs:string?
@@ -201,8 +197,7 @@
};
-variable $errors as xs:string := string-join(for $complete-dir in local:get-src-dirs()
- return local:testXQDoc($complete-dir),"");
+variable $errors as xs:string := local:testXQDoc();
variable $errorsCount := count(fn:analyze-string($errors,"ERROR:")//fn:match);
Follow ups
-
[Merge] lp:~zorba-coders/zorba/bug_871335 into lp:zorba
From: noreply, 2012-03-07
-
[Merge] lp:~zorba-coders/zorba/bug_871335 into lp:zorba
From: Zorba Build Bot, 2012-03-07
-
[Merge] lp:~zorba-coders/zorba/bug_871335 into lp:zorba
From: Zorba Build Bot, 2012-03-07
-
[Merge] lp:~zorba-coders/zorba/bug_871335 into lp:zorba
From: Sorin Marian Nasoi, 2012-03-07
-
Re: [Merge] lp:~zorba-coders/zorba/bug_871335 into lp:zorba
From: Sorin Marian Nasoi, 2012-03-07
-
[Merge] lp:~zorba-coders/zorba/bug_871335 into lp:zorba
From: Zorba Build Bot, 2012-03-07
-
Re: [Merge] lp:~zorba-coders/zorba/bug_871335 into lp:zorba
From: Zorba Build Bot, 2012-03-07
-
[Merge] lp:~zorba-coders/zorba/bug_871335 into lp:zorba
From: Sorin Marian Nasoi, 2012-03-07
-
Re: [Merge] lp:~zorba-coders/zorba/bug_871335 into lp:zorba
From: Chris Hillery, 2012-03-07
-
Re: [Merge] lp:~zorba-coders/zorba/bug_871335 into lp:zorba
From: Sorin Marian Nasoi, 2012-03-07