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

conan create may fail if test_package requires the tested reference in a different configuration #14314

Closed
1 task done
jcar87 opened this issue Jul 17, 2023 · 2 comments · Fixed by #14347
Closed
1 task done
Milestone

Comments

@jcar87
Copy link
Contributor

jcar87 commented Jul 17, 2023

What is your question?

For discussion / look into.

When running conan create to build a specific package (given input profiles, options, etc), there are some circumstances in which the package may be created, but test_package can fail, some examples:

  • when the test_package has a self.requires() and a self.tool_requires() on self.tested_reference_str. In some circumstances this can lead to two different package IDs being required for a successful test package, for example:

    • --profile:build and --profile:host are different when cross compiling - the test package will fail if the package for the build profile does not previously exist.
    • -o "*:shared=True" - the option only applies to the host context, but not the build context (the package ID resolved for the tool require) - here we are NOT cross building but it would still fail, unless the same options and settings were passed to both build and host contexts.
  • when the package is always used as a tool_requires, and the test package has self.tool_requires() on the tested reference - in this case, the options and settings will apply to what is being created, but a different package ID will be required when testing. In these instances, --build-require should be passed to the command line when invoking conan create - but this requires external knowledge that the tool is used as a tool requirement.

For the first scenario, knowledge of this situation is required in order to derive a correct build order, or alternatively one may want to silence the test package (-tf=""). For the second scenario, one must know that the package is (exclusively?) used as a tool requirement to pass --build-require when invoking conan create.

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@DoDoENT
Copy link
Contributor

DoDoENT commented Jul 18, 2023

Today I stumbled upon a similar/same issue but found out that not even --build=missing helps, even if applied to conan test only.

I'm generally OK with the fact that conan create creates only a single package ID, but a subsequent conan test should be able to build its missing packages by dependency, even if it's executed as part of conan create (and yes, that would mean that multiple package IDs are created with single conan create call).

@memsharded
Copy link
Member

#14347 has changed this, adding the --build-test=xxx alternative (that defaults to --build) that allows to control what is being built. conan create . --build=missing will also build missing binaries for test_package and conan create . --build-test=missing will do the same, but guaranteeing that no packages in the "main" tested graph are being built from source. It will be in 2.0.10

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 a pull request may close this issue.

3 participants