Skip to content

Commit

Permalink
disable stacktrace related test for sanitized UT (pingcap#4463)
Browse files Browse the repository at this point in the history
  • Loading branch information
SchrodingerZhu authored Mar 28, 2022
1 parent e5a78d3 commit 6cfbd20
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions dbms/src/Common/tests/gtest_stacktrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

#include <Common/StackTrace.h>
#include <common/defines.h>
#include <gtest/gtest.h>

#include <thread>
Expand All @@ -21,7 +22,7 @@ namespace DB
{
namespace tests
{
GTEST_NO_INLINE_ void function_0(bool output = false)
NO_INLINE void function_0(bool output = false)
{
auto res = StackTrace().toString();
std::string::size_type idx;
Expand All @@ -36,7 +37,7 @@ GTEST_NO_INLINE_ void function_0(bool output = false)
idx = res.find("function_2", idx);
EXPECT_NE(idx, std::string::npos);
}
GTEST_NO_INLINE_ void function_1(bool output = false, size_t level = 0)
NO_INLINE void function_1(bool output = false, size_t level = 0)
{
if (level == 0)
{
Expand All @@ -47,10 +48,15 @@ GTEST_NO_INLINE_ void function_1(bool output = false, size_t level = 0)
function_1(output, level - 1);
}
}
GTEST_NO_INLINE_ void function_2(bool output = false, size_t level = 0)
NO_INLINE void function_2(bool output = false, size_t level = 0)
{
function_1(output, level);
}

// Sanitizers wrongly report info on the rust side and they may mess up the stacktrace.
// Setting no_sanitize does not fix the issue.
// we skip the stacktrace tests for TSAN
#if !defined(THREAD_SANITIZER) && !defined(ADDRESS_SANITIZER)
TEST(StackTrace, SingleThread)
{
function_2(true);
Expand All @@ -74,5 +80,7 @@ TEST(StackTrace, MultiThreads)
i.join();
}
}
#endif

} // namespace tests
} // namespace DB

0 comments on commit 6cfbd20

Please sign in to comment.