mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
WIP - adding Runner process.
This commit is contained in:
parent
cc9196fc26
commit
f3bc8bdc16
2 changed files with 72 additions and 33 deletions
|
@ -21,6 +21,15 @@ extern AutoTester* autoTester;
|
||||||
#include <tlhelp32.h>
|
#include <tlhelp32.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static QLabel* _workingFolderLabel;
|
||||||
|
static QString _workingFolder;
|
||||||
|
|
||||||
|
static const QString INSTALLER_URL{ "http://builds.highfidelity.com/HighFidelity-Beta-latest-dev.exe" };
|
||||||
|
static const QString INSTALLER_FILENAME{ "HighFidelity-Beta-latest-dev.exe" };
|
||||||
|
|
||||||
|
static const QString BUILD_XML_URL{ "https://highfidelity.com/dev-builds.xml" };
|
||||||
|
static const QString BUILD_XML_FILENAME{ "dev-builds.xml" };
|
||||||
|
|
||||||
TestRunner::TestRunner(std::vector<QCheckBox*> dayCheckboxes,
|
TestRunner::TestRunner(std::vector<QCheckBox*> dayCheckboxes,
|
||||||
std::vector<QCheckBox*> timeEditCheckboxes,
|
std::vector<QCheckBox*> timeEditCheckboxes,
|
||||||
std::vector<QTimeEdit*> timeEdits,
|
std::vector<QTimeEdit*> timeEdits,
|
||||||
|
@ -68,7 +77,7 @@ void TestRunner::setWorkingFolder() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRunner::run() {
|
void TestRunner::run() {
|
||||||
_testStartDateTime = QDateTime::currentDateTime();
|
runner->_testStartDateTime = QDateTime::currentDateTime();
|
||||||
_automatedTestIsRunning = true;
|
_automatedTestIsRunning = true;
|
||||||
|
|
||||||
// Initial setup
|
// Initial setup
|
||||||
|
@ -78,26 +87,24 @@ void TestRunner::run() {
|
||||||
// This will be restored at the end of the tests
|
// This will be restored at the end of the tests
|
||||||
saveExistingHighFidelityAppDataFolder();
|
saveExistingHighFidelityAppDataFolder();
|
||||||
|
|
||||||
// Download the latest High Fidelity installer and build XML.
|
QThread* thread = new QThread;
|
||||||
QStringList urls;
|
|
||||||
urls << INSTALLER_URL << BUILD_XML_URL;
|
|
||||||
|
|
||||||
QStringList filenames;
|
Runner* runner = new Runner();
|
||||||
filenames << INSTALLER_FILENAME << BUILD_XML_FILENAME;
|
runner->moveToThread(thread);
|
||||||
|
connect(runner, SIGNAL(error(QString)), this, SLOT(errorString(QString)));
|
||||||
updateStatusLabel("Downloading installer");
|
connect(thread, SIGNAL(started()), runner, SLOT(process()));
|
||||||
|
connect(runner, SIGNAL(finished()), thread, SLOT(quit()));
|
||||||
autoTester->downloadFiles(urls, _workingFolder, filenames, (void*)this);
|
connect(runner, SIGNAL(finished()), runner, SLOT(deleteLater()));
|
||||||
|
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
|
||||||
// `installerDownloadComplete` will run after download has completed
|
thread->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRunner::installerDownloadComplete() {
|
void TestRunner::installerDownloadComplete() {
|
||||||
appendLog(QString("Test started at ") + QString::number(_testStartDateTime.time().hour()) + ":" +
|
appendLog(QString("Test started at ") + QString::number(runner->_testStartDateTime.time().hour()) + ":" +
|
||||||
QString("%1").arg(_testStartDateTime.time().minute(), 2, 10, QChar('0')) + ", on " +
|
QString("%1").arg(runner->_testStartDateTime.time().minute(), 2, 10, QChar('0')) + ", on " +
|
||||||
_testStartDateTime.date().toString("ddd, MMM d, yyyy"));
|
runner->_testStartDateTime.date().toString("ddd, MMM d, yyyy"));
|
||||||
|
|
||||||
updateStatusLabel("Installing");
|
autoTester->updateStatusLabel("Installing");
|
||||||
|
|
||||||
// Kill any existing processes that would interfere with installation
|
// Kill any existing processes that would interfere with installation
|
||||||
killProcesses();
|
killProcesses();
|
||||||
|
@ -106,7 +113,7 @@ void TestRunner::installerDownloadComplete() {
|
||||||
|
|
||||||
createSnapshotFolder();
|
createSnapshotFolder();
|
||||||
|
|
||||||
updateStatusLabel("Running tests");
|
autoTester->updateStatusLabel("Running tests");
|
||||||
|
|
||||||
startLocalServerProcesses();
|
startLocalServerProcesses();
|
||||||
runInterfaceWithTestScript();
|
runInterfaceWithTestScript();
|
||||||
|
@ -244,7 +251,7 @@ void TestRunner::runInterfaceWithTestScript() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRunner::evaluateResults() {
|
void TestRunner::evaluateResults() {
|
||||||
updateStatusLabel("Evaluating results");
|
autoTester->updateStatusLabel("Evaluating results");
|
||||||
autoTester->startTestsEvaluation(false, true, _snapshotFolder, _branch, _user);
|
autoTester->startTestsEvaluation(false, true, _snapshotFolder, _branch, _user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,7 +259,7 @@ void TestRunner::automaticTestRunEvaluationComplete(QString zippedFolder) {
|
||||||
addBuildNumberToResults(zippedFolder);
|
addBuildNumberToResults(zippedFolder);
|
||||||
restoreHighFidelityAppDataFolder();
|
restoreHighFidelityAppDataFolder();
|
||||||
|
|
||||||
updateStatusLabel("Testing complete");
|
autoTester->updateStatusLabel("Testing complete");
|
||||||
_automatedTestIsRunning = false;
|
_automatedTestIsRunning = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,10 +405,6 @@ void TestRunner::checkTime() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRunner::updateStatusLabel(const QString& message) {
|
|
||||||
autoTester->updateStatusLabel(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TestRunner::appendLog(const QString& message) {
|
void TestRunner::appendLog(const QString& message) {
|
||||||
if (!_logFile.open(QIODevice::Append | QIODevice::Text)) {
|
if (!_logFile.open(QIODevice::Append | QIODevice::Text)) {
|
||||||
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
|
||||||
|
@ -414,4 +417,26 @@ void TestRunner::appendLog(const QString& message) {
|
||||||
_logFile.close();
|
_logFile.close();
|
||||||
|
|
||||||
autoTester->appendLogWindow(message);
|
autoTester->appendLogWindow(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Runner::Runner() {
|
||||||
|
}
|
||||||
|
|
||||||
|
Runner::~Runner() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void Runner::process() {
|
||||||
|
// Download the latest High Fidelity installer and build XML.
|
||||||
|
QStringList urls;
|
||||||
|
urls << INSTALLER_URL << BUILD_XML_URL;
|
||||||
|
|
||||||
|
QStringList filenames;
|
||||||
|
filenames << INSTALLER_FILENAME << BUILD_XML_FILENAME;
|
||||||
|
|
||||||
|
autoTester->updateStatusLabel("Downloading installer");
|
||||||
|
|
||||||
|
autoTester->downloadFiles(urls, _workingFolder, filenames, (void*)this);
|
||||||
|
|
||||||
|
// `installerDownloadComplete` will run after download has completed
|
||||||
|
emit finished();
|
||||||
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
#include "Downloader.h"
|
#include "Downloader.h"
|
||||||
|
|
||||||
|
class Runner;
|
||||||
|
|
||||||
class TestRunner : public QObject {
|
class TestRunner : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -51,7 +53,6 @@ public:
|
||||||
|
|
||||||
void copyFolder(const QString& source, const QString& destination);
|
void copyFolder(const QString& source, const QString& destination);
|
||||||
|
|
||||||
void updateStatusLabel(const QString& message);
|
|
||||||
void appendLog(const QString& message);
|
void appendLog(const QString& message);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -63,7 +64,6 @@ private:
|
||||||
QDir _appDataFolder;
|
QDir _appDataFolder;
|
||||||
QDir _savedAppDataFolder;
|
QDir _savedAppDataFolder;
|
||||||
|
|
||||||
QString _workingFolder;
|
|
||||||
QString _snapshotFolder;
|
QString _snapshotFolder;
|
||||||
|
|
||||||
QString _installationFolder;
|
QString _installationFolder;
|
||||||
|
@ -73,24 +73,38 @@ private:
|
||||||
const QString UNIQUE_FOLDER_NAME{ "fgadhcUDHSFaidsfh3478JJJFSDFIUSOEIrf" };
|
const QString UNIQUE_FOLDER_NAME{ "fgadhcUDHSFaidsfh3478JJJFSDFIUSOEIrf" };
|
||||||
const QString SNAPSHOT_FOLDER_NAME{ "snapshots" };
|
const QString SNAPSHOT_FOLDER_NAME{ "snapshots" };
|
||||||
|
|
||||||
const QString INSTALLER_URL{ "http://builds.highfidelity.com/HighFidelity-Beta-latest-dev.exe" };
|
|
||||||
const QString INSTALLER_FILENAME{ "HighFidelity-Beta-latest-dev.exe" };
|
|
||||||
|
|
||||||
const QString BUILD_XML_URL{ "https://highfidelity.com/dev-builds.xml" };
|
|
||||||
const QString BUILD_XML_FILENAME{ "dev-builds.xml" };
|
|
||||||
|
|
||||||
QString _branch;
|
QString _branch;
|
||||||
QString _user;
|
QString _user;
|
||||||
|
|
||||||
std::vector<QCheckBox*> _dayCheckboxes;
|
std::vector<QCheckBox*> _dayCheckboxes;
|
||||||
std::vector<QCheckBox*> _timeEditCheckboxes;
|
std::vector<QCheckBox*> _timeEditCheckboxes;
|
||||||
std::vector<QTimeEdit*> _timeEdits;
|
std::vector<QTimeEdit*> _timeEdits;
|
||||||
QLabel* _workingFolderLabel;
|
|
||||||
|
|
||||||
QTimer* _timer;
|
QTimer* _timer;
|
||||||
|
|
||||||
QFile _logFile;
|
QFile _logFile;
|
||||||
|
Runner* runner;
|
||||||
|
};
|
||||||
|
|
||||||
|
class Runner : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
friend TestRunner;
|
||||||
|
|
||||||
|
Runner();
|
||||||
|
~Runner();
|
||||||
|
|
||||||
|
void updateStatusLabel(const QString& message);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void process();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void finished();
|
||||||
|
void error(QString err);
|
||||||
|
|
||||||
|
private:
|
||||||
QDateTime _testStartDateTime;
|
QDateTime _testStartDateTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue