Renamed HTML folder.

Corrected names of tests.
This commit is contained in:
NissimHadar 2018-10-05 08:58:14 -07:00
parent d79d092dc8
commit 19f41eac2b
2 changed files with 15 additions and 10 deletions

View file

@ -32,8 +32,12 @@ void AWSInterface::createWebPageFromResults(const QString& testResults, const QS
void AWSInterface::createHTMLFile(const QString& testResults, const QString& tempDirectory) { void AWSInterface::createHTMLFile(const QString& testResults, const QString& tempDirectory) {
// For file named `D:/tt/snapshots/TestResults--2018-10-03_15-35-28(9433)[DESKTOP-PMKNLSQ].zip` // For file named `D:/tt/snapshots/TestResults--2018-10-03_15-35-28(9433)[DESKTOP-PMKNLSQ].zip`
// - the HTML will be named `TestResults--2018-10-03_15-35-28(9433)[DESKTOP-PMKNLSQ]` // - the HTML will be in a folder named `TestResults--2018-10-03_15-35-28(9433)[DESKTOP-PMKNLSQ]`
QString resultsPath = tempDirectory + "/" + resultsFolder + "/"; QStringList pathComponents = testResults.split('/');
QString filename = pathComponents[pathComponents.length() - 1];
_resultsFolder = filename.left(filename.length() - 4);
QString resultsPath = tempDirectory + "/" + _resultsFolder + "/";
QDir().mkdir(resultsPath); QDir().mkdir(resultsPath);
QStringList tokens = testResults.split('/'); QStringList tokens = testResults.split('/');
QString htmlFilename = resultsPath + tokens[tokens.length() - 1].split('.')[0] + ".html"; QString htmlFilename = resultsPath + tokens[tokens.length() - 1].split('.')[0] + ".html";
@ -151,21 +155,23 @@ void AWSInterface::writeTable(QTextStream& stream) {
for (int i = 0; i < newNames.length(); ++i) { for (int i = 0; i < newNames.length(); ++i) {
QDir dir(originalNames[i]); QDir dir(originalNames[i]);
dir.rename(originalNames[i], _tempDirectory + "/" + resultsFolder + "/" + newNames[i]); dir.rename(originalNames[i], _tempDirectory + "/" + _resultsFolder + "/" + newNames[i]);
} }
QDirIterator it2((_tempDirectory + "/" + resultsFolder).toStdString().c_str()); QDirIterator it2((_tempDirectory + "/" + _resultsFolder).toStdString().c_str());
while (it2.hasNext()) { while (it2.hasNext()) {
QString nextDirectory = it2.next(); QString nextDirectory = it2.next();
// Skip `.` and `..` directories, as well as the HTML directory // Skip `.` and `..` directories, as well as the HTML directory
if (nextDirectory.right(1) == "." || nextDirectory.contains(QString("/") + resultsFolder + "/TestResults--")) { if (nextDirectory.right(1) == "." || nextDirectory.contains(QString("/") + _resultsFolder + "/TestResults--")) {
continue; continue;
} }
int splitIndex = nextDirectory.lastIndexOf("."); QStringList pathComponents = nextDirectory.split('/');
QString testName = nextDirectory.left(splitIndex).replace(".", " / "); QString filename = pathComponents[pathComponents.length() - 1];
QString testNumber = nextDirectory.right(nextDirectory.length() - (splitIndex + 1)); int splitIndex = filename.lastIndexOf(".");
QString testName = filename.left(splitIndex).replace(".", " / ");
QString testNumber = filename.right(filename.length() - (splitIndex + 1));
// The failures are ordered lexicographically, so we know that we can rely on the testName changing to create a new table // The failures are ordered lexicographically, so we know that we can rely on the testName changing to create a new table
if (testName != previousTestName) { if (testName != previousTestName) {

View file

@ -37,8 +37,7 @@ public:
private: private:
QString _tempDirectory; QString _tempDirectory;
QString _resultsFolder;
const QString resultsFolder{ "HTML" };
}; };
#endif // hifi_AWSInterface_h #endif // hifi_AWSInterface_h