mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 03:27:48 +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.detectedDeviceLabel,
|
||||||
_ui.folderLineEdit,
|
_ui.folderLineEdit,
|
||||||
_ui.downloadAPKPushbutton,
|
_ui.downloadAPKPushbutton,
|
||||||
|
_ui.installAPKPushbutton,
|
||||||
_ui.runLatestOnMobileCheckBox,
|
_ui.runLatestOnMobileCheckBox,
|
||||||
_ui.urlOnMobileLineEdit,
|
_ui.urlOnMobileLineEdit,
|
||||||
_ui.statusLabelOnMobile
|
_ui.statusLabelOnMobile
|
||||||
|
@ -362,6 +363,10 @@ void Nitpick::on_downloadAPKPushbutton_clicked() {
|
||||||
_testRunnerMobile->downloadAPK();
|
_testRunnerMobile->downloadAPK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Nitpick::on_installAPKPushbutton_clicked() {
|
||||||
|
_testRunnerMobile->installAPK();
|
||||||
|
}
|
||||||
|
|
||||||
void Nitpick::on_pullFolderPushbutton_clicked() {
|
void Nitpick::on_pullFolderPushbutton_clicked() {
|
||||||
_testRunnerMobile->pullFolder();
|
_testRunnerMobile->pullFolder();
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,10 @@ private slots:
|
||||||
void on_setWorkingFolderRunOnMobilePushbutton_clicked();
|
void on_setWorkingFolderRunOnMobilePushbutton_clicked();
|
||||||
void on_connectDevicePushbutton_clicked();
|
void on_connectDevicePushbutton_clicked();
|
||||||
void on_runLatestOnMobileCheckBox_clicked();
|
void on_runLatestOnMobileCheckBox_clicked();
|
||||||
|
|
||||||
void on_downloadAPKPushbutton_clicked();
|
void on_downloadAPKPushbutton_clicked();
|
||||||
|
void on_installAPKPushbutton_clicked();
|
||||||
|
|
||||||
void on_pullFolderPushbutton_clicked();
|
void on_pullFolderPushbutton_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -32,6 +32,9 @@ void TestRunner::setWorkingFolder(QLabel* workingFolderLabel) {
|
||||||
}
|
}
|
||||||
|
|
||||||
workingFolderLabel->setText(QDir::toNativeSeparators(_workingFolder));
|
workingFolderLabel->setText(QDir::toNativeSeparators(_workingFolder));
|
||||||
|
|
||||||
|
// This file is used for debug purposes.
|
||||||
|
_logFile.setFileName(_workingFolder + "/log.txt");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRunner::downloadBuildXml(void* caller) {
|
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) {
|
void Worker::setCommandLine(const QString& commandLine) {
|
||||||
_commandLine = commandLine;
|
_commandLine = commandLine;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,11 @@
|
||||||
#define hifi_testRunner_h
|
#define hifi_testRunner_h
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
#include <QDir>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QTimeEdit>
|
||||||
|
|
||||||
class Worker;
|
class Worker;
|
||||||
|
|
||||||
|
@ -31,6 +33,8 @@ public:
|
||||||
void parseBuildInformation();
|
void parseBuildInformation();
|
||||||
QString getInstallerNameFromURL(const QString& url);
|
QString getInstallerNameFromURL(const QString& url);
|
||||||
|
|
||||||
|
void appendLog(const QString& message);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QLabel* _workingFolderLabel;
|
QLabel* _workingFolderLabel;
|
||||||
QLabel* _statusLabel;
|
QLabel* _statusLabel;
|
||||||
|
@ -52,6 +56,11 @@ protected:
|
||||||
#else
|
#else
|
||||||
const QString INSTALLER_FILENAME_LATEST{ "" };
|
const QString INSTALLER_FILENAME_LATEST{ "" };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
QDateTime _testStartDateTime;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QFile _logFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Worker : public QObject {
|
class Worker : public QObject {
|
||||||
|
|
|
@ -83,8 +83,6 @@ void TestRunnerDesktop::setWorkingFolderAndEnableControls() {
|
||||||
_installationFolder = _workingFolder + "/High_Fidelity";
|
_installationFolder = _workingFolder + "/High_Fidelity";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_logFile.setFileName(_workingFolder + "/log.txt");
|
|
||||||
|
|
||||||
nitpick->enableRunTabControls();
|
nitpick->enableRunTabControls();
|
||||||
|
|
||||||
_timer = new QTimer(this);
|
_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) {
|
QString TestRunnerDesktop::getPRNumberFromURL(const QString& url) {
|
||||||
try {
|
try {
|
||||||
QStringList urlParts = url.split("/");
|
QStringList urlParts = url.split("/");
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QTimeEdit>
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#include "TestRunner.h"
|
#include "TestRunner.h"
|
||||||
|
@ -67,8 +66,6 @@ public:
|
||||||
|
|
||||||
void copyFolder(const QString& source, const QString& destination);
|
void copyFolder(const QString& source, const QString& destination);
|
||||||
|
|
||||||
void appendLog(const QString& message);
|
|
||||||
|
|
||||||
QString getPRNumberFromURL(const QString& url);
|
QString getPRNumberFromURL(const QString& url);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -106,11 +103,6 @@ private:
|
||||||
QCheckBox* _runServerless;
|
QCheckBox* _runServerless;
|
||||||
QPushButton* _runNow;
|
QPushButton* _runNow;
|
||||||
QTimer* _timer;
|
QTimer* _timer;
|
||||||
|
|
||||||
QFile _logFile;
|
|
||||||
|
|
||||||
QDateTime _testStartDateTime;
|
|
||||||
|
|
||||||
QThread* _installerThread;
|
QThread* _installerThread;
|
||||||
QThread* _interfaceThread;
|
QThread* _interfaceThread;
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ TestRunnerMobile::TestRunnerMobile(
|
||||||
QLabel* detectedDeviceLabel,
|
QLabel* detectedDeviceLabel,
|
||||||
QLineEdit *folderLineEdit,
|
QLineEdit *folderLineEdit,
|
||||||
QPushButton* downloadAPKPushbutton,
|
QPushButton* downloadAPKPushbutton,
|
||||||
|
QPushButton* installAPKPushbutton,
|
||||||
QCheckBox* runLatest,
|
QCheckBox* runLatest,
|
||||||
QLineEdit* url,
|
QLineEdit* url,
|
||||||
QLabel* statusLabel,
|
QLabel* statusLabel,
|
||||||
|
@ -36,6 +37,7 @@ TestRunnerMobile::TestRunnerMobile(
|
||||||
_detectedDeviceLabel = detectedDeviceLabel;
|
_detectedDeviceLabel = detectedDeviceLabel;
|
||||||
_folderLineEdit = folderLineEdit;
|
_folderLineEdit = folderLineEdit;
|
||||||
_downloadAPKPushbutton = downloadAPKPushbutton;
|
_downloadAPKPushbutton = downloadAPKPushbutton;
|
||||||
|
_installAPKPushbutton = installAPKPushbutton;
|
||||||
_runLatest = runLatest;
|
_runLatest = runLatest;
|
||||||
_url = url;
|
_url = url;
|
||||||
_statusLabel = statusLabel;
|
_statusLabel = statusLabel;
|
||||||
|
@ -50,7 +52,6 @@ void TestRunnerMobile::setWorkingFolderAndEnableControls() {
|
||||||
setWorkingFolder(_workingFolderLabel);
|
setWorkingFolder(_workingFolderLabel);
|
||||||
|
|
||||||
_connectDeviceButton->setEnabled(true);
|
_connectDeviceButton->setEnabled(true);
|
||||||
_downloadAPKPushbutton->setEnabled(true);
|
|
||||||
|
|
||||||
// Find ADB (Android Debugging Bridge) before continuing
|
// Find ADB (Android Debugging Bridge) before continuing
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
@ -104,6 +105,7 @@ void TestRunnerMobile::connectDevice() {
|
||||||
_detectedDeviceLabel->setText(line2.remove(DEVICE));
|
_detectedDeviceLabel->setText(line2.remove(DEVICE));
|
||||||
_pullFolderButton->setEnabled(true);
|
_pullFolderButton->setEnabled(true);
|
||||||
_folderLineEdit->setEnabled(true);
|
_folderLineEdit->setEnabled(true);
|
||||||
|
_downloadAPKPushbutton->setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,25 +145,22 @@ void TestRunnerMobile::downloadComplete() {
|
||||||
_statusLabel->setText("Downloading installer");
|
_statusLabel->setText("Downloading installer");
|
||||||
|
|
||||||
nitpick->downloadFiles(urls, _workingFolder, filenames, (void*)this);
|
nitpick->downloadFiles(urls, _workingFolder, filenames, (void*)this);
|
||||||
|
|
||||||
// `downloadComplete` will run again after download has completed
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Download of Installer has completed
|
_statusLabel->setText("Installer download complete");
|
||||||
//// appendLog(QString("Tests started at ") + QString::number(_testStartDateTime.time().hour()) + ":" +
|
_installAPKPushbutton->setEnabled(true);
|
||||||
//// 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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRunnerMobile::pullFolder() {
|
void TestRunnerMobile::installAPK() {
|
||||||
QString command = _adbCommand + " pull " + _folderLineEdit->text() + " " + _workingFolder + " >" + _workingFolder + "/pullOutput.txt";
|
_statusLabel->setText("Installing");
|
||||||
|
QString command = _adbCommand + " install -r -d " + _workingFolder + "/" + _installerFilename + " >" + _workingFolder + "/installOutput.txt";
|
||||||
system(command.toStdString().c_str());
|
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,
|
QLabel* detectedDeviceLabel,
|
||||||
QLineEdit *folderLineEdit,
|
QLineEdit *folderLineEdit,
|
||||||
QPushButton* downloadAPKPushbutton,
|
QPushButton* downloadAPKPushbutton,
|
||||||
|
QPushButton* installAPKPushbutton,
|
||||||
QCheckBox* runLatest,
|
QCheckBox* runLatest,
|
||||||
QLineEdit* url,
|
QLineEdit* url,
|
||||||
QLabel* statusLabel,
|
QLabel* statusLabel,
|
||||||
|
@ -37,8 +38,12 @@ public:
|
||||||
|
|
||||||
void setWorkingFolderAndEnableControls();
|
void setWorkingFolderAndEnableControls();
|
||||||
void connectDevice();
|
void connectDevice();
|
||||||
void downloadAPK();
|
|
||||||
void downloadComplete();
|
void downloadComplete();
|
||||||
|
void downloadAPK();
|
||||||
|
|
||||||
|
void installAPK();
|
||||||
|
|
||||||
void pullFolder();
|
void pullFolder();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -47,6 +52,7 @@ private:
|
||||||
QLabel* _detectedDeviceLabel;
|
QLabel* _detectedDeviceLabel;
|
||||||
QLineEdit* _folderLineEdit;
|
QLineEdit* _folderLineEdit;
|
||||||
QPushButton* _downloadAPKPushbutton;
|
QPushButton* _downloadAPKPushbutton;
|
||||||
|
QPushButton* _installAPKPushbutton;
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
const QString _adbExe{ "adb.exe" };
|
const QString _adbExe{ "adb.exe" };
|
||||||
|
|
|
@ -709,6 +709,22 @@
|
||||||
<string>#######</string>
|
<string>#######</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</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>
|
||||||
<widget class="QWidget" name="tab_2">
|
<widget class="QWidget" name="tab_2">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
|
Loading…
Reference in a new issue