Re: [CMake] building and running tests with one command
The closest I've come to solving this problem is that for each test ${testTarget}, I add two cmake tests: add_test(NAME build_${testTarget} COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target ${testTarget} --config $CONFIGURATION) add_test(NAME someName COMMAND ${testTarget} ...) It might even be possible to combine them into one command, perhaps with a custom test driver. Petr On Tue, May 8, 2012 at 1:27 AM, Leif Walsh leif.wa...@gmail.com wrote: Hi, Is there a make, cmake, or ctest way to rebuild the dependencies of a test if needed, and then run the test? Suppose I have a bulit directory and I'm developing. I want to make edits, then run a command specifying one test to check, so that anything needed by that test gets rebuilt (if my changes require it), and then run. In make, I would do this by having one rule like run_%: % ./$ so that if I want to edit some library's source file and then run test_foobar, I would just run `make run_test_foobar`, and the source I changed would get recompiled, the library would get relinked, test_foobar would get relinked if it's static, and then test_foobar would be run. I hoped ctest --bulid-and-test would help, but it seems it doesn't. I tried --build-target test_foobar (I have add_test(test_foobar ...) in my configuration), and it only built test_foobar, it didn't seem to run it. -- Cheers, Leif -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] building and running tests with one command
So you run 'ctest -R testTarget' and it picks up the build test too? Hmm. Thanks. On Wed, 9 May 2012, Petr Kmoch wrote: The closest I've come to solving this problem is that for each test ${testTarget}, I add two cmake tests: add_test(NAME build_${testTarget} COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target ${testTarget} --config $CONFIGURATION) add_test(NAME someName COMMAND ${testTarget} ...) It might even be possible to combine them into one command, perhaps with a custom test driver. Petr On Tue, May 8, 2012 at 1:27 AM, Leif Walsh leif.wa...@gmail.com wrote: Hi, Is there a make, cmake, or ctest way to rebuild the dependencies of a test if needed, and then run the test? Suppose I have a bulit directory and I'm developing. I want to make edits, then run a command specifying one test to check, so that anything needed by that test gets rebuilt (if my changes require it), and then run. In make, I would do this by having one rule like run_%: % ./$ so that if I want to edit some library's source file and then run test_foobar, I would just run `make run_test_foobar`, and the source I changed would get recompiled, the library would get relinked, test_foobar would get relinked if it's static, and then test_foobar would be run. I hoped ctest --bulid-and-test would help, but it seems it doesn't. I tried --build-target test_foobar (I have add_test(test_foobar ...) in my configuration), and it only built test_foobar, it didn't seem to run it. -- Cheers, Leif -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake -- Cheers, Leif-- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] building and running tests with one command
Actuall, I haven't tried this using ctest directly, just via make test (or its Visual Studio equivalent). I believe that to make it work as one test, you'd have to provide a trivial launcher which does the two build - run steps in sequence. Petr On Wed, May 9, 2012 at 3:16 PM, Leif Walsh leif.wa...@gmail.com wrote: So you run 'ctest -R testTarget' and it picks up the build test too? Hmm. Thanks. On Wed, 9 May 2012, Petr Kmoch wrote: The closest I've come to solving this problem is that for each test ${testTarget}, I add two cmake tests: add_test(NAME build_${testTarget} COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target ${testTarget} --config $CONFIGURATION) add_test(NAME someName COMMAND ${testTarget} ...) It might even be possible to combine them into one command, perhaps with a custom test driver. Petr On Tue, May 8, 2012 at 1:27 AM, Leif Walsh leif.wa...@gmail.com wrote: Hi, Is there a make, cmake, or ctest way to rebuild the dependencies of a test if needed, and then run the test? Suppose I have a bulit directory and I'm developing. I want to make edits, then run a command specifying one test to check, so that anything needed by that test gets rebuilt (if my changes require it), and then run. In make, I would do this by having one rule like run_%: % ./$ so that if I want to edit some library's source file and then run test_foobar, I would just run `make run_test_foobar`, and the source I changed would get recompiled, the library would get relinked, test_foobar would get relinked if it's static, and then test_foobar would be run. I hoped ctest --bulid-and-test would help, but it seems it doesn't. I tried --build-target test_foobar (I have add_test(test_foobar ...) in my configuration), and it only built test_foobar, it didn't seem to run it. -- Cheers, Leif -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake -- Cheers, Leif -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] building and running tests with one command
I assume you have looked at ctest --build-and-test? -Bill -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] building and running tests with one command
Yeah, I tried it and I couldn't really figure out what it's doing. I could give it a binary name that it would build and I could give it a command to use to test, but the goal here is to only require the test name (since that may be different from the binary name) and to build all dependencies of the test. Sent from my iPhone On May 9, 2012, at 10:45, Bill Hoffman bill.hoff...@kitware.com wrote: I assume you have looked at ctest --build-and-test? -Bill -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] building and running tests with one command
On Mon, May 7, 2012 at 7:27 PM, Leif Walsh leif.wa...@gmail.com wrote: Hi, Is there a make, cmake, or ctest way to rebuild the dependencies of a test if needed, and then run the test? No -- there is no knowledge in the generated build system about what a test depends on. The only thing add_test does is generate test suite command lines and execute them. It does nothing to inject itself into the build system's dependency list. You might find previous messages in the list archive about this topic, I know I've answered this before. Ideally, we'd like to get to that point where what you want is feasible, but right now, it's not. Suppose I have a bulit directory and I'm developing. I want to make edits, then run a command specifying one test to check, so that anything needed by that test gets rebuilt (if my changes require it), and then run. In make, I would do this by having one rule like run_%: % ./$ so that if I want to edit some library's source file and then run test_foobar, I would just run `make run_test_foobar`, and the source I changed would get recompiled, the library would get relinked, test_foobar would get relinked if it's static, and then test_foobar would be run. I hoped ctest --bulid-and-test would help, but it seems it doesn't. I tried --build-target test_foobar (I have add_test(test_foobar ...) in my configuration), and it only built test_foobar, it didn't seem to run it. -- Cheers, Leif -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
[CMake] building and running tests with one command
Hi, Is there a make, cmake, or ctest way to rebuild the dependencies of a test if needed, and then run the test? Suppose I have a bulit directory and I'm developing. I want to make edits, then run a command specifying one test to check, so that anything needed by that test gets rebuilt (if my changes require it), and then run. In make, I would do this by having one rule like run_%: % ./$ so that if I want to edit some library's source file and then run test_foobar, I would just run `make run_test_foobar`, and the source I changed would get recompiled, the library would get relinked, test_foobar would get relinked if it's static, and then test_foobar would be run. I hoped ctest --bulid-and-test would help, but it seems it doesn't. I tried --build-target test_foobar (I have add_test(test_foobar ...) in my configuration), and it only built test_foobar, it didn't seem to run it. -- Cheers, Leif -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake