[PATCH] D91620: [compiler-rt][test] Heed COMPILER_RT_DEBUG when compiling unittests

Haowei Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 13 14:44:02 PST 2022


haowei added a comment.

So I tried

  cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;lld" -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;compiler-rt" ../llvm -DCMAKE_C_COMPILER=/mnt/nvme_sec/SRC/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang -DCMAKE_CXX_COMPILER=/mnt/nvme_sec/SRC/fuchsia/prebuilt/third_party/clang/linux-x64/bin/clang++ -DLLVM_ENABLE_LLD=On -DLLVM_TARGETS_TO_BUILD="X86"

and run

  ninja
  ninja check-runtimes

And I triggered those MSAN failures. The host toolchain I used are the prebuilts we built and can be found at https://chrome-infra-packages.appspot.com/p/fuchsia/third_party/clang/linux-amd64/+/integration The host toolchain shouldn't matter much as the runtimes should be built by the stage1 toolchain from the source.

Example of the test output:

  FAIL: MemorySanitizer-Unit :: ./Msan-x86_64-Test/37/75 (15519 of 16268)
  ******************** TEST 'MemorySanitizer-Unit :: ./Msan-x86_64-Test/37/75' FAILED ********************
  Script(shard):
  --
  GTEST_OUTPUT=json:/mnt/nvme_sec/SRC/llvm-project/build-cmake/msan-failure/runtimes/runtimes-bins/compiler-rt/lib/msan/tests/./Msan-x86_64-Test-MemorySanitizer-Unit-3368237-37-75.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=75 GTEST_SHARD_INDEX=37 /mnt/nvme_sec/SRC/llvm-project/build-cmake/msan-failure/runtimes/runtimes-bins/compiler-rt/lib/msan/tests/./Msan-x86_64-Test
  --
  
  Note: This is test shard 38 of 75.
  [==========] Running 4 tests from 1 test suite.
  [----------] Global test environment set-up.
  [----------] 4 tests from MemorySanitizer
  [ RUN      ] MemorySanitizer.pipe2
  [       OK ] MemorySanitizer.pipe2 (0 ms)
  [ RUN      ] MemorySanitizer.wcstod
  [       OK ] MemorySanitizer.wcstod (0 ms)
  [ RUN      ] MemorySanitizer.VAArgManyTest
  [       OK ] MemorySanitizer.VAArgManyTest (0 ms)
  [ RUN      ] MemorySanitizer.Bmi
  MemorySanitizer:DEADLYSIGNAL
  ==229427==ERROR: MemorySanitizer: SEGV on unknown address 0x000000000000 (pc 0x55d6565b0663 bp 0x7ffc5788abb0 sp 0x7ffc5788ab60 T229427)
  ==229427==The signal is caused by a WRITE memory access.
  ==229427==Hint: address points to the zero page.
      #0 0x55d6565b0663 in HaveBmi() /mnt/nvme_sec/SRC/llvm-project/compiler-rt/lib/msan/tests/msan_test.cpp:4714:3
      #1 0x55d6565b04d2 in MemorySanitizer_Bmi_Test::TestBody() /mnt/nvme_sec/SRC/llvm-project/compiler-rt/lib/msan/tests/msan_test.cpp:4846:7
      #2 0x55d6569943a4 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /mnt/nvme_sec/SRC/llvm-project/runtimes/../third-party/unittest/googletest/src/gtest.cc:2433:10
      #3 0x55d6567dfa76 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /mnt/nvme_sec/SRC/llvm-project/runtimes/../third-party/unittest/googletest/src/gtest.cc:2469:14
      #4 0x55d6567df15e in testing::Test::Run() /mnt/nvme_sec/SRC/llvm-project/runtimes/../third-party/unittest/googletest/src/gtest.cc:2508:5
      #5 0x55d6567e69a0 in testing::TestInfo::Run() /mnt/nvme_sec/SRC/llvm-project/runtimes/../third-party/unittest/googletest/src/gtest.cc:2684:11
      #6 0x55d6567ee1ef in testing::TestSuite::Run() /mnt/nvme_sec/SRC/llvm-project/runtimes/../third-party/unittest/googletest/src/gtest.cc:2816:28
      #7 0x55d65684106a in testing::internal::UnitTestImpl::RunAllTests() /mnt/nvme_sec/SRC/llvm-project/runtimes/../third-party/unittest/googletest/src/gtest.cc:5338:44
      #8 0x55d6569cda4f in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /mnt/nvme_sec/SRC/llvm-project/runtimes/../third-party/unittest/googletest/src/gtest.cc:2433:10
      #9 0x55d65683dd2d in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /mnt/nvme_sec/SRC/llvm-project/runtimes/../third-party/unittest/googletest/src/gtest.cc:2469:14
      #10 0x55d65683cc1e in testing::UnitTest::Run() /mnt/nvme_sec/SRC/llvm-project/runtimes/../third-party/unittest/googletest/src/gtest.cc:4925:10
      #11 0x55d656779555 in RUN_ALL_TESTS() /mnt/nvme_sec/SRC/llvm-project/runtimes/../third-party/unittest/googletest/include/gtest/gtest.h:2472:46
      #12 0x55d6567792e5 in main /mnt/nvme_sec/SRC/llvm-project/compiler-rt/lib/msan/tests/msan_test_main.cpp:19:10
      #13 0x7f3142229209 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
      #14 0x7f31422292bb in __libc_start_main csu/../csu/libc-start.c:389:3
      #15 0x55d65627a420 in _start (/mnt/nvme_sec/SRC/llvm-project/build-cmake/msan-failure/runtimes/runtimes-bins/compiler-rt/lib/msan/tests/Msan-x86_64-Test+0x16e420)
  
  MemorySanitizer can not provide additional info.
  SUMMARY: MemorySanitizer: SEGV /mnt/nvme_sec/SRC/llvm-project/compiler-rt/lib/msan/tests/msan_test.cpp:4714:3 in HaveBmi()
  ==229427==ABORTING
  
  --
  exit: 1

The profile tests are seems to not being set using this command line so they didn't run.

Those MSAN tests didn't fail when I use the same cmake/ninja command to build 0fa8f29a11c70426dda74158716ccd13dd7ff81a <https://reviews.llvm.org/rG0fa8f29a11c70426dda74158716ccd13dd7ff81a> (1 patch ahead of this one).
Since this is an comfirmed test failure caused by this patch and we have a reproducer. Can we revert this change while it is being fixed?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91620



More information about the llvm-commits mailing list