Fat-Zer wrote:
Good day,
A long time ago I (kinda) promised to do something good on the testing support for tdelibs with cmake. I'm sorry I protracted it so much. But as it sad it's better late then never, so I want to present a series of patches to fix/add/restore/enhance/whatever test support in tdelibs.
Long story short: the repository is located here: https://github.com/Fat-Zer/tdelibs/tree/fix-check (branch fix-check) Note that cmake submodule has a different link due to it required some modifications too
There were already some workarounds for tdeui and tdeabc, but they had several problems:
- checks executables were added to "all" target, so they were build
unconditionally
- tests were run during build phase (which is confusing and wrong)
- no test statistics etc
What the patch set features:
- Add EXCLUDE_FROM_ALL flag for tde_add_library macro
- New macro tde_add_check_executable
- add tests from dcop/tdecore/tdeui/tdeio/tdeabc/tdewallet
- a fix in tdeio against mimemagic (fixes one check application)
- 40+ automated tests (mostly of base features which won't likely
fail) but anyway IMHO it's nice to have them.
How to use: To build tests/check run "make check"; To run automated tests run either "make test" or "ctest"; To run specific tests e.g. for tdecore use "ctest -R tdecore" (note that "tdecore" is just a substring of a test name ) To see verbose output of tests add -V flag "ctest -V -R tdecore". For more information see cmake documentation about ctest and cmake add_test macro.
No automated test require nor X session nor a running tde session, but if run inside a such session they may interact with it.
About tde_add_check_executable cmake macro: The macro is mostly a tde_add_executable with a redused set of arguments, but except of adding executable target to the "all" it adds them to a special custom target "check". As of specific of test executables (which are mostly one-source-file-based) it doesn't require the SOURCE section, instead of which it globs the files based on the target name. Also it has a TEST argument to automatically add a test out of given file.
Wow - this sounds pretty cool. Thanks! I'll look forward to check out next.