diff --git a/autotests/symlinktest.cpp b/autotests/symlinktest.cpp --- a/autotests/symlinktest.cpp +++ b/autotests/symlinktest.cpp @@ -29,6 +29,11 @@ Q_OBJECT private Q_SLOTS: + void initTestCase() + { + // Go up one level from the bin dir + m_buildDir = QDir(QCoreApplication::applicationDirPath() + "/..").canonicalPath(); + } // Invalid symlinks shouldn't happen. void test_broken() { @@ -45,6 +50,11 @@ if (!info.isSymLink() || info.exists()) { continue; } + if (info.canonicalPath().startsWith(m_buildDir)) { + // ignore any symlink in the builddir, they might point to a relative path that doesn't exist in the builddir + // and everything will still be fine after make install, when reunited with the source dir + continue; + } brokenSymLinks << info; } failSymlinkList(brokenSymLinks, @@ -70,6 +80,8 @@ failSymlinkList(OOTSymLinks, QStringLiteral("Found out-of-tree symlinks:\n")); } +private: + QString m_buildDir; }; QTEST_GUILESS_MAIN(SymlinkTest)