Commit a5f172bd authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Allow to work on windows too

parent 24fcc68e
Pipeline #20816 passed with stage
in 42 minutes and 26 seconds
...@@ -85,15 +85,34 @@ void MessageViewer::Test::compareFile(const QString &outFile, const QString &ref ...@@ -85,15 +85,34 @@ void MessageViewer::Test::compareFile(const QString &outFile, const QString &ref
f.close(); f.close();
} }
QProcess proc;
#ifdef _WIN32
args = QStringList()
<< QStringLiteral("Compare-Object")
<< QString(QStringLiteral("(Get-Content %1)")).arg(referenceFile)
<< QString(QStringLiteral("(Get-Content %1)")).arg(htmlFile);
proc.start(QStringLiteral("powershell"), args);
QVERIFY(proc.waitForFinished());
auto pStdOut = proc.readAllStandardOutput();
if (pStdOut.size()) {
qDebug() << "Files are different, diff output message:\n"
<< pStdOut.toStdString().c_str();
}
QCOMPARE(pStdOut.size(), 0);
#else
// compare to reference file // compare to reference file
args = QStringList() args = QStringList()
<< QStringLiteral("-u") << QStringLiteral("-u")
<< referenceFile << referenceFile
<< htmlFile; << htmlFile;
QProcess proc;
proc.setProcessChannelMode(QProcess::ForwardedChannels); proc.setProcessChannelMode(QProcess::ForwardedChannels);
proc.start(QStringLiteral("diff"), args); proc.start(QStringLiteral("diff"), args);
QVERIFY(proc.waitForFinished()); QVERIFY(proc.waitForFinished());
QCOMPARE(proc.exitCode(), 0); QCOMPARE(proc.exitCode(), 0);
#endif
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment