[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/merge-cedet-tests 9c2d002 145/316: Added cpproot a
From: |
Edward John Steere |
Subject: |
[Emacs-diffs] scratch/merge-cedet-tests 9c2d002 145/316: Added cpproot and java root to detection tests |
Date: |
Sat, 28 Jan 2017 09:09:55 +0000 (UTC) |
branch: scratch/merge-cedet-tests
commit 9c2d002a0b99bb53eb7474a002b724ca82635814
Author: Eric Ludlam <address@hidden>
Commit: Edward John Steere <address@hidden>
Added cpproot and java root to detection tests
* test/manual/cedet/cedet/ede/detect-utest.el:
(ede-detect-utest-project-list): Add cpproot and javaroot. Add sub
dirs under project and automake types. (ede-detect-utest-basedir):
New function (UTESTCPP, UTESTJAVA): New. (ede-detect-utest): Improve
debug output for failed tests. (ede-detect-utest-subproj-p,
ede-detect-utest-subautomake-p): New.
---
test/manual/cedet/cedet/ede/detect-utest.el | 98 ++++++++++++++++++++++++---
1 file changed, 87 insertions(+), 11 deletions(-)
diff --git a/test/manual/cedet/cedet/ede/detect-utest.el
b/test/manual/cedet/cedet/ede/detect-utest.el
index 41ecb5e..ca9aa71 100644
--- a/test/manual/cedet/cedet/ede/detect-utest.el
+++ b/test/manual/cedet/cedet/ede/detect-utest.el
@@ -23,7 +23,9 @@
(defvar ede-detect-utest-project-list
'(
+ ( "src/proj/sub/TEST" . ede-detect-utest-subproj-p )
( "src/proj/Project.ede" . ede-proj-project-p )
+ ( "src/automake/sub/Makefile.am" . ede-detect-utest-subautomake-p)
( "src/automake/Makefile.am" . project-am-makefile-p )
( "src/android/AndroidManifest.xml" . ede-android-project-p )
( "src/android/src/test.java" . ede-android-project-p )
@@ -32,11 +34,33 @@
;( "src/ant/build.xml" . ede-ant-project-p )
( "src/linux/Makefile" . ede-linux-project-p )
( "src/linux/scripts/ver_linux" . ede-linux-project-p )
+ ;; these ROOT projects are created by hand in a .emacs file.
+ ;; These need to be defined in here to get this test to work.
+ ( "src/cpproot/src/main.cpp" . ede-cpp-root-project-p )
+ ( "src/cpproot/README" . ede-cpp-root-project-p )
+ ( "src/javaroot/com/test/Foo.Java" . ede-java-root-project-p )
+ ( "src/javaroot/README" . ede-java-root-project-p )
)
"List of sources to load in ndetectable projects.
Each entry is a cons cell:
( SRCFILE . PROJECT-TYPE )")
+(defun ede-detect-utest-basedir ()
+ "Get the basedir of the detection unit tests."
+ (save-current-buffer
+ (set-buffer (semantic-find-file-noselect
+ (expand-file-name "cedet/ede/detect.el"
+ cedet-utest-root)))
+ (expand-file-name "src" default-directory)))
+
+(ede-cpp-root-project "UTESTCPP"
+ :file (expand-file-name "cpproot/README"
+ (ede-detect-utest-basedir)))
+
+(ede-java-root-project "UTESTJAVA"
+ :file (expand-file-name "javaroot/README"
+ (ede-detect-utest-basedir)))
+
;;;###autoload
(defun ede-detect-utest ()
"Test out the detection scheme for EDE."
@@ -47,12 +71,16 @@ Each entry is a cons cell:
(project-linux-build-directory-default 'same)
(project-linux-architecture-default "glnx")
(ede-project-directories t) ; safe to load Project.ede
+ (basedir nil)
+ (baselen nil)
)
(cedet-utest-log-setup "EDE DETECT")
(set-buffer (semantic-find-file-noselect
(expand-file-name "cedet/ede/detect.el"
cedet-utest-root)))
+ (setq basedir default-directory
+ baselen (length basedir))
(dolist (fl ede-detect-utest-project-list)
@@ -68,17 +96,52 @@ Each entry is a cons cell:
(set-buffer b)
;; Run the EDE detection code. Firing up the mode isn't really
needed.
- (ede-initialize-state-current-buffer)
-
- ;; Test the result.
- (unless (funcall (cdr fl) ede-object-root-project)
-
- (message "Found %S, wanted %S"
- ede-object-root-project
- (cdr fl))
-
- (push fl errlog))
- )
+ (condition-case err
+ (ede-initialize-state-current-buffer)
+ (error
+ (semantic-ia-utest-log "!! In %s: load threw error %S\n"
+ (substring default-directory baselen)
+ err)
+ (push fl errlog)
+ ))
+
+ (let* ((proj ede-object-root-project))
+
+ (if (not proj)
+ (progn
+
+ ;; Use the detector to to provide better debugging info.
+ (let ((projdetect (ede-detect-directory-for-project
default-directory)))
+
+ (if (not projdetect)
+ (progn
+ ;; Detected nothing
+ (semantic-ia-utest-log "!! In %s: Detected
nothing, wanted %S\n"
+ (substring
default-directory baselen)
+ (cdr fl))
+ (push fl errlog))
+
+ ;; Else, some other error.
+ (semantic-ia-utest-log "!! In %s: Detected %S, failed
to load project type %s\n"
+ (substring default-directory
baselen)
+ (eieio-object-name (cdr
projdetect))
+ (cdr fl))
+ (push fl errlog))))
+
+ ;; Test the result.
+ (if (funcall (cdr fl) proj)
+
+ (semantic-ia-utest-log "** In %s: Found %s ... Done\n"
+ (substring default-directory baselen)
+ (cdr fl))
+
+ (semantic-ia-utest-log "!! In %s: Found %S, wanted %S\n"
+ (substring default-directory baselen)
+ (eieio-object-name proj)
+ (cdr fl))
+
+ (push fl errlog))
+ )))
;; If it wasn't already in memory, whack it.
(when (and b (not fb))
@@ -96,6 +159,19 @@ Each entry is a cons cell:
)
+(defun ede-detect-utest-subproj-p (project)
+ "Special predicate for testing the ede-proj-project type."
+ (and (ede-proj-project-p project)
+ (string= (file-name-nondirectory (directory-file-name (oref project
directory))) "proj")
+ (not (eq project (ede-current-project)))
+ ))
+
+(defun ede-detect-utest-subautomake-p (project)
+ "Special predicate for testing the ede-proj-project type."
+ (and (project-am-makefile project)
+ (string= (file-name-nondirectory (directory-file-name (oref project
directory))) "automake")
+ (not (eq project (ede-current-project)))
+ ))
(provide 'cedet/ede/detect-utest)
- [Emacs-diffs] scratch/merge-cedet-tests 702d44d 139/316: Fix how the target file name is created, (continued)
- [Emacs-diffs] scratch/merge-cedet-tests 702d44d 139/316: Fix how the target file name is created, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 7b417f2 131/316: Tests contributed by Barry OReilly, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests a3da4e8 121/316: Added new file to test completion on STL classes and namespace., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 309ef34 124/316: Move tests in cedet/semantic, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests ae78cf0 140/316: Tests: Add ERT test for the C Bovinator, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 39048f9 153/316: (ede-detect-utest): Re-run tests with inode optimization disabled., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests af4eb43 149/316: Additions to generic project testing, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 614a6bb 044/316: Synchronize base 'cedet/ede' with Emacs, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests a375d40 093/316: ("cit"): Give it a new name. (Misc): New target., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests b0da906 144/316: New unit test for EDE project detection., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 9c2d002 145/316: Added cpproot and java root to detection tests,
Edward John Steere <=
- [Emacs-diffs] scratch/merge-cedet-tests 47c4081 165/316: sample lib srces for dirmatch tests., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests ef840da 159/316: compdb: add project detection tests, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 8c4e7fd 111/316: Added arduino and better suggestions, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 6945c33 126/316: Expand preprocessor to handle macros which open or close scope., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 89526ab 134/316: Move tests in cedet/semantic, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 0e41dab 116/316: Move tests in cedet/semantic, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 8ba639f 150/316: (ede-detect-utest-project-list): Add jvm-base projects for ant, lein, maven, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 284144e 154/316: Fixes for test execution, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests fa54ec1 162/316: (isFooLike, A, B, main2): New test tweaked from example by Liang Wang, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests cebc72c 228/316: Make unit tests use randomized file names, Edward John Steere, 2017/01/28