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

Native plugin fails if no tests are run in a module #188

Closed
dzou opened this issue Jan 6, 2022 · 4 comments · Fixed by #239
Closed

Native plugin fails if no tests are run in a module #188

dzou opened this issue Jan 6, 2022 · 4 comments · Fixed by #239
Assignees
Labels
gradle-plugin Related to Gradle plugin junit-support Related to JUnit Support project maven-plugin Related to Maven plugin

Comments

@dzou
Copy link

dzou commented Jan 6, 2022

The native-maven-plugin will fail if no tests are run for some module after running mvn test -Pnative. It fails with the error "Test configuration file wasn't found. Make sure that test execution wasn't skipped." (No test config file will be written if no tests are run)

Error:

[ERROR] Test configuration file wasn't found. Make sure that test execution wasn't skipped.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for native-junit-experiment 1.0-SNAPSHOT:
[INFO] 
[INFO] native-junit-experiment ............................ SUCCESS [  0.051 s]
[INFO] empty-test-module .................................. FAILURE [  0.544 s]
[INFO] simple-module ...................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.860 s
[INFO] Finished at: 2022-01-06T10:09:52-05:00

Repro: https://github.com/dzou/native-plugin-empty-tests

I would expect the tests to just pass if no tests are run. This is important for multi-module projects because we use a test-filter which only runs native-image integration tests, and in multi-module projects, not all modules have native-image tests. It would then be useful in these cases to have the tests to pass if there's no tests that are run for some module.

@mpeddada1
Copy link

Hi @sbrannen, thanks again for a great product! Just checking in, do we have any updates on this issue?

@alvarosanchez alvarosanchez self-assigned this Apr 22, 2022
@alvarosanchez
Copy link
Member

@sbrannen I have taken a look at this. The problem in the reproducing example is that empty-test-module comes before simple-module. The latter do have tests, but we are halting the execution prematurely in the former.

I find it more appropriate to just warn about it and let the reactor execution continue. What do you think?

@lazar-mitrovic
Copy link
Collaborator

Applicable to Gradle as well:

> Task :nativeTestCompile FAILED

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':nativeTestCompile' (type 'BuildNativeImageTask').
  - In plugin 'org.graalvm.buildtools.gradle.NativeImagePlugin$Inject' type 'org.graalvm.buildtools.gradle.tasks.BuildNativeImageTask' property 'testListDirectory' specifies directory 'native-plugin-empty-tests/empty-test-module/build/test-results/test/testlist' which doesn't exist.
    
    Reason: An input file was expected to be present but it doesn't exist.
    
    Possible solutions:
      1. Make sure the directory exists before the task is called.
      2. Make sure that the task which produces the directory is declared as an input.
    
    Please refer to https://docs.gradle.org/7.4/userguide/validation_problems.html#input_file_does_not_exist for more details about this problem.

@lazar-mitrovic lazar-mitrovic added the junit-support Related to JUnit Support project label May 13, 2022
@sbrannen
Copy link
Collaborator

I find it more appropriate to just warn about it and let the reactor execution continue. What do you think?

Yes, just warning about the situation would be better.

In any case, a multi-module/project build (Maven or Gradle) should not fail if some of the modules/projects don't have tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gradle-plugin Related to Gradle plugin junit-support Related to JUnit Support project maven-plugin Related to Maven plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants