splhack added a comment.

@jasonmolenda thank you for looking into this!
I was finally able to repro the test failure on arm64 macOS with this diff (the 
version with `ASSERT_EQ(a_file_spec.GetPath(), b_file_spec.GetPath()`) and this 
CMake config.

  cmake \
      ../llvm \
      -G Ninja \
      -DCMAKE_BUILD_TYPE=RelWithDebInfo \
      -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
      -DLLVM_TARGETS_TO_BUILD=X86;ARM;AArch64 \
      -DLLDB_TEST_USER_ARGS="--build-dir;$(pwd);-t;--env;TERM=vt100" \
      -DLLDB_ENFORCE_STRICT_TEST_REQUIREMENTS=Off \
      -DLLDB_ENABLE_PYTHON=On \
      -DLLVM_ENABLE_ASSERTIONS:BOOL=TRUE \
      -DLLVM_ENABLE_MODULES=On \
      -DLLVM_ENABLE_PROJECTS="clang;lld;lldb;cross-project-tests" \
      -DLLVM_LIT_ARGS="-v --time-tests --shuffle 
--xunit-xml-output=$(pwd)/results.xml -v -j 8" \
      -DLLVM_VERSION_PATCH=99 \
      -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;compiler-rt" \
      -DPython3_EXECUTABLE=/usr/bin/python3 \
      -DSWIG_EXECUTABLE=/opt/brew/Cellar/swig@3/3.0.12/bin/swig



  ******************** TEST 'lldb-unit :: Target/./TargetTests/6/11' FAILED 
********************
  Script(shard):
  --
  
GTEST_OUTPUT=json:/Users/user/Sources/llvm-project/build/tools/lldb/unittests/Target/./TargetTests-lldb-unit-45687-6-11.json
 GTEST_SHUFFLE=1 GTEST_TOTAL_SHARDS=11 GTEST_SHARD_INDEX=6 
GTEST_RANDOM_SEED=20766 
/Users/user/Sources/llvm-project/build/tools/lldb/unittests/Target/./TargetTests
  --
  
  Script:
  --
  
/Users/user/Sources/llvm-project/build/tools/lldb/unittests/Target/./TargetTests
 --gtest_filter=LocateModuleCallbackTest.GetOrCreateModuleWithCachedModule
  --
  
/Users/user/Sources/llvm-project/lldb/unittests/Target/LocateModuleCallbackTest.cpp:152:
 Failure
  Expected equality of these values:
    a_file_spec.GetPath()
      Which is: 
"/Users/user/Sources/llvm-project/build/tools/lldb/unittests/Target/Inputs/AndroidModule.unstripped.so"
    b_file_spec.GetPath()
      Which is: 
"/var/folders/hv/pgk33lbd2snf__0bd0v30yyc0000gn/T/lit-tmp-qrocj9y_/lldb/45872/LocateModuleCallbackTest-GetOrCreateModuleWithCachedModule/remote-android/.cache/80008338-82A0-51E5-5922-C905D23890DA-BDDEFECC/AndroidModule.so"
  
/Users/user/Sources/llvm-project/lldb/unittests/Target/LocateModuleCallbackTest.cpp:280:
 Failure
  Value of: module_sp->GetSymbolFileFileSpec()
    Actual: true
  Expected: false
  
  
/Users/user/Sources/llvm-project/lldb/unittests/Target/LocateModuleCallbackTest.cpp:152
  Expected equality of these values:
    a_file_spec.GetPath()
      Which is: 
"/Users/user/Sources/llvm-project/build/tools/lldb/unittests/Target/Inputs/AndroidModule.unstripped.so"
    b_file_spec.GetPath()
      Which is: 
"/var/folders/hv/pgk33lbd2snf__0bd0v30yyc0000gn/T/lit-tmp-qrocj9y_/lldb/45872/LocateModuleCallbackTest-GetOrCreateModuleWithCachedModule/remote-android/.cache/80008338-82A0-51E5-5922-C905D23890DA-BDDEFECC/AndroidModule.so"
  
/Users/user/Sources/llvm-project/lldb/unittests/Target/LocateModuleCallbackTest.cpp:280
  Value of: module_sp->GetSymbolFileFileSpec()
    Actual: true
  Expected: false

The root cause is that the module is cached in this specific test, 
`GetOrCreateModuleWithCachedModule`.
Because `llvm-lit` runs multiple tests in a same process by this CMake config.
Most runtime data is surely initialized by gtest `SetUp` but `ModuleList` 
global instance lives beyond the test lifespan.
Fixed it by tear down the cached module.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155333/new/

https://reviews.llvm.org/D155333

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to