eclipse / xtext

Eclipse Xtext™ is a language development framework
http://www.eclipse.org/Xtext
Eclipse Public License 2.0
767 stars 320 forks source link

[Oxygen] Test Failures on Oxygen+: SimpleProjectsIntegrationTest AND IntegrationTest #2410

Open cdietrich opened 6 years ago

cdietrich commented 6 years ago

http://services.typefox.io/open-source/jenkins/job/xtext-eclipse/job/cd_photon/4/testReport/ has failing tests e.g.

org.eclipse.xtext.builder.impl.SimpleProjectsIntegrationTest.testNewlyAddedReexportedSource org.eclipse.xtext.builder.impl.SimpleProjectsIntegrationTest.testReexportedJarRemoved

the same fail on my local machine (agains oxygen) on others it does not

it seems to be a race how builds and forget builds are executed

good case:

Begin testNewlyAddedReexportedSource
reallyWaitForAutoBuild
reallyWaitForAutoBuild
reallyWaitForAutoBuild
reallyWaitForAutoBuild
reallyWaitForAutoBuild
reallyWaitForAutoBuild
forget foo FULL
forget bar FULL
forget baz FULL
reallyWaitForAutoBuild
forget bar FULL
build baz FULL
build foo FULL
build bar FULL
reallyWaitForAutoBuild
forget baz FULL
build baz FULL
forget baz FULL
forget baz FULL
waitForBuild 1
reallyWaitForAutoBuild
build baz FULL
doUpdate: baz
queueURI: platform:/resource/baz/src/Baz.buildertestlanguage
assert 1
reallyWaitForAutoBuild
forget foo FULL
build foo FULL
doUpdate: foo
queueURI: archive:platform:/resource/foo/foo.jar!/foo/Foo.buildertestlanguage
queueURI: platform:/resource/baz/src/Baz.buildertestlanguage
build bar AUTO
build baz AUTO
doUpdate: baz
waitForBuild 2
reallyWaitForAutoBuild
assert 2
End testNewlyAddedReexportedSource
reallyWaitForAutoBuild
doUpdate: baz
doUpdate: foo

bad case

Begin testNewlyAddedReexportedSource
reallyWaitForAutoBuild
reallyWaitForAutoBuild
reallyWaitForAutoBuild
reallyWaitForAutoBuild
reallyWaitForAutoBuild
reallyWaitForAutoBuild
forget foo FULL
forget bar FULL
forget baz FULL
reallyWaitForAutoBuild
forget bar FULL
build bar FULL
build baz FULL
build foo FULL
reallyWaitForAutoBuild
forget baz FULL
build baz FULL
forget baz FULL
forget baz FULL
waitForBuild 1
reallyWaitForAutoBuild
build baz FULL
doUpdate: baz
queueURI: platform:/resource/baz/src/Baz.buildertestlanguage
assert 1
org.eclipse.core.internal.resources.Workspace@494c452b
reallyWaitForAutoBuild
forget foo FULL
build bar AUTO
build baz AUTO
build foo FULL
doUpdate: foo
queueURI: archive:platform:/resource/foo/foo.jar!/foo/Foo.buildertestlanguage
queueURI: platform:/resource/baz/src/Baz.buildertestlanguage
waitForBuild 2
reallyWaitForAutoBuild
assert 2
reallyWaitForAutoBuild
doUpdate: baz
doUpdate: foo
cdietrich commented 6 years ago

enhanced looging:

bad:

Begin testNewlyAddedReexportedSource
reallyWaitForAutoBuild
[foo; []]
[foo; []]
reallyWaitForAutoBuild
[foo; []]
reallyWaitForAutoBuild
[bar; [], foo; []]
reallyWaitForAutoBuild
[bar; [], foo; []]
reallyWaitForAutoBuild
[bar; [], baz; [], foo; []]
reallyWaitForAutoBuild
[bar; [], baz; [], foo; []]
forget foo FULL
forget bar FULL
forget baz FULL
reallyWaitForAutoBuild
forget bar FULL
[bar; [], baz; [], foo; []]
build bar FULL
Result for bar -> foo
build baz FULL
Result for baz -> 
build foo FULL
Result for foo -> 
reallyWaitForAutoBuild
forget baz FULL
[bar; [], baz; [], foo; []]
build baz FULL
Result for baz -> bar
forget baz FULL
forget baz FULL
waitForBuild 1
reallyWaitForAutoBuild
[bar; [], baz; [], foo; []]
build baz FULL
doUpdate: baz
queueURI: platform:/resource/baz/src/Baz.buildertestlanguage
Result for baz -> bar
assert 1
org.eclipse.core.internal.resources.Workspace@2f84848e
reallyWaitForAutoBuild
forget foo FULL
[bar; [], baz; [], foo; []]
build bar AUTO
Result for bar -> foo
build baz AUTO
Result for baz -> bar
build foo FULL
doUpdate: foo
queueURI: archive:platform:/resource/foo/foo.jar!/foo/Foo.buildertestlanguage
queueURI: platform:/resource/baz/src/Baz.buildertestlanguage
Result for foo -> 
waitForBuild 2
reallyWaitForAutoBuild
assert 2
reallyWaitForAutoBuild
doUpdate: baz
doUpdate: foo
[]

good:

Begin testNewlyAddedReexportedSource
reallyWaitForAutoBuild
[foo; []]
[foo; []]
reallyWaitForAutoBuild
[foo; []]
reallyWaitForAutoBuild
[bar; [], foo; []]
reallyWaitForAutoBuild
[bar; [], foo; []]
reallyWaitForAutoBuild
[bar; [], baz; [], foo; []]
reallyWaitForAutoBuild
[bar; [], baz; [], foo; []]
forget foo FULL
forget bar FULL
forget baz FULL
reallyWaitForAutoBuild
forget bar FULL
[baz; [], foo; [], bar; []]
build baz FULL
Result for baz -> 
build foo FULL
Result for foo -> 
build bar FULL
Result for bar -> foo
reallyWaitForAutoBuild
forget baz FULL
[foo; [], bar; [], baz; []]
build baz FULL
Result for baz -> bar
forget baz FULL
forget baz FULL
waitForBuild 1
reallyWaitForAutoBuild
[foo; [], bar; [], baz; []]
build baz FULL
doUpdate: baz
queueURI: platform:/resource/baz/src/Baz.buildertestlanguage
Result for baz -> bar
assert 1
org.eclipse.core.internal.resources.Workspace@5126c0cd
reallyWaitForAutoBuild
forget foo FULL
[foo; [], bar; [], baz; []]
build foo FULL
doUpdate: foo
queueURI: archive:platform:/resource/foo/foo.jar!/foo/Foo.buildertestlanguage
queueURI: platform:/resource/baz/src/Baz.buildertestlanguage
Result for foo -> 
build bar AUTO
Result for bar -> foo
build baz AUTO
doUpdate: baz
Result for baz -> bar
waitForBuild 2
reallyWaitForAutoBuild
assert 2
End testNewlyAddedReexportedSource
reallyWaitForAutoBuild
doUpdate: baz
doUpdate: foo
cdietrich commented 6 years ago

Helps:

addToClasspath(foo, newLibraryEntry);
addToClasspath(bar, JavaCore.newProjectEntry(foo.getPath(), true));
addToClasspath(baz, JavaCore.newProjectEntry(bar.getPath(), false));
Workspace ws = ((org.eclipse.core.internal.resources.Workspace)ResourcesPlugin.getWorkspace());
Method method = Workspace.class.getDeclaredMethod("flushBuildOrder");
method.setAccessible(true);
method.invoke(ws);

cause:

SetClasspathOperation no longer calls ProjectReferenceChange

=>

addToClasspath(bar, JavaCore.newProjectEntry(foo.getPath(), true));
setReference(bar.getProject(),foo.getProject());
addToClasspath(baz, JavaCore.newProjectEntry(bar.getPath(), false));
setReference(baz.getProject(),bar.getProject());

helps too

=> we should rework addToClasspath / removeFromClasspath

cdietrich commented 6 years ago

https://bugs.eclipse.org/bugs/show_bug.cgi?id=507795#c15 https://github.com/eclipse/eclipse.jdt.core/commit/f7ed9839ef5f6bfc6dd1db3bdc1a458b7b45c64b#diff-cedc3f8c2d2afc863a49dd8665e5487a

maybe we get it running with IDynamicReferenceProvider, first try did not work

cdietrich commented 6 years ago

have no idea whats happening

cdietrich commented 6 years ago

Build can be run against Photon with -PusePhotonTarget

cdietrich commented 6 years ago

still have no clue/idea how to tackle this problem

szarnekow commented 6 years ago

maybe we get it running with IDynamicReferenceProvider, first try did not work

Do you still have the code around?

cdietrich commented 6 years ago

no, it was a 1:1 copy of the one from jdt's org.eclipse.jdt.internal.core.DynamicProjectReferences the registration is done via the builder

code from jdt

<extension 
    point="org.eclipse.core.resources.builders" 
    id="javabuilder"
    name="%javaBuilderName">
    <builder>
        <run class="org.eclipse.jdt.internal.core.builder.JavaBuilder">
        </run>
        <dynamicReference class="org.eclipse.jdt.internal.core.DynamicProjectReferences"/>
    </builder>
</extension>
cdietrich commented 4 years ago

clear milestone