diff --git a/tools/nitpick/src/AWSInterface.cpp b/tools/nitpick/src/AWSInterface.cpp index 21b88277db..11a0f06d07 100644 --- a/tools/nitpick/src/AWSInterface.cpp +++ b/tools/nitpick/src/AWSInterface.cpp @@ -27,7 +27,7 @@ void AWSInterface::createWebPageFromResults(const QString& testResults, QLineEdit* urlLineEdit) { _testResults = testResults; _workingDirectory = workingDirectory; - + _urlLineEdit = urlLineEdit; _urlLineEdit->setEnabled(false); @@ -43,7 +43,7 @@ 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 working directory - QStringList parts =_testResults.split('/'); + QStringList parts = _testResults.split('/'); QString zipFolderName = _workingDirectory + "/" + parts[parts.length() - 1].split('.')[0]; if (QDir(zipFolderName).exists()) { QDir dir = zipFolderName; @@ -116,7 +116,7 @@ void AWSInterface::writeTitle(QTextStream& stream) { QString date_buildorPR_hostName = tokens[tokens.length() - 1].split("--")[1].split(".")[0]; QString buildorPR = date_buildorPR_hostName.split('(')[1].split(')')[0]; - QString hostName = date_buildorPR_hostName.split('[')[1].split(']')[0]; + QString hostName = date_buildorPR_hostName.split('[')[1].split(']')[0]; QStringList dateList = date_buildorPR_hostName.split('(')[0].split('_')[0].split('-'); QString year = dateList[0]; @@ -189,7 +189,7 @@ void AWSInterface::writeTable(QTextStream& stream) { for (int i = 0; i < originalNamesSuccesses.length(); ++i) { newNamesSuccesses.append(originalNamesSuccesses[i].split("--tests.")[1]); } - + _htmlFailuresFolder = _workingDirectory + "/" + _resultsFolder + "/" + FAILURES_FOLDER; QDir().mkdir(_htmlFailuresFolder); @@ -204,7 +204,11 @@ void AWSInterface::writeTable(QTextStream& stream) { QDir().rename(originalNamesSuccesses[i], _htmlSuccessesFolder + "/" + newNamesSuccesses[i]); } + // Mac does not read folders in lexicographic order, so this step is divided into 2 + // Each test consists of the test name and its index. QDirIterator it2(_htmlFailuresFolder); + QStringList folderNames; + while (it2.hasNext()) { QString nextDirectory = it2.next(); @@ -214,10 +218,17 @@ void AWSInterface::writeTable(QTextStream& stream) { } QStringList pathComponents = nextDirectory.split('/'); - QString filename = pathComponents[pathComponents.length() - 1]; - int splitIndex = filename.lastIndexOf("."); - QString testName = filename.left(splitIndex).replace(".", " / "); - QString testNumber = filename.right(filename.length() - (splitIndex + 1)); + QString folderName = pathComponents[pathComponents.length() - 1]; + + folderNames << folderName; + } + + folderNames.sort(); + for (const auto& folderName : folderNames) { + int splitIndex = folderName.lastIndexOf("."); + QString testName = folderName.left(splitIndex).replace('.', " / "); + + int testNumber = folderName.right(folderName.length() - (splitIndex + 1)).toInt(); // The failures are ordered lexicographically, so we know that we can rely on the testName changing to create a new table if (testName != previousTestName) { @@ -232,7 +243,7 @@ void AWSInterface::writeTable(QTextStream& stream) { openTable(stream); } - createEntry(testNumber.toInt(), filename, stream, true); + createEntry(testNumber, folderName, stream, true); } closeTable(stream); @@ -290,7 +301,7 @@ void AWSInterface::closeTable(QTextStream& stream) { void AWSInterface::createEntry(int index, const QString& testResult, QTextStream& stream, const bool isFailure) { stream << "\t\t\t