Skip to content

Commit

Permalink
Adjust tests to run on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
fniephaus committed Oct 18, 2023
1 parent 43f0b2f commit 0b95991
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,13 @@ class JavaApplicationFunctionalTest extends AbstractFunctionalTest {
given:
withSample("java-application")
buildFile << """
graalvmNative.binaries.all {
verbose = true
graalvmNative {
useArgFile = false // required to check for --pgo flag
binaries {
all {
verbose = true
}
}
}
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class NativeConfigRepoFunctionalTest extends AbstractFunctionalTest {
outputContains "[graalvm reachability metadata repository for org.graalvm.internal:library-with-reflection:1.5]: Configuration directory not found. Trying latest version."

and: "but finds one thanks to the latest configuration field"
outputContains "[graalvm reachability metadata repository for org.graalvm.internal:library-with-reflection:1.5]: Configuration directory is org.graalvm.internal/library-with-reflection/1"
outputContains "[graalvm reachability metadata repository for org.graalvm.internal:library-with-reflection:1.5]: Configuration directory is org.graalvm.internal" + File.separator + "library-with-reflection" + File.separator + "1"

where:
format | label
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class OfficialMetadataRepoFunctionalTest extends AbstractFunctionalTest {
}

and: "finds metadata in the remote repository"
outputContains "[graalvm reachability metadata repository for com.h2database:h2:2.1.210]: Configuration directory is com.h2database/h2/2.1.210"
outputContains "[graalvm reachability metadata repository for com.h2database:h2:2.1.210]: Configuration directory is com.h2database" + File.separator + "h2" + File.separator + "2.1.210"
outputDoesNotContain "Falling back to the default repository at"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ package org.graalvm.buildtools.maven

import spock.lang.Issue

import static org.graalvm.buildtools.utils.SharedConstants.NATIVE_IMAGE_EXE;

class JavaApplicationFunctionalTest extends AbstractGraalVMMavenFunctionalTest {
def "proper options are added to the native-image invocation"() {
withSample("java-application")
Expand All @@ -55,7 +57,9 @@ class JavaApplicationFunctionalTest extends AbstractGraalVMMavenFunctionalTest {

then:
buildSucceeded
outputContains "native-image -cp / -g --no-fallback --verbose --shared -Ob"
outputContains NATIVE_IMAGE_EXE
outputContains "-cp " // actual path is OS-specific (/ vs C:\)
outputContains "-g --no-fallback --verbose --shared -Ob"
}

def "can build and execute a native image with the Maven plugin"() {
Expand Down Expand Up @@ -116,7 +120,7 @@ class JavaApplicationFunctionalTest extends AbstractGraalVMMavenFunctionalTest {
then:
buildSucceeded
outputContains "Args file written to: target/native-image"
outputContains "Args file written to: target" + File.separator + "native-image"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@

package org.graalvm.buildtools.maven

import static org.graalvm.buildtools.utils.SharedConstants.NATIVE_IMAGE_EXE;

class MetadataRepositoryFunctionalTest extends AbstractGraalVMMavenFunctionalTest {

void "if metadata is disabled, reflection fails"() {
Expand Down Expand Up @@ -70,7 +72,7 @@ class MetadataRepositoryFunctionalTest extends AbstractGraalVMMavenFunctionalTes
outputContains "[graalvm reachability metadata repository for org.graalvm.internal:library-with-reflection:1.5]: Configuration directory not found. Trying latest version."

and: "but it finds one thanks to the latest configuration field"
outputContains "[graalvm reachability metadata repository for org.graalvm.internal:library-with-reflection:1.5]: Configuration directory is org.graalvm.internal/library-with-reflection/1"
outputContains "[graalvm reachability metadata repository for org.graalvm.internal:library-with-reflection:1.5]: Configuration directory is org.graalvm.internal" + File.separator + "library-with-reflection" + File.separator + "1"
}

void "if excludeConfig is set it is added to the command line invocation"() {
Expand All @@ -82,7 +84,7 @@ class MetadataRepositoryFunctionalTest extends AbstractGraalVMMavenFunctionalTes

then:
buildSucceeded
outputContains "native-image --exclude-config dummy/path/to/file.jar \"*\""
outputContains NATIVE_IMAGE_EXE + " --exclude-config dummy/path/to/file.jar \"*\""
}

void "if the path doesn't exist it throws an error"() {
Expand Down Expand Up @@ -138,7 +140,7 @@ class MetadataRepositoryFunctionalTest extends AbstractGraalVMMavenFunctionalTes
outputContains "[graalvm reachability metadata repository for org.graalvm.internal:library-with-reflection:1.5]: Configuration directory not found. Trying latest version."

and: "but it finds one thanks to the latest configuration field"
outputContains "[graalvm reachability metadata repository for org.graalvm.internal:library-with-reflection:1.5]: Configuration directory is org.graalvm.internal/library-with-reflection/1"
outputContains "[graalvm reachability metadata repository for org.graalvm.internal:library-with-reflection:1.5]: Configuration directory is org.graalvm.internal" + File.separator + "library-with-reflection" + File.separator + "1"
}

void "it can download a remote repository"() {
Expand All @@ -158,7 +160,7 @@ class MetadataRepositoryFunctionalTest extends AbstractGraalVMMavenFunctionalTes
outputContains "[graalvm reachability metadata repository for org.graalvm.internal:library-with-reflection:1.5]: Configuration directory not found. Trying latest version."

and: "but it finds one thanks to the latest configuration field"
outputContains "[graalvm reachability metadata repository for org.graalvm.internal:library-with-reflection:1.5]: Configuration directory is org.graalvm.internal/library-with-reflection/1"
outputContains "[graalvm reachability metadata repository for org.graalvm.internal:library-with-reflection:1.5]: Configuration directory is org.graalvm.internal" + File.separator + "library-with-reflection" + File.separator + "1"
}

void "when pointing to a missing URL, reflection fails"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@

package org.graalvm.buildtools.maven

import spock.lang.IgnoreIf

class OfficialMetadataRepositoryFunctionalTest extends AbstractGraalVMMavenFunctionalTest {
@IgnoreIf({ os.windows })
void "the application runs when using the official metadata repository"() {
given:
withSample("metadata-repo-integration")
Expand All @@ -60,6 +63,7 @@ class OfficialMetadataRepositoryFunctionalTest extends AbstractGraalVMMavenFunct
outputDoesNotContain "Falling back to the default repository."
}

@IgnoreIf({ os.windows })
void "the application runs when using the versioned official metadata repository"() {
given:
withSample("metadata-repo-integration")
Expand Down
1 change: 1 addition & 0 deletions samples/java-library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ dependencies {
}

graalvmNative {
useArgFile = false // required to check for flags in tests
binaries {
main {
verbose = true
Expand Down
1 change: 1 addition & 0 deletions samples/java-library/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
<imageName>${imageName}</imageName>
<fallback>false</fallback>
<sharedLibrary>true</sharedLibrary>
<useArgFile>false</useArgFile>
</configuration>
</plugin>
</plugins>
Expand Down
1 change: 1 addition & 0 deletions samples/native-config-integration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
<imageName>${imageName}</imageName>
<fallback>false</fallback>
<quickBuild>true</quickBuild>
<useArgFile>false</useArgFile>
</configuration>
</plugin>
</plugins>
Expand Down

0 comments on commit 0b95991

Please sign in to comment.