Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rtsan] Re-enable rtsan tests #98219

Merged
merged 6 commits into from
Jul 9, 2024

Conversation

vitalybuka
Copy link
Collaborator

@vitalybuka vitalybuka commented Jul 9, 2024

Follow up to #92460

DEPS llvm_gtest is not used by compiler-rt,
compiler-rt compiles them with COMPILER_RT_GOOGLETEST_SOURCES.

This reverts commit e217f98.

Created using spr 1.3.4
@llvmbot
Copy link
Collaborator

llvmbot commented Jul 9, 2024

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Vitaly Buka (vitalybuka)

Changes

DEPS llvm_gtest is not used by compiler-rt,
compiler-rt compiles them with COMPILER_RT_GOOGLETEST_SOURCES.

This reverts commit e217f98.


Full diff: https://github.com/llvm/llvm-project/pull/98219.diff

2 Files Affected:

  • (modified) compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake (+3-3)
  • (modified) compiler-rt/lib/rtsan/tests/CMakeLists.txt (-1)
diff --git a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
index c8bec41db36e9..bc152e304aaaf 100644
--- a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
+++ b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
@@ -32,9 +32,9 @@ set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
     ${LOONGARCH64})
 set(ALL_ASAN_ABI_SUPPORTED_ARCH ${X86_64} ${ARM64} ${ARM64_32})
 set(ALL_DFSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64} ${LOONGARCH64})
-#set(ALL_RTSAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
-#    ${MIPS32} ${MIPS64} ${PPC64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON}
-#    ${LOONGARCH64})
+set(ALL_RTSAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
+    ${MIPS32} ${MIPS64} ${PPC64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON}
+    ${LOONGARCH64})
 
 if(ANDROID)
   set(OS_NAME "Android")
diff --git a/compiler-rt/lib/rtsan/tests/CMakeLists.txt b/compiler-rt/lib/rtsan/tests/CMakeLists.txt
index d96e538b255f4..a489719f09228 100644
--- a/compiler-rt/lib/rtsan/tests/CMakeLists.txt
+++ b/compiler-rt/lib/rtsan/tests/CMakeLists.txt
@@ -94,7 +94,6 @@ foreach(arch ${RTSAN_TEST_ARCH})
     COMPILE_DEPS ${RTSAN_UNITTEST_HEADERS}
     SOURCES ${RTSAN_NOINST_TEST_SOURCES}
             ${COMPILER_RT_GOOGLETEST_SOURCES}
-    DEPS llvm_gtest
     CFLAGS ${RTSAN_UNITTEST_CFLAGS}
     LINK_FLAGS ${RTSAN_UNITTEST_LINK_FLAGS}
     RUNTIME ${RTSAN_TEST_RUNTIME})

@vitalybuka
Copy link
Collaborator Author

@cjappl

Copy link
Contributor

@cjappl cjappl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also have the failure on fuchsia and windows as outlined here:

#92460 (comment)

Fuchsia we can "fix" I believe via this patch that disables the problematic interceptors for now:

diff --git a/compiler-rt/lib/rtsan/rtsan_interceptors.cpp b/compiler-rt/lib/rtsan/rtsan_interceptors.cpp
index 3a65f9d3f779..ad9a97bdae7c 100644
--- a/compiler-rt/lib/rtsan/rtsan_interceptors.cpp
+++ b/compiler-rt/lib/rtsan/rtsan_interceptors.cpp
@@ -42,6 +42,8 @@ void ExpectNotRealtime(const char *intercepted_function_name) {
 
 // Filesystem
 
+#if !SANITIZER_FUCHSIA
+
 INTERCEPTOR(int, open, const char *path, int oflag, ...) {
   // TODO Establish whether we should intercept here if the flag contains
   // O_NONBLOCK
@@ -70,6 +72,8 @@ INTERCEPTOR(int, openat, int fd, const char *path, int oflag, ...) {
   return result;
 }
 
+#endif //!SANITIZER_FUCHSIA
+
 INTERCEPTOR(int, creat, const char *path, mode_t mode) {
   // TODO Establish whether we should intercept here if the flag contains
   // O_NONBLOCK
@@ -359,8 +363,11 @@ void __rtsan::InitializeInterceptors() {
   INTERCEPT_FUNCTION(pvalloc);
 #endif
 
+#ifndef SANITIZER_FUCHSIA
   INTERCEPT_FUNCTION(open);
   INTERCEPT_FUNCTION(openat);
+#endif //SANITIZER_FUCHSIA
+
   INTERCEPT_FUNCTION(close);
   INTERCEPT_FUNCTION(fopen);
   INTERCEPT_FUNCTION(fread);
diff --git a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp
index f5b016089087..e250df41b53a 100644
--- a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp
+++ b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp
@@ -172,6 +172,7 @@ TEST(TestRtsanInterceptors, NanosleepDiesWhenRealtime) {
     Filesystem
 */
 
+#if !SANITIZER_FUCHSIA
 TEST_F(RtsanFileTest, OpenDiesWhenRealtime) {
   auto func = [this]() { open(GetTemporaryFilePath(), O_RDONLY); };
   ExpectRealtimeDeath(func, "open");
@@ -197,6 +198,7 @@ TEST_F(RtsanFileTest, OpenCreatesFileWithProperMode) {
   // Mask st_mode to get permission bits only
   ASSERT_THAT(st.st_mode & 0777, Eq(mode));
 }
+#endif // !SANITIZER_FUCHSIA
 
 TEST_F(RtsanFileTest, CreatDiesWhenRealtime) {
   auto func = [this]() { creat(GetTemporaryFilePath(), S_IWOTH | S_IROTH); };

Windows we can just disable the entire sanitizer. the guts rely on pthread, so there is no chance of it working at this point, possibly in the future

compiler-rt/lib/rtsan/tests/CMakeLists.txt Show resolved Hide resolved
@cjappl
Copy link
Contributor

cjappl commented Jul 9, 2024

Sincere thanks for your help @vitalybuka , really appreciate it as an LLVM newbie

@vitalybuka vitalybuka requested a review from cjappl July 9, 2024 21:11
@vitalybuka
Copy link
Collaborator Author

We also have the failure on fuchsia and windows as outlined here:

#92460 (comment)

Fuchsia we can "fix" I believe via this patch that disables the problematic interceptors for now:

diff --git a/compiler-rt/lib/rtsan/rtsan_interceptors.cpp b/compiler-rt/lib/rtsan/rtsan_interceptors.cpp
index 3a65f9d3f779..ad9a97bdae7c 100644
--- a/compiler-rt/lib/rtsan/rtsan_interceptors.cpp
+++ b/compiler-rt/lib/rtsan/rtsan_interceptors.cpp
@@ -42,6 +42,8 @@ void ExpectNotRealtime(const char *intercepted_function_name) {
 
 // Filesystem
 
+#if !SANITIZER_FUCHSIA
+
 INTERCEPTOR(int, open, const char *path, int oflag, ...) {
   // TODO Establish whether we should intercept here if the flag contains
   // O_NONBLOCK
@@ -70,6 +72,8 @@ INTERCEPTOR(int, openat, int fd, const char *path, int oflag, ...) {
   return result;
 }
 
+#endif //!SANITIZER_FUCHSIA
+
 INTERCEPTOR(int, creat, const char *path, mode_t mode) {
   // TODO Establish whether we should intercept here if the flag contains
   // O_NONBLOCK
@@ -359,8 +363,11 @@ void __rtsan::InitializeInterceptors() {
   INTERCEPT_FUNCTION(pvalloc);
 #endif
 
+#ifndef SANITIZER_FUCHSIA
   INTERCEPT_FUNCTION(open);
   INTERCEPT_FUNCTION(openat);
+#endif //SANITIZER_FUCHSIA
+
   INTERCEPT_FUNCTION(close);
   INTERCEPT_FUNCTION(fopen);
   INTERCEPT_FUNCTION(fread);
diff --git a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp
index f5b016089087..e250df41b53a 100644
--- a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp
+++ b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp
@@ -172,6 +172,7 @@ TEST(TestRtsanInterceptors, NanosleepDiesWhenRealtime) {
     Filesystem
 */
 
+#if !SANITIZER_FUCHSIA
 TEST_F(RtsanFileTest, OpenDiesWhenRealtime) {
   auto func = [this]() { open(GetTemporaryFilePath(), O_RDONLY); };
   ExpectRealtimeDeath(func, "open");
@@ -197,6 +198,7 @@ TEST_F(RtsanFileTest, OpenCreatesFileWithProperMode) {
   // Mask st_mode to get permission bits only
   ASSERT_THAT(st.st_mode & 0777, Eq(mode));
 }
+#endif // !SANITIZER_FUCHSIA
 
 TEST_F(RtsanFileTest, CreatDiesWhenRealtime) {
   auto func = [this]() { creat(GetTemporaryFilePath(), S_IWOTH | S_IROTH); };

Windows we can just disable the entire sanitizer. the guts rely on pthread, so there is no chance of it working at this point, possibly in the future

Oh, as I remember fuchia does not have interceptors at all

@cjappl
Copy link
Contributor

cjappl commented Jul 9, 2024

I think adding this patch would disable on windows and fuchsia, and we can evaluate in the future to enable them:

diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
index 1130f9f721df..6df15c6cec17 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -751,7 +751,8 @@ else()
   set(COMPILER_RT_HAS_ASAN FALSE)
 endif()
 
-if (COMPILER_RT_HAS_SANITIZER_COMMON AND RTSAN_SUPPORTED_ARCH)
+# RTSan does not run on windows or fuschia for now
+if (COMPILER_RT_HAS_SANITIZER_COMMON AND RTSAN_SUPPORTED_ARCH AND NOT OS_NAME MATCHES "Windows|Fuchsia")
   set(COMPILER_RT_HAS_RTSAN TRUE)
 else()
   set(COMPILER_RT_HAS_RTSAN FALSE)
diff --git a/compiler-rt/lib/rtsan/CMakeLists.txt b/compiler-rt/lib/rtsan/CMakeLists.txt
index bd7358e86e59..3cc27a2a8338 100644
--- a/compiler-rt/lib/rtsan/CMakeLists.txt
+++ b/compiler-rt/lib/rtsan/CMakeLists.txt
@@ -25,66 +25,68 @@ set(RTSAN_LINK_LIBS
   ${COMPILER_RT_UNWINDER_LINK_LIBS}
   ${COMPILER_RT_CXX_LINK_LIBS})
 
-if(APPLE)
-  add_compiler_rt_object_libraries(RTRtsan
-    OS ${SANITIZER_COMMON_SUPPORTED_OS}
-    ARCHS ${RTSAN_SUPPORTED_ARCH}
-    SOURCES ${RTSAN_CXX_SOURCES}
-    ADDITIONAL_HEADERS ${RTSAN_HEADERS}
-    CFLAGS ${RTSAN_CFLAGS}
-    DEPS ${RTSAN_DEPS})
-else()
-  add_compiler_rt_object_libraries(RTRtsan
-    ARCHS ${RTSAN_SUPPORTED_ARCH}
-    SOURCES ${RTSAN_CXX_SOURCES}
-    ADDITIONAL_HEADERS ${RTSAN_HEADERS}
-    CFLAGS ${RTSAN_CFLAGS}
-    DEPS ${RTSAN_DEPS})
-  add_compiler_rt_object_libraries(RTRtsan_preinit
-    ARCHS ${RTSAN_SUPPORTED_ARCH}
-    SOURCES ${RTSAN_PREINIT_SOURCES}
-    ADDITIONAL_HEADERS ${RTSAN_HEADERS}
-    CFLAGS ${RTSAN_CFLAGS})
-endif()
+if (COMPILER_RT_HAS_RTSAN)
+  if(APPLE)
+    add_compiler_rt_object_libraries(RTRtsan
+      OS ${SANITIZER_COMMON_SUPPORTED_OS}
+      ARCHS ${RTSAN_SUPPORTED_ARCH}
+      SOURCES ${RTSAN_CXX_SOURCES}
+      ADDITIONAL_HEADERS ${RTSAN_HEADERS}
+      CFLAGS ${RTSAN_CFLAGS}
+      DEPS ${RTSAN_DEPS})
+  else()
+    add_compiler_rt_object_libraries(RTRtsan
+      ARCHS ${RTSAN_SUPPORTED_ARCH}
+      SOURCES ${RTSAN_CXX_SOURCES}
+      ADDITIONAL_HEADERS ${RTSAN_HEADERS}
+      CFLAGS ${RTSAN_CFLAGS}
+      DEPS ${RTSAN_DEPS})
+    add_compiler_rt_object_libraries(RTRtsan_preinit
+      ARCHS ${RTSAN_SUPPORTED_ARCH}
+      SOURCES ${RTSAN_PREINIT_SOURCES}
+      ADDITIONAL_HEADERS ${RTSAN_HEADERS}
+      CFLAGS ${RTSAN_CFLAGS})
+  endif()
 
-set(RTSAN_COMMON_RUNTIME_OBJECT_LIBS
-  RTInterception
-  RTSanitizerCommon
-  RTSanitizerCommonLibc
-  RTSanitizerCommonCoverage
-  RTSanitizerCommonSymbolizer)
+  set(RTSAN_COMMON_RUNTIME_OBJECT_LIBS
+    RTInterception
+    RTSanitizerCommon
+    RTSanitizerCommonLibc
+    RTSanitizerCommonCoverage
+    RTSanitizerCommonSymbolizer)
 
-append_list_if(COMPILER_RT_HAS_LIBDL dl RTSAN_LINK_LIBS)
-append_list_if(COMPILER_RT_HAS_LIBRT rt RTSAN_LINK_LIBS)
-append_list_if(COMPILER_RT_HAS_LIBM m RTSAN_LINK_LIBS)
-append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread RTSAN_LINK_LIBS)
-append_list_if(COMPILER_RT_HAS_LIBLOG log RTSAN_LINK_LIBS)
+  append_list_if(COMPILER_RT_HAS_LIBDL dl RTSAN_LINK_LIBS)
+  append_list_if(COMPILER_RT_HAS_LIBRT rt RTSAN_LINK_LIBS)
+  append_list_if(COMPILER_RT_HAS_LIBM m RTSAN_LINK_LIBS)
+  append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread RTSAN_LINK_LIBS)
+  append_list_if(COMPILER_RT_HAS_LIBLOG log RTSAN_LINK_LIBS)
 
-add_compiler_rt_component(rtsan)
+  add_compiler_rt_component(rtsan)
 
-if (APPLE)
-  add_weak_symbols("sanitizer_common" WEAK_SYMBOL_LINK_FLAGS)
-  set(RTSAN_LINK_FLAGS ${RTSAN_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS})
+  if (APPLE)
+    add_weak_symbols("sanitizer_common" WEAK_SYMBOL_LINK_FLAGS)
+    set(RTSAN_LINK_FLAGS ${RTSAN_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS})
 
-  add_compiler_rt_runtime(clang_rt.rtsan
-    SHARED
-    OS ${SANITIZER_COMMON_SUPPORTED_OS}
-    ARCHS ${RTSAN_SUPPORTED_ARCH}
-    OBJECT_LIBS RTRtsan
-                ${RTSAN_COMMON_RUNTIME_OBJECT_LIBS}
-    LINK_FLAGS ${RTSAN_LINK_FLAGS}
-    LINK_LIBS ${RTSAN_LINK_LIBS}
-    PARENT_TARGET rtsan)
-else()
-  add_compiler_rt_runtime(clang_rt.rtsan
-    STATIC
-    ARCHS ${RTSAN_SUPPORTED_ARCH}
-    OBJECT_LIBS RTRtsan_preinit
-                RTRtsan
-                ${RTSAN_COMMON_RUNTIME_OBJECT_LIBS}
-    LINK_FLAGS ${RTSAN_LINK_FLAGS}
-    CFLAGS ${RTSAN_CFLAGS}
-    PARENT_TARGET rtsan)
+    add_compiler_rt_runtime(clang_rt.rtsan
+      SHARED
+      OS ${SANITIZER_COMMON_SUPPORTED_OS}
+      ARCHS ${RTSAN_SUPPORTED_ARCH}
+      OBJECT_LIBS RTRtsan
+                  ${RTSAN_COMMON_RUNTIME_OBJECT_LIBS}
+      LINK_FLAGS ${RTSAN_LINK_FLAGS}
+      LINK_LIBS ${RTSAN_LINK_LIBS}
+      PARENT_TARGET rtsan)
+  else()
+    add_compiler_rt_runtime(clang_rt.rtsan
+      STATIC
+      ARCHS ${RTSAN_SUPPORTED_ARCH}
+      OBJECT_LIBS RTRtsan_preinit
+                  RTRtsan
+                  ${RTSAN_COMMON_RUNTIME_OBJECT_LIBS}
+      LINK_FLAGS ${RTSAN_LINK_FLAGS}
+      CFLAGS ${RTSAN_CFLAGS}
+      PARENT_TARGET rtsan)
+  endif()
 endif()
 
 if(COMPILER_RT_INCLUDE_TESTS)


@cjappl
Copy link
Contributor

cjappl commented Jul 9, 2024

(to be clear, I don't have a windows or fuchsia machine to test this change on, please be as skeptical as possible - this is just based on the code I see around it, and trying out disabling Darwin)

@@ -751,7 +751,8 @@ else()
set(COMPILER_RT_HAS_ASAN FALSE)
endif()

if (COMPILER_RT_HAS_SANITIZER_COMMON AND RTSAN_SUPPORTED_ARCH)
if (COMPILER_RT_HAS_SANITIZER_COMMON AND RTSAN_SUPPORTED_ARCH AND
OS_NAME MATCHES "Android|Darwin|Linux")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cjappl how about this and let motivated folks with access to those OSes to test and enable when needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me.

I believe we need to add the conditional check for COMPILER_RT_HAS_RTSAN in compiler-rt/lib/rtsan/CMakeLists.txt. We missed that in the first PR.

With that change, this should be good! I'm going to approve, assuming that you add that conditional in there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually rather limit to whatever you are willing to work in near future.
What is your platforms of interest?

Copy link
Contributor

@cjappl cjappl Jul 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linux and Darwin are the platforms that we have easiest development access to in ubuntu and MacOS. I think starting there and building up would be just fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we need to add the conditional check for COMPILER_RT_HAS_RTSAN in compiler-rt/lib/rtsan/CMakeLists.txt. We missed that in the first PR.

COMPILER_RT_HAS_${} checked by root lib/ and test/ CMakeLists

Copy link
Contributor

@cjappl cjappl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See one last comment before submission, we need to wrap some cmake in the improved conditional.

Thanks again for the help. Do let me know if there are any more failures, I will keep an eye on my indbox

@@ -751,7 +751,8 @@ else()
set(COMPILER_RT_HAS_ASAN FALSE)
endif()

if (COMPILER_RT_HAS_SANITIZER_COMMON AND RTSAN_SUPPORTED_ARCH)
if (COMPILER_RT_HAS_SANITIZER_COMMON AND RTSAN_SUPPORTED_ARCH AND
OS_NAME MATCHES "Android|Darwin|Linux")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me.

I believe we need to add the conditional check for COMPILER_RT_HAS_RTSAN in compiler-rt/lib/rtsan/CMakeLists.txt. We missed that in the first PR.

With that change, this should be good! I'm going to approve, assuming that you add that conditional in there.

@vitalybuka vitalybuka requested a review from cjappl July 9, 2024 22:38
Copy link
Contributor

@cjappl cjappl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Let me know if any more failures come up and I'm happy to help

@vitalybuka vitalybuka merged commit 6b84537 into main Jul 9, 2024
4 of 5 checks passed
@vitalybuka vitalybuka deleted the users/vitalybuka/spr/rtsan-re-enable-rtsan-tests branch July 9, 2024 23:06
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 9, 2024

LLVM Buildbot has detected a new failure on builder clang-ppc64le-linux-test-suite running on ppc64le-clang-test-suite while building compiler-rt at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/95/builds/1044

Here is the relevant piece of the build log for the reference:

Step 6 (test-build-unified-tree-check-all) failure: test (failure)
...
67.980 [7/6/79] Generating ASAN_INST_TEST_OBJECTS.asan_test.cpp.powerpc64le-inline.o
82.561 [7/5/80] Generating ASAN_NOINST_TEST_OBJECTS.gtest-all.cc.powerpc64le-inline.o
83.234 [6/5/81] Generating POWERPC64LELinuxConfig/Asan-powerpc64le-inline-Noinst-Test
89.259 [6/4/82] Generating ASAN_INST_TEST_OBJECTS.gtest-all.cc.powerpc64le-calls.o
90.362 [4/5/83] Generating POWERPC64LELinuxDynamicConfig/Asan-powerpc64le-calls-Dynamic-Test
90.714 [4/4/84] Generating POWERPC64LELinuxConfig/Asan-powerpc64le-calls-Test
92.268 [4/3/85] Generating ASAN_NOINST_TEST_OBJECTS.gtest-all.cc.powerpc64le-calls.o
92.922 [3/3/86] Generating POWERPC64LELinuxConfig/Asan-powerpc64le-calls-Noinst-Test
94.995 [3/2/87] Generating RtsanNoInstTestObjects.gtest-all.cc.powerpc64le.o
95.129 [2/2/88] Generating Rtsan-powerpc64le-NoInstTest
FAILED: compiler-rt/lib/rtsan/tests/Rtsan-powerpc64le-NoInstTest /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests/Rtsan-powerpc64le-NoInstTest 
cd /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests && /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/./bin/clang++ RtsanNoInstTestObjects.rtsan_preinit.cpp.powerpc64le.o RtsanNoInstTestObjects.rtsan_test_context.cpp.powerpc64le.o RtsanNoInstTestObjects.rtsan_test_main.cpp.powerpc64le.o RtsanNoInstTestObjects.gtest-all.cc.powerpc64le.o RtsanNoInstTestObjects.gmock-all.cc.powerpc64le.o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests/libRTRtsanTest.powerpc64le.a -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests/./Rtsan-powerpc64le-NoInstTest -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -resource-dir=/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/./lib/../lib/clang/19 -Wl,-rpath,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/./lib/../lib/clang/19/lib/powerpc64le-unknown-linux-gnu -lstdc++ -no-pie -latomic -m64 -fno-function-sections
/usr/bin/ld: RtsanNoInstTestObjects.gtest-all.cc.powerpc64le.o: undefined reference to symbol 'pthread_getspecific@@GLIBC_2.17'
//usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
103.369 [2/1/89] Generating ASAN_INST_TEST_OBJECTS.gtest-all.cc.powerpc64le-inline.o
ninja: build stopped: subcommand failed.
89.600 [23/224/916] Building CXX object tools/clang/tools/extra/unittests/clang-tidy/CMakeFiles/ClangTidyTests.dir/ModernizeModuleTest.cpp.o
In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/third-party/unittest/googletest/include/gtest/gtest-param-test.h:181,
                 from /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/third-party/unittest/googletest/include/gtest/gtest.h:68,
                 from /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/clang-tools-extra/unittests/clang-tidy/ModernizeModuleTest.cpp:11:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-param-util.h: In instantiation of ‘class testing::internal::ParameterizedTestFactory<clang::tidy::test::SizeTest_TokenSize_Test>’:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-param-util.h:445:12:   required from ‘testing::internal::TestFactoryBase* testing::internal::TestMetaFactory<TestSuite>::CreateTestFactory(testing::internal::TestMetaFactory<TestSuite>::ParamType) [with TestSuite = clang::tidy::test::SizeTest_TokenSize_Test; testing::internal::TestMetaFactory<TestSuite>::ParamType = clang::tidy::test::{anonymous}::SizeParam]’
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-param-util.h:444:20:   required from here
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-param-util.h:399:7: warning: ‘testing::internal::ParameterizedTestFactory<clang::tidy::test::SizeTest_TokenSize_Test>’ has a field ‘testing::internal::ParameterizedTestFactory<clang::tidy::test::SizeTest_TokenSize_Test>::parameter_’ whose type uses the anonymous namespace [-Wsubobject-linkage]
 class ParameterizedTestFactory : public TestFactoryBase {
       ^~~~~~~~~~~~~~~~~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-param-util.h: In instantiation of ‘class testing::internal::ParameterizedTestFactory<clang::tidy::test::MatcherTest_MatchResult_Test>’:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-param-util.h:445:12:   required from ‘testing::internal::TestFactoryBase* testing::internal::TestMetaFactory<TestSuite>::CreateTestFactory(testing::internal::TestMetaFactory<TestSuite>::ParamType) [with TestSuite = clang::tidy::test::MatcherTest_MatchResult_Test; testing::internal::TestMetaFactory<TestSuite>::ParamType = clang::tidy::test::{anonymous}::MatchParam]’
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-param-util.h:444:20:   required from here
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/third-party/unittest/googletest/include/gtest/internal/gtest-param-util.h:399:7: warning: ‘testing::internal::ParameterizedTestFactory<clang::tidy::test::MatcherTest_MatchResult_Test>’ has a field ‘testing::internal::ParameterizedTestFactory<clang::tidy::test::MatcherTest_MatchResult_Test>::parameter_’ whose type uses the anonymous namespace [-Wsubobject-linkage]
144.424 [9/26/1128] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/SymbolCollectorTests.cpp.o
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp: In member function ‘virtual void clang::clangd::{anonymous}::SymbolCollectorTest_SpelledReferences_Test::TestBody()’:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp:1104:8: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]
     if (!SpelledRanges.empty())
        ^
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp:1107:8: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]
     if (!ImplicitRanges.empty())
        ^
146.732 [9/22/1132] Building CXX object tools/clang/tools/extra/include-cleaner/unittests/CMakeFiles/ClangIncludeCleanerTests.dir/FindHeadersTest.cpp.o
FAILED: runtimes/CMakeFiles/runtimes-test-depends /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/CMakeFiles/runtimes-test-depends 
cd /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins && /home/buildbots/llvm-external-buildbots/cmake-3.28.2/bin/cmake --build /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/ --target runtimes-test-depends --config Release
150.254 [8/21/1134] Building CXX object tools/clang/unittests/Analysis/FlowSensitive/CMakeFiles/ClangAnalysisFlowSensitiveTests.dir/TransferTest.cpp.o
150.360 [8/20/1135] Linking CXX executable tools/clang/tools/extra/unittests/clang-doc/ClangDocTests
150.632 [8/19/1136] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/TUSchedulerTests.cpp.o
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp: In member function ‘virtual void clang::clangd::{anonymous}::TUSchedulerTests_PublishWithStalePreamble_Test::TestBody()::BlockPreambleThread::onPreambleAST(clang::clangd::PathRef, llvm::StringRef, clang::clangd::CapturedASTCtx, std::shared_ptr<const clang::include_cleaner::PragmaIncludes>)’:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/llvm-project/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp:1219:10: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]
       if (BuildBefore)
          ^
Step 7 (test-build-unified-tree-check-runtimes) failure: test (failure)
...
-- Generated Sanitizer SUPPORTED_TOOLS list on "Linux" is "asan;lsan;msan;tsan;ubsan"
-- sanitizer_common tests on "Linux" will run against "asan;lsan;msan;tsan;ubsan"
-- check-shadowcallstack does nothing.
-- Configuring done (3.3s)
-- Generating done (0.6s)
-- Build files have been written to: /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins
5.285 [0/1/4] cd /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins && /home/buildbots/llvm-external-buildbots/cmake-3.28.2/bin/cmake --build /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/ --target check-runtimes --config Release
0.068 [5/3/1] Building CXX object compiler-rt/lib/ubsan/CMakeFiles/RTUbsan_dynamic_version_script_dummy.powerpc64le.dir/dummy.cpp.o
0.071 [4/3/2] Building CXX object compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic_version_script_dummy.powerpc64le.dir/dummy.cpp.o
0.171 [3/3/3] Generating Rtsan-powerpc64le-NoInstTest
FAILED: compiler-rt/lib/rtsan/tests/Rtsan-powerpc64le-NoInstTest /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests/Rtsan-powerpc64le-NoInstTest 
cd /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests && /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/./bin/clang++ RtsanNoInstTestObjects.rtsan_preinit.cpp.powerpc64le.o RtsanNoInstTestObjects.rtsan_test_context.cpp.powerpc64le.o RtsanNoInstTestObjects.rtsan_test_main.cpp.powerpc64le.o RtsanNoInstTestObjects.gtest-all.cc.powerpc64le.o RtsanNoInstTestObjects.gmock-all.cc.powerpc64le.o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests/libRTRtsanTest.powerpc64le.a -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests/./Rtsan-powerpc64le-NoInstTest -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -resource-dir=/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/./lib/../lib/clang/19 -Wl,-rpath,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/./lib/../lib/clang/19/lib/powerpc64le-unknown-linux-gnu -lstdc++ -no-pie -latomic -m64 -fno-function-sections
/usr/bin/ld: RtsanNoInstTestObjects.gtest-all.cc.powerpc64le.o: undefined reference to symbol 'pthread_getspecific@@GLIBC_2.17'
//usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
0.507 [3/2/4] Linking CXX shared library /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/lib/clang/19/lib/powerpc64le-unknown-linux-gnu/libclang_rt.ubsan_standalone.so
0.852 [3/1/5] Linking CXX shared library /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/lib/clang/19/lib/powerpc64le-unknown-linux-gnu/libclang_rt.asan.so
ninja: build stopped: subcommand failed.
FAILED: runtimes/CMakeFiles/check-runtimes /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/CMakeFiles/check-runtimes 
cd /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins && /home/buildbots/llvm-external-buildbots/cmake-3.28.2/bin/cmake --build /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/ --target check-runtimes --config Release
ninja: build stopped: subcommand failed.

@cjappl
Copy link
Contributor

cjappl commented Jul 9, 2024

Looking at this error as we speak

@vitalybuka
Copy link
Collaborator Author

-lpthread ?

@vitalybuka
Copy link
Collaborator Author

Asan has append_list_if(COMPILER_RT_HAS_LIBPTHREAD -pthread ASAN_UNITTEST_NOINST_LINK_FLAGS) ?

@vitalybuka
Copy link
Collaborator Author

As it does not reproduce for me, if you don't mind, I'll leave this one you?
Please send me PR with undo of #98250 and a fix.

cjappl added a commit to realtime-sanitizer/llvm-project that referenced this pull request Jul 10, 2024
vitalybuka pushed a commit that referenced this pull request Jul 10, 2024
…98256)

Follow up to #98219

This reverts commit
[14f7450](14f7450)

Ensure that -pthread is explicitly linked when running the rtsan tests. 

Issue this fixes:
```
FAILED: compiler-rt/lib/rtsan/tests/Rtsan-powerpc64le-NoInstTest /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests/Rtsan-powerpc64le-NoInstTest 
cd /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests && /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/./bin/clang++ RtsanNoInstTestObjects.rtsan_preinit.cpp.powerpc64le.o RtsanNoInstTestObjects.rtsan_test_context.cpp.powerpc64le.o RtsanNoInstTestObjects.rtsan_test_main.cpp.powerpc64le.o RtsanNoInstTestObjects.gtest-all.cc.powerpc64le.o RtsanNoInstTestObjects.gmock-all.cc.powerpc64le.o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests/libRTRtsanTest.powerpc64le.a -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests/./Rtsan-powerpc64le-NoInstTest -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -resource-dir=/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/./lib/../lib/clang/19 -Wl,-rpath,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/./lib/../lib/clang/19/lib/powerpc64le-unknown-linux-gnu -lstdc++ -no-pie -latomic -m64 -fno-function-sections
/usr/bin/ld: RtsanNoInstTestObjects.gtest-all.cc.powerpc64le.o: undefined reference to symbol 'pthread_getspecific@@GLIBC_2.17'
//usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line
```
@chapuni
Copy link
Contributor

chapuni commented Jul 10, 2024

I saw https://lab.llvm.org/buildbot/#/builders/41/builds/506 still failing, due to gtest crash.

Let me disable again. (9ae24c9)

@cjappl
Copy link
Contributor

cjappl commented Jul 10, 2024

Thanks @chapuni !!

aaryanshukla pushed a commit to aaryanshukla/llvm-project that referenced this pull request Jul 14, 2024
Follow up to llvm#92460

DEPS llvm_gtest is not used by compiler-rt,
compiler-rt compiles them with COMPILER_RT_GOOGLETEST_SOURCES.

This reverts commit e217f98.
aaryanshukla pushed a commit to aaryanshukla/llvm-project that referenced this pull request Jul 14, 2024
aaryanshukla pushed a commit to aaryanshukla/llvm-project that referenced this pull request Jul 14, 2024
…lvm#98256)

Follow up to llvm#98219

This reverts commit
[14f7450](llvm@14f7450)

Ensure that -pthread is explicitly linked when running the rtsan tests. 

Issue this fixes:
```
FAILED: compiler-rt/lib/rtsan/tests/Rtsan-powerpc64le-NoInstTest /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests/Rtsan-powerpc64le-NoInstTest 
cd /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests && /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/./bin/clang++ RtsanNoInstTestObjects.rtsan_preinit.cpp.powerpc64le.o RtsanNoInstTestObjects.rtsan_test_context.cpp.powerpc64le.o RtsanNoInstTestObjects.rtsan_test_main.cpp.powerpc64le.o RtsanNoInstTestObjects.gtest-all.cc.powerpc64le.o RtsanNoInstTestObjects.gmock-all.cc.powerpc64le.o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests/libRTRtsanTest.powerpc64le.a -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests/./Rtsan-powerpc64le-NoInstTest -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -resource-dir=/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/./lib/../lib/clang/19 -Wl,-rpath,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/./lib/../lib/clang/19/lib/powerpc64le-unknown-linux-gnu -lstdc++ -no-pie -latomic -m64 -fno-function-sections
/usr/bin/ld: RtsanNoInstTestObjects.gtest-all.cc.powerpc64le.o: undefined reference to symbol 'pthread_getspecific@@GLIBC_2.17'
//usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants