diff options
Diffstat (limited to 'autotests/kconfig_compiler/kconfigcompiler_test.cpp')
-rw-r--r-- | autotests/kconfig_compiler/kconfigcompiler_test.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/autotests/kconfig_compiler/kconfigcompiler_test.cpp b/autotests/kconfig_compiler/kconfigcompiler_test.cpp index 383745b1..7ab4a923 100644 --- a/autotests/kconfig_compiler/kconfigcompiler_test.cpp +++ b/autotests/kconfig_compiler/kconfigcompiler_test.cpp @@ -125,9 +125,7 @@ void KConfigCompiler_Test::testBaselineComparison() if (content != contentRef) { appendFileDiff(fileRef.fileName(), file.fileName()); } - // use split('\n') to avoid - // the whole output shown inline - QCOMPARE(content.split('\n'), contentRef.split('\n')); + QVERIFY(content == contentRef); } @@ -166,17 +164,23 @@ void KConfigCompiler_Test::appendFileDiff(const QString &oldFile, const QString return; } - QStringList args; - args << QStringLiteral("-u"); - args << QFileInfo(oldFile).absoluteFilePath(); - args << QFileInfo(newFile).absoluteFilePath(); + QStringList args({ + QStringLiteral("-u"), + QFileInfo(oldFile).absoluteFilePath(), + QFileInfo(newFile).absoluteFilePath() }); QProcess process; process.start(m_diffExe, args, QIODevice::ReadOnly); process.waitForStarted(); process.waitForFinished(); + if (process.exitCode() == 1) { - QByteArray out = process.readAllStandardOutput(); - qDebug() << '\n' << out; + const QString diffFileName = oldFile + QStringLiteral(".diff"); + QFile diffFile(diffFileName); + QVERIFY2(diffFile.open(QIODevice::WriteOnly), qPrintable(QLatin1String("Could not save diff file for ") + oldFile)); + diffFile.write(process.readAllStandardOutput()); + + // force a failure to print the flename where we stored the diff. + QVERIFY2(false, qPrintable(QLatin1String("This test failed, look at the following file for details: ") + diffFileName)); } } |