2014-10-07 15:51:02 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2014-10-07 15:51:02 +02:00
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** This file is part of Qt Creator.
|
2014-10-07 15:51:02 +02:00
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
2014-10-07 15:51:02 +02:00
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-22 10:37:55 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2014-10-07 15:51:02 +02:00
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2014-10-07 15:51:02 +02:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2016-01-12 13:52:21 +01:00
|
|
|
#include "autotestconstants.h"
|
|
|
|
|
|
2016-01-18 14:37:32 +01:00
|
|
|
#include <projectexplorer/project.h>
|
2019-03-13 08:06:08 +01:00
|
|
|
#include <projectexplorer/runcontrol.h>
|
2014-10-07 15:51:02 +02:00
|
|
|
#include <utils/environment.h>
|
|
|
|
|
|
2016-04-29 10:13:35 +02:00
|
|
|
#include <QFutureInterface>
|
2016-01-18 14:37:32 +01:00
|
|
|
#include <QPointer>
|
2014-10-07 15:51:02 +02:00
|
|
|
#include <QStringList>
|
|
|
|
|
|
2016-04-29 10:13:35 +02:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QProcess;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
namespace Autotest {
|
|
|
|
|
namespace Internal {
|
2019-08-19 10:55:32 +02:00
|
|
|
class TestRunConfiguration;
|
|
|
|
|
} // namespace Internal
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2020-03-26 10:11:39 +01:00
|
|
|
class ITestFramework;
|
2016-04-29 10:13:35 +02:00
|
|
|
class TestOutputReader;
|
|
|
|
|
class TestResult;
|
2019-08-19 10:55:32 +02:00
|
|
|
enum class TestRunMode;
|
2016-04-29 10:13:35 +02:00
|
|
|
|
|
|
|
|
using TestResultPtr = QSharedPointer<TestResult>;
|
|
|
|
|
|
|
|
|
|
class TestConfiguration
|
2014-10-07 15:51:02 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2020-03-26 10:11:39 +01:00
|
|
|
explicit TestConfiguration(ITestFramework *framework);
|
2016-04-29 10:13:35 +02:00
|
|
|
virtual ~TestConfiguration();
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2017-09-05 13:57:22 +02:00
|
|
|
void completeTestInformation(TestRunMode runMode);
|
2017-09-13 14:27:20 +02:00
|
|
|
void completeTestInformation(ProjectExplorer::RunConfiguration *rc, TestRunMode runMode);
|
2015-04-27 16:11:28 +02:00
|
|
|
|
2014-11-06 16:01:06 +01:00
|
|
|
void setTestCases(const QStringList &testCases);
|
|
|
|
|
void setTestCaseCount(int count);
|
2017-02-21 14:53:58 +01:00
|
|
|
void setExecutableFile(const QString &executableFile);
|
|
|
|
|
void setProjectFile(const QString &projectFile);
|
2014-10-07 15:51:02 +02:00
|
|
|
void setWorkingDirectory(const QString &workingDirectory);
|
2016-01-26 17:24:11 +01:00
|
|
|
void setBuildDirectory(const QString &buildDirectory);
|
2014-11-13 12:31:58 +01:00
|
|
|
void setDisplayName(const QString &displayName);
|
2014-10-07 15:51:02 +02:00
|
|
|
void setEnvironment(const Utils::Environment &env);
|
|
|
|
|
void setProject(ProjectExplorer::Project *project);
|
2017-10-12 08:08:27 +02:00
|
|
|
void setInternalTarget(const QString &target);
|
2017-06-09 09:30:21 +02:00
|
|
|
void setInternalTargets(const QSet<QString> &targets);
|
2017-09-13 14:27:20 +02:00
|
|
|
void setOriginalRunConfiguration(ProjectExplorer::RunConfiguration *runConfig);
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2020-03-26 10:11:39 +01:00
|
|
|
ITestFramework *framework() const;
|
2014-10-07 15:51:02 +02:00
|
|
|
QStringList testCases() const { return m_testCases; }
|
2014-11-03 08:30:22 +01:00
|
|
|
int testCaseCount() const { return m_testCaseCount; }
|
2016-08-05 15:02:37 +02:00
|
|
|
QString executableFilePath() const;
|
|
|
|
|
QString workingDirectory() const;
|
2016-01-26 17:24:11 +01:00
|
|
|
QString buildDirectory() const { return m_buildDir; }
|
2017-08-04 18:33:50 +02:00
|
|
|
QString projectFile() const { return m_projectFile; }
|
2014-11-13 12:31:58 +01:00
|
|
|
QString displayName() const { return m_displayName; }
|
2017-08-31 11:26:02 +02:00
|
|
|
Utils::Environment environment() const { return m_runnable.environment; }
|
2016-01-18 14:37:32 +01:00
|
|
|
ProjectExplorer::Project *project() const { return m_project.data(); }
|
2017-09-13 14:27:20 +02:00
|
|
|
QSet<QString> internalTargets() const { return m_buildTargets; }
|
|
|
|
|
ProjectExplorer::RunConfiguration *originalRunConfiguration() const { return m_origRunConfig; }
|
2019-08-19 10:55:32 +02:00
|
|
|
Internal::TestRunConfiguration *runConfiguration() const { return m_runConfig; }
|
2017-09-13 14:27:20 +02:00
|
|
|
bool hasExecutable() const;
|
2018-09-21 09:10:54 +02:00
|
|
|
bool isDeduced() const { return m_deducedConfiguration; }
|
|
|
|
|
QString runConfigDisplayName() const { return m_deducedConfiguration ? m_deducedFrom
|
2017-04-03 09:17:58 +02:00
|
|
|
: m_displayName; }
|
2016-04-29 10:13:35 +02:00
|
|
|
|
2018-05-16 15:42:03 +02:00
|
|
|
ProjectExplorer::Runnable runnable() const { return m_runnable; }
|
2016-04-29 10:13:35 +02:00
|
|
|
virtual TestOutputReader *outputReader(const QFutureInterface<TestResultPtr> &fi,
|
|
|
|
|
QProcess *app) const = 0;
|
2017-09-01 14:59:39 +02:00
|
|
|
virtual QStringList argumentsForTestRunner(QStringList *omitted = nullptr) const = 0;
|
2018-08-29 12:33:15 +02:00
|
|
|
virtual Utils::Environment filteredEnvironment(const Utils::Environment &original) const = 0;
|
2020-03-26 10:11:39 +01:00
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
private:
|
2020-03-26 10:11:39 +01:00
|
|
|
ITestFramework *m_framework;
|
2014-10-07 15:51:02 +02:00
|
|
|
QStringList m_testCases;
|
2016-04-29 10:13:35 +02:00
|
|
|
int m_testCaseCount = 0;
|
2017-02-21 14:53:58 +01:00
|
|
|
QString m_projectFile;
|
2016-01-26 17:24:11 +01:00
|
|
|
QString m_buildDir;
|
2014-11-13 12:31:58 +01:00
|
|
|
QString m_displayName;
|
2018-09-21 09:10:54 +02:00
|
|
|
QString m_deducedFrom;
|
2016-01-18 14:37:32 +01:00
|
|
|
QPointer<ProjectExplorer::Project> m_project;
|
2018-09-21 09:10:54 +02:00
|
|
|
bool m_deducedConfiguration = false;
|
2019-08-19 10:55:32 +02:00
|
|
|
Internal::TestRunConfiguration *m_runConfig = nullptr;
|
2017-06-09 09:30:21 +02:00
|
|
|
QSet<QString> m_buildTargets;
|
2017-09-13 14:27:20 +02:00
|
|
|
ProjectExplorer::RunConfiguration *m_origRunConfig = nullptr;
|
2018-05-16 15:42:03 +02:00
|
|
|
ProjectExplorer::Runnable m_runnable;
|
2016-04-29 10:13:35 +02:00
|
|
|
};
|
|
|
|
|
|
2016-08-12 09:07:38 +02:00
|
|
|
class DebuggableTestConfiguration : public TestConfiguration
|
|
|
|
|
{
|
|
|
|
|
public:
|
2020-03-26 10:11:39 +01:00
|
|
|
explicit DebuggableTestConfiguration(ITestFramework *framework, TestRunMode runMode = TestRunMode::Run)
|
|
|
|
|
: TestConfiguration(framework), m_runMode(runMode) {}
|
2016-08-12 09:07:38 +02:00
|
|
|
|
2017-09-05 13:57:22 +02:00
|
|
|
void setRunMode(TestRunMode mode) { m_runMode = mode; }
|
|
|
|
|
TestRunMode runMode() const { return m_runMode; }
|
|
|
|
|
bool isDebugRunMode() const;
|
2017-09-29 15:01:32 +02:00
|
|
|
void setMixedDebugging(bool enable) { m_mixedDebugging = enable; }
|
|
|
|
|
bool mixedDebugging() const { return m_mixedDebugging; }
|
2016-08-12 09:07:38 +02:00
|
|
|
private:
|
2017-09-05 13:57:22 +02:00
|
|
|
TestRunMode m_runMode;
|
2017-09-29 15:01:32 +02:00
|
|
|
bool m_mixedDebugging = false;
|
2016-08-12 09:07:38 +02:00
|
|
|
};
|
|
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
} // namespace Autotest
|