Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds minJDK and maxJDK to IfMandrelVersion annotation #88

Merged
merged 1 commit into from
Apr 4, 2022

Conversation

Karm
Copy link
Owner

@Karm Karm commented Apr 1, 2022

Tested examples:

    @Test
    @Tag("jdkVersionTest")
    @Order(1)
    @IfMandrelVersion(min = "21.3.1")
    public void jdkVersionCheckA(TestInfo testInfo) {
        System.out.println("KARM Running test "+testInfo.getTestMethod());
    }

    @Test
    @Tag("jdkVersionTest")
    @Order(2)
    @IfMandrelVersion(min = "21.3.1", minJDK = "17")
    public void jdkVersionCheckB(TestInfo testInfo) {
        System.out.println("KARM Running test "+testInfo.getTestMethod());
    }

    @Test
    @Tag("jdkVersionTest")
    @Order(3)
    @IfMandrelVersion(min = "22", minJDK = "17")
    public void jdkVersionCheckC(TestInfo testInfo) {
        System.out.println("KARM Running test "+testInfo.getTestMethod());
    }

    @Test
    @Tag("jdkVersionTest")
    @Order(4)
    @IfMandrelVersion(min = "22", minJDK = "17.0.2")
    public void jdkVersionCheckD(TestInfo testInfo) {
        System.out.println("KARM Running test "+testInfo.getTestMethod());
    }

    @Test
    @Tag("jdkVersionTest")
    @Order(5)
    @IfMandrelVersion(min = "22", minJDK = "17", maxJDK = "17.0.2")
    public void jdkVersionCheckE(TestInfo testInfo) {
        System.out.println("KARM Running test "+testInfo.getTestMethod());
    }

    @Test
    @Tag("jdkVersionTest")
    @Order(6)
    @IfMandrelVersion(min = "21", minJDK = "11.0.12", maxJDK = "17.0.1")
    public void jdkVersionCheckF(TestInfo testInfo) {
        System.out.println("KARM Running test "+testInfo.getTestMethod());
    }

    @Test
    @Tag("jdkVersionTest")
    @Order(7)
    @IfMandrelVersion(min = "21", maxJDK = "11")
    public void jdkVersionCheckG(TestInfo testInfo) {
        System.out.println("KARM Running test "+testInfo.getTestMethod());
    }

@Karm Karm requested a review from zakkak April 1, 2022 10:30
@Karm Karm self-assigned this Apr 1, 2022
@Karm Karm linked an issue Apr 1, 2022 that may be closed by this pull request
Copy link
Collaborator

@zakkak zakkak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks @Karm .

One question though, why don't you include the unit tests in the PR as well?

@Karm
Copy link
Owner Author

Karm commented Apr 1, 2022

LGTM, Thanks @Karm .

One question though, why don't you include the unit tests in the PR as well?

I didn't want to fall into the rabbit hole of mocking classes or providing fake native-image command on PATH to properly test the test suite. The annotation is evaluated early. You gently pushed me into that rabbit hole now, so I'll try to include those tests without adding much overhead... :-D

@Karm Karm force-pushed the jdk-min-max-version-annotation branch 2 times, most recently from 851d10c to cf047ae Compare April 1, 2022 20:58
@Karm
Copy link
Owner Author

Karm commented Apr 1, 2022

@zakkak Tests added: https://github.com/Karm/mandrel-integration-tests/pull/88/files#diff-85646c56861bc740418a91c2da8cc67d41ce46b7cf583216e71e50f1d64e8de0

It creates a fake native-image command that spits out one predefined version.
Test methods run (or don't run) accordingly.
Log file is verified (only the expected subset of test methods should have written to that file).

@Karm
Copy link
Owner Author

Karm commented Apr 1, 2022

Error:  org.graalvm.tests.integration.utils.versions.VersionsTest  Time elapsed: 0.078 s  <<< ERROR!
java.nio.file.NoSuchFileException: C:\Users\RUNNER~1\AppData\Local\Temp\versions-log
	at org.graalvm.tests.integration.utils.versions.VersionsTest.teardown(VersionsTest.java:77)

Hmm, it passes just fine on my Windows VM, so this might be some GH setup...like "don't use Temp" ?

@Karm
Copy link
Owner Author

Karm commented Apr 2, 2022

I see what's wrong. One cannot run it with the rest of the tests, because org.graalvm.tests.integration.utils.versions.UsedVersion is immutably set an the fake native-image version is then used for the rest of the TS.

I will make a separate GH workflow just for this.

@Karm Karm force-pushed the jdk-min-max-version-annotation branch from 728ffcf to ab26d1d Compare April 2, 2022 14:52
@Karm
Copy link
Owner Author

Karm commented Apr 2, 2022

cp: cannot create regular file '/home/runner/.m2/settings.xml': No such file or directory
Error: Process completed with exit code 1.

?

Tested examples:

```java
    @test
    @tag("jdkVersionTest")
    @order(1)
    @IfMandrelVersion(min = "21.3.1")
    public void jdkVersionCheckA(TestInfo testInfo) {
        System.out.println("KARM Running test "+testInfo.getTestMethod());
    }

    @test
    @tag("jdkVersionTest")
    @order(2)
    @IfMandrelVersion(min = "21.3.1", minJDK = "17")
    public void jdkVersionCheckB(TestInfo testInfo) {
        System.out.println("KARM Running test "+testInfo.getTestMethod());
    }

    @test
    @tag("jdkVersionTest")
    @order(3)
    @IfMandrelVersion(min = "22", minJDK = "17")
    public void jdkVersionCheckC(TestInfo testInfo) {
        System.out.println("KARM Running test "+testInfo.getTestMethod());
    }

    @test
    @tag("jdkVersionTest")
    @order(4)
    @IfMandrelVersion(min = "22", minJDK = "17.0.2")
    public void jdkVersionCheckD(TestInfo testInfo) {
        System.out.println("KARM Running test "+testInfo.getTestMethod());
    }

    @test
    @tag("jdkVersionTest")
    @order(5)
    @IfMandrelVersion(min = "22", minJDK = "17", maxJDK = "17.0.2")
    public void jdkVersionCheckE(TestInfo testInfo) {
        System.out.println("KARM Running test "+testInfo.getTestMethod());
    }

    @test
    @tag("jdkVersionTest")
    @order(6)
    @IfMandrelVersion(min = "21", minJDK = "11.0.12", maxJDK = "17.0.1")
    public void jdkVersionCheckF(TestInfo testInfo) {
        System.out.println("KARM Running test "+testInfo.getTestMethod());
    }

    @test
    @tag("jdkVersionTest")
    @order(7)
    @IfMandrelVersion(min = "21", maxJDK = "11")
    public void jdkVersionCheckG(TestInfo testInfo) {
        System.out.println("KARM Running test "+testInfo.getTestMethod());
    }
```

Adds VersionTests

Disables VersionsTest on Windows, GH Windows behave strangely WRT Temp dir

Separate GH workflow for Versions tests, Windows included

 ~/.m2/ might not exist if there is no cache

~/.m2 might not exist on new workflow
@Karm Karm force-pushed the jdk-min-max-version-annotation branch from 6b90d6f to dcaadea Compare April 2, 2022 21:57
@Karm
Copy link
Owner Author

Karm commented Apr 2, 2022

Finally O.K. Squashed.

@Karm Karm merged commit 98791f5 into master Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JDK17: @DisabledOnJre(JRE.JAVA_11) is a poor solution
2 participants