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

Fix diff support on windows

parent 621f9f5f
Pipeline #162221 failed with stages
in 5 minutes and 39 seconds
......@@ -19,13 +19,29 @@ void compareFile(const QString &name)
const QString refFile = QLatin1String(KDEBUGSETTINGS_DATA_DIR) + QLatin1Char('/') + name + QStringLiteral(".ref");
const QString generatedFile = QLatin1String(KDEBUGSETTINGS_BINARY_DATA_DIR) + QLatin1Char('/') + name + QStringLiteral("-generated.ref");
#ifdef _WIN32
QStringList args = QStringList() << QStringLiteral("Compare-Object") << QString(QStringLiteral("(Get-Content %1)")).arg(refFile)
<< QString(QStringLiteral("(Get-Content %1)")).arg(generatedFile);
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
QStringList args = QStringList() << QStringLiteral("-u") << refFile << generatedFile;
QProcess proc;
const QStringList args = QStringList() << QStringLiteral("-u") << refFile << generatedFile;
proc.setProcessChannelMode(QProcess::ForwardedChannels);
proc.start(QStringLiteral("diff"), args);
QVERIFY(proc.waitForFinished());
QCOMPARE(proc.exitCode(), 0);
#endif
}
SaveRulesJobTest::SaveRulesJobTest(QObject *parent)
......
Supports Markdown
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