Commit Graph

54 Commits

Author SHA1 Message Date
Martchus a9453483a7 Allow adding test targets manually 2020-06-15 22:28:19 +02:00
Martchus e241d718ce Apply cmake-format 2020-03-05 19:05:33 +01:00
Martchus f5e275288d Reformat CMake files with cmake-format 0.6.7 2020-01-26 19:24:04 +01:00
Martchus 522d2e8cc8 Avoid an indentation level in TestTarget.cmake 2020-01-20 17:57:03 +01:00
Martchus d5930c8d60 Set visbility preset for test application to default 2020-01-20 17:54:28 +01:00
Martchus a9cb91bee2 Set default visibility explicitely to hidden
Hidden default visibility is already expected to be handled by
users of the library because it is the default under Windows.
2020-01-10 18:05:55 +01:00
Martchus 9d8135bfd7 Require CMake 3.3.0 in all modules 2020-01-10 18:01:13 +01:00
Martchus 1ce06517cc Apply cmake-format 0.6.5 2019-12-27 01:45:30 +01:00
Martchus 3fb40baebc Reformat CMake scripts against cmake-format 0.6.3 2019-12-15 18:58:42 +01:00
Martchus 6376819c07 Apply cmake-format v0.6.0 2019-11-30 17:58:01 +01:00
Martchus 99bc257755 Apply cmake-format 2019-08-06 00:02:38 +02:00
Martchus bc0d7af67f Apply cmake-format 0.5.1
* Disable autosort as it messes with add_library and
  add_executable calls
2019-06-01 12:14:30 +02:00
Martchus a17f322f3c Apply cmake-format 2019-05-04 20:57:56 +02:00
Martchus 1480d9ab63 Support installing multiple configurations within the same prefix 2019-05-04 01:59:45 +02:00
Martchus 8ffe0e6a51 Polish CMake code 2019-04-22 22:19:08 +02:00
Martchus e9cc26478b Don't mix building static and shared libraries 2019-04-22 20:42:48 +02:00
Martchus 86f3bf8b3b Apply cmake-format 2019-02-06 17:30:52 +01:00
Martchus b2bf0a002b Allow to add default cppunit test application
To get rid of the boilderplate file "cppunit.cpp" in each
project using cppunit for tests.
2019-01-13 22:14:42 +01:00
Martchus f66aa33d61 Reduce indentation in TestTarget.cmake 2019-01-13 22:01:52 +01:00
Martchus c66420b1dc Remove target to launch tests with wine
This wasn't of much use. One can just use `make
check` and set WINEPATH before manually.
2018-10-07 20:04:31 +02:00
Martchus 52bf075317 Move creation of srcdirref and testfiles dir to BasicConfig
Those make testing more convenient and are also useful when
there's no test target, eg. when testing syncthingtray with
mocked configuration.
2018-05-01 23:59:28 +02:00
Martchus 5950aed7ec Adjust use of llvm-cov to LLVM 5 2018-01-29 16:20:09 +01:00
Martchus 18e7154c03 Allow test target to be intended for manual testing
So those test targets which only setup an environment for
manual testing can be excluded from eg. `make check`.
2018-01-28 00:36:46 +01:00
Martchus 9744efda70 Ensure default testfiles directory for working copy exists 2017-11-17 23:36:36 +01:00
Martchus e283eea1f0 Prevent using executable of header-only lib for coverage 2017-11-15 19:13:36 +01:00
Martchus 2bb4aa36a4 Let tests find the testfiles from sources without extra args
Currently the path of the testfiles always had to be specified
either manually using the -p argument or by running the tests
via the build system targets. The first option is annoying and
the second option not so nice when using Qt Creator and the
debugger.

This commit allows tests to find the testfiles from the source
directory automatically (as fallback). This is achieved by
creating a file containing the path of the source directory
with CMake. Note that this file can only be found if the working
directory is set to the binary directory (default in Qt Creator).
2017-10-30 23:01:07 +01:00
Martchus cb02d5c733 Add target for building all tests
This allows to build all tests at once without
adding them to "all" target. In contrast to the
check target, the tests are not executed.
2017-10-19 16:20:49 +02:00
Martchus a475ef8693 Make creating overall test coverage depend on awk script 2017-08-17 17:59:08 +02:00
Martchus e4709099d2 Prevent error in coverage target when building only static libs 2017-07-28 17:34:28 +02:00
Martchus c966e3fb1b Improve finding cppunit
* Add include dir
* Make library/include dir configurable via cache variable
2017-07-22 15:33:41 +02:00
Martchus 942c14ce3d Fix target include dirs
* Add include path of own header files for build
  and external use via imported target. Previously
  only include dirs required for external libs were
  added.
* Using global include dirs is no longer required.
* When PUBLIC_SHARED_INCLUDE_DIRS is empty, adding
  "${PUBLIC_SHARED_INCLUDE_DIRS}" to public include dirs
  does not leave INTERFACE_INCLUDE_DIRECTORIES property
  empty. Instead the source dir is added. So just don't
  use quotes here.
2017-07-11 22:02:27 +02:00
Martchus 442f7a9b25 Exclude generated files from coverage
* So files generated by moc or qdbusxml2cpp are not
  part of coverage statistics
* When filtering files, llvm-cov prints multiple tables
  showing coverage on function level.
  -> Generate overall coverage stats via awk.
2017-07-09 23:38:11 +02:00
Martchus 6f146072ea Allow overriding 3rd party libs/includes
So passwordfile can be told to use legacy OpenSSL
header in accordance with Qt 5 which still requires
OpenSSL 1.0
2017-07-04 22:44:32 +02:00
Martchus a4fc4024b5 Make tidy and coverage optional and disabled by default
* Prevent warnings about required tools being unavailable
  when tidy/coverage targets aren't desired anyways (eg.
  when packaging)
* Do not automatically execute tidy check when packaging
  in unclean environment
2017-06-20 23:38:45 +02:00
Martchus 57d5d04d9f Merge prof data of subprocesses created when executing tests
So coverage is accounted correctly when tests create subprocesses
of the application to be tested using execApp().
2017-06-20 23:19:49 +02:00
Martchus 1e14b09e64 Fix passing application path to tests 2017-06-19 14:15:44 +02:00
Martchus 64572e6860 Add general coverage target 2017-06-19 14:01:33 +02:00
Martchus 6807d899d2 Enable source code based coverage analysis 2017-06-18 16:17:44 +02:00
Martchus 2174dc516a Allow specifying target compile options via variable 2017-06-18 16:14:45 +02:00
Martchus ac348ee3b9 Find cppunit via pkg-config 2017-05-23 00:49:45 +02:00
Martchus 13ac2305d5 Allow not to link tests against cppunit 2017-05-23 00:10:27 +02:00
Martchus b74327d961 Move creation of check target to BasicConfig.cmake
* So other tests like tidy check can be added
* Even if there are no tests after all, the
  check target shoudn't cause any problems
2017-05-01 02:57:58 +02:00
Martchus daaedb7ba3 Fix issues in TestTarget.cmake
* Fix error message
* Improve comments
* Improve target names
* Fix working directory for check target
* Add info that calling enable_testing() on root
  level is required for check target to work
* Create workingdir for tests under binary dir to
  prevent polluting source dir
2017-03-27 22:12:20 +02:00
Martchus 2965f0cd00 Improve testing applications
When LINK_TESTS_AGAINST_APP_TARGET set, create a
library in addition to the application so tests can
link against it to check particular functions. This
replaces the current approach of linking against the
application directly which lead to linker errors.
2017-03-27 11:15:14 +02:00
Martchus fdbe874bcd Allow to disable excluding tests from all target 2017-03-23 20:31:57 +01:00
Martchus 64cc931555 Improve CMake modules 2017-02-11 02:30:46 +01:00
Martchus cb3b50c28c Allow overriding default CXX_STANDARD
to ease using newer C++ features in further
projects without setting the standard manually
for each target
2017-02-04 17:44:46 +01:00
Martchus 416008da1a Set compile definitions for tests 2016-11-26 13:06:27 +01:00
Martchus 00f7795dcd Link test target against neccassary libraries
In addition to previous libs, also link against
 - same libs as app/lib target
 - the app target itself if required
2016-09-20 20:52:29 +02:00
Martchus 7b946864a6 Remove pthread dependency from test target 2016-09-11 20:32:59 +02:00