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>
|
2017-08-31 11:26:02 +02:00
|
|
|
#include <projectexplorer/runnables.h>
|
2014-10-07 15:51:02 +02:00
|
|
|
#include <utils/environment.h>
|
|
|
|
|
|
2016-04-29 10:13:35 +02:00
|
|
|
#include <QFutureInterface>
|
2014-10-07 15:51:02 +02:00
|
|
|
#include <QObject>
|
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 {
|
|
|
|
|
|
2016-04-29 10:13:35 +02:00
|
|
|
class TestOutputReader;
|
|
|
|
|
class TestResult;
|
2016-06-15 12:29:24 +02:00
|
|
|
class TestRunConfiguration;
|
2016-04-29 10:13:35 +02:00
|
|
|
|
|
|
|
|
using TestResultPtr = QSharedPointer<TestResult>;
|
|
|
|
|
|
|
|
|
|
class TestConfiguration
|
2014-10-07 15:51:02 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2016-04-29 10:13:35 +02:00
|
|
|
explicit TestConfiguration();
|
|
|
|
|
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-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
|
|
|
|
|
|
|
|
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; }
|
2016-06-15 12:29:24 +02:00
|
|
|
TestRunConfiguration *runConfiguration() const { return m_runConfig; }
|
2017-09-13 14:27:20 +02:00
|
|
|
bool hasExecutable() const;
|
2017-04-03 09:17:58 +02:00
|
|
|
bool isGuessed() const { return m_guessedConfiguration; }
|
|
|
|
|
QString runConfigDisplayName() const { return m_guessedConfiguration ? m_guessedFrom
|
|
|
|
|
: m_displayName; }
|
2016-04-29 10:13:35 +02:00
|
|
|
|
2017-09-01 14:59:39 +02:00
|
|
|
ProjectExplorer::StandardRunnable 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;
|
2014-10-07 15:51:02 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
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;
|
2017-04-03 09:17:58 +02:00
|
|
|
QString m_guessedFrom;
|
2016-01-18 14:37:32 +01:00
|
|
|
QPointer<ProjectExplorer::Project> m_project;
|
2016-04-29 10:13:35 +02:00
|
|
|
bool m_guessedConfiguration = false;
|
2017-09-13 14:27:20 +02:00
|
|
|
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;
|
2017-08-31 11:26:02 +02:00
|
|
|
ProjectExplorer::StandardRunnable m_runnable;
|
2016-04-29 10:13:35 +02:00
|
|
|
};
|
|
|
|
|
|
2016-08-12 09:07:38 +02:00
|
|
|
class DebuggableTestConfiguration : public TestConfiguration
|
|
|
|
|
{
|
|
|
|
|
public:
|
2017-09-05 13:57:22 +02:00
|
|
|
explicit DebuggableTestConfiguration(TestRunMode runMode = TestRunMode::Run)
|
|
|
|
|
: m_runMode(runMode) {}
|
2016-08-12 09:07:38 +02:00
|
|
|
~DebuggableTestConfiguration() {}
|
|
|
|
|
|
2017-09-05 13:57:22 +02:00
|
|
|
void setRunMode(TestRunMode mode) { m_runMode = mode; }
|
|
|
|
|
TestRunMode runMode() const { return m_runMode; }
|
|
|
|
|
bool isDebugRunMode() const;
|
2016-08-12 09:07:38 +02:00
|
|
|
private:
|
2017-09-05 13:57:22 +02:00
|
|
|
TestRunMode m_runMode;
|
2016-08-12 09:07:38 +02:00
|
|
|
};
|
|
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Autotest
|