[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/merge-cedet-tests 644d6ca 278/316: Test external d
From: |
Edward John Steere |
Subject: |
[Emacs-diffs] scratch/merge-cedet-tests 644d6ca 278/316: Test external database tools. |
Date: |
Sat, 28 Jan 2017 09:10:11 +0000 (UTC) |
branch: scratch/merge-cedet-tests
commit 644d6ca29e9651a04d8723ec8877e64fb1c15ba7
Author: zappo <address@hidden>
Commit: Edward John Steere <address@hidden>
Test external database tools.
---
test/manual/cedet/cit-externaldb.el | 174 +++++++++++++++++++++++++++++++++++
1 file changed, 174 insertions(+)
diff --git a/test/manual/cedet/cit-externaldb.el
b/test/manual/cedet/cit-externaldb.el
new file mode 100644
index 0000000..9c3d8c2
--- /dev/null
+++ b/test/manual/cedet/cit-externaldb.el
@@ -0,0 +1,174 @@
+;;; cit-global.el ---
+;;
+;; Copyright (C) 2010 Eric M. Ludlam
+;;
+;; Author: Eric M. Ludlam <address@hidden>
+;; X-RCS: $Id: cit-externaldb.el,v 1.1 2010-06-13 01:12:50 zappo Exp $
+;;
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program; see the file COPYING. If not, write to
+;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+;;
+;; Test GNU Global functionality against the current project.
+;;
+;; 1) Create a database
+;; 2) Test the find-file feature
+;; 3) Test the tag lookup feature.
+;; 4) Test the symbol references lookup via symref
+
+(require 'cit-symref)
+
+;;; Code:
+
+(defvar cit-externaldb-files-to-find
+ '(("foo.hpp" . "include/foo.hpp")
+ ("bar.cpp" . "src/bar.cpp")
+ ;("elfoo.el" . "src/elfoo.el")
+ ;("foodoc.texi" . "src/foodoc.texi")
+ ;("DNE.cpp" . "doesnotexist.cpp")
+ )
+ "List of file names to lookup and their locations.")
+
+(defvar cit-external-db-tool-list
+ '( (global ;; 0 tool name (used by symref)
+ cedet-global ;; 1 library support for tool
+ cedet-gnu-global-version-check ;; 2 version check
+ cedet-gnu-global-gtags-call ;; 3 create a db
+ ede-locate-global ;; 4 ede locate tool name
+ semanticdb-global ;; 5 database src file
+ semanticdb-enable-gnu-global-in-buffer ;; 6 enable db in a buffer
+ semanticdb-table-global ;; 7 the database type
+ ( "GTAGS" "GPATH" "GSYMS" "GRTAGS" ) ;; 8 files created
+ )
+ (idutils ;; 0 tool name (used by symref)
+ cedet-idutils ;; 1 library support for tool
+ cedet-idutils-version-check ;; 2 version check
+ cedet-idutils-mkid-call ;; 3 create a db
+ ede-locate-idutils ;; 4 ede locate tool name
+ nil ;; 5 database src file
+ nil ;; 6 enable db in a buffer
+ nil ;; 7 the database type
+ ( "ID" ) ;; 8 files created
+ )
+ (cscope ;; 0 tool name (used by symref)
+ cedet-cscope ;; 1 library support for tool
+ cedet-cscope-version-check ;; 2 version check
+ cedet-cscope-create ;; 3 create a db
+ ede-locate-cscope ;; 4 ede locate tool name
+ nil ;; 5 database src file
+ nil ;; 6 enable db in a buffer
+ nil ;; 7 the database type
+ ( "cscope.out" "cscope.files") ;; 8 files created
+ )
+
+ )
+ "Different external DB tools to test.")
+
+(defun cit-externaldb-test ()
+ "Test the external database tools."
+ (dolist (TOOL cit-external-db-tool-list)
+ ;; Pull in the tool libraries needed
+ (require (nth 1 TOOL))
+ (when (nth 5 TOOL) (require (nth 5 TOOL)))
+
+ ;; Check the tool
+ (if (not (funcall (nth 2 TOOL) t))
+ (progn
+ (message "Skipping %s test." (nth 0 TOOL))
+ (sit-for 1))
+
+ ;; Call to test this instance.
+ (cit-gnu-externaldb-test-one (nth 0 TOOL)
+ (nth 3 TOOL)
+ (nth 4 TOOL)
+ (nth 6 TOOL)
+ (nth 7 TOOL)
+ (nth 8 TOOL)
+ ))))
+
+(defun cit-gnu-externaldb-test-one (symrefsym
+ createfcn
+ edelocatesym
+ semanticdbenablefcn
+ semanticdbclass
+ cleanupfiles)
+ "Test GNU Global tooling integration if it is available."
+ (let ((bufftokill (find-file (cit-file "Project.ede"))))
+
+ ;; 1) Create
+ ;; We are at the root of the created CIT project. Lets create a
+ ;; database.
+ (funcall createfcn nil)
+
+ ;; 2) force ede's find file to use gnu global
+ (let* ((ede-locate-setup-options (list edelocatesym))
+ (base default-directory)
+ (fname nil))
+
+ (dolist (F cit-externaldb-files-to-find)
+ (let* ((raw (ede-expand-filename (ede-current-project) (car F)))
+ (expect (cdr F))
+ (result (when (stringp raw)
+ (file-relative-name raw default-directory))))
+
+ (when (not (string= result expect))
+ (error "%s: Expected %s; Found %s" symrefsym expect result))
+ ))
+ )
+ (let ((fail (ede-expand-filename (ede-current-project)
"doesnotexist.cpp")))
+ (if fail
+ (error "%s TEST: Found a file that shouldn't exist." symrefsym)))
+
+ ;; 3) Look up tags with a GNU Global database
+ (if semanticdbenablefcn
+ (save-excursion
+ (let ((killme (find-file (cit-file "src/main.cpp"))))
+ (funcall semanticdbenablefcn)
+
+ (let ((res (semanticdb-find-tags-by-name "doSomethingPublic")))
+
+ ;; There is only one database result because we never enabled
+ ;; semanticdb minor mode.
+ (if (not (object-of-class-p (car (car res)) semanticdbclass))
+ (error "Did not find %s results table." symrefsym))
+
+ (when (/= (semanticdb-find-result-length res) 1)
+ (error "%s should find 1 tag, found %d"
+ symrefsym
+ (semanticdb-find-result-length res)))
+
+ (kill-buffer killme))))
+ ;; else, message
+ (message "Skipping %s database test : Nothing to test." symrefsym))
+
+ ;; 4) Symref symbol lookup via our external tool
+ (setq semantic-symref-tool 'detect)
+ (when (not (eq (semantic-symref-detect-symref-tool) symrefsym))
+ (error "Symref doesn't recognize %s backend." symrefsym))
+
+ ;; Do the tests again.
+ (cit-symref-quick-find-test)
+
+ ;; Delete the GTAGS and other files.
+ (dolist (F cleanupfiles)
+ (when (file-exists-p F)
+ (delete-file F)))
+
+ (kill-buffer bufftokill)))
+
+(provide 'cit-externaldb)
+
+;;; cit-externaldb.el ends here
- [Emacs-diffs] scratch/merge-cedet-tests 152728b 238/316: New make-type argument to control which include, (continued)
- [Emacs-diffs] scratch/merge-cedet-tests 152728b 238/316: New make-type argument to control which include, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests bff505d 132/316: Synchronize cedet/semantic with Emacs., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests ef97bdd 203/316: (cedet-utest-batch): Disable saving EDE's cache file., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests c561582 298/316: Improve test utilities, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 9ab6e1b 270/316: Emacs Lisp support for cedet integration tests., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 5cc7300 264/316: Synchronize cedet/semantic with Emacs., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 0caf48a 302/316: Improve test output, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 975468f 275/316: Add header comments and provide., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 60a3f4b 299/316: (semantic-ia-utest-file-list): add testwisent.wy, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests e492fd9 301/316: (semantic-ia-utest-file-list): Add testunion.cpp., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 644d6ca 278/316: Test external database tools.,
Edward John Steere <=
- [Emacs-diffs] scratch/merge-cedet-tests 9cac087 281/316: Remove obsolete cvs-auto-updated 'X-RCS' line., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 7eeab10 240/316: (cit-remove-and-do-shared-lib): Enable for use with Make projects too. Create the srcs in a new lib directory., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests a4e395c 156/316: Add a final call to ede list sanity check, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 6d5a631 277/316: Add header comments and provide., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests bef87bf 290/316: Make unit tests use randomized file names, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 47d9c79 295/316: Moved tests about, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 02c7dbb 310/316: Move tests in cedet/semantic, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 0a0dd27 167/316: Test typedef which has the keyword "class" included, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests dfddc2d 262/316: (cit-make-dist): Use cit-check-compilation-for-error., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests da4dd24 253/316: New test for testing ede/cpp-root projects., Edward John Steere, 2017/01/28