Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 335864

Summary: ResourceAttributeTest fails on Windows 7 due to running "ln"
Product: [Eclipse Project] Platform Reporter: Martin Oberhuber <mober.at+eclipse>
Component: ResourcesAssignee: Szymon Brandys <Szymon.Brandys>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: kim.moir, Szymon.Brandys
Version: 3.7   
Target Milestone: 3.7 M6   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on: 328889    
Bug Blocks: 331716    
Attachments:
Description Flags
Patch fixing the issue
none
Additional patch to CoreTest harness for Win7 64bit
none
Improved patch to CoreTest harness for Win7 64bit, prints failure cause
none
patch v3 to CoreTest harness for Win7, makes version check protected none

Description Martin Oberhuber CLA 2011-01-31 11:16:36 EST
+++ This bug was initially created as a clone of Bug #328889 +++

Similar to bug 328889, ResourceAttributeTest also tries to run "ln" on
Windows 7. I assume that this had not been detected before because the
ResourceAttributeTest isn't part of the AutomatedTests suite.
Comment 1 Martin Oberhuber CLA 2011-01-31 11:17:57 EST
Created attachment 187978 [details]
Patch fixing the issue
Comment 2 Martin Oberhuber CLA 2011-01-31 13:11:12 EST
Created attachment 187987 [details]
Additional patch to CoreTest harness for Win7 64bit

Attached additional patch is needed to run on Win7 64bit, because "mklink" is not an exe but a cmd builtin. I also improved the check whether running on vista or higher, such that we won't have to edit the code again when the next version of Windows comes out.
Comment 3 Martin Oberhuber CLA 2011-01-31 13:16:42 EST
I committed the 1st patch, but apparently I don't have commit rights on 

   o.e.core.tests.harness

Szymon could you commit the 2nd patch please?

I tested this on my Win7 64-bit system. Note that in order for "mklink" to succeed, I had to run my Eclipse host with elevated privileges. To do so, 

  1. create a Windows Shortcut pointing to your eclipse.exe
  2. Right-click > Properties on the Shortcut
  3. Click the "Advanced" button
  4. Enable the "Run as Administrator" checkbox

Interestingly, just being logged in as an Administrator was not sufficient. I had to explicitly run Eclipse as an administrator (ie with elevated privileges) too. This seems to be a known and desired behavior by Microsoft. In order to run "mklink" on commandline, the cmd.exe also has to run with elevated privileges.

I did not test this on Vista, nor on Wind7-32bit but looking at the code I do expect this to still work.
Comment 4 Martin Oberhuber CLA 2011-01-31 13:25:48 EST
Created attachment 187988 [details]
Improved patch to CoreTest harness for Win7 64bit, prints failure cause
Comment 5 John Arthorne CLA 2011-01-31 13:35:58 EST
This failure also mentioned in bug 331716, but feel free to release this one separately.
Comment 6 Martin Oberhuber CLA 2011-01-31 14:01:56 EST
Created attachment 187993 [details]
patch v3 to CoreTest harness for Win7, makes version check protected

Attached patch v3 enables checking the windows version (needed for fixing 
bug 331716)
Comment 7 Szymon Brandys CLA 2011-03-21 08:26:28 EDT
*** Bug 336659 has been marked as a duplicate of this bug. ***
Comment 8 Szymon Brandys CLA 2011-03-21 09:41:07 EDT
"patch v3..." committed.