Disable OOM tests when TSAN is enabled.

Bug: dawn:1725
Change-Id: I83ddaaf0d98d2831f95abbfbf5adfad268ebdba5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127380
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
This commit is contained in:
Le Hoang Quyen 2023-04-14 22:38:28 +00:00 committed by Dawn LUCI CQ
parent 4489109c86
commit 7532f6665e
3 changed files with 24 additions and 11 deletions

View File

@ -887,6 +887,14 @@ bool DawnTestBase::IsAsan() const {
#endif #endif
} }
bool DawnTestBase::IsTsan() const {
#if defined(THREAD_SANITIZER)
return true;
#else
return false;
#endif
}
bool DawnTestBase::HasToggleEnabled(const char* toggle) const { bool DawnTestBase::HasToggleEnabled(const char* toggle) const {
auto toggles = dawn::native::GetTogglesUsed(backendDevice); auto toggles = dawn::native::GetTogglesUsed(backendDevice);
return std::find_if(toggles.begin(), toggles.end(), [toggle](const char* name) { return std::find_if(toggles.begin(), toggles.end(), [toggle](const char* name) {
@ -999,8 +1007,8 @@ wgpu::Device DawnTestBase::CreateDevice(std::string isolationKey) {
// to CreateDeviceImpl. // to CreateDeviceImpl.
mNextIsolationKeyQueue.push(std::move(isolationKey)); mNextIsolationKeyQueue.push(std::move(isolationKey));
// RequestDevice is overriden by CreateDeviceImpl and device descriptor is ignored by it. Give // RequestDevice is overriden by CreateDeviceImpl and device descriptor is ignored by it.
// an empty descriptor. // Give an empty descriptor.
// TODO(dawn:1684): Replace empty DeviceDescriptor with nullptr after Dawn wire support it. // TODO(dawn:1684): Replace empty DeviceDescriptor with nullptr after Dawn wire support it.
wgpu::DeviceDescriptor deviceDesc = {}; wgpu::DeviceDescriptor deviceDesc = {};
mAdapter.RequestDevice( mAdapter.RequestDevice(
@ -1012,8 +1020,8 @@ wgpu::Device DawnTestBase::CreateDevice(std::string isolationKey) {
FlushWire(); FlushWire();
ASSERT(apiDevice); ASSERT(apiDevice);
// Set up the mocks for uncaptured errors and device loss. The loss of the device is expected // Set up the mocks for uncaptured errors and device loss. The loss of the device is
// to happen at the end of the test so at it directly. // expected to happen at the end of the test so at it directly.
apiDevice.SetUncapturedErrorCallback(mDeviceErrorCallback.Callback(), apiDevice.SetUncapturedErrorCallback(mDeviceErrorCallback.Callback(),
mDeviceErrorCallback.MakeUserdata(apiDevice.Get())); mDeviceErrorCallback.MakeUserdata(apiDevice.Get()));
apiDevice.SetDeviceLostCallback(mDeviceLostCallback.Callback(), apiDevice.SetDeviceLostCallback(mDeviceLostCallback.Callback(),
@ -1045,8 +1053,8 @@ wgpu::Device DawnTestBase::CreateDevice(std::string isolationKey) {
} }
void DawnTestBase::SetUp() { void DawnTestBase::SetUp() {
// Setup the per-test platform. Tests can provide one by overloading CreateTestPlatform. This is // Setup the per-test platform. Tests can provide one by overloading CreateTestPlatform.
// NOT a thread-safe operation and is allowed here for testing only. // This is NOT a thread-safe operation and is allowed here for testing only.
mTestPlatform = CreateTestPlatform(); mTestPlatform = CreateTestPlatform();
dawn::native::FromAPI(gTestEnv->GetInstance()->Get()) dawn::native::FromAPI(gTestEnv->GetInstance()->Get())
->SetPlatformForTesting(mTestPlatform.get()); ->SetPlatformForTesting(mTestPlatform.get());
@ -1058,9 +1066,10 @@ void DawnTestBase::SetUp() {
"_" + ::testing::UnitTest::GetInstance()->current_test_info()->name(); "_" + ::testing::UnitTest::GetInstance()->current_test_info()->name();
mWireHelper->BeginWireTrace(traceName.c_str()); mWireHelper->BeginWireTrace(traceName.c_str());
// RequestAdapter is overriden to ignore RequestAdapterOptions, but dawn_wire requires a valid // RequestAdapter is overriden to ignore RequestAdapterOptions, but dawn_wire requires a
// pointer, so give a empty option. // valid pointer, so give a empty option.
// TODO(dawn:1684): Replace empty RequestAdapterOptions with nullptr after Dawn wire support it. // TODO(dawn:1684): Replace empty RequestAdapterOptions with nullptr after Dawn wire support
// it.
wgpu::RequestAdapterOptions options = {}; wgpu::RequestAdapterOptions options = {};
mInstance.RequestAdapter( mInstance.RequestAdapter(
&options, &options,
@ -1094,8 +1103,8 @@ void DawnTestBase::DestroyDevice(wgpu::Device device) {
resolvedDevice = this->device; resolvedDevice = this->device;
} }
// No expectation is added because the expectations for this kind of destruction is set up as // No expectation is added because the expectations for this kind of destruction is set up
// soon as the device is created. // as soon as the device is created.
resolvedDevice.Destroy(); resolvedDevice.Destroy();
} }

View File

@ -260,6 +260,7 @@ class DawnTestBase {
bool IsDXC() const; bool IsDXC() const;
bool IsAsan() const; bool IsAsan() const;
bool IsTsan() const;
bool HasToggleEnabled(const char* workaround) const; bool HasToggleEnabled(const char* workaround) const;

View File

@ -984,6 +984,7 @@ TEST_P(BufferTests, CreateBufferOOM) {
DAWN_TEST_UNSUPPORTED_IF(IsOpenGL()); DAWN_TEST_UNSUPPORTED_IF(IsOpenGL());
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES()); DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
DAWN_TEST_UNSUPPORTED_IF(IsAsan()); DAWN_TEST_UNSUPPORTED_IF(IsAsan());
DAWN_TEST_UNSUPPORTED_IF(IsTsan());
wgpu::BufferDescriptor descriptor; wgpu::BufferDescriptor descriptor;
descriptor.usage = wgpu::BufferUsage::CopyDst; descriptor.usage = wgpu::BufferUsage::CopyDst;
@ -1010,6 +1011,7 @@ TEST_P(BufferTests, BufferMappedAtCreationOOM) {
DAWN_TEST_UNSUPPORTED_IF(IsOpenGL()); DAWN_TEST_UNSUPPORTED_IF(IsOpenGL());
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES()); DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
DAWN_TEST_UNSUPPORTED_IF(IsAsan()); DAWN_TEST_UNSUPPORTED_IF(IsAsan());
DAWN_TEST_UNSUPPORTED_IF(IsTsan());
// Test non-mappable buffer // Test non-mappable buffer
{ {
@ -1076,6 +1078,7 @@ TEST_P(BufferTests, CreateBufferOOMMapAsync) {
DAWN_TEST_UNSUPPORTED_IF(IsOpenGL()); DAWN_TEST_UNSUPPORTED_IF(IsOpenGL());
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES()); DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
DAWN_TEST_UNSUPPORTED_IF(IsAsan()); DAWN_TEST_UNSUPPORTED_IF(IsAsan());
DAWN_TEST_UNSUPPORTED_IF(IsTsan());
auto RunTest = [this](const wgpu::BufferDescriptor& descriptor) { auto RunTest = [this](const wgpu::BufferDescriptor& descriptor) {
wgpu::Buffer buffer; wgpu::Buffer buffer;