Skip to content

Commit

Permalink
mwcio_ntcchannelfactory.t: skip tests running on Solaris or under san…
Browse files Browse the repository at this point in the history
…itizers (bloomberg#347)
  • Loading branch information
alexander-e1off committed Oct 24, 2024
1 parent b2b8ada commit 0b0f30f
Showing 1 changed file with 92 additions and 25 deletions.
117 changes: 92 additions & 25 deletions src/groups/mwc/mwcio/mwcio_ntcchannelfactory.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,21 @@ static const ChannelWatermarkType::Enum WAT_HIGH =
static const ChannelWatermarkType::Enum WAT_LOW =
ChannelWatermarkType::e_LOW_WATERMARK;

#ifdef BSLS_PLATFORM_OS_SOLARIS
static const bool skipTest = true;
#elif defined( \
__has_feature) // Clang-supported method for checking sanitizers.
static const bool skipTest = __has_feature(memory_sanitizer) ||
__has_feature(thread_sanitizer) ||
__has_feature(undefined_behavior_sanitizer);
#elif defined(__SANITIZE_MEMORY__) || defined(__SANITIZE_THREAD__) || \
defined(__SANITIZE_UNDEFINED__)
// GCC-supported macros for checking MSAN, TSAN and UBSAN.
static const bool skipTest = true;
#else
static const bool skipTest = false; // Default to running the test.
#endif

// ========================
// class Tester_ChannelInfo
// ========================
Expand Down Expand Up @@ -1040,6 +1055,22 @@ static void test6_preCreationCbTest()
{
mwctst::TestHelper::printTestName("Pre Creation Cb Test");

if (skipTest) {
// This test has been disabled for Solaris/MSan/TSan/UBSan build. This
// test relies on the timings of certain callbacks being fired before
// or after certain operations. Normally this timing is always
// observed, but in msan/tsan/ubsan enabled build, the timing gets
// changed, leading to test failure. Of course, the right fix is to
// not rely on these timings, which can be worked on if the test starts
// failing in non-instrumented builds. Additionally, we could try to
// enable this test in MSan/TSan/UBSan build once all MSan/TSan/UBSan
// reports have been fixed to see if that helps (see `msansup.txt`,
// `tsansup.txt` and `ubsansup.txt`).
bsl::cout << "Test skipped (running on Solaris or under sanitizer)"
<< bsl::endl;
return; // RETURN
}

Tester t(s_allocator_p);

// Concern 'a'
Expand Down Expand Up @@ -1075,6 +1106,22 @@ static void test5_visitChannelsTest()
{
mwctst::TestHelper::printTestName("Cancel Handle Test");

if (skipTest) {
// This test has been disabled for Solaris/MSan/TSan/UBSan build. This
// test relies on the timings of certain callbacks being fired before
// or after certain operations. Normally this timing is always
// observed, but in msan/tsan/ubsan enabled build, the timing gets
// changed, leading to test failure. Of course, the right fix is to
// not rely on these timings, which can be worked on if the test starts
// failing in non-instrumented builds. Additionally, we could try to
// enable this test in MSan/TSan/UBSan build once all MSan/TSan/UBSan
// reports have been fixed to see if that helps (see `msansup.txt`,
// `tsansup.txt` and `ubsansup.txt`).
bsl::cout << "Test skipped (running on Solaris or under sanitizer)"
<< bsl::endl;
return; // RETURN
}

Tester t(s_allocator_p);

// Concerns 'a'
Expand Down Expand Up @@ -1115,31 +1162,19 @@ static void test4_cancelHandleTest()
{
mwctst::TestHelper::printTestName("Cancel Handle Test");

#if defined(__has_feature) // Clang-supported method for checking sanitizers.
const bool skipTestForSanitizers = __has_feature(memory_sanitizer) ||
__has_feature(thread_sanitizer) ||
__has_feature(
undefined_behavior_sanitizer);
#elif defined(__SANITIZE_MEMORY__) || defined(__SANITIZE_THREAD__) || \
defined(__SANITIZE_UNDEFINED__)
// GCC-supported macros for checking MSAN and TSAN.
const bool skipTestForSanitizers = true;
#else
const bool skipTestForSanitizers = false; // Default to running the test.
#endif

if (skipTestForSanitizers) {
// This test has been disabled for MSan/TSan/UBSan build. This test
// relies on the timings of certain callbacks being fired before or
// after certain operations. Normally this timing is always observed,
// but in msan/tsan/ubsan enabled build, the timing gets changed,
// leading to test failure. Of course, the right fix is to not rely on
// these timings, which can be worked on if the test starts failing in
// non-instrumented builds. Additionally, we could try to enable this
// test in MSan/TSan/UBSan build once all MSan/TSan/UBSan reports have
// been fixed to see if that helps (see `msansup.txt`, `tsansup.txt`
// and `ubsansup.txt`).
bsl::cout << "Test skipped (running under sanitizer)" << bsl::endl;
if (skipTest) {
// This test has been disabled for Solaris/MSan/TSan/UBSan build. This
// test relies on the timings of certain callbacks being fired before
// or after certain operations. Normally this timing is always
// observed, but in msan/tsan/ubsan enabled build, the timing gets
// changed, leading to test failure. Of course, the right fix is to
// not rely on these timings, which can be worked on if the test starts
// failing in non-instrumented builds. Additionally, we could try to
// enable this test in MSan/TSan/UBSan build once all MSan/TSan/UBSan
// reports have been fixed to see if that helps (see `msansup.txt`,
// `tsansup.txt` and `ubsansup.txt`).
bsl::cout << "Test skipped (running on Solaris or under sanitizer)"
<< bsl::endl;
return; // RETURN
}

Expand Down Expand Up @@ -1197,6 +1232,22 @@ static void test3_watermarkTest()
{
mwctst::TestHelper::printTestName("Watermark Test");

if (skipTest) {
// This test has been disabled for Solaris/MSan/TSan/UBSan build. This
// test relies on the timings of certain callbacks being fired before
// or after certain operations. Normally this timing is always
// observed, but in msan/tsan/ubsan enabled build, the timing gets
// changed, leading to test failure. Of course, the right fix is to
// not rely on these timings, which can be worked on if the test starts
// failing in non-instrumented builds. Additionally, we could try to
// enable this test in MSan/TSan/UBSan build once all MSan/TSan/UBSan
// reports have been fixed to see if that helps (see `msansup.txt`,
// `tsansup.txt` and `ubsansup.txt`).
bsl::cout << "Test skipped (running on Solaris or under sanitizer)"
<< bsl::endl;
return; // RETURN
}

Tester t(s_allocator_p);

// Concern 'a'
Expand Down Expand Up @@ -1286,6 +1337,22 @@ static void test1_breathingTest()
{
mwctst::TestHelper::printTestName("Breathing Test");

if (skipTest) {
// This test has been disabled for Solaris/MSan/TSan/UBSan build. This
// test relies on the timings of certain callbacks being fired before
// or after certain operations. Normally this timing is always
// observed, but in msan/tsan/ubsan enabled build, the timing gets
// changed, leading to test failure. Of course, the right fix is to
// not rely on these timings, which can be worked on if the test starts
// failing in non-instrumented builds. Additionally, we could try to
// enable this test in MSan/TSan/UBSan build once all MSan/TSan/UBSan
// reports have been fixed to see if that helps (see `msansup.txt`,
// `tsansup.txt` and `ubsansup.txt`).
bsl::cout << "Test skipped (running on Solaris or under sanitizer)"
<< bsl::endl;
return; // RETURN
}

Tester t(s_allocator_p);
t.init(L_);

Expand Down

0 comments on commit 0b0f30f

Please sign in to comment.