Karm / mandrel-integration-tests

Integration tests for GraalVM and its Mandrel distribution. Runs Quarkus, Helidon and Micronaut applications and small targeted reproducers. The focus is solely on native-image utility and compilation of Java applications into native executables.
Apache License 2.0
5 stars 3 forks source link

Add Records annotations test #79

Closed jerboaa closed 2 years ago

jerboaa commented 2 years ago

Integration test verifying record annotations work. Looking at how GHA respond to this.

zakkak commented 2 years ago

I would prefer an upstream test for this TBH.

jerboaa commented 2 years ago

I would prefer an upstream test for this TBH.

Sure. I'll see what I can do.

jerboaa commented 2 years ago

For the 21.3 branch this test would still be useful. I don't think an upstream test would get backported to 21.3.

zakkak commented 2 years ago

For the 21.3 branch this test would still be useful. I don't think an upstream test would get backported to 21.3.

Maybe, but on the other hand I don't see why not. It doesn't add any risk (on the contrary), it's just a test.

Karm commented 2 years ago

@jerboaa THX :pray: :+1:

We need to fidget some more with the test pom tags to exclude compilation on JDK 11. JDK 17 runs should be added. Lemme try...

Karm commented 2 years ago

( and let's remove the binary file...?)

jerboaa commented 2 years ago

I would prefer an upstream test for this TBH.

Sure. I'll see what I can do.

Upstream PR is here: https://github.com/oracle/graal/pull/4423

jerboaa commented 2 years ago

( and let's remove the binary file...?)

Done.

jerboaa commented 2 years ago

@jerboaa THX pray +1

We need to fidget some more with the test pom tags to exclude compilation on JDK 11. JDK 17 runs should be added. Lemme try...

Exclusion on JDK 11 should be fine now. Yes, GHA would be good to have a JDK 17 run :)

Karm commented 2 years ago

I'm looking into those failures. It looks like the compatibility patch for old Quarkus is not applied any more...

Karm commented 2 years ago

I think that this

       <profile>
            <id>ide</id>
            <activation>
                <jdk>11</jdk>
            </activation>
            <properties>
                <excludeTags>none</excludeTags>
            </properties>

makes all tags active, so when running

$ mvn clean verify -Ptestsuite -Dquarkus.version=1.11.7.Final

it is trying to execute everything, including tests like

   @Test
    @Tag("debugSymbolsQuarkus")
    @Tag("builder-image")
    @DisabledOnOs({OS.WINDOWS})
    public void debugSymbolsQuarkusContainer(TestInfo testInfo) throws IOException, InterruptedException {

That should be excluded in this scenario by:

        <profile>
            <id>testsuite</id>
            <modules>
                <module>testsuite</module>
            </modules>
            <properties>
                <excludeTags>builder-image</excludeTags>
            </properties>
        </profile>

Also the report clearly shows that it is trying to compile all modules, not only testsuite:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Native image integration TS 1.0.0-SNAPSHOT ......... SUCCESS [  0.086 s]
[INFO] testsuite 1.0.0-SNAPSHOT ........................... FAILURE [17:03 min]
[INFO] quarkus-full-microprofile 1.0.0-SNAPSHOT ........... SKIPPED
[INFO] micronaut-helloworld 0.1 ........................... SKIPPED
[INFO] myproject 1.0-SNAPSHOT ............................. SKIPPED
[INFO] random-numbers 1 ................................... SKIPPED
[INFO] timezones 1 ........................................ SKIPPED
[INFO] version 1 .......................................... SKIPPED
[INFO] imageio 1 .......................................... SKIPPED
[INFO] debug-symbols-smoke 1 .............................. SKIPPED
[INFO] quarkus-spoklik-encoding 1.0.0-SNAPSHOT ............ SKIPPED
[INFO] quarkus-vertx 1.0.0-SNAPSHOT ....................... SKIPPED

vs master:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Native image integration TS 1.0.0-SNAPSHOT:
[INFO] 
[INFO] Native image integration TS ........................ SUCCESS [  0.112 s]
[INFO] testsuite .......................................... SUCCESS [09:17 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
Karm commented 2 years ago
2022-03-24 15:01:45 (121 MB/s) - ‘mandrel-java11-linux-amd64-21.3.1.1-Final.tar.gz’ saved [225663750/225663750]

tar: mandrel-java17-linux-amd64-21.3.1.1-Final.tar.gz: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now

:man_facepalming:

WIP

jerboaa commented 2 years ago

For the 21.3 branch this test would still be useful. I don't think an upstream test would get backported to 21.3.

Maybe, but on the other hand I don't see why not. It doesn't add any risk (on the contrary), it's just a test.

True, but figuring out what's wrong is less than ideal using the upstream test. Example:

$ mx --primary-suite-path substratevm --J @-Xmx2g native-unittest
Building junit image for matching: com.oracle.svm.configure.test.config.OmitPreviousConfigTests com.oracle.svm.configure.test.config.ResourceConfigurationTest com.oracle.svm.test.AbstractClassSerializationTest com.oracle.svm.test.ArraySetTest com.oracle.svm.test.FinishedDefaultThreadTest com.oracle.svm.test.FinishedThreadTest com.oracle.svm.test.ForkJoinTest com.oracle.svm.test.GetPackageTest com.oracle.svm.test.GitHub1087 com.oracle.svm.test.GitHub1398 com.oracle.svm.test.ImageInfoTest com.oracle.svm.test.JVMFuncFallbackTest com.oracle.svm.test.NativeImageResourceFileSystemProviderTest com.oracle.svm.test.NetworkInterfaceTest com.oracle.svm.test.ProcessPropertiesTest com.oracle.svm.test.SecurityServiceTest com.oracle.svm.test.SerializationRegistrationTest com.oracle.svm.test.ServiceLoaderTest com.oracle.svm.test.SocketSetOptionTest com.oracle.svm.test.StackTraceTests com.oracle.svm.test.TestInetAddress com.oracle.svm.test.jdk11.AbstractServiceLoaderTest com.oracle.svm.test.jdk11.NoProviderConstructorServiceLoaderTest com.oracle.svm.test.jdk11.ReusePortAvailableTest com.oracle.svm.test.jdk11.ServiceLoaderTest com.oracle.svm.test.jdk11.jfr.TestClassEvent com.oracle.svm.test.jdk11.jfr.TestJFRCompiles com.oracle.svm.test.jdk11.jfr.TestRecordingParsable com.oracle.svm.test.jdk11.jfr.TestSingleEvent com.oracle.svm.test.jdk17.recordannotations.RecordAnnotationsTest com.oracle.svm.test.proxy.ProxyExceptionTest
[com.oracle.svm.junit.svmjunitrunner:55885]    classlist:   1,722.98 ms,  0.96 GB
[com.oracle.svm.junit.svmjunitrunner:55885]        (cap):     569.15 ms,  0.96 GB
[com.oracle.svm.junit.svmjunitrunner:55885]        setup:   2,816.26 ms,  0.96 GB
[com.oracle.svm.junit.svmjunitrunner:55885]     (clinit):     408.63 ms,  5.66 GB
[com.oracle.svm.junit.svmjunitrunner:55885]   (typeflow):   5,473.45 ms,  5.66 GB
[com.oracle.svm.junit.svmjunitrunner:55885]    (objects):  43,017.72 ms,  5.66 GB
[com.oracle.svm.junit.svmjunitrunner:55885]   (features):   2,691.61 ms,  5.66 GB
[com.oracle.svm.junit.svmjunitrunner:55885]     analysis:  52,590.59 ms,  5.66 GB
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getConstantPool() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Detailed message:
Trace:
        at parsing java.lang.System$2.getConstantPool(System.java:2262)
Call path from entry point to java.lang.System$2.getConstantPool(Class):
        no path found from entry point to target method

com.oracle.svm.core.util.UserError$UserException: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getConstantPool() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Detailed message:
Trace:
        at parsing java.lang.System$2.getConstantPool(System.java:2262)
Call path from entry point to java.lang.System$2.getConstantPool(Class):
        no path found from entry point to target method

        at com.oracle.svm.core.util.UserError.abort(UserError.java:87)
        at com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:233)
        at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:759)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:529)
        at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:488)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:403)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:569)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:122)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:599)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getConstantPool() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Detailed message:
Trace:
        at parsing java.lang.System$2.getConstantPool(System.java:2262)
Call path from entry point to java.lang.System$2.getConstantPool(Class):
        no path found from entry point to target method

        at com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:126)
        at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:756)
        ... 6 more
Caused by: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getConstantPool() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
        at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.lookup(AnnotationSubstitutionProcessor.java:188)
        at com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor$ChainedSubstitutionProcessor.lookup(SubstitutionProcessor.java:140)
        at com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor$ChainedSubstitutionProcessor.lookup(SubstitutionProcessor.java:140)
        at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:414)
        at com.oracle.graal.pointsto.infrastructure.WrappedConstantPool.lookupMethod(WrappedConstantPool.java:125)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.lookupMethodInPool(BytecodeParser.java:4350)
        at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.lookupMethodInPool(SharedGraphBuilderPhase.java:140)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.lookupMethod(BytecodeParser.java:4344)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeVirtual(BytecodeParser.java:1718)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5417)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3477)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.handleBytecodeBlock(BytecodeParser.java:3437)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3282)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1145)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1030)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:84)
        at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:81)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.run(Phase.java:49)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:212)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
        at com.oracle.graal.pointsto.flow.AnalysisParsedGraph.parseBytecode(AnalysisParsedGraph.java:132)
        at com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsed(AnalysisMethod.java:616)
        at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:163)
        at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:321)
        at com.oracle.graal.pointsto.flow.MethodTypeFlow.createTypeFlow(MethodTypeFlow.java:293)
        at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureTypeFlowCreated(MethodTypeFlow.java:282)
        at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:103)
        at com.oracle.graal.pointsto.DefaultAnalysisPolicy$DefaultVirtualInvokeTypeFlow.onObservedUpdate(DefaultAnalysisPolicy.java:222)
        at com.oracle.graal.pointsto.flow.TypeFlow.notifyObservers(TypeFlow.java:490)
        at com.oracle.graal.pointsto.flow.TypeFlow.update(TypeFlow.java:559)
        at com.oracle.graal.pointsto.PointsToAnalysis$2.run(PointsToAnalysis.java:595)
        at com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:188)
        at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:172)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
        at java.base/java.util.concurrent.ForkJoinPool.externalHelpQuiescePool(ForkJoinPool.java:2104)
        at java.base/java.util.concurrent.ForkJoinPool.awaitQuiescence(ForkJoinPool.java:3321)
        at com.oracle.graal.pointsto.util.CompletionExecutor.complete(CompletionExecutor.java:238)
        at com.oracle.graal.pointsto.PointsToAnalysis.checkObjectGraph(PointsToAnalysis.java:680)
        at com.oracle.graal.pointsto.PointsToAnalysis.finish(PointsToAnalysis.java:644)
        at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:704)
        ... 6 more
[com.oracle.svm.junit.svmjunitrunner:55885]      [total]:  57,327.71 ms,  5.66 GB
# Printing build artifacts to: /disk/graal/upstream-sources/graal/substratevm/svmbuild/linux-amd64/junit/tmpxM99ZR/com.oracle.svm.junit.svmjunitrunner.build_artifacts.txt
Error: Image build request failed with exit status 1

Having it in integration tests allows us to run it in a more self contained manner (plus we'd be able to run it on the container image). Therefore, I'd be +1 on also including it here, but I won't insist.

Karm commented 2 years ago

Having it in integration tests allows us to run it in a more self contained manner (plus we'd be able to run it on the container image). Therefore, I'd be +1 on also including it here, but I won't insist.

This test will be merged here. I would like to iron out the JDK 17 GH action here, and the JFR JDK 17 config flag, and then it's all peachy. I will commit to your branch again later.