Darren Hoo | 11 Mar 11:23 2011

Re: How to get cedet work with global?

"Eric M. Ludlam" <eric <at> siege-engine.com> writes:

Hi Eric,
> It appears that in cedet/tests/cit-externaldb.el, the semanticdb lookup 
> test is not validating that the found tags points at a specific file. 
> It would be very useful if this change could be accompanied by an update 
> to make sure the discovered test tags are accompanied by a file location 
> so it does not regress.
> I also see the comments all say "gnu global" in the test procedure, when 
> the test is testing many types of databases.  That would be handy to fix 
> also.

I've added test to the integration test and made some trivial changes to 
the comments. 

the bzr diff output is as follows, Inline diff or attachments patch,
which one is prefered? I hope I did not break the rules here.

=== modified file 'semantic/semanticdb-find.el'
--- semantic/semanticdb-find.el	2011-03-10 20:21:50 +0000
+++ semantic/semanticdb-find.el	2011-03-11 10:10:31 +0000
 <at>  <at>  -899,8 +899,9  <at>  <at> 
 		;; Find-file-match allows a tool to make sure the tag is
 		;; 'live', somewhere in a buffer.
 		(cond ((eq find-file-match 'name)
-		       (let ((f (semanticdb-full-filename nametable)))
-			 (semantic--tag-put-property ntag :filename f)))
+		       (or (semantic--tag-get-property ntag :filename)
+			   (let ((f (semanticdb-full-filename nametable)))
+			     (semantic--tag-put-property ntag :filename f))))
 		      ((and find-file-match ntab)
 		       (semanticdb-get-buffer ntab))

=== modified file 'tests/cit-externaldb.el'
--- tests/cit-externaldb.el	2010-07-25 13:50:15 +0000
+++ tests/cit-externaldb.el	2011-03-11 10:05:40 +0000
 <at>  <at>  -106,7 +106,7  <at>  <at> 
-  "Test GNU Global tooling integration if it is available."
+  "Test external database tooling integration if it is available."
   (let ((bufftokill (find-file (cit-file "Project.ede"))))    

     ;; 1) Create
 <at>  <at>  -114,7 +114,7  <at>  <at> 
     ;; database.
     (funcall createfcn default-directory)

-    ;; 2) force ede's find file to use gnu global
+    ;; 2) force ede's find file to use external tool
     (require 'ede-locate)
     (let* ((ede-locate-setup-options (list edelocatesym))
 	   (base default-directory)
 <at>  <at>  -141,7 +141,7  <at>  <at> 
     ;; After removing the old locate system, restore the old one.

-    ;; 3) Look up tags with a GNU Global database
+    ;; 3) Look up tags with a external database
     (if semanticdbenablefcn
 	  (let ((killme (find-file (cit-file "src/main.cpp"))))
 <at>  <at>  -159,6 +159,11  <at>  <at> 
 		       (semanticdb-find-result-length res)))

+	      (dolist (tag (semanticdb-strip-find-results res 'name))
+		(if (not (semantic--tag-get-property tag :filename))
+		    (error "Tag %s does not point to a specific file."
+			   (semantic-tag-name tag))))
 	      (kill-buffer killme))))
       ;; else, message
       (message "Skipping %s database test : Nothing to test." symrefsym))
 <at>  <at>  -171,7 +176,7  <at>  <at> 
     ;; Do the tests again.

-    ;; Delete the GTAGS and other files.
+    ;; Delete the files created by external tool.
     (dolist (F cleanupfiles)
       (when (file-exists-p F)
 	(delete-file F)))

Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.