Support sanitizers in runtime tests (#4622)

This commit is contained in:
Alexander Shabalin
2021-01-20 19:42:09 +03:00
committed by Nikolay Krasko
parent 3ee8d98726
commit 6cc60ad6a2
10 changed files with 256 additions and 66 deletions
@@ -112,7 +112,9 @@ TEST_F(KonanAllocatorAwareTest, PlacementAllocated) {
TEST_F(KonanAllocatorAwareTest, PlacementConstructedArray) {
constexpr size_t kCount = 5;
std::array<uint8_t, sizeof(A) * kCount> buffer;
// TODO: Consider removing support for placement new[] altogether, since there's no
// portable way to know needed storage size ahead of time.
alignas(A) std::array<uint8_t, sizeof(A) * kCount + sizeof(size_t)> buffer;
A* as = new (buffer.data()) A[kCount];
std::vector<int> actual;
@@ -8,6 +8,9 @@ namespace kotlin {
#if KONAN_WINDOWS
// TODO: Figure out why creating many threads on windows is so slow.
constexpr int kDefaultThreadCount = 10;
#elif __has_feature(thread_sanitizer)
// TSAN has a huge overhead.
constexpr int kDefaultThreadCount = 10;
#else
constexpr int kDefaultThreadCount = 100;
#endif