Print the diff to stdout on comparison failure

Previously the output of diff -u was written to a file when the
generated file did not match the expectations. Having the output printed
to stdout makes it easier to see the exact error without having to know
that a diff exists in a certain file somewhere in the build directory.

REVIEW: 115832
wilder
Alex Richardson 12 years ago
parent 445ca7d954
commit 9e3d22c3f5
  1. 14
      autotests/kconfig_compiler/kconfigcompiler_test.cpp
  2. 1
      autotests/kconfig_compiler/kconfigcompiler_test.h

@ -78,11 +78,8 @@ static CompilerTestSet willFailCases = {
void KConfigCompiler_Test::initTestCase()
{
m_diffExe = QStandardPaths::findExecutable("diff");
if (!m_diffExe.isEmpty()) {
m_diff.setFileName(QDir::currentPath() + QLatin1String("/kconfigcompiler_test_differences.diff"));
if (m_diff.exists()) {
m_diff.remove();
}
if (m_diffExe.isEmpty()) {
qDebug() << "diff command not found, detailed info on comparison failure will not be available.";
}
}
@ -155,11 +152,6 @@ void KConfigCompiler_Test::appendFileDiff(const QString &oldFile, const QString
if (m_diffExe.isEmpty()) {
return;
}
if (!m_diff.isOpen()) {
if (!m_diff.open(QIODevice::WriteOnly)) {
return;
}
}
QStringList args;
args << "-u";
@ -172,6 +164,6 @@ void KConfigCompiler_Test::appendFileDiff(const QString &oldFile, const QString
process.waitForFinished();
if (process.exitCode() == 1) {
QByteArray out = process.readAllStandardOutput();
m_diff.write(out);
qDebug() << '\n' << out;
}
}

@ -35,7 +35,6 @@ private:
void appendFileDiff(const QString &oldFile, const QString &newFile);
QString m_diffExe;
QFile m_diff;
};
#endif

Loading…
Cancel
Save