Bug 172820 - Hard-coded class libraries names in org/eclipse/jdt/core/tests/util/Util.java
Summary: Hard-coded class libraries names in org/eclipse/jdt/core/tests/util/Util.java
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.3 RC2   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-02-04 22:31 EST by Sean Qiu CLA
Modified: 2007-07-05 08:18 EDT (History)
1 user (show)

See Also:


Attachments
The patch contains the simple workaround described above (3.59 KB, patch)
2007-05-21 07:23 EDT, Nina Rinskaya CLA
no flags Details | Diff
Updated patch for 3.3 stream. (1.95 KB, patch)
2007-05-22 09:44 EDT, Frederic Fusier CLA
no flags Details | Diff
Updated patch with DRLVMLauncher class (8.31 KB, patch)
2007-05-23 05:33 EDT, Nina Rinskaya CLA
no flags Details | Diff
Updated patch with DRLVMLauncher class for 3.3 stream (6.53 KB, patch)
2007-05-24 05:22 EDT, Frederic Fusier CLA
no flags Details | Diff
Updated patch with DRLVMLauncher class for 3.3 stream (update contributor) (7.24 KB, patch)
2007-05-24 06:48 EDT, Frederic Fusier CLA
no flags Details | Diff
Failures while running regression.TestAll (62.15 KB, text/plain)
2007-05-24 10:27 EDT, Frederic Fusier CLA
no flags Details
Patch fixes Harmony classpath issue (1.63 KB, patch)
2007-07-05 04:13 EDT, Nina Rinskaya CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sean Qiu CLA 2007-02-04 22:31:52 EST
In the function "public static String[] getJavaClassLibs()", it will get the class library path according to the name of vm. But Harmony (harmony.apache.org) class library use J9 VM (modified version but with the same vm name as J9) and DRLVM, While their class library is neither in jre/lib/rt.jar or jre/lib/jclMax/classes.zip. The class library deployed in lib/boot/*.jar.

It will make the test all fail because the test can not locate the library's class.
So could you refactor the function to let it support the harmony's class library?

// Line 499 of Util.java

       if ("DRLVM".equals(vmName)) {
             FilenameFilter jarFilter = new FilenameFilter() {
                 public boolean accept(File dir, String name) {
                         return name.endsWith(".jar") &
!name.endsWith("-src.jar");
                 }
           };
           String[] jars = new File(jreDir + "/lib/boot/").list(jarFilter);
             for (int i = 0; i < jars.length; i++) {
               jars[i] = toNativePath(jreDir + "/lib/boot/" + jars[i]);
           }
             return jars;
       }


	if ("J9".equals(vmName)) {
                if (vm is from harmony)
                   add harmony's classlib jars in to the path.

                else{
		   in deed IBM JDK
                return path;                
	}

Thanks.
Comment 1 Nina Rinskaya CLA 2007-05-21 07:23:33 EDT
Created attachment 67967 [details]
The patch contains the simple workaround described above

The patch attached contains a simple workaround described above, it deals with several methods from org/eclipse/jdt/core/tests/compiler, org/eclipse/jdt/core/tests/runtime, org/eclipse/jdt/core/tests/util that use hard-coded class library path that doesn't work for Apache Harmony.
Comment 2 Frederic Fusier CLA 2007-05-21 09:52:34 EDT
I can only put this change in 3.3 stream as there's no 3.2.3 target...
Is it ok for you ?
Comment 3 Frederic Fusier CLA 2007-05-22 09:44:13 EDT
Created attachment 68111 [details]
Updated patch for 3.3 stream.

Please let me know if this patch would be ok for you
Comment 4 Frederic Fusier CLA 2007-05-23 05:09:49 EDT
Nina, can you let me know if the updated patch will be ok for you?
Comment 5 Nina Rinskaya CLA 2007-05-23 05:31:46 EDT
Sorry for the delay, I've figured out that it's not so good to use SideCarVMLauncher to launch DRLVM (because on Linux it has only "java" binary, not "javaw"). Could you please look at the patch that I'm attaching below with a DRLVMLauncher class that does just the same thing as for SideCar, but with "java" binary? Thanks!
Comment 6 Nina Rinskaya CLA 2007-05-23 05:33:09 EDT
Created attachment 68301 [details]
Updated patch with DRLVMLauncher class

I'm attaching the updated patch with DRLVMLauncher class.
Comment 7 Frederic Fusier CLA 2007-05-24 05:22:09 EDT
Created attachment 68528 [details]
Updated patch with DRLVMLauncher class for 3.3 stream

With this patch, compiler tests are now able to run and get class libs correctly. 

However, there still some failures which I think are already covered by other bugs. Nina, it would be great if you can confirm this assumption and put other bugs references here, thanks
Comment 8 Frederic Fusier CLA 2007-05-24 06:48:03 EDT
Created attachment 68539 [details]
Updated patch with DRLVMLauncher class for 3.3 stream (update contributor)

Same patch but adding the real contributor in copyrights comments
Comment 9 Frederic Fusier CLA 2007-05-24 06:48:49 EDT
Cancel the review as the changes is only in tests...
Comment 10 Nina Rinskaya CLA 2007-05-24 07:25:09 EDT
(In reply to comment #7)
> Created an attachment (id=68528) [details]
> Updated patch with DRLVMLauncher clas for 3.3 stream
> 
> With this patch, compiler tests are now able to run and get class libs
> correctly. 
> 
> However, there still some failures which I think are already covered by other
> bugs. Nina, it would be great if you can confirm this assumption and put other
> bugs references here, thanks
> 


Frédéric, thank you for the patch! Do you mean the failures in compiler suite run on Apache Harmony or the failures on another JRE? Thanks. 
Comment 11 Frederic Fusier CLA 2007-05-24 07:34:38 EDT
(In reply to comment #10)
> Frédéric, thank you for the patch! Do you mean the failures in compiler suite
> run on Apache Harmony or the failures on another JRE? Thanks. 
> 
I meant compiler test suite RunAllCompilerTests run on Apache Harmony JRE using stable build 5.0M1...
Comment 12 Nina Rinskaya CLA 2007-05-24 09:20:59 EDT
(In reply to comment #11)
> (In reply to comment #10)
> > Frédéric, thank you for the patch! Do you mean the failures in compiler suite
> > run on Apache Harmony or the failures on another JRE? Thanks. 
> > 
> I meant compiler test suite RunAllCompilerTests run on Apache Harmony JRE using
> stable build 5.0M1...
> 

Yes, you are right, there are several bugs (both against Apache Harmony and Eclipse Unit Tests) that affects jdtcorecompiler suite (we actually use Eclipse and EUT 3.2), as far as I know they are:

(Eclipse issues)

1. https://bugs.eclipse.org/bugs/show_bug.cgi?id=188103, fixed in 3.3RC2 couples days ago, affected 58 tests in org.eclipse.jdt.core.tests.compiler.regression.TestAll suite.

2. https://bugs.eclipse.org/bugs/show_bug.cgi?id=188127, also recently fixed in 3.3RC2, affected 27 tests from org.eclipse.jdt.core.tests.eval suite

(Harmony issues)

3. http://issues.apache.org/jira/browse/HARMONY-3054, open, intermittently crashes org.eclipse.jdt.core.tests.compiler.regression.TestAll and org.eclipse.jdt.core.tests.compiler.parser.TestAll 

4. http://issues.apache.org/jira/browse/HARMONY-2914, open, file handlers waste/leak on Linux while opening zip/jar files, intermittently crashes org.eclipse.jdt.core.tests.compiler.regression.TestAll if open files limit is set to default value.

You might probably get another failures when running EUT 3.3 version. If you could give then the logs, we could see whether these are known issues or not. Thank you again!
Comment 13 Frederic Fusier CLA 2007-05-24 10:27:23 EDT
Created attachment 68579 [details]
Failures while running regression.TestAll

Here are the 16 remaining failures I got while running the 4308 tests of org.eclipse.jdt.core.tests.compiler.regression.TestAll test suite...

Note that I also got several unexpected terminaiton in the middle of the test:
<terminated, exit value: -1073741819>C:\JDKs\harmony\1.5.0\jre\bin\javaw.exe (May 24, 2007 3:35:52 PM)	

But sounds like a know bug on your side (point 3).
Comment 14 Frederic Fusier CLA 2007-05-24 10:33:59 EDT
Released for 3.3 RC2
Comment 15 David Audel CLA 2007-05-25 06:42:38 EDT
Verified for 3.3 RC2 using build I20070525-0010
Comment 16 Nina Rinskaya CLA 2007-05-25 06:49:21 EDT
Frédéric, thank you for the logs, I'll investigate these failures and I'll let you know if there are any issues similar to this one (e.g., JRE implementation dependency).

Thanks again for you help.
Comment 17 Nina Rinskaya CLA 2007-07-05 04:12:04 EDT
I would like to get back to this issue because that the patch that I suggested is not quite correct: it composes the classpath for Apache Harmony by collecting all jars from $JRE/lib/boot, but it's not quite correct. The better way is to collect all jars from System.getProperty("sun.boot.class.path") - this is where Harmony stores its classpath entries. Otherwise some stub jars from $JRE/lib/boot that are not supposed to be used are put to the classpath, and the $JRE/bin/default/kernel.jar that introduces almost all kernel API is missed. In this case some Eclipse Automated tests fail (org.eclipse.jdt.core.tests.compiler.regression.GenericTypeTest.test0641 - 1.5, org.eclipse.jdt.core.tests.compiler.regression.GenericTypeTest.test0800 - 1.5) because Eclipse compiler uses this wrong classpath. 

The same issue for org/eclipse/jdt/internal/compiler/batch/Main.java was fixed in https://bugs.eclipse.org/bugs/show_bug.cgi?id=188648 - please see the patch attached to this issue, it looks to resolve the classpath correctly. But some tests call org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.getDefaultClassPaths() to compose the classpath for compiler and sometimes the stub jar-s in the classpath cause incorrect behavior.

I'm attaching the simple patch that substitutes correct classpath for Harmony, but could you also please review the patch for https://bugs.eclipse.org/bugs/show_bug.cgi?id=188648? Thank you!
Comment 18 Nina Rinskaya CLA 2007-07-05 04:13:37 EDT
Created attachment 73085 [details]
Patch fixes Harmony classpath issue
Comment 19 Frederic Fusier CLA 2007-07-05 04:54:52 EDT
Nina,
Please open a new bug as the initial fix for this one was put in 3.3 and so prevent us to reopen it...
Thanks
Comment 20 Nina Rinskaya CLA 2007-07-05 08:18:10 EDT
(In reply to comment #19)
> Nina,
> Please open a new bug as the initial fix for this one was put in 3.3 and so
> prevent us to reopen it...
> Thanks
> 

Done: https://bugs.eclipse.org/bugs/show_bug.cgi?id=195509