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

mwcio_ntcchannelfactory.t: skip tests running on Solaris or under sanitizers #347

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading