Skip to content

Adds two new switches to the maven test goal #720

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ public class NativeTestMojo extends AbstractNativeImageMojo {
@Parameter(property = "skipNativeTests", defaultValue = "false")
private boolean skipNativeTests;

@Parameter(property = "skipTestExecution", defaultValue = "false")
private boolean skipTestExecution;

@Parameter(property = "failNoTests", defaultValue = "true")
private boolean failNoTests;

@Override
protected void populateApplicationClasspath() throws MojoExecutionException {
super.populateApplicationClasspath();
Expand Down Expand Up @@ -147,8 +153,13 @@ public void execute() throws MojoExecutionException {
return;
}
if (!hasTestIds()) {
logger.error("Test configuration file wasn't found. Make sure that test execution wasn't skipped.");
throw new IllegalStateException("Test configuration file wasn't found.");
if (failNoTests) {
logger.error("Test configuration file wasn't found. Make sure that test execution wasn't skipped.");
throw new IllegalStateException("Test configuration file wasn't found.");
} else {
logger.info("No tests found, skipping.");
return;
}
}

logger.info("====================");
Expand All @@ -168,7 +179,10 @@ public void execute() throws MojoExecutionException {
mainClass = "org.graalvm.junit.platform.NativeImageJUnitLauncher";

buildImage();
runNativeTests(outputDirectory.toPath().resolve(NATIVE_TESTS_EXE));

if (!skipTestExecution) {
runNativeTests(outputDirectory.toPath().resolve(NATIVE_TESTS_EXE));
}
}

private void configureEnvironment() {
Expand Down