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
|
|
|
|
|
|
|
|
#include "testconfiguration.h"
|
|
|
|
|
#include "testresult.h"
|
|
|
|
|
|
2017-09-13 14:27:20 +02:00
|
|
|
#include <QDialog>
|
2016-01-19 14:24:09 +01:00
|
|
|
#include <QFutureWatcher>
|
2014-10-07 15:51:02 +02:00
|
|
|
#include <QObject>
|
|
|
|
|
#include <QProcess>
|
|
|
|
|
|
2017-09-13 14:27:20 +02:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QComboBox;
|
|
|
|
|
class QDialogButtonBox;
|
|
|
|
|
class QLabel;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
class Project;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace Autotest {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class TestRunner : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
static TestRunner* instance();
|
|
|
|
|
~TestRunner();
|
|
|
|
|
|
|
|
|
|
void setSelectedTests(const QList<TestConfiguration *> &selected);
|
2014-11-06 10:48:17 +01:00
|
|
|
bool isTestRunning() const { return m_executingTests; }
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2017-09-05 13:57:22 +02:00
|
|
|
void prepareToRunTests(TestRunMode mode);
|
2016-06-28 22:38:54 +03:00
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
signals:
|
2014-11-03 08:30:22 +01:00
|
|
|
void testRunStarted();
|
|
|
|
|
void testRunFinished();
|
2015-01-13 11:24:41 +01:00
|
|
|
void requestStopTestRun();
|
2016-02-25 13:02:31 +01:00
|
|
|
void testResultReady(const TestResultPtr &result);
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2016-06-28 22:38:54 +03:00
|
|
|
private:
|
2014-10-07 15:51:02 +02:00
|
|
|
void buildProject(ProjectExplorer::Project *project);
|
|
|
|
|
void buildFinished(bool success);
|
2014-11-06 10:48:17 +01:00
|
|
|
void onFinished();
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2015-06-29 09:22:58 +02:00
|
|
|
void runTests();
|
2016-06-15 12:29:24 +02:00
|
|
|
void debugTests();
|
|
|
|
|
void runOrDebugTests();
|
2014-10-07 15:51:02 +02:00
|
|
|
explicit TestRunner(QObject *parent = 0);
|
|
|
|
|
|
2016-02-25 13:02:31 +01:00
|
|
|
QFutureWatcher<TestResultPtr> m_futureWatcher;
|
2014-10-07 15:51:02 +02:00
|
|
|
QList<TestConfiguration *> m_selectedTests;
|
2014-11-06 10:48:17 +01:00
|
|
|
bool m_executingTests;
|
2017-09-05 13:57:22 +02:00
|
|
|
TestRunMode m_runMode = TestRunMode::Run;
|
2014-10-07 15:51:02 +02:00
|
|
|
|
2015-06-29 09:22:58 +02:00
|
|
|
// temporarily used if building before running is necessary
|
|
|
|
|
QMetaObject::Connection m_buildConnect;
|
2014-10-07 15:51:02 +02:00
|
|
|
};
|
|
|
|
|
|
2017-09-13 14:27:20 +02:00
|
|
|
class RunConfigurationSelectionDialog : public QDialog
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
explicit RunConfigurationSelectionDialog(const QString &testsInfo, QWidget *parent = nullptr);
|
|
|
|
|
QString displayName() const;
|
|
|
|
|
QString executable() const;
|
|
|
|
|
private:
|
|
|
|
|
void populate();
|
|
|
|
|
void updateLabels();
|
|
|
|
|
QLabel *m_details;
|
|
|
|
|
QLabel *m_executable;
|
|
|
|
|
QLabel *m_arguments;
|
|
|
|
|
QLabel *m_workingDir;
|
|
|
|
|
QComboBox *m_rcCombo;
|
|
|
|
|
QDialogButtonBox *m_buttonBox;
|
|
|
|
|
};
|
|
|
|
|
|
2014-10-07 15:51:02 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Autotest
|