-
Notifications
You must be signed in to change notification settings - Fork 393
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
Add tests to CMake build #92
Conversation
...in lcm-lua, for consistency with lcm-python.
"Fix" some C casts between pointer types that also unnecessarily discarded a `const` qualifier. Use `const_cast` instead of C casts in a few spots that really do need to remove a const qualifier. (This fixes spots that were tripping `-Wcast-qual`, including in generated code.)
Rearrange member initializers to match declaration order, i.e. the order in which the compiler actually executes them. This fixes -Wreorder violations.
Add CMake logic to build the gtest library and the C/C++ unit test executables. Register "pure" (i.e. the ones that don't need a server) C/C++ unit tests so they can be run with CTest.
Fix building Python documentation to use the correct path separator for PYTHONPATH on Windows.
Create a Python helper script to launch the C test server and run a specified test client. Set up client/server tests for CTest for C, C++, Python and Lua. This should account for all of the existing tests except for the Java client/server test.
Build dependency JAR's for Java client/server test, and the JAR for the test itself. Add necessary logic to register and run the test with CTest.
I get the following configure error:
I'm on cmake 3.2.2 Also, it looks like you've mixed in some C++ code (e.g., I spotted a const_cast<>). |
Ack, it looks like the ability to add dependencies to
Yes, but only in C++ sources, no? (The instance in |
hmm... The main challenge with requiring such a new version of CMake is that most LCM Linux users will not be running a distro with CMake 3.5. Even users on OS/X and Windows may be running an older install, and it's nice to not force people to upgrade dependencies. One of the main priorities for LCM is wide portability and compatibility. Requiring a build system that was released less than 6 months ago isn't super conducive to that =/ That said, I'm okay bumping the CMake required version to 3.5 if we:
If you'd like to purge the autotools build system, which I'm assuming you do judging by the frequent comments... ;) then my request is that we maintain backwards compatibility with CMake 2.8 (picked mostly because that's what shipped with Ubuntu 14.04) Thoughts? |
3.3 is sufficient for the current state of this branch. Note that Fedora 22, which recently went EOL, has CMake 3.3.1.
...but it's as easy to install a newer CMake on Windows and OS X as it was to obtain whatever version the user has currently.
This would be... difficult; there are several places where (We'd also have to go back to carrying a copy of What about following what some other projects have done and making 1.3.x a "LTS" branch (still using autotools) and moving just master to CMake-only? (I could live with staying at 3.1, tagged 2014-12-15, as the minimum requirement. In fact, given this discussion, I'll go ahead and add a work-around for pre-3.3 to this branch.) |
CMake prior to 3.3 does not support dependencies on INTERFACE targets, so add a work-around to ensure proper build order (namely, generating the C++ test type bindings before compiling the C++ tests) for older versions of CMake. (Just requiring 3.1 is a little controversial at this time, so we'd rather not bump the minimum requirement even higher just now.)
Sorry for the slow action on this. I've merged in this PR and applied a minor fix (#101). |
No worries, I've also been busy with other things. Thanks! |
Add tests to CMake build
Add necessary CMake logic to build and run the unit and client/server tests with CMake/CTest.
Demo:
(Note: the Java client/server test may be flaky; I've seen it fail at least once, then pass when re-run. Also, trying to run the tests in parallel will end badly for fairly obvious reasons. Don't do that 😁.)
I haven't actually tried to run the tests using the old framework, so this is based on what I could figure out reading the various
Makefile
s and scripts. Please let me know if I missed something.There are also some warning fixes in the branch because I build with
-Werror=reorder -Werror=cast=qual
, and the tests were tripping these. (Note especially the change in code generation. There should be no behavior changes, however.) I also noticed and fixed an error with the Python documentation generation on Windows.Note that the client/server tests require Python. The old driver scripts are also Python, so this isn't a new. Also, this conveniently provides a good example of generating LCM types with CMake. (Especially for C++, which is a little screwy to set up, but works beautifully for consumers.)