Bug 433639 - SymlinkResourceTest fails when executed with Java 7 fragment
Summary: SymlinkResourceTest fails when executed with Java 7 fragment
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 4.4   Edit
Hardware: All Windows 7
: P3 normal (vote)
Target Milestone: 4.4 M7   Edit
Assignee: Szymon Ptaszkiewicz CLA
QA Contact:
URL:
Whiteboard:
Keywords: test
Depends on: 380325
Blocks:
  Show dependency tree
 
Reported: 2014-04-28 06:42 EDT by Szymon Ptaszkiewicz CLA
Modified: 2014-04-30 06:15 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Szymon Ptaszkiewicz CLA 2014-04-28 06:42:32 EDT
When running SymlinkResourceTest.testBug232426 and testBug358830 with Java 7 fragment on Windows 7 with admin privileges (the tests need to be enabled by commenting out isWindowsVistaOrHigher() at the beginning), the tests fail with the following exceptions:

junit.framework.AssertionFailedError
	at junit.framework.Assert.fail(Assert.java:55)
	at junit.framework.Assert.assertTrue(Assert.java:22)
	at junit.framework.Assert.assertTrue(Assert.java:31)
	at junit.framework.TestCase.assertTrue(TestCase.java:201)
	at org.eclipse.core.tests.internal.localstore.SymlinkResourceTest$2.visit(SymlinkResourceTest.java:116)
	at org.eclipse.core.internal.resources.Resource$2.visit(Resource.java:126)
	at org.eclipse.core.internal.resources.Resource$1.visitElement(Resource.java:85)
	at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:82)
	at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:86)
	at org.eclipse.core.internal.watson.ElementTreeIterator.iterate(ElementTreeIterator.java:127)
	at org.eclipse.core.internal.resources.Resource.accept(Resource.java:95)
	at org.eclipse.core.internal.resources.Resource.accept(Resource.java:52)
	at org.eclipse.core.internal.resources.Resource.accept(Resource.java:124)
	at org.eclipse.core.internal.resources.Resource.accept(Resource.java:108)
	at org.eclipse.core.tests.internal.localstore.SymlinkResourceTest.testBug232426(SymlinkResourceTest.java:109)
	...
	
junit.framework.AssertionFailedError: expected:<3> but was:<4>
	at junit.framework.Assert.fail(Assert.java:57)
	at junit.framework.Assert.failNotEquals(Assert.java:329)
	at junit.framework.Assert.assertEquals(Assert.java:78)
	at junit.framework.Assert.assertEquals(Assert.java:234)
	at junit.framework.Assert.assertEquals(Assert.java:241)
	at junit.framework.TestCase.assertEquals(TestCase.java:409)
	at org.eclipse.core.tests.internal.localstore.SymlinkResourceTest.testBug358830(SymlinkResourceTest.java:153)
	...
Comment 1 Szymon Ptaszkiewicz CLA 2014-04-28 07:28:56 EDT
The difference in SymlinkResourceTest.testBug358830 between running with native fragment and Java 7 fragment is that in case of native implementation a symbolic link is considered to be a directory if its link target is directory. The test can be fixed in DosHandler either by replacing

info.setDirectory(attrs.isDirectory());

with

info.setDirectory(Files.isDirectory(path));

which follows symbolic link and tells if the link target is a directory or by removing LinkOption.NOFOLLOW_LINKS flag when reading attributes of the link. In order to tell what is the correct fix here it needs to be checked carefully how exactly native implementation behaves in case of other attributes of symbolic links and then use more suitable solution.

The case of SymlinkResourceTest.testBug232426 is even more interesting because it was supposed to hang in the same way as it hangs with native fragment due to bug 363463, but it failed without any hang. Therefore, there are 2 issues here: 1) why it doesn't hang, 2) why it fails.
Comment 2 Szymon Ptaszkiewicz CLA 2014-04-28 08:43:44 EDT
(In reply to Szymon Ptaszkiewicz from comment #1)
> The case of SymlinkResourceTest.testBug232426 is even more interesting
> because it was supposed to hang in the same way as it hangs with native
> fragment due to bug 363463, but it failed without any hang. Therefore, there
> are 2 issues here: 1) why it doesn't hang, 2) why it fails.

Even with native fragment it is possible to get three different results when running this test multiple times: test passes, tests fails, hang during background refresh (when running the whole AutomatedSuite). Apparently, it depends on the way background refresh works, so it seems that SymlinkResourceTest.testBug232426 can be affected by bug 251159 or a similar issue despite filesystem fragment being used.
Comment 3 Szymon Ptaszkiewicz CLA 2014-04-29 11:27:56 EDT
Steps to reproduce the bug manually:
1. Create a project.
2. Create a folder in the project.
3. Create a symbolic link in the folder pointing at another existing folder.
4. Refresh the project and expand all nodes.
=> When bug 433636 is fixed, the symbolic link is shown but it is not shown as a link to directory.
Comment 5 Szymon Ptaszkiewicz CLA 2014-04-30 06:15:40 EDT
Verified in I20140429-2000.