Reputation: 3367
I am currently in the process of introducing Conan.io (Version 1.20.5) to my project.
With Cmake.test(), I am missing the XML testreport that was previously generated by calling ctest -T test
directly.
Here is the conanfile.py build() excerpt:
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
cmake.test()
Comments:
1.) Defining args to the build() is breaking the build as these args seem to be forwarded to _build(): https://github.com/conan-io/conan/blob/812c8ec8185e24b2bc41fb6e855d35c925526670/conans/client/build/cmake.py#L276
Regards, Christian
Upvotes: 6
Views: 2111
Reputation: 83
For conan 2.0 the parameter to cmake.test()
is cli_args
and CTest now accepts --output-junit
so I have:
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
cmake.test(cli_args=["ARGS=--output-junit testing/results.xml"])
Upvotes: 1
Reputation: 3887
You want to pass an argument to ctest
, but Conan calls cmake --build . --target test
instead of ctest
directly, thus you need to pass as extra argument:
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
cmake.test(args=['--', 'ARGS=-T Test'])
This will result in the follow command:
> cmake --build '/tmp/foo/test_package/build/878b1b6e2d4cbc82452d014e37c38868584457e8' '--target' 'test' 'ARGS=-T Test' '--' '-j4'
Now you will have the XML file result.
Regards!
Upvotes: 9