AutoTest: Provide DebuggableTestConfiguration

Preparation for easier distinguishing arguments for performing
normal run versus debug run.

Change-Id: I41cfa7fca5730f721b5b6a980c82c015f9e7f914
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2016-08-12 09:07:38 +02:00
parent 7efa4e8c9d
commit f3cb2ee761
5 changed files with 28 additions and 3 deletions

View File

@@ -30,7 +30,7 @@
namespace Autotest { namespace Autotest {
namespace Internal { namespace Internal {
class GTestConfiguration : public TestConfiguration class GTestConfiguration : public DebuggableTestConfiguration
{ {
public: public:
explicit GTestConfiguration() {} explicit GTestConfiguration() {}

View File

@@ -135,7 +135,10 @@ TestConfiguration *GTestTreeItem::testConfiguration() const
TestConfiguration *GTestTreeItem::debugConfiguration() const TestConfiguration *GTestTreeItem::debugConfiguration() const
{ {
return testConfiguration(); GTestConfiguration *config = static_cast<GTestConfiguration *>(testConfiguration());
if (config)
config->setRunMode(DebuggableTestConfiguration::Debug);
return config;
} }
// used as key inside getAllTestCases()/getSelectedTestCases() for Google Tests // used as key inside getAllTestCases()/getSelectedTestCases() for Google Tests

View File

@@ -30,7 +30,7 @@
namespace Autotest { namespace Autotest {
namespace Internal { namespace Internal {
class QtTestConfiguration : public TestConfiguration class QtTestConfiguration : public DebuggableTestConfiguration
{ {
public: public:
explicit QtTestConfiguration() {} explicit QtTestConfiguration() {}

View File

@@ -136,6 +136,8 @@ TestConfiguration *QtTestTreeItem::testConfiguration() const
TestConfiguration *QtTestTreeItem::debugConfiguration() const TestConfiguration *QtTestTreeItem::debugConfiguration() const
{ {
QtTestConfiguration *config = static_cast<QtTestConfiguration *>(testConfiguration()); QtTestConfiguration *config = static_cast<QtTestConfiguration *>(testConfiguration());
if (config)
config->setRunMode(DebuggableTestConfiguration::Debug);
return config; return config;
} }

View File

@@ -103,5 +103,25 @@ private:
TestRunConfiguration *m_runConfig = 0; TestRunConfiguration *m_runConfig = 0;
}; };
class DebuggableTestConfiguration : public TestConfiguration
{
public:
enum RunMode
{
Run,
Debug
};
explicit DebuggableTestConfiguration(RunMode runMode = Run) : m_runMode(runMode) {}
~DebuggableTestConfiguration() {}
void setRunMode(RunMode mode) { m_runMode = mode; }
RunMode runMode() const { return m_runMode; }
private:
RunMode m_runMode;
};
} // namespace Internal } // namespace Internal
} // namespace Autotest } // namespace Autotest