Commit Graph

72 Commits

Author SHA1 Message Date
Martchus dd41762b70 Add testDirPath() for finding directories with test files
The same as testFilePath(), just for directories.
2020-09-23 22:49:33 +02:00
Martchus 52722be407 Add test helper execHelperAppInSearchPath() 2020-06-10 18:42:50 +02:00
Martchus 3fe1ea64cf Improve documentation of some test utilities 2020-04-13 23:35:22 +02:00
Martchus 06e29dd751 test utils: Use /proc/self/exe to find srcdirref, at least where supported
So it also works if e.g. chdir() is called before instantiating
the TestApplication.
2020-04-11 22:12:49 +02:00
Martchus 9fe7053869 Print "Executing test" via cppunit.h
Otherwise it is a bit annoying if one just wants to instantiate
a TestApplication for looking up test files.
2020-04-11 21:50:55 +02:00
Martchus 0cdf2c3492 Use const where possible in code dealing with profiling data 2020-01-12 21:02:43 +01:00
Martchus 1bdc088b54 Close workingCopy in workingCopyPathAs() for correct error handling 2019-12-15 19:01:04 +01:00
Martchus e71d54d93f Make run the default arg of TestApplication 2019-06-17 21:04:13 +02:00
Martchus 66bb3e5253 Rename TestApplication::m_instance to TestApplication::s_instance 2019-06-17 21:03:37 +02:00
Martchus 7249751d30 Apply clang-format and cmake-format 2019-06-16 16:54:26 +02:00
Martchus 428a67d68b Improve test application for cppunit
* Allow to list available tests
* Fail the test if at least one explicitely specified unit
  is not available
2019-06-14 18:07:45 +02:00
Martchus b48b2f5c06 Have everything in one top-level namespace 2019-06-10 21:56:46 +02:00
Martchus 4c1b733290 Rework ArgumentParser::parseArgs()
* Remove "ext()" and "orExit()" versions
* Exit by default (might be intrusive but it is the most
  common use)
* Rename Failure to ParseError
2019-06-10 16:03:27 +02:00
Martchus c701fc25ee Remove directoryEntries() 2019-06-05 23:50:38 +02:00
Martchus f16703ffc0 Remove workingCopyPathMode() 2019-05-11 19:02:32 +02:00
Martchus f0c6035609 Simplify dealing with multiple testfile paths 2019-05-11 18:47:14 +02:00
Martchus 151a3ae9e5 Apply clang-format 2019-05-04 20:58:23 +02:00
Martchus a6fdb3369a Make unsuccessful testFilePath() throw an exception 2019-04-22 20:42:48 +02:00
Martchus 6d7a6ab735 Don't pretent to add arguments implicitely 2019-04-13 20:33:39 +02:00
Marius Kittler 132f936c57 Remove workaround for GCC Bug 66145 2019-04-13 20:33:39 +02:00
Martchus ac8fe5d2c7 Improve constructors for test application 2019-04-13 20:33:39 +02:00
Martchus bc8ea407bc Prevent use of static variables in ArgumentParser
Have --no-color and --help added by default rather
so argument parser is in control over them and don't
has to use static functions.
2019-04-13 20:33:39 +02:00
Martchus 789af62d97 Add workingCopyPathAs() 2019-01-20 22:56:22 +01:00
Martchus d21cde6fe3 Remove unused variable in testFilePath() 2019-01-20 22:16:07 +01:00
Martchus 8b35d06aa7 Improve documentation for testFilePath()/workingCopyPath() 2019-01-20 22:15:35 +01:00
Martchus 757a3476cc test utilities: Print testfile path in all cases 2018-11-02 22:36:22 +01:00
Martchus 34eac527ee Log actual application path when testing 2018-10-25 18:20:14 +02:00
Martchus 17fc55a2c6 Fix compilation of testutils under Windows without NativeFileStream 2018-10-07 21:14:56 +02:00
Martchus 61edf58c3e Fix workingCopyPathMode 2018-10-06 16:18:39 +02:00
Martchus 5356d793fc Make all tests pass under Windows
* Workaround some issues
* Disable some tests (better than not running tests
  at all)
2018-10-03 22:37:55 +02:00
Martchus 8e3c40abb5 Make conversion from multi byte to wide string generic 2018-10-03 21:26:41 +02:00
Martchus 25ef4e28a2 Make tests compile under Windows 2018-09-30 13:55:30 +02:00
Martchus 826c43ef8b Include missing cerrno 2018-08-12 22:17:09 +02:00
Martchus d0bf2fb390 Add more debug output to TestApplication::workingCopyPathMode 2018-08-11 22:21:48 +02:00
Martchus 2347677495 Adjust name of working copy until unique if unable to override 2018-07-28 20:51:25 +02:00
Martchus f50321f414 Improve coding style in testutils.cpp 2018-07-28 20:00:28 +02:00
Martchus 0f45817956 Make output of workingCopyPathMode() even more verbose 2018-07-28 19:39:11 +02:00
Martchus c53472fdce Make failing TestApplication::workingCopyPathMode() more verbose 2018-07-28 15:59: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 df7a3ee93c Apply clang-format from LLVM 6 2018-03-24 17:00:30 +01:00
Martchus 3a768508fd Use src dir as fallback unless arg *and* env var specified 2018-02-03 17:16:30 +01:00
Martchus ab42e9d96c Improve documentation of testutils 2017-11-12 16:58:53 +01:00
Martchus cc5d6052f5 test application: Allow to skip argument parsing 2017-11-12 16:17:08 +01:00
Martchus 924481b033 Fix platform check for readFallback...() functions 2017-11-01 19:30:55 +01:00
Martchus 6fd2603cff teat application: Prevent copying dir entries 2017-11-01 19:17:57 +01:00
Martchus 34f3ebb45d Let tests find the application path without extra args
Currently the path of the application to be tested always had to
be specified either manually using the -a 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 makes tests assume the application to be tested is
called like the test executable itself, just without "_tests"-suffix.
2017-10-30 23:03:43 +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 dab05bdade Improve coding style in test utilities 2017-10-24 01:02:07 +02:00
Martchus e52fd5a4af Apply tidy after updating to clang-format 5.0.0
The behavior of clang-format slightly changed in Clang 5.0.0:
http://releases.llvm.org/5.0.0/tools/clang/docs/ReleaseNotes.html#clang-format
2017-09-17 21:45:23 +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