Skip to content
  • Igor Kushnir's avatar
    Fix test_files-clang failure with Clang 13 · 88d667ab
    Igor Kushnir authored
    The test fails on my system and on KDevelop CI like this:
    QDEBUG : TestFiles::testFiles(basicdeclsandcontexts.cpp) "identifier" FAILED: Declaration's identifier ("(unnamed struct at /home/jenkins/workspace/KDevelop/kdevelop/kf5-qt5 SUSEQt5.15/plugins/clang/tests/files/basicdeclsandcontexts.cpp:97:1)") doesn't match test data (""). (Declaration on line 97 in /home/jenkins/workspace/KDevelop/kdevelop/kf5-qt5 SUSEQt5.15/plugins/clang/tests/files/basicdeclsandcontexts.cpp)
    QDEBUG : TestFiles::testFiles(basicdeclsandcontexts.cpp) "identifier" FAILED: Declaration's identifier ("(unnamed union at /home/jenkins/workspace/KDevelop/kdevelop/kf5-qt5 SUSEQt5.15/plugins/clang/tests/files/basicdeclsandcontexts.cpp:100:1)") doesn't match test data (""). (Declaration on line 100 in /home/jenkins/workspace/KDevelop/kdevelop/kf5-qt5 SUSEQt5.15/plugins/clang/tests/files/basicdeclsandcontexts.cpp)
    FAIL!  : TestFiles::testFiles(basicdeclsandcontexts.cpp) 'validator.testsPassed()' returned FALSE. ()
       Loc: [/home/jenkins/workspace/KDevelop/kdevelop/kf5-qt5 SUSEQt5.15/plugins/clang/tests/test_files.cpp(116)]
    
    The test fix is based on adding testDataAdjuster callback to
    DeclarationValidator. It should be possible to reuse this new interface
    to solve future test_files* failures.
    
    I haven't verified that the test passes with older Clang versions. But
    made sure that the test data is adjusted to the values from the parent
    commit when Clang version is older than 13. So it should pass.
    88d667ab