mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 07:19:05 +02:00
Use new format of installer.
This commit is contained in:
parent
5f4ffd9d82
commit
71197ca0d1
3 changed files with 140 additions and 90 deletions
|
@ -104,39 +104,62 @@ 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.
|
// Download the latest High Fidelity build XML.
|
||||||
QStringList urls;
|
QStringList urls;
|
||||||
QStringList filenames;
|
QStringList filenames;
|
||||||
if (_runLatest->isChecked()) {
|
|
||||||
_installerFilename = INSTALLER_FILENAME_LATEST;
|
|
||||||
|
|
||||||
urls << INSTALLER_URL_LATEST << BUILD_XML_URL;
|
urls << DEV_BUILD_XML_URL;
|
||||||
filenames << _installerFilename << BUILD_XML_FILENAME;
|
filenames << DEV_BUILD_XML_FILENAME;
|
||||||
} else {
|
|
||||||
QString urlText = _url->toPlainText();
|
|
||||||
urls << urlText;
|
|
||||||
_installerFilename = getInstallerNameFromURL(urlText);
|
|
||||||
filenames << _installerFilename;
|
|
||||||
}
|
|
||||||
|
|
||||||
updateStatusLabel("Downloading installer");
|
updateStatusLabel("Downloading Build XML");
|
||||||
|
|
||||||
|
buildXMLDownloaded = false;
|
||||||
autoTester->downloadFiles(urls, _workingFolder, filenames, (void*)this);
|
autoTester->downloadFiles(urls, _workingFolder, filenames, (void*)this);
|
||||||
|
|
||||||
// `installerDownloadComplete` will run after download has completed
|
// `downloadComplete` will run after download has completed
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRunner::installerDownloadComplete() {
|
void TestRunner::downloadComplete() {
|
||||||
appendLog(QString("Tests started at ") + QString::number(_testStartDateTime.time().hour()) + ":" +
|
if (!buildXMLDownloaded) {
|
||||||
QString("%1").arg(_testStartDateTime.time().minute(), 2, 10, QChar('0')) + ", on " +
|
// Download of Build XML has completed
|
||||||
_testStartDateTime.date().toString("ddd, MMM d, yyyy"));
|
buildXMLDownloaded = true;
|
||||||
|
|
||||||
updateStatusLabel("Installing");
|
parseBuildInformation();
|
||||||
|
|
||||||
// Kill any existing processes that would interfere with installation
|
// Download the High Fidelity installer
|
||||||
killProcesses();
|
QStringList urls;
|
||||||
|
QStringList filenames;
|
||||||
|
if (_runLatest->isChecked()) {
|
||||||
|
_installerFilename = INSTALLER_FILENAME_LATEST;
|
||||||
|
|
||||||
runInstaller();
|
urls << _buildInformation.url;
|
||||||
|
filenames << _installerFilename;
|
||||||
|
} else {
|
||||||
|
QString urlText = _url->toPlainText();
|
||||||
|
urls << urlText;
|
||||||
|
_installerFilename = getInstallerNameFromURL(urlText);
|
||||||
|
filenames << _installerFilename;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateStatusLabel("Downloading installer");
|
||||||
|
|
||||||
|
autoTester->downloadFiles(urls, _workingFolder, filenames, (void*)this);
|
||||||
|
|
||||||
|
// `downloadComplete` will run again after download has completed
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Download of Installer has completed
|
||||||
|
appendLog(QString("Tests started at ") + QString::number(_testStartDateTime.time().hour()) + ":" +
|
||||||
|
QString("%1").arg(_testStartDateTime.time().minute(), 2, 10, QChar('0')) + ", on " +
|
||||||
|
_testStartDateTime.date().toString("ddd, MMM d, yyyy"));
|
||||||
|
|
||||||
|
updateStatusLabel("Installing");
|
||||||
|
|
||||||
|
// Kill any existing processes that would interfere with installation
|
||||||
|
killProcesses();
|
||||||
|
|
||||||
|
runInstaller();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRunner::runInstaller() {
|
void TestRunner::runInstaller() {
|
||||||
|
@ -360,70 +383,10 @@ void TestRunner::addBuildNumberToResults(QString zippedFolderName) {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
QDomDocument domDocument;
|
|
||||||
QString filename{ _workingFolder + "/" + BUILD_XML_FILENAME };
|
|
||||||
QFile file(filename);
|
|
||||||
if (!file.open(QIODevice::ReadOnly) || !domDocument.setContent(&file)) {
|
|
||||||
throw QString("Could not open " + filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString platformOfInterest;
|
QStringList filenameParts = zippedFolderName.split(".");
|
||||||
#ifdef Q_OS_WIN
|
QString augmentedFilename = filenameParts[0] + "(" + _buildInformation.build + ")." + filenameParts[1];
|
||||||
platformOfInterest = "windows";
|
QFile::rename(zippedFolderName, augmentedFilename);
|
||||||
#else if Q_OS_MAC
|
|
||||||
platformOfInterest = "mac";
|
|
||||||
#endif
|
|
||||||
QDomElement element = domDocument.documentElement();
|
|
||||||
|
|
||||||
// Verify first element is "projects"
|
|
||||||
if (element.tagName() != "projects") {
|
|
||||||
throw("File seems to be in wrong format");
|
|
||||||
}
|
|
||||||
|
|
||||||
element = element.firstChild().toElement();
|
|
||||||
if (element.tagName() != "project") {
|
|
||||||
throw("File seems to be in wrong format");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (element.attribute("name") != "interface") {
|
|
||||||
throw("File is not from 'interface' build");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now loop over the platforms
|
|
||||||
while (!element.isNull()) {
|
|
||||||
element = element.firstChild().toElement();
|
|
||||||
QString sdf = element.tagName();
|
|
||||||
if (element.tagName() != "platform" || element.attribute("name") != platformOfInterest) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Next element should be the build
|
|
||||||
element = element.firstChild().toElement();
|
|
||||||
if (element.tagName() != "build") {
|
|
||||||
throw("File seems to be in wrong format");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Next element should be the version
|
|
||||||
element = element.firstChild().toElement();
|
|
||||||
if (element.tagName() != "version") {
|
|
||||||
throw("File seems to be in wrong format");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add the build number to the end of the filename
|
|
||||||
QString build = element.text();
|
|
||||||
QStringList filenameParts = zippedFolderName.split(".");
|
|
||||||
QString augmentedFilename = filenameParts[0] + "(" + build + ")." + filenameParts[1];
|
|
||||||
QFile::rename(zippedFolderName, augmentedFilename);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (QString errorMessage) {
|
|
||||||
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), errorMessage);
|
|
||||||
exit(-1);
|
|
||||||
} catch (...) {
|
|
||||||
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), "unknown error");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRunner::restoreHighFidelityAppDataFolder() {
|
void TestRunner::restoreHighFidelityAppDataFolder() {
|
||||||
|
@ -554,6 +517,82 @@ QString TestRunner::getPRNumberFromURL(const QString& url) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestRunner::parseBuildInformation() {
|
||||||
|
try {
|
||||||
|
QDomDocument domDocument;
|
||||||
|
QString filename{ _workingFolder + "/" + DEV_BUILD_XML_FILENAME };
|
||||||
|
QFile file(filename);
|
||||||
|
if (!file.open(QIODevice::ReadOnly) || !domDocument.setContent(&file)) {
|
||||||
|
throw QString("Could not open " + filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString platformOfInterest;
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
platformOfInterest = "windows";
|
||||||
|
#else if Q_OS_MAC
|
||||||
|
platformOfInterest = "mac";
|
||||||
|
#endif
|
||||||
|
QDomElement element = domDocument.documentElement();
|
||||||
|
|
||||||
|
// Verify first element is "projects"
|
||||||
|
if (element.tagName() != "projects") {
|
||||||
|
throw("File seems to be in wrong format");
|
||||||
|
}
|
||||||
|
|
||||||
|
element = element.firstChild().toElement();
|
||||||
|
if (element.tagName() != "project") {
|
||||||
|
throw("File seems to be in wrong format");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (element.attribute("name") != "interface") {
|
||||||
|
throw("File is not from 'interface' build");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now loop over the platforms
|
||||||
|
while (!element.isNull()) {
|
||||||
|
element = element.firstChild().toElement();
|
||||||
|
if (element.tagName() != "platform" || element.attribute("name") != platformOfInterest) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Next element should be the build
|
||||||
|
element = element.firstChild().toElement();
|
||||||
|
if (element.tagName() != "build") {
|
||||||
|
throw("File seems to be in wrong format");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Next element should be the version
|
||||||
|
element = element.firstChild().toElement();
|
||||||
|
if (element.tagName() != "version") {
|
||||||
|
throw("File seems to be in wrong format");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the build number to the end of the filename
|
||||||
|
_buildInformation.build = element.text();
|
||||||
|
|
||||||
|
// First sibling should be stable_version
|
||||||
|
element = element.nextSibling().toElement();
|
||||||
|
if (element.tagName() != "stable_version") {
|
||||||
|
throw("File seems to be in wrong format");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Next sibling should be url
|
||||||
|
element = element.nextSibling().toElement();
|
||||||
|
if (element.tagName() != "url") {
|
||||||
|
throw("File seems to be in wrong format");
|
||||||
|
}
|
||||||
|
_buildInformation.url = element.text();
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (QString errorMessage) {
|
||||||
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), errorMessage);
|
||||||
|
exit(-1);
|
||||||
|
} catch (...) {
|
||||||
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), "unknown error");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Worker::setCommandLine(const QString& commandLine) {
|
void Worker::setCommandLine(const QString& commandLine) {
|
||||||
_commandLine = commandLine;
|
_commandLine = commandLine;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,12 @@
|
||||||
#include <QTimeEdit>
|
#include <QTimeEdit>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
class BuildInformation {
|
||||||
|
public:
|
||||||
|
QString build;
|
||||||
|
QString url;
|
||||||
|
};
|
||||||
|
|
||||||
class Worker;
|
class Worker;
|
||||||
|
|
||||||
class TestRunner : public QObject {
|
class TestRunner : public QObject {
|
||||||
|
@ -40,7 +46,7 @@ public:
|
||||||
|
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
void installerDownloadComplete();
|
void downloadComplete();
|
||||||
void runInstaller();
|
void runInstaller();
|
||||||
void verifyInstallationSucceeded();
|
void verifyInstallationSucceeded();
|
||||||
|
|
||||||
|
@ -66,6 +72,8 @@ public:
|
||||||
QString getInstallerNameFromURL(const QString& url);
|
QString getInstallerNameFromURL(const QString& url);
|
||||||
QString getPRNumberFromURL(const QString& url);
|
QString getPRNumberFromURL(const QString& url);
|
||||||
|
|
||||||
|
void parseBuildInformation();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void checkTime();
|
void checkTime();
|
||||||
void installationComplete();
|
void installationComplete();
|
||||||
|
@ -78,13 +86,14 @@ signals:
|
||||||
private:
|
private:
|
||||||
bool _automatedTestIsRunning{ false };
|
bool _automatedTestIsRunning{ false };
|
||||||
|
|
||||||
const QString INSTALLER_URL_LATEST{ "http://builds.highfidelity.com/HighFidelity-Beta-latest-dev.exe" };
|
|
||||||
const QString INSTALLER_FILENAME_LATEST{ "HighFidelity-Beta-latest-dev.exe" };
|
const QString INSTALLER_FILENAME_LATEST{ "HighFidelity-Beta-latest-dev.exe" };
|
||||||
|
|
||||||
QString _installerURL;
|
QString _installerURL;
|
||||||
QString _installerFilename;
|
QString _installerFilename;
|
||||||
const QString BUILD_XML_URL{ "https://highfidelity.com/dev-builds.xml" };
|
const QString DEV_BUILD_XML_URL{ "https://highfidelity.com/dev-builds.xml" };
|
||||||
const QString BUILD_XML_FILENAME{ "dev-builds.xml" };
|
const QString DEV_BUILD_XML_FILENAME{ "dev-builds.xml" };
|
||||||
|
|
||||||
|
bool buildXMLDownloaded;
|
||||||
|
|
||||||
QDir _appDataFolder;
|
QDir _appDataFolder;
|
||||||
QDir _savedAppDataFolder;
|
QDir _savedAppDataFolder;
|
||||||
|
@ -117,6 +126,8 @@ private:
|
||||||
QThread* interfaceThread;
|
QThread* interfaceThread;
|
||||||
Worker* installerWorker;
|
Worker* installerWorker;
|
||||||
Worker* interfaceWorker;
|
Worker* interfaceWorker;
|
||||||
|
|
||||||
|
BuildInformation _buildInformation;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Worker : public QObject {
|
class Worker : public QObject {
|
||||||
|
|
|
@ -36,7 +36,7 @@ AutoTester::AutoTester(QWidget* parent) : QMainWindow(parent) {
|
||||||
_ui.statusLabel->setText("");
|
_ui.statusLabel->setText("");
|
||||||
_ui.plainTextEdit->setReadOnly(true);
|
_ui.plainTextEdit->setReadOnly(true);
|
||||||
|
|
||||||
setWindowTitle("Auto Tester - v4.6");
|
setWindowTitle("Auto Tester - v5.0");
|
||||||
|
|
||||||
// Coming soon to an auto-tester near you...
|
// Coming soon to an auto-tester near you...
|
||||||
//// _helpWindow.textBrowser->setText()
|
//// _helpWindow.textBrowser->setText()
|
||||||
|
@ -266,7 +266,7 @@ void AutoTester::saveFile(int index) {
|
||||||
if (_caller == _test) {
|
if (_caller == _test) {
|
||||||
_test->finishTestsEvaluation();
|
_test->finishTestsEvaluation();
|
||||||
} else if (_caller == _testRunner) {
|
} else if (_caller == _testRunner) {
|
||||||
_testRunner->installerDownloadComplete();
|
_testRunner->downloadComplete();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_ui.progressBar->setValue(_numberOfFilesDownloaded);
|
_ui.progressBar->setValue(_numberOfFilesDownloaded);
|
||||||
|
|
Loading…
Reference in a new issue