[cfe-dev] Random non-reproducible errors in ClangdTests

Mikael Holmén via cfe-dev cfe-dev at lists.llvm.org
Wed Sep 5 06:19:40 PDT 2018


Hi,

For a while now we randomly see failures when running the ClangdTests test.

E.g the below but sometimes other failures:

--------
FAIL: Extra Tools Unit Tests :: 
clangd/./ClangdTests/WorkspaceSymbolsTest.Namespaces (16172 of 39758)
******************** TEST 'Extra Tools Unit Tests :: 
clangd/./ClangdTests/WorkspaceSymbolsTest.Namespaces' FAILED 
********************
Note: Google Test filter = WorkspaceSymbolsTest.Namespaces
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from WorkspaceSymbolsTest
[ RUN      ] WorkspaceSymbolsTest.Namespaces
../tools/clang/tools/extra/unittests/clangd/FindSymbolsTests.cpp:151: 
Failure
Value of: getSymbols("a")
Expected: has 4 elements and there exists some permutation of elements 
such that:
  - element #0 (named "ans1") and (in container ""), and
  - element #1 (named "ai1") and (in container "ans1"), and
  - element #2 (named "ans2") and (in container "ans1"), and
  - element #3 (named "ai2") and (in container "ans1::ans2")
   Actual: {}
../tools/clang/tools/extra/unittests/clangd/FindSymbolsTests.cpp:153: 
Failure
Value of: getSymbols("::")
Expected: has 1 element that (named "ans1") and (in container "")
   Actual: {}
../tools/clang/tools/extra/unittests/clangd/FindSymbolsTests.cpp:155: 
Failure
Value of: getSymbols("::a")
Expected: has 1 element that (named "ans1") and (in container "")
   Actual: {}
../tools/clang/tools/extra/unittests/clangd/FindSymbolsTests.cpp:158: 
Failure
Value of: getSymbols("ans1::")
Expected: has 2 elements and there exists some permutation of elements 
such that:
  - element #0 (named "ai1") and (in container "ans1"), and
  - element #1 (named "ans2") and (in container "ans1")
   Actual: {}
../tools/clang/tools/extra/unittests/clangd/FindSymbolsTests.cpp:160: 
Failure
Value of: getSymbols("::ans1")
Expected: has 1 element that (named "ans1") and (in container "")
   Actual: {}
../tools/clang/tools/extra/unittests/clangd/FindSymbolsTests.cpp:163: 
Failure
Value of: getSymbols("::ans1::")
Expected: has 2 elements and there exists some permutation of elements 
such that:
  - element #0 (named "ai1") and (in container "ans1"), and
  - element #1 (named "ans2") and (in container "ans1")
   Actual: {}
../tools/clang/tools/extra/unittests/clangd/FindSymbolsTests.cpp:165: 
Failure
Value of: getSymbols("::ans1::ans2")
Expected: has 1 element that (named "ans2") and (in container "ans1")
   Actual: {}
../tools/clang/tools/extra/unittests/clangd/FindSymbolsTests.cpp:167: 
Failure
Value of: getSymbols("::ans1::ans2::")
Expected: has 1 element that (named "ai2") and (in container "ans1::ans2")
   Actual: {}
[  FAILED  ] WorkspaceSymbolsTest.Namespaces (39 ms)
[----------] 1 test from WorkspaceSymbolsTest (39 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (40 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] WorkspaceSymbolsTest.Namespaces

  1 FAILED TEST


It can fail and then at once pass again so something funny is going on.


I ran valgrind on ClangdTests and then I got a bunch of complaints, the 
first being:


[ RUN      ] ClangdVFSTest.SearchLibDir
Updating file /clangd-test/foo.cpp with command [/clangd-test] clang 
-ffreestanding -xc++ -target x86_64-linux-unknown -m64 
--gcc-toolchain=/randomusr -stdlib=libstdc++ /clangd-test/foo.cpp 
-resource-dir=/data/repo/llvm-patch/build-all/tools/clang/tools/extra/unittests/clangd/../lib/clang/8.0.0
Preamble for file /clangd-test/foo.cpp cannot be reused. Attempting to 
rebuild it.
Built preamble of size 175020 for file /clangd-test/foo.cpp
==14605== Thread 2 worker:foo.cpp:
==14605== Conditional jump or move depends on uninitialised value(s)
==14605==    at 0xCDF8A6: 
clang::Sema::SetCtorInitializers(clang::CXXConstructorDecl*, bool, 
llvm::ArrayRef<clang::CXXCtorInitializer*>) (in 
/data/repo/llvm-patch/build-all/tools/clang/tools/extra/unittests/clangd/ClangdTests)
==14605==    by 0xD01CB9: 
clang::Sema::DefineImplicitDefaultConstructor(clang::SourceLocation, 
clang::CXXConstructorDecl*) (in 
/data/repo/llvm-patch/build-all/tools/clang/tools/extra/unittests/clangd/ClangdTests)
==14605==    by 0xEA3B93: PerformConstructorInitialization(clang::Sema&, 
clang::InitializedEntity const&, clang::InitializationKind const&, 
llvm::MutableArrayRef<clang::Expr*>, clang::InitializationSequence::Step 
const&, bool&, bool, bool, clang::SourceLocation, clang::SourceLocation) 
(in 
/data/repo/llvm-patch/build-all/tools/clang/tools/extra/unittests/clangd/ClangdTests)
==14605==    by 0xE9AA3F: 
clang::InitializationSequence::Perform(clang::Sema&, 
clang::InitializedEntity const&, clang::InitializationKind const&, 
llvm::MutableArrayRef<clang::Expr*>, clang::QualType*) (in 
/data/repo/llvm-patch/build-all/tools/clang/tools/extra/unittests/clangd/ClangdTests)
==14605==    by 0xBFA3C4: 
clang::Sema::ActOnUninitializedDecl(clang::Decl*) (in 
/data/repo/llvm-patch/build-all/tools/clang/tools/extra/unittests/clangd/ClangdTests)
==14605==    by 0x13C5EFF: 
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, 
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) 
(in 
/data/repo/llvm-patch/build-all/tools/clang/tools/extra/unittests/clangd/ClangdTests)
==14605==    by 0x13C40B7: 
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, 
clang::DeclaratorContext, clang::SourceLocation*, 
clang::Parser::ForRangeInit*) (in 
/data/repo/llvm-patch/build-all/tools/clang/tools/extra/unittests/clangd/ClangdTests)
==14605==    by 0x13AAF5B: 
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, 
clang::ParsingDeclSpec&, clang::AccessSpecifier) (in 
/data/repo/llvm-patch/build-all/tools/clang/tools/extra/unittests/clangd/ClangdTests)
==14605==    by 0x13AAA1D: 
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, 
clang::ParsingDeclSpec*, clang::AccessSpecifier) (in 
/data/repo/llvm-patch/build-all/tools/clang/tools/extra/unittests/clangd/ClangdTests)
==14605==    by 0x13A9861: 
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, 
clang::ParsingDeclSpec*) (in 
/data/repo/llvm-patch/build-all/tools/clang/tools/extra/unittests/clangd/ClangdTests)
==14605==    by 0x13A8629: 
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) 
(in 
/data/repo/llvm-patch/build-all/tools/clang/tools/extra/unittests/clangd/ClangdTests)
==14605==    by 0x13A840F: 
clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) 
(in 
/data/repo/llvm-patch/build-all/tools/clang/tools/extra/unittests/clangd/ClangdTests)
==14605==
Updating file /clangd-test/foo.cpp with command [/clangd-test] clang 
-ffreestanding -xc++ -target x86_64-linux-unknown -m64 
--gcc-toolchain=/randomusr -stdlib=libstdc++ /clangd-test/foo.cpp 
-resource-dir=/data/repo/llvm-patch/build-all/tools/clang/tools/extra/unittests/clangd/../lib/clang/8.0.0
Reusing preamble for file /clangd-test/foo.cpp
[       OK ] ClangdVFSTest.SearchLibDir (952 ms)



It's not obvious to me what the problem really is. Does anyone here have 
a clue?

Regards,
Mikael



More information about the cfe-dev mailing list