JavaTestsLoader.st
changeset 2353 fa7400d022a0
parent 2152 1cbdfbcc685c
child 2380 9195eccdcbd9
child 2396 fadc6d7a2f5b
--- a/JavaTestsLoader.st	Sat Feb 02 01:23:18 2013 +0100
+++ b/JavaTestsLoader.st	Sat Feb 16 19:08:45 2013 +0100
@@ -1,11 +1,11 @@
 "
  COPYRIGHT (c) 1996-2011 by Claus Gittinger
+
+ New code and modifications done at SWING Research Group [1]:
+
  COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
                             SWING Research Group, Czech Technical University in Prague
 
- Parts of the code written by Claus Gittinger are under following
- license:
-
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
  inclusion of the above copyright notice.   This software may not
@@ -13,31 +13,10 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 
- Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
-
- Permission is hereby granted, free of charge, to any person
- obtaining a copy of this software and associated documentation
- files (the 'Software'), to deal in the Software without
- restriction, including without limitation the rights to use,
- copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following
- conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- OTHER DEALINGS IN THE SOFTWARE.
-
- [1] Code written at SWING Research Group contain a signature
-     of one of the above copright owners.
+ [1] Code written at SWING Research Group contains a signature
+     of one of the above copright owners. For exact set of such code,
+     see the differences between this version and version stx:libjava
+     as of 1.9.2010
 "
 "{ Package: 'stx:libjava' }"
 
@@ -53,12 +32,12 @@
 copyright
 "
  COPYRIGHT (c) 1996-2011 by Claus Gittinger
+
+ New code and modifications done at SWING Research Group [1]:
+
  COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
                             SWING Research Group, Czech Technical University in Prague
 
- Parts of the code written by Claus Gittinger are under following
- license:
-
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
  inclusion of the above copyright notice.   This software may not
@@ -66,31 +45,10 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 
- Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
-
- Permission is hereby granted, free of charge, to any person
- obtaining a copy of this software and associated documentation
- files (the 'Software'), to deal in the Software without
- restriction, including without limitation the rights to use,
- copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following
- conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- OTHER DEALINGS IN THE SOFTWARE.
-
- [1] Code written at SWING Research Group contain a signature
-     of one of the above copright owners.
+ [1] Code written at SWING Research Group contains a signature
+     of one of the above copright owners. For exact set of such code,
+     see the differences between this version and version stx:libjava
+     as of 1.9.2010
 
 "
 ! !
@@ -99,8 +57,7 @@
 
 buildSuiteForLibjava
 
-    ^self buildSuiteFrom: 
-        (self loadLibjava)
+    ^(self buildSuiteFrom: (self loadLibjava)) name: 'stx:libjava Test Suite'
 
     "
         JavaTestsLoader buildSuiteForLibjava
@@ -111,8 +68,7 @@
 
 buildSuiteForMauve
 
-    ^self buildSuiteFrom: 
-        (self loadMauve)
+    ^(self buildSuiteFrom: (self loadMauve)) name: 'Mauve Test Suite'
 
     "
         JavaTestsLoader buildSuiteForMauve
@@ -145,7 +101,7 @@
 load:testdir 
     |base dirs|
 
-    base := (UserPreferences current javaTestsDirectory asFilename / testdir) 
+    base := ((Smalltalk getPackageDirectoryForPackage: #stx:libjava) / 'test' / testdir) 
                 pathName.
     dirs := JavaTestsResource classpath 
                 select:[:each | each startsWith:base ].
@@ -153,19 +109,21 @@
 
     "
         JavaTestsLoader load: 'libjava'"
+
     "Created: / 07-05-2011 / 18:40:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 22-01-2013 / 23:27:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaTestsLoader class methodsFor:'loading - test suites'!
 
 loadLibjava
-    |cp|
-
+    | cp |
     JavaTestsResource new setUp.
     cp := JavaTestsResource classpathForLibjava.
-    ^self loadIn: cp
+    ^ self loadIn: cp
 
     "Created: / 21-06-2011 / 17:35:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (format): / 03-11-2011 / 10:17:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
 !
 
 loadMauve
@@ -223,9 +181,8 @@
 
     classes do:
         [:jclass|
-        (jclass ~~ (Java at:'stx.libjava.tests.JUnit3Tests')
-            and:[jclass ~~ (Java at:'stx.libjava.tests.JUnit4Tests')
-                and:[jclass isTestCaseLike]])
+        ((self ignoredTestCaseNames includes: jclass name) not
+                and:[jclass isTestCaseLike])
                     ifTrue:
                         [ | tc |
                         tc := jclass asTestCase.
@@ -234,13 +191,30 @@
                                                 ].
                         tc isAbstract ifFalse:[javaTestCases add:tc ]]].
 
+    javaTestCases sort:[:a :b| a name < b name ].
+
     javaTestCases do:
                 [:each | 
                 suite addTests:each buildSuite tests ].
 
     ^suite
 
-    "Modified: / 21-06-2011 / 17:39:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 23-07-2012 / 20:12:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+ignoredTestCaseNames
+    "Return an array of java slashed class names to be ignored when
+     building testsuite"
+
+    ^#(
+        #'stx/libjava/tests/JUnit3Tests'
+        #'stx/libjava/tests/JUnit4Tests'
+
+        "Fails because of broken finalization, ignore for now.."
+        #'gnu/testlet/java/nio/channels/FileChannel/manyopen'
+    )
+
+    "Created: / 23-07-2012 / 20:06:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 loadIn: directories
@@ -250,21 +224,20 @@
     "Created: / 11-06-2011 / 16:05:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-loadIn: directories matching: pattern
-
+loadIn: directories matching: pattern 
     | classes |
-    
-    JavaInitializedResource new setUp.  
+
+    JavaInitializedResource new setUp.
     JavaLibrariesResource new setUp.
     JavaTestsResource new setUp.
     classes := OrderedCollection new.
-
-    directories do:
-            [:each|
-            each asFilename exists ifTrue:
-                [classes addAll: (JavaClassReader loadClassesIn: each matching: pattern)]].
-
-    ^classes
+    directories do: [
+        :each | 
+        each asFilename exists ifTrue: [
+            classes addAll: (JavaVM loadClassesIn: each matching: pattern)
+        ]
+    ].
+    ^ classes
 
     "Created: / 11-06-2011 / 16:05:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 20-06-2011 / 19:02:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -272,6 +245,16 @@
 
 !JavaTestsLoader class methodsFor:'documentation'!
 
+version_CVS
+    ^ '$Header: /cvs/stx/stx/libjava/JavaTestsLoader.st,v 1.2 2013-02-16 18:08:32 vrany Exp $'
+!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+!
+
 version_SVN
-    ^ '$Id: JavaTestsLoader.st,v 1.1 2011-08-18 19:06:53 vrany Exp $'
+    ^ '§Id§'
 ! !
+