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

test objects are not being pulled during the build with eo-maven-plugin #4030

Open
h1alexbel opened this issue Mar 21, 2025 · 12 comments
Open

Comments

@h1alexbel
Copy link
Member

h1alexbel commented Mar 21, 2025

In the external EO library, where it has its own objects, we building the project with eo-maven-plugin with this configuration:

<configuration>
  <foreign>${project.build.directory}/eo-foreign.csv</foreign>
  <foreignFormat>csv</foreignFormat>
</configuration>
<executions>
  <execution>
    <id>compile</id>
    <goals>
      <goal>register</goal>
      <goal>compile</goal>
      <goal>transpile</goal>
      <goal>xmir-to-phi</goal>
      <goal>phi-to-xmir</goal>
      <goal>copy</goal>
      <goal>unplace</goal>
      <goal>unspile</goal>
    </goals>
    <configuration>
      <keepBinaries>
        <glob>EOorg/EOeolang/EOdom/**</glob>
      </keepBinaries>
    </configuration>
  </execution>
  <execution>
    <id>test-compile</id>
    <phase>generate-test-sources</phase>
    <goals>
      <goal>register</goal>
      <goal>compile</goal>
      <goal>xmir-to-phi</goal>
      <goal>phi-to-xmir</goal>
      <goal>transpile</goal>
    </goals>
    <configuration>
      <scope>test</scope>
      <sourcesDir>${project.basedir}/src/test/eo</sourcesDir>
      <targetDir>${project.build.directory}/eo-test</targetDir>
      <phiInputDir>${project.build.directory}/eo-test/1-parse</phiInputDir>
      <phiOutputDir>${project.build.directory}/eo-test/phi</phiOutputDir>
      <unphiInputDir>${project.build.directory}/eo-test/phi</unphiInputDir>
      <unphiOutputDir>${project.build.directory}/eo-test/unphi</unphiOutputDir>
      <addSourcesRoot>false</addSourcesRoot>
      <addTestSourcesRoot>true</addTestSourcesRoot>
      <generatedDir>${project.build.directory}/generated-test-sources</generatedDir>
      <placeBinariesThatHaveSources>true</placeBinariesThatHaveSources>
    </configuration>
  </execution>
</executions>

During lint goal we are getting unit-test-missing warning on external objects (try, nan, dataized, string, number, etc.) though we have them:

org.eolang.try:0 Tests "org.eolang.try-tests" not found for "org.eolang.try" (unit-test-missing)
[WARNING] org.eolang.nan:0 Tests "org.eolang.nan-tests" not found for "org.eolang.nan" (unit-test-missing)
[WARNING] org.eolang.dataized:0 Tests "org.eolang.dataized-tests" not found for "org.eolang.dataized" (unit-test-missing)
[WARNING] org.eolang.string:0 Tests "org.eolang.string-tests" not found for "org.eolang.string" (unit-test-missing)
[WARNING] org.eolang.number:0 Tests "org.eolang.number-tests" not found for "org.eolang.number" (unit-test-missing)

Seems that *-test.eo objects are not being pulled from home during the execution of eo-maven-plugin, and thats why we are getting those warnings.

Full story here.

@h1alexbel
Copy link
Member Author

@maxonfjvipon please check

@maxonfjvipon
Copy link
Member

@h1alexbel we definitely don't need to pull them. Every library should run only its own tests. We need to find a way to suppress this check for the objects which are pulled from outside of the project

@yegor256
Copy link
Member

@maxonfjvipon or maybe we should pull tests too, and run them together with local tests?

@maxonfjvipon
Copy link
Member

@yegor256 I don't think it's a good idea. Imagine you run the tests on your local little java repository and you see that all of you dependencies start executing their tests and instead of 2 seconds for build you'll have 10 minutes (possibly). I think we should be able to suppress some WPA lints (and maybe not only WPA) for external dependencies because we're not responsible for them and don't want to see warnings because of them

@yegor256
Copy link
Member

yegor256 commented Mar 22, 2025

@maxonfjvipon indeed, this does make sense. However, look at it from another point of view. We do whole-program-compilation, using sources for all our objects. We download sources from the Network. How can we trust them? What if we download, but they don't work, after compilation?

Maybe instead of skipping lints for "foreign" objects and tests, we can mark those tests as "secondary" and skip them by default. But they can be unskipped, if a user wants a perfectly safe local compilation and testing.

@h1alexbel
Copy link
Member Author

h1alexbel commented Mar 23, 2025

@maxonfjvipon I agree with @yegor256 about ability to run all tests if one would want ensure maximum level of stability. How about we introduce new option <processForeign>true</processForeign> in eo-maven-plugin, which if enabled will pull all foreign tests for objects, library depend on, and run full pipeline: compile, test, lint. If an option disabled, then foreign tests won't be pulled, but lint defects in them (and in corresponding live objects) will be suppressed. WDYT?

@maxonfjvipon
Copy link
Member

@yegor256 @h1alexbel then it should some another mechanism of pulling, because we actually pull only object which current objects are depending on. Tests are independable.

@h1alexbel
Copy link
Member Author

@maxonfjvipon can we detect which object is used in tests, and pull those tests?

@maxonfjvipon
Copy link
Member

@h1alexbel I don't think so. We can try to scan 4-pull directories, build tree of all possible packages where tests may appear, probe them in objectionary, and pull. But I'm not sure how we can merge it into our current pipeline. And should we?

@yegor256
Copy link
Member

yegor256 commented Mar 25, 2025

@maxonfjvipon When we publish tests to objectionary/home, we can add +optional meta to them (automatically). Then, when we run tests locally, we will have tests with this meta and without it. WDYT?

@maxonfjvipon
Copy link
Member

@yegor256 probably, I think, do not run pulled tests is not a problem. The problem is - how to download them

@yegor256
Copy link
Member

@maxonfjvipon maybe simply by name? If we pull foo.eo, we automatically try to pull foo-tests.eo

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

No branches or pull requests

3 participants