-
Notifications
You must be signed in to change notification settings - Fork 991
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
[question] cmake.test() and -c tools.build:skip_test=False with Conan-2.x #13864
Comments
Hi @maitrey
I don't think this is related to this ticket, but this would be a different question. There will be some changes in 2.0.5 (#13833) that will allow debugging and step-into into packages in the Conan cache. |
The implementation of def test(self, build_type=None, target=None, cli_args=None, build_tool_args=None, env=""):
if self._conanfile.conf.get("tools.build:skip_test", check_type=bool):
return So you shouldn't need to add anything to your recipe, just |
Finally, it would be necessary to have something to reproduce, with the information above is not possible to know what could be happening. I'd recommend starting from the |
I will try to upload the code later today. In conan-1.56, I did not have this issue with cmake.test(). I have always used build and tests but with 2.x, I wanted to take benefit of the feature skip tests. conan injects a variable BUILD_TESTING and I started to use that.
|
A couple of quick comments:
The problem with the .sh and .bat files seems related to the configuration. If you can please share the whole output before that error, that could give us some hints. |
Thanks for the tips. Fixed it . In the build folder should I have both the :
Comes up only when I add cmake.test(). Does that give any hint to you? |
That could happen if it is some cross-building, this is why I was asking about the configuration and the full output. In that case, the |
Yes it is cross building. I am sorry but what does can_run(self) do ? How did it work with conan-1.x ? Has something changed with respect to cmake.test(). Sorry for the list of stupid questions. |
https://docs.conan.io/2/reference/conanfile/methods/test.html?highlight=can_run -> But here it says not to use it for any kind of testing : unit, integration or functional tests. |
Well, it seems that for cross-building scenarios |
Okay that I understand will run the build but skip the tests. Question is then how to run the tests ? |
But you cannot run the tests if you are cross building. They will not run in the build machine. Am I missing something? |
I used cmake.test() with conan-1.59 and all tests could be executed (unit tests, functional tests.), It looks to me that there has been a change with 2.x and it doesnot work anymore. I understand that I cannot run the tests using cmake.test() anymore if i am doing cross building. Question is:
|
FORDEBUGGING.zip
And used the command : conan create . --user autosar--channel bringupconan2 -pr:b=default -pr:h=ndp -c tools.build.cross_building:can_run=True
Any ideas or help is greatly appreciated. |
Hi @maitrey I'd still like to understand how you are able to run executables for the host platform in the build platform when you are cross compiling. What system are you using? What I am missing? do you have some kind of remote testing system? This is important to understand, because Conan is being confused, being generated files for both "build" and "run" environment, which are clearly not compatible, because they belong to different OSs. |
Could it be that , this was added in 2.x and now shows issues:
|
No I was wrong, this was existing in conan-1.56. Anyhow I understand the argument above from you and I am also clueless how did it work before. I see couple of differences in the settings.yml, in 1.56 I had:
Does that make a difference? |
Now i think I know, in 2.x I use buildenv and in 1.56 I always used [env] because of which it generated only one .bat. Now conan2.x is explicit automatically has buildenv and runenv in profile and throws errors: [settings] [env] [conf] The tests are not using binaries that are generated for the target platform. |
@memsharded : Good Morning! Could I use: self.run("ctest") . There are some compliance reasons(internal) we have to run some checks like docu checks.So I have to run them after build process. Are there are any side effects of using it this way ? |
Another point to add:
|
The explanation of the issue is something like this:
This behavior seem correct, and aligned to the fact that some binaries intended for a cross-building scenario cannot be executed, and this is why I have been trying to understand the use case. So you might need to customize the recipe somehow to implement this use case. Some things that you can try:
|
Hi James, |
What is your question?
Dear Conan Folks,
I can see that the structure of folders is different in conan cache .. when i build locally i see the export sources sources and sources in another folder and build and package in another folder .. When the build is running everything is run inside a t folder and this is cleaned up once the package is created . Also, the CMAKE_SOURCE_DIR , CMAKE_BINARY_DIR ; CMAKE_CURRENT_SOURCE_DIR and CMAKE__CURRENT_BINARY_DIR all point to everything insiide the t folder . Its not possible to debug as the compile_commands.json information after copying to b folder is having information that no longer exists.How can I disable that the t folder stays for debugging purposes ?
I am using the command to build my packages locally:
conan create . --user autosar--channel bringupconan2 -pr:b=default -pr:h=ndp -c tools.build:skip_test=False
I am using add_test to run static code analysis. In my case, there is a python script that I call. But I donot see the Testing logs and also if I use BUILD_TESTING I cannot see which testing targets are built :( .
If I use like this:
and in CMakeLists.txt:
It fails with:
ERROR: mngr/0.0.0-dev.0@autosar/bringupconan2: Error in build() method, line 64
cmake.test()
ConanException: Cannot wrap command with different envs,['C:\Users\.conan2\p\t\mngr396dd68d0350b\b\build\Debug\generators\conanbuild.bat'] - ['C:\Users\.conan2\p\t\mngr396dd68d0350b\b\build\Debug\generators\conanrun.sh']
If I use add_custom_target instead of add_test it fails with:
ERROR: Couldn't move folder: C:\Users.conan2\p\t\mngr5fc49c520f875->C:\Users.conan2\p\mngrbe25c70a5cd31
Destination path C:\Users.conan2\p\mngrbe25c70a5cd31\mngr5fc49c520f875 already exists
Folder might be busy or open. Close any app using it and retry.
And there is no other application that has opened this location , unfortuantely.
How do I fix it ?
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: