mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-07 10:02:24 +02:00
Testing APK installation.
This commit is contained in:
parent
57d3cec2f9
commit
ce90b62c3e
9 changed files with 73 additions and 42 deletions
|
@ -112,6 +112,7 @@ void Nitpick::setup() {
|
|||
_ui.detectedDeviceLabel,
|
||||
_ui.folderLineEdit,
|
||||
_ui.downloadAPKPushbutton,
|
||||
_ui.installAPKPushbutton,
|
||||
_ui.runLatestOnMobileCheckBox,
|
||||
_ui.urlOnMobileLineEdit,
|
||||
_ui.statusLabelOnMobile
|
||||
|
@ -362,6 +363,10 @@ void Nitpick::on_downloadAPKPushbutton_clicked() {
|
|||
_testRunnerMobile->downloadAPK();
|
||||
}
|
||||
|
||||
void Nitpick::on_installAPKPushbutton_clicked() {
|
||||
_testRunnerMobile->installAPK();
|
||||
}
|
||||
|
||||
void Nitpick::on_pullFolderPushbutton_clicked() {
|
||||
_testRunnerMobile->pullFolder();
|
||||
}
|
||||
|
|
|
@ -98,7 +98,10 @@ private slots:
|
|||
void on_setWorkingFolderRunOnMobilePushbutton_clicked();
|
||||
void on_connectDevicePushbutton_clicked();
|
||||
void on_runLatestOnMobileCheckBox_clicked();
|
||||
|
||||
void on_downloadAPKPushbutton_clicked();
|
||||
void on_installAPKPushbutton_clicked();
|
||||
|
||||
void on_pullFolderPushbutton_clicked();
|
||||
|
||||
private:
|
||||
|
|
|
@ -32,6 +32,9 @@ void TestRunner::setWorkingFolder(QLabel* workingFolderLabel) {
|
|||
}
|
||||
|
||||
workingFolderLabel->setText(QDir::toNativeSeparators(_workingFolder));
|
||||
|
||||
// This file is used for debug purposes.
|
||||
_logFile.setFileName(_workingFolder + "/log.txt");
|
||||
}
|
||||
|
||||
void TestRunner::downloadBuildXml(void* caller) {
|
||||
|
@ -151,6 +154,20 @@ QString TestRunner::getInstallerNameFromURL(const QString& url) {
|
|||
}
|
||||
}
|
||||
|
||||
void TestRunner::appendLog(const QString& message) {
|
||||
if (!_logFile.open(QIODevice::Append | QIODevice::Text)) {
|
||||
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
|
||||
"Could not open the log file");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
_logFile.write(message.toStdString().c_str());
|
||||
_logFile.write("\n");
|
||||
_logFile.close();
|
||||
|
||||
nitpick->appendLogWindow(message);
|
||||
}
|
||||
|
||||
void Worker::setCommandLine(const QString& commandLine) {
|
||||
_commandLine = commandLine;
|
||||
}
|
||||
|
|
|
@ -12,9 +12,11 @@
|
|||
#define hifi_testRunner_h
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QDir>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QObject>
|
||||
#include <QTimeEdit>
|
||||
|
||||
class Worker;
|
||||
|
||||
|
@ -31,6 +33,8 @@ public:
|
|||
void parseBuildInformation();
|
||||
QString getInstallerNameFromURL(const QString& url);
|
||||
|
||||
void appendLog(const QString& message);
|
||||
|
||||
protected:
|
||||
QLabel* _workingFolderLabel;
|
||||
QLabel* _statusLabel;
|
||||
|
@ -52,6 +56,11 @@ protected:
|
|||
#else
|
||||
const QString INSTALLER_FILENAME_LATEST{ "" };
|
||||
#endif
|
||||
|
||||
QDateTime _testStartDateTime;
|
||||
|
||||
private:
|
||||
QFile _logFile;
|
||||
};
|
||||
|
||||
class Worker : public QObject {
|
||||
|
|
|
@ -83,8 +83,6 @@ void TestRunnerDesktop::setWorkingFolderAndEnableControls() {
|
|||
_installationFolder = _workingFolder + "/High_Fidelity";
|
||||
#endif
|
||||
|
||||
_logFile.setFileName(_workingFolder + "/log.txt");
|
||||
|
||||
nitpick->enableRunTabControls();
|
||||
|
||||
_timer = new QTimer(this);
|
||||
|
@ -661,20 +659,6 @@ void TestRunnerDesktop::checkTime() {
|
|||
}
|
||||
}
|
||||
|
||||
void TestRunnerDesktop::appendLog(const QString& message) {
|
||||
if (!_logFile.open(QIODevice::Append | QIODevice::Text)) {
|
||||
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
|
||||
"Could not open the log file");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
_logFile.write(message.toStdString().c_str());
|
||||
_logFile.write("\n");
|
||||
_logFile.close();
|
||||
|
||||
nitpick->appendLogWindow(message);
|
||||
}
|
||||
|
||||
QString TestRunnerDesktop::getPRNumberFromURL(const QString& url) {
|
||||
try {
|
||||
QStringList urlParts = url.split("/");
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include <QObject>
|
||||
#include <QPushButton>
|
||||
#include <QThread>
|
||||
#include <QTimeEdit>
|
||||
#include <QTimer>
|
||||
|
||||
#include "TestRunner.h"
|
||||
|
@ -67,8 +66,6 @@ public:
|
|||
|
||||
void copyFolder(const QString& source, const QString& destination);
|
||||
|
||||
void appendLog(const QString& message);
|
||||
|
||||
QString getPRNumberFromURL(const QString& url);
|
||||
|
||||
private slots:
|
||||
|
@ -106,11 +103,6 @@ private:
|
|||
QCheckBox* _runServerless;
|
||||
QPushButton* _runNow;
|
||||
QTimer* _timer;
|
||||
|
||||
QFile _logFile;
|
||||
|
||||
QDateTime _testStartDateTime;
|
||||
|
||||
QThread* _installerThread;
|
||||
QThread* _interfaceThread;
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ TestRunnerMobile::TestRunnerMobile(
|
|||
QLabel* detectedDeviceLabel,
|
||||
QLineEdit *folderLineEdit,
|
||||
QPushButton* downloadAPKPushbutton,
|
||||
QPushButton* installAPKPushbutton,
|
||||
QCheckBox* runLatest,
|
||||
QLineEdit* url,
|
||||
QLabel* statusLabel,
|
||||
|
@ -36,6 +37,7 @@ TestRunnerMobile::TestRunnerMobile(
|
|||
_detectedDeviceLabel = detectedDeviceLabel;
|
||||
_folderLineEdit = folderLineEdit;
|
||||
_downloadAPKPushbutton = downloadAPKPushbutton;
|
||||
_installAPKPushbutton = installAPKPushbutton;
|
||||
_runLatest = runLatest;
|
||||
_url = url;
|
||||
_statusLabel = statusLabel;
|
||||
|
@ -50,7 +52,6 @@ void TestRunnerMobile::setWorkingFolderAndEnableControls() {
|
|||
setWorkingFolder(_workingFolderLabel);
|
||||
|
||||
_connectDeviceButton->setEnabled(true);
|
||||
_downloadAPKPushbutton->setEnabled(true);
|
||||
|
||||
// Find ADB (Android Debugging Bridge) before continuing
|
||||
#ifdef Q_OS_WIN
|
||||
|
@ -104,6 +105,7 @@ void TestRunnerMobile::connectDevice() {
|
|||
_detectedDeviceLabel->setText(line2.remove(DEVICE));
|
||||
_pullFolderButton->setEnabled(true);
|
||||
_folderLineEdit->setEnabled(true);
|
||||
_downloadAPKPushbutton->setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -143,25 +145,22 @@ void TestRunnerMobile::downloadComplete() {
|
|||
_statusLabel->setText("Downloading installer");
|
||||
|
||||
nitpick->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"));
|
||||
|
||||
_statusLabel->setText("Installing");
|
||||
|
||||
// Kill any existing processes that would interfere with installation
|
||||
//// killProcesses();
|
||||
|
||||
//// runInstaller();
|
||||
_statusLabel->setText("Installer download complete");
|
||||
_installAPKPushbutton->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void TestRunnerMobile::pullFolder() {
|
||||
QString command = _adbCommand + " pull " + _folderLineEdit->text() + " " + _workingFolder + " >" + _workingFolder + "/pullOutput.txt";
|
||||
void TestRunnerMobile::installAPK() {
|
||||
_statusLabel->setText("Installing");
|
||||
QString command = _adbCommand + " install -r -d " + _workingFolder + "/" + _installerFilename + " >" + _workingFolder + "/installOutput.txt";
|
||||
system(command.toStdString().c_str());
|
||||
_statusLabel->setText("Installation complete");
|
||||
}
|
||||
|
||||
void TestRunnerMobile::pullFolder() {
|
||||
_statusLabel->setText("Pulling folder");
|
||||
QString command = _adbCommand + " pull " + _folderLineEdit->text() + " " + _workingFolder + _installerFilename;
|
||||
system(command.toStdString().c_str());
|
||||
_statusLabel->setText("Pull complete");
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ public:
|
|||
QLabel* detectedDeviceLabel,
|
||||
QLineEdit *folderLineEdit,
|
||||
QPushButton* downloadAPKPushbutton,
|
||||
QPushButton* installAPKPushbutton,
|
||||
QCheckBox* runLatest,
|
||||
QLineEdit* url,
|
||||
QLabel* statusLabel,
|
||||
|
@ -37,8 +38,12 @@ public:
|
|||
|
||||
void setWorkingFolderAndEnableControls();
|
||||
void connectDevice();
|
||||
void downloadAPK();
|
||||
|
||||
void downloadComplete();
|
||||
void downloadAPK();
|
||||
|
||||
void installAPK();
|
||||
|
||||
void pullFolder();
|
||||
|
||||
private:
|
||||
|
@ -47,6 +52,7 @@ private:
|
|||
QLabel* _detectedDeviceLabel;
|
||||
QLineEdit* _folderLineEdit;
|
||||
QPushButton* _downloadAPKPushbutton;
|
||||
QPushButton* _installAPKPushbutton;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
const QString _adbExe{ "adb.exe" };
|
||||
|
|
|
@ -709,6 +709,22 @@
|
|||
<string>#######</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="installAPKPushbutton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>250</y>
|
||||
<width>160</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Install APK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<attribute name="title">
|
||||
|
|
Loading…
Reference in a new issue