Merge branch 'leaky-boat' into transport-refs-3

pull/36509/head
Craig Tiller 10 months ago
commit 801505866d
  1. 2
      test/core/event_engine/event_engine_test_utils.cc
  2. 65
      test/core/test_util/build.cc

@ -81,7 +81,7 @@ void WaitForSingleOwner(std::shared_ptr<EventEngine> engine) {
int n = 0; int n = 0;
while (engine.use_count() > 1) { while (engine.use_count() > 1) {
++n; ++n;
if (n == 100) AsanAssertNoLeaks(); if (n % 100 == 0) AsanAssertNoLeaks();
GRPC_LOG_EVERY_N_SEC(2, GPR_INFO, "engine.use_count() = %ld", GRPC_LOG_EVERY_N_SEC(2, GPR_INFO, "engine.use_count() = %ld",
engine.use_count()); engine.use_count());
absl::SleepFor(absl::Milliseconds(100)); absl::SleepFor(absl::Milliseconds(100));

@ -12,7 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "test/core/test_util/build.h" // Define GRPC_BUILD_HAS_ASAN as 1 or 0 depending on if we're building under
// ASAN.
#if defined(__has_feature) #if defined(__has_feature)
#if __has_feature(address_sanitizer) #if __has_feature(address_sanitizer)
#define GRPC_BUILD_HAS_ASAN 1 #define GRPC_BUILD_HAS_ASAN 1
@ -27,58 +28,62 @@
#endif #endif
#endif #endif
#if GRPC_BUILD_HAS_ASAN // Define GRPC_BUILD_HAS_TSAN as 1 or 0 depending on if we're building under
#include <sanitizer/lsan_interface.h> // TSAN.
#endif
bool BuiltUnderValgrind() {
#ifdef RUNNING_ON_VALGRIND
return true;
#else
return false;
#endif
}
bool BuiltUnderTsan() {
#if defined(__has_feature) #if defined(__has_feature)
#if __has_feature(thread_sanitizer) #if __has_feature(thread_sanitizer)
return true; #define GRPC_BUILD_HAS_TSAN 1
#else #else
return false; #define GRPC_BUILD_HAS_TSAN 0
#endif #endif
#else #else
#ifdef THREAD_SANITIZER #ifdef THREAD_SANITIZER
return true; #define GRPC_BUILD_HAS_TSAN 1
#else #else
return false; #define GRPC_BUILD_HAS_TSAN 0
#endif
#endif #endif
}
bool BuiltUnderAsan() { return GRPC_BUILD_HAS_ASAN != 0; }
void AsanAssertNoLeaks() {
#if GRPC_BUILD_HAS_ASAN
__lsan_do_leak_check();
#endif #endif
}
bool BuiltUnderMsan() { // Define GRPC_BUILD_HAS_MSAN as 1 or 0 depending on if we're building under
// MSAN.
#if defined(__has_feature) #if defined(__has_feature)
#if __has_feature(memory_sanitizer) #if __has_feature(memory_sanitizer)
return true; #define GRPC_BUILD_HAS_MSAN 1
#else #else
return false; #define GRPC_BUILD_HAS_MSAN 0
#endif #endif
#else #else
#ifdef MEMORY_SANITIZER #ifdef MEMORY_SANITIZER
#define GRPC_BUILD_HAS_MSAN 1
#else
#define GRPC_BUILD_HAS_MSAN 0
#endif
#endif
#if GRPC_BUILD_HAS_ASAN
#include <sanitizer/lsan_interface.h>
#endif
bool BuiltUnderValgrind() {
#ifdef RUNNING_ON_VALGRIND
return true; return true;
#else #else
return false; return false;
#endif #endif
}
bool BuiltUnderTsan() { return GRPC_BUILD_HAS_TSAN != 0; }
bool BuiltUnderAsan() { return GRPC_BUILD_HAS_ASAN != 0; }
void AsanAssertNoLeaks() {
#if GRPC_BUILD_HAS_ASAN
__lsan_do_leak_check();
#endif #endif
} }
bool BuiltUnderMsan() { return GRPC_BUILD_HAS_MSAN != 0; }
bool BuiltUnderUbsan() { bool BuiltUnderUbsan() {
#ifdef GRPC_UBSAN #ifdef GRPC_UBSAN
return true; return true;

Loading…
Cancel
Save