mirror of
https://github.com/overte-org/overte.git
synced 2025-06-07 00:01:39 +02:00
Delete old failures before unzipping
This commit is contained in:
parent
2bcdb129c0
commit
fd6518ec56
7 changed files with 102 additions and 41 deletions
|
@ -11,12 +11,14 @@
|
||||||
|
|
||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QProcess>
|
||||||
|
|
||||||
#include <quazip5/quazip.h>
|
#include <quazip5/quazip.h>
|
||||||
#include <quazip5/JlCompress.h>
|
#include <quazip5/JlCompress.h>
|
||||||
|
|
||||||
AWSInterface::AWSInterface(QObject* parent) :
|
AWSInterface::AWSInterface(QObject* parent) : QObject(parent) {
|
||||||
QObject(parent) {
|
_pythonInterface = new PythonInterface();
|
||||||
|
_pythonCommand = _pythonInterface->getPythonCommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AWSInterface::createWebPageFromResults(const QString& testResults, const QString& workingDirectory) {
|
void AWSInterface::createWebPageFromResults(const QString& testResults, const QString& workingDirectory) {
|
||||||
|
@ -32,6 +34,16 @@ void AWSInterface::createWebPageFromResults(const QString& testResults, const QS
|
||||||
}
|
}
|
||||||
|
|
||||||
void AWSInterface::extractTestFailuresFromZippedFolder() {
|
void AWSInterface::extractTestFailuresFromZippedFolder() {
|
||||||
|
// For a test results zip file called `D:/tt/TestResults--2018-10-02_16-54-11(9426)[DESKTOP-PMKNLSQ].zip`
|
||||||
|
// the folder will be called `TestResults--2018-10-02_16-54-11(9426)[DESKTOP-PMKNLSQ]`
|
||||||
|
// and, this folder will be in the workign directory
|
||||||
|
QStringList parts =_testResults.split('/');
|
||||||
|
QString zipFolderName = _workingDirectory + "/" + parts[parts.length() - 1].split('.')[0];
|
||||||
|
if (QDir(zipFolderName).exists()) {
|
||||||
|
QDir dir = zipFolderName;
|
||||||
|
dir.removeRecursively();
|
||||||
|
}
|
||||||
|
|
||||||
QDir().mkdir(_workingDirectory);
|
QDir().mkdir(_workingDirectory);
|
||||||
JlCompress::extractDir(_testResults, _workingDirectory);
|
JlCompress::extractDir(_testResults, _workingDirectory);
|
||||||
}
|
}
|
||||||
|
@ -272,4 +284,14 @@ void AWSInterface::updateAWS() {
|
||||||
stream << "s3.Bucket('hifi-content').put_object(Bucket='hifi-content', Key='nissim/" << _resultsFolder << "/" << HTML_FILENAME << "', Body=data)\n";
|
stream << "s3.Bucket('hifi-content').put_object(Bucket='hifi-content', Key='nissim/" << _resultsFolder << "/" << HTML_FILENAME << "', Body=data)\n";
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
|
QProcess* process = new QProcess();
|
||||||
|
|
||||||
|
connect(process, &QProcess::started, this, [=]() { _busyWindow.exec(); });
|
||||||
|
connect(process, SIGNAL(finished(int)), process, SLOT(deleteLater()));
|
||||||
|
connect(process, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), this,
|
||||||
|
[=](int exitCode, QProcess::ExitStatus exitStatus) { _busyWindow.hide(); });
|
||||||
|
|
||||||
|
QStringList parameters = QStringList() << filename ;
|
||||||
|
process->start(_pythonCommand, parameters);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,10 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
|
||||||
|
#include "ui/BusyWindow.h"
|
||||||
|
|
||||||
|
#include "PythonInterface.h"
|
||||||
|
|
||||||
class AWSInterface : public QObject {
|
class AWSInterface : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -46,6 +50,11 @@ private:
|
||||||
|
|
||||||
const QString FAILURE_FOLDER{ "failures" };
|
const QString FAILURE_FOLDER{ "failures" };
|
||||||
const QString HTML_FILENAME{ "TestResults.html" };
|
const QString HTML_FILENAME{ "TestResults.html" };
|
||||||
|
|
||||||
|
BusyWindow _busyWindow;
|
||||||
|
|
||||||
|
PythonInterface* _pythonInterface;
|
||||||
|
QString _pythonCommand;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_AWSInterface_h
|
#endif // hifi_AWSInterface_h
|
32
tools/auto-tester/src/PythonInterface.cpp
Normal file
32
tools/auto-tester/src/PythonInterface.cpp
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
//
|
||||||
|
// PythonInterface.cpp
|
||||||
|
//
|
||||||
|
// Created by Nissim Hadar on Oct 6, 2018.
|
||||||
|
// Copyright 2013 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
#include "PythonInterface.h"
|
||||||
|
|
||||||
|
#include <QFile>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QProcess>
|
||||||
|
|
||||||
|
PythonInterface::PythonInterface() {
|
||||||
|
if (QProcessEnvironment::systemEnvironment().contains("PYTHON_PATH")) {
|
||||||
|
QString _pythonPath = QProcessEnvironment::systemEnvironment().value("PYTHON_PATH");
|
||||||
|
if (!QFile::exists(_pythonPath + "/" + _pythonExe)) {
|
||||||
|
QMessageBox::critical(0, _pythonExe, QString("Python executable not found in ") + _pythonPath);
|
||||||
|
}
|
||||||
|
_pythonCommand = _pythonPath + "/" + _pythonExe;
|
||||||
|
} else {
|
||||||
|
QMessageBox::critical(0, "PYTHON_PATH not defined",
|
||||||
|
"Please set PYTHON_PATH to directory containing the Python executable");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString PythonInterface::getPythonCommand() {
|
||||||
|
return _pythonCommand;
|
||||||
|
}
|
26
tools/auto-tester/src/PythonInterface.h
Normal file
26
tools/auto-tester/src/PythonInterface.h
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
//
|
||||||
|
// PythonInterface.h
|
||||||
|
//
|
||||||
|
// Created by Nissim Hadar on Oct 6, 2018.
|
||||||
|
// Copyright 2013 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
#ifndef hifi_PythonInterface_h
|
||||||
|
#define hifi_PythonInterface_h
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
class PythonInterface {
|
||||||
|
public:
|
||||||
|
PythonInterface();
|
||||||
|
|
||||||
|
QString getPythonCommand();
|
||||||
|
|
||||||
|
private:
|
||||||
|
const QString _pythonExe{ "python.exe" };
|
||||||
|
QString _pythonCommand;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // hifi_PythonInterface_h
|
|
@ -41,29 +41,15 @@ TestRailInterface::TestRailInterface() {
|
||||||
_testRailResultsSelectorWindow.setProjectID(INTERFACE_AUTOMATION_PROJECT_ID);
|
_testRailResultsSelectorWindow.setProjectID(INTERFACE_AUTOMATION_PROJECT_ID);
|
||||||
|
|
||||||
_testRailResultsSelectorWindow.setSuiteID(INTERFACE_SUITE_ID);
|
_testRailResultsSelectorWindow.setSuiteID(INTERFACE_SUITE_ID);
|
||||||
|
|
||||||
|
_pythonInterface = new PythonInterface();
|
||||||
|
_pythonCommand = _pythonInterface->getPythonCommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TestRailInterface::getObject(const QString& path) {
|
QString TestRailInterface::getObject(const QString& path) {
|
||||||
return path.right(path.length() - path.lastIndexOf("/") - 1);
|
return path.right(path.length() - path.lastIndexOf("/") - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TestRailInterface::setPythonCommand() {
|
|
||||||
if (QProcessEnvironment::systemEnvironment().contains("PYTHON_PATH")) {
|
|
||||||
QString _pythonPath = QProcessEnvironment::systemEnvironment().value("PYTHON_PATH");
|
|
||||||
if (!QFile::exists(_pythonPath + "/" + _pythonExe)) {
|
|
||||||
QMessageBox::critical(0, _pythonExe, QString("Python executable not found in ") + _pythonPath);
|
|
||||||
}
|
|
||||||
_pythonCommand = _pythonPath + "/" + _pythonExe;
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
QMessageBox::critical(0, "PYTHON_PATH not defined",
|
|
||||||
"Please set PYTHON_PATH to directory containing the Python executable");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Creates the testrail.py script
|
// Creates the testrail.py script
|
||||||
// This is the file linked to from http://docs.gurock.com/testrail-api2/bindings-python
|
// This is the file linked to from http://docs.gurock.com/testrail-api2/bindings-python
|
||||||
void TestRailInterface::createTestRailDotPyScript() {
|
void TestRailInterface::createTestRailDotPyScript() {
|
||||||
|
@ -770,10 +756,6 @@ void TestRailInterface::createTestSuitePython(const QString& testDirectory,
|
||||||
_userGitHub = userGitHub;
|
_userGitHub = userGitHub;
|
||||||
_branchGitHub = branchGitHub;
|
_branchGitHub = branchGitHub;
|
||||||
|
|
||||||
if (!setPythonCommand()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!requestTestRailTestCasesDataFromUser()) {
|
if (!requestTestRailTestCasesDataFromUser()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1127,10 +1109,6 @@ void TestRailInterface::getRunsFromTestRail() {
|
||||||
void TestRailInterface::createTestRailRun(const QString& outputDirectory) {
|
void TestRailInterface::createTestRailRun(const QString& outputDirectory) {
|
||||||
_outputDirectory = outputDirectory;
|
_outputDirectory = outputDirectory;
|
||||||
|
|
||||||
if (!setPythonCommand()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!requestTestRailRunDataFromUser()) {
|
if (!requestTestRailRunDataFromUser()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1145,10 +1123,6 @@ void TestRailInterface::createTestRailRun(const QString& outputDirectory) {
|
||||||
void TestRailInterface::updateTestRailRunResults(const QString& testResults, const QString& tempDirectory) {
|
void TestRailInterface::updateTestRailRunResults(const QString& testResults, const QString& tempDirectory) {
|
||||||
_outputDirectory = tempDirectory;
|
_outputDirectory = tempDirectory;
|
||||||
|
|
||||||
if (!setPythonCommand()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!requestTestRailResultsDataFromUser()) {
|
if (!requestTestRailResultsDataFromUser()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#define hifi_test_testrail_interface_h
|
#define hifi_test_testrail_interface_h
|
||||||
|
|
||||||
#include "ui/BusyWindow.h"
|
#include "ui/BusyWindow.h"
|
||||||
|
|
||||||
#include "ui/TestRailTestCasesSelectorWindow.h"
|
#include "ui/TestRailTestCasesSelectorWindow.h"
|
||||||
#include "ui/TestRailRunSelectorWindow.h"
|
#include "ui/TestRailRunSelectorWindow.h"
|
||||||
#include "ui/TestRailResultsSelectorWindow.h"
|
#include "ui/TestRailResultsSelectorWindow.h"
|
||||||
|
@ -22,7 +21,9 @@
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
class TestRailInterface : public QObject{
|
#include "PythonInterface.h"
|
||||||
|
|
||||||
|
class TestRailInterface : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -65,9 +66,7 @@ public:
|
||||||
bool requestTestRailRunDataFromUser();
|
bool requestTestRailRunDataFromUser();
|
||||||
bool requestTestRailResultsDataFromUser();
|
bool requestTestRailResultsDataFromUser();
|
||||||
|
|
||||||
void createAddTestCasesPythonScript(const QString& testDirectory,
|
void createAddTestCasesPythonScript(const QString& testDirectory, const QString& userGitHub, const QString& branchGitHub);
|
||||||
const QString& userGitHub,
|
|
||||||
const QString& branchGitHub);
|
|
||||||
|
|
||||||
void processDirectoryPython(const QString& directory,
|
void processDirectoryPython(const QString& directory,
|
||||||
QTextStream& stream,
|
QTextStream& stream,
|
||||||
|
@ -88,7 +87,6 @@ public:
|
||||||
void addRun();
|
void addRun();
|
||||||
void updateRunWithResults();
|
void updateRunWithResults();
|
||||||
|
|
||||||
bool setPythonCommand();
|
|
||||||
void extractTestFailuresFromZippedFolder(const QString& testResults, const QString& tempDirectory);
|
void extractTestFailuresFromZippedFolder(const QString& testResults, const QString& tempDirectory);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -117,9 +115,6 @@ private:
|
||||||
QString _userGitHub;
|
QString _userGitHub;
|
||||||
QString _branchGitHub;
|
QString _branchGitHub;
|
||||||
|
|
||||||
const QString _pythonExe{ "python.exe" };
|
|
||||||
QString _pythonCommand;
|
|
||||||
|
|
||||||
QStringList _releaseNames;
|
QStringList _releaseNames;
|
||||||
|
|
||||||
QStringList _sectionNames;
|
QStringList _sectionNames;
|
||||||
|
@ -129,6 +124,9 @@ private:
|
||||||
std::vector<int> _runIDs;
|
std::vector<int> _runIDs;
|
||||||
|
|
||||||
QString TEMP_NAME{ "fgadhcUDHSFaidsfh3478JJJFSDFIUSOEIrf" };
|
QString TEMP_NAME{ "fgadhcUDHSFaidsfh3478JJJFSDFIUSOEIrf" };
|
||||||
|
|
||||||
|
PythonInterface* _pythonInterface;
|
||||||
|
QString _pythonCommand;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -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 - v6.0");
|
setWindowTitle("Auto Tester - v6.1");
|
||||||
|
|
||||||
// Coming soon to an auto-tester near you...
|
// Coming soon to an auto-tester near you...
|
||||||
//// _helpWindow.textBrowser->setText()
|
//// _helpWindow.textBrowser->setText()
|
||||||
|
|
Loading…
Reference in a new issue