Commit Graph

110 Commits

Author SHA1 Message Date
Bernhard Beschow
2d92ae391a AutoTest: Prefer ITestBase::type() to ITestBase::asTest*()
The casting provided by the asTest*() methods isn't made use of here, so
using the "data-oriented" type() method seems more expressive.

Change-Id: Ia3e1a28d126f096afed54eeb0d884c52332f4350
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-02-09 22:38:20 +00:00
Bernhard Beschow
c16f8ce988 AutoTest: Prefer ITestParser to ITestFramework in TestCodeParser
Preserves the level of abstraction.

Change-Id: I01354fc8fcdf846dd2ef2a20fce12f6e9c4756b2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-02-08 09:36:35 +00:00
Bernhard Beschow
ed6083b521 AutoTest: Improve type safety in TestParseResult
By having TestParseResults take ITestFramework rather than ITestBase as
parameter, some base->asFramework() casts can be avoided today which
could possibly fail in the future.

Moreover, it allows TestTreeItem to take ITestFramework rather than
ITestBase as parameter which improves type safety further. This shall be
done in a separate commit though.

Change-Id: I66594415d68c3423076a0830ecd11080d3b6c186
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-02-04 11:31:56 +00:00
Bernhard Beschow
3d075d30d0 AutoTest: Fix invalid static_cast
Test tools only create ITestTreeItems, not TestTreeItems.

Change-Id: Idb20844b80e351d4f0a472e4b97b074797ad6f99
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-02-04 11:31:09 +00:00
Christian Stenger
da07d8f5c3 AutoTest: Fix some clazy warnings
Avoids potential nullptr accesses and unneeded allocations.

Change-Id: I8c13ca1dab885fc3e9a05dc7329ff592a7f0fe1a
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-01-19 12:27:08 +00:00
Christian Stenger
ab963bd4f1 AutoTest: Simplify expression
Change-Id: I3f724e3d9f749f533cd6d18e2258cf7e99c29239
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-01-15 06:20:18 +00:00
Christian Stenger
3de4ac3736 AutoTest: Handle test tools inside project settings
This effectively enables to handle ctest project wise instead
of just globally. So far only code based test frameworks could
be enabled or disabled by project.

Change-Id: I491f91119c3500131ca51af4d55b0e68d47debf0
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-01-15 06:20:09 +00:00
Bernhard Beschow
f82692cc7f AutoTest: Make code more symmetric
... by assuming that active.keys() is a subset of
TestFrameworkManager::registeredFrameworks() which is used in the case
above. Also, TestFrameworkManager::registeredFrameworks() is already
sorted, as can be seen from the above case, too.

Change-Id: If82c8c998716fa56d6257d3ee0ec09c12d458bb1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-01-07 14:54:34 +00:00
Christian Stenger
40d83926a2 AutoTest: Use more specific types for test tree model
Allows to move over some static casts to the base tree model.

Change-Id: I19e322714a6026771139eeb0ded4645afb45aabe
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-12-07 05:33:16 +00:00
David Schulz
7853c6ba4d AutoTest: add ITestBase::type() for better readability
Change-Id: I67133f4940329483f2d8d25d1212f4e07f57d39d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-11-30 05:15:15 +00:00
Christian Stenger
c217f0694d AutoTest: Allow registering ITestTools
Task-number: QTCREATORBUG-23332
Change-Id: I529b1cc1f110739c264c7a021aada063f697b1db
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-11-27 09:53:43 +00:00
Eike Ziller
5ca70bdcb3 Merge remote-tracking branch 'origin/4.14'
Change-Id: Iea84f23cf394de13e99a9ed777c8c113e4eff473
2020-11-19 15:38:13 +01:00
Jarek Kobus
2c919c43be Use QHash instead of QMap when key is a pointer type
Ordering in container by pointer to memory doesn't make much sense.
QHash is faster for lookups in this case.

Change-Id: I0d4bdac7f5bb9afffdeaef70b99326547c080f55
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-11-17 14:38:17 +00:00
Christian Stenger
73613d8549 AutoTest: Introduce ITestTool
Preparation for separating handling of code based and
build system based tests.

Task-number: QTCREATORBUG-23332
Change-Id: I490af5f3157fd4a8cd07d976cdfd9e4503ade97b
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-11-16 08:10:31 +00:00
Christian Stenger
239a59c596 AutoTest: Introduce ITestConfiguration
Preparation for an additional simpler test configuration
which needs to have the same common base.

Change-Id: I1800ed5d7301f1aea99eba6ef588a204697bd569
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-11-16 08:10:04 +00:00
Christian Stenger
55298cc211 AutoTest: Introduce ITestTreeItem
Preparation for having separated test tree items with a
common base.

Change-Id: I3735f582cc96910e971f5a41c799cc0729a10a58
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-11-16 08:09:46 +00:00
Christian Stenger
ac14a1e038 AutoTest: Clean up header mess
Better decoupling and reduced binary size.

Change-Id: I4f6239979d9d7dae4ad92f19ec8420be38372c07
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-11-09 08:24:01 +00:00
Christian Stenger
24db5dcc4f AutoTest: Use base of framework inside TestTreeItem
...and respectively inside the parse results which hold the
information that are used to create the items.

Change-Id: I78f7b5632df5d449d39fa03ffbf48036a138e337
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-11-09 08:23:00 +00:00
Christian Stenger
ff06a409c2 AutoTest: Immediately update checkstate cache
...as soon a modification of the check states happens
instead of waiting for the next parsing to update.
Otherwise we might lose all changes that have been
made without a parse.

Change-Id: I33a92786742eb2b58c1cfcdb438412a2c5bbaed8
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-10-01 08:07:50 +00:00
Christian Stenger
a7e1411ebf AutoTest: Cache failed states
Avoid losing failed states of test while editing files
that trigger a re-parse and may drop the original item.

Change-Id: Ia66c7f61819d610cced42ff9f86449855b80da2a
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-10-01 08:07:40 +00:00
Christian Stenger
5f22126a79 AutoTest: Support gathering failed tests
Mark test tree items as failed for the last run
to be able to re-run them in an easier way.

Change-Id: I7ea3dcd16e5a02797d41f13e02b2fa95b857cf5e
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-09-16 06:53:54 +00:00
Christian Stenger
df49d6e40d AutoTest: Persist check state to project settings
Make it easier to switch between projects and restore
the former check states of the found test items if
we have these information.

Change-Id: I99a5357388c36aa8cce6f5f82184d6ab2a8bf6e8
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-07-13 06:26:12 +00:00
David Schulz
dfd7bdd22a Autotest: Introduce ItemDataCache
Change-Id: Icbd703a8ddd3c5dea4a90d2c32c1866764bc0267
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-07-07 08:42:08 +00:00
hjk
e1c88116b3 Core/Utils: Migrate further to Utils::Id
The coreplugin/id.h header is kept for downstream for now.

Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
(cherry picked from commit 430a33dcd9)
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-07-06 11:15:18 +00:00
Christian Stenger
1b8c68f617 AutoTest: Restore former check state on reparse
When reparsing while modifying a file it can happen that
the parse failed for some reason or did not provide full
information due to syntax errors the code model cannot cope
with.
This in turn can purge items from the test tree. Re-adding
the items in a later reparse had just added the item and
did not take care of (former) check states.
Add simple caching mechanism to keep track of check states
and use them if available.

Task-number: QTCREATORBUG-24099
Change-Id: I3ca04f5fd58810df71582972e6fe96a00cfc48f1
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-06-18 07:49:59 +00:00
Eike Ziller
9a149e295b Merge remote-tracking branch 'origin/4.12'
Conflicts:
	src/tools/qml2puppet/CMakeLists.txt

Change-Id: Id6243b0f725a68075d789bf35e771113b742645b
2020-03-30 17:27:55 +02:00
hjk
78235d63b4 Autotest: Slim down TestFrameworkManager interface
- sort frameworks at insertion time
- apply the 'static' pattern
- inline code from convenience functions that are only used once on
  the caller side

Change-Id: Ic4a46ad9487c58b4dfd61658a6fccebb88a428a9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-03-27 14:16:48 +00:00
Christian Stenger
ca82019cf0 AutoTest: Fix flakyness of plugin test
Relying on the order of tests of the underlying tree
model is bad as we order the model for the user with a
QSortFilterProxyModel.
Using non-unique keys is not wise either.
Ensure the keys are unique to have reliable results.

Change-Id: I556371d018c16e7b03a8ec85d60afc850056a94a
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-03-26 15:09:57 +00:00
Christian Stenger
0b7c4520cd AutoTest: Fix regression in frameworks order
Latest refactorings resulted in possible different orders
for the tree model as well as for the frameworks inside the
project wide settings.
Fix this by sorting explicitly and iterating over the list.

Change-Id: I9b673770b03732820f0ea4f902f3586abd07d51a
Reviewed-by: hjk <hjk@qt.io>
2020-03-25 13:38:55 +00:00
hjk
7158e67612 AutoTest: Move TestCodeParser and TestTreeModel ownership to plugin pimpl
Change-Id: I01b32aae894a4b419c8a067f604d5f04a2b14dfe
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-03-20 13:13:52 +00:00
hjk
d3f79fcc68 AutoTest: Use ITestFramework * instead of its id in some cases
Change-Id: Ic327e31185247b6479c78af8bf8156f44bb4bdfb
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-03-16 12:18:29 +00:00
Eike Ziller
fcb12a275f Merge remote-tracking branch 'origin/4.10' into 4.11
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
	src/plugins/projectexplorer/deploymentdata.cpp
	src/plugins/projectexplorer/msvctoolchain.cpp

Change-Id: I64c304fc71435629a6a0060a9df71e8952699508
2019-10-16 15:27:22 +02:00
Christian Stenger
4b76f6c65d AutoTest: Fix Run Under Cursor for GTest
Broke while introducing TestSuite and following the
official terms.
Amends 6189745a3b.

Fixes: QTCREATORBUG-23068
Change-Id: I02a8c72debface1e15b2e1901ec6115e210a0312
Reviewed-by: pawelrutka <prutka13@gmail.com>
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-10-10 13:19:31 +00:00
Christian Stenger
89ae78fd89 AutoTest: Reparse only newly added frameworks
Instead of re-parsing all test frameworks trigger a reparse
just for the newly added as results for the other should not
have changed.

Change-Id: I6eb53da04bb927a884d6431e137bfe68f391f2ad
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-09-18 08:03:49 +00:00
Christian Stenger
49942bc06a AutoTest: Re-order responsibilities
Keep the timer for syncing frameworks where it
is really used, do not create functions that are
not necessary at all.

Change-Id: Ie0a49a2611dc67510b72562455ea2a1af7b1c538
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-09-06 10:07:01 +00:00
Nikolai Kosjar
6e0697cb58 AutoTest: Fix endless timer timeout
Change-Id: I6222e9b2102e5cc65b940c25ac0c877c07a48462
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-09-02 10:26:19 +00:00
Christian Stenger
03b80025a9 AutoTest: Shuffle namespaces for clearer separation
Change-Id: I6ac440c6d72c3d0dbcd75907f8a6ae756f3cf5ee
Reviewed-by: hjk <hjk@qt.io>
2019-09-02 09:04:16 +00:00
Christian Stenger
43e27f76b3 AutoTest: Add project based {en|dis}abling of test frameworks
Provide integration into the 'Project' view which allows to set
some settings on a per project base.
For now only enabling or disabling of test frameworks.

Task-number: QTCREATORBUG-16704
Change-Id: Iedd9a300164931e07a21cbb4e5a222be3266c81e
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-09-02 05:49:52 +00:00
Christian Stenger
0d11d880ca AutoTest: Unify container usage in TestFrameworkManager
And provide an accessor for the framework's priority which
will be needed later on.

Change-Id: I5a2480699d9467ee50e2cc44b9d4ff58f9e8da88
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-08-22 13:34:23 +00:00
hjk
473a741c9f Utils: Rename FileName to FilePath
More in line with QFileInfo terminonlogy which appears to be
best-of-breed within Qt.

Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 12:23:26 +00:00
Christian Stenger
b86c05b96a AutoTest: Add unit test for parsing boost tests
To execute them you need - beside the former prerequisites -
either have boost installed installed at system level (UNIX)
or you must specify BOOST_INCLUDE_DIR as environment variable
otherwise the respective test will be skipped.

Change-Id: I6bd8472e554132ab05e58b56e3ccbd5e9dffada9
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-05-24 06:27:22 +00:00
Christian Stenger
6189745a3b AutoTest: Adapt Type enum
Follow the official terms used by the test frameworks.
In detail this means Google test now uses TestSuite and TestCase
and the value for a normal function has been simplified to
TestFunction.
Beside the visual change there is no change in functionality.

Change-Id: Idf541d07fa3469e04a699d46f4625ff9075d5b6f
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-05-23 12:20:05 +00:00
Christian Stenger
efa7a5a4d4 AutoTest: Add suite layer for tests
Test suites are used in several test frameworks. To avoid
fiddling around with the types and their meaning on the
frameworks side just add another type (TestSuite) that can
be used.
Frameworks can use or ignore this type as it is done already
for other types.

Change-Id: I6c2a312a32ce5716f55b49303e2b1a0f6f8e8da4
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-05-16 07:41:38 +00:00
Christian Stenger
9c06940dc9 AutoTest: Extract decision of adding filtered items
The old approach was working due to the fact that all
test frameworks followed a fixed type scheme and tried
to handle differences between the AutoTest plugin and
the "real" world of the test framework internally.
Generalizing this decision does no more make sense when
adding an optional test suite layer.

Change-Id: I4788150a8935d8e35e557df8475aa95c8ca545b4
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-05-16 07:41:04 +00:00
Eike Ziller
db9837fa6c Merge remote-tracking branch 'origin/4.7'
Conflicts:
	src/plugins/clangtools/clangtoolruncontrol.cpp
	src/plugins/cpptools/compileroptionsbuilder.cpp

Change-Id: Ib1e8abf066898b50c90fc1ccba4697fe983e8a8f
2018-08-15 13:53:28 +02:00
Christian Stenger
164d6ce7e0 AutoTest: Fix and unify handling of group nodes
QtTest had been forgotten to handle correctly as well. So, it
was possible to have several levels of grouping which had not
been handled correctly.
By (current) definition we handle only one level of grouping,
so prohibit more for QtTest tree items as well.
Basically move the check into a separate function and use this
beforehand instead of creating a nullptr.

Change-Id: Icbf02eae67e89464f371eb349eecf2976636d05f
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-08-07 11:01:51 +00:00
Christian Stenger
1d894c0f7a AutoTest: Code cosmetics
* use nullptr
* override
* remove old style casts
* fix most of the code model warnings

Change-Id: Ia08e846f9326ae28ca7e7d66748e25a8b817b9b1
Reviewed-by: Xing Xiong
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-07-20 08:34:48 +00:00
Sergey Morozov
57edd22d11 AutoTest: Add action to run all tests from current file
Run specific test functions since one test case can be implemented in multiple files.

Task-number: QTCREATORBUG-20329
Change-Id: I07f435c264f18e9608caa5b7ee20dff2d33ee9c0
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-05-15 14:41:53 +00:00
Christian Stenger
95446fb614 AutoTest: Use TypedTreeItem for test tree items
Change-Id: I739b6aefc868550b01c7421b4b304293564bb7b6
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-04-20 06:52:46 +00:00
Christian Stenger
32a219f5c1 AutoTest: Fix check state handling for filtering
Changing (gtest) filters can result in inconsistent
check states up to the root item.
This patch makes the check states consistent again.

Change-Id: I83b146c8859a352892945312ee2fd183699fc79c
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-04-17 07:00:38 +00:00