Cleanup: Remove unnecessary TestSetUp overload

Bug: dawn:396
Change-Id: I9d12fb983ea3ef3a01b569caff453a441ab86c70
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21700
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
This commit is contained in:
Austin Eng 2020-05-15 22:06:35 +00:00 committed by Commit Bot service account
parent da722adec9
commit 40dc5d3f21
38 changed files with 87 additions and 86 deletions

View File

@ -356,22 +356,12 @@ class DawnTestBase {
template <typename Params = AdapterTestParam> template <typename Params = AdapterTestParam>
class DawnTestWithParams : public DawnTestBase, public ::testing::TestWithParam<Params> { class DawnTestWithParams : public DawnTestBase, public ::testing::TestWithParam<Params> {
private:
void SetUp() override final {
// DawnTestBase::SetUp() creates the device and wire.
// It was separate from TestSetUp() so we can skip tests completely if no adapter
// is available.
// TODO(enga): There is now always an available adapter otherwise we fail test environment
// SetUp. Consider removing the extra TestSetUp() overload.
DawnTestBase::SetUp();
TestSetUp();
}
protected: protected:
DawnTestWithParams(); DawnTestWithParams();
~DawnTestWithParams() override = default; ~DawnTestWithParams() override = default;
virtual void TestSetUp() { void SetUp() override {
DawnTestBase::SetUp();
} }
void TearDown() override { void TearDown() override {

View File

@ -26,8 +26,8 @@ constexpr static unsigned int kRTSize = 64;
class ColorStateTest : public DawnTest { class ColorStateTest : public DawnTest {
protected: protected:
void TestSetUp() override { void SetUp() override {
DawnTest::TestSetUp(); DawnTest::SetUp();
vsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"( vsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
#version 450 #version 450

View File

@ -29,8 +29,8 @@ namespace {
class D3D12ResourceTestBase : public DawnTest { class D3D12ResourceTestBase : public DawnTest {
public: public:
void TestSetUp() override { void SetUp() override {
DawnTest::TestSetUp(); DawnTest::SetUp();
if (UsesWire()) { if (UsesWire()) {
return; return;
} }

View File

@ -25,7 +25,8 @@
class DeprecationTests : public DawnTest { class DeprecationTests : public DawnTest {
protected: protected:
void TestSetUp() override { void SetUp() override {
DawnTest::SetUp();
// Skip when validation is off because warnings might be emitted during validation calls // Skip when validation is off because warnings might be emitted during validation calls
DAWN_SKIP_TEST_IF(IsDawnValidationSkipped()); DAWN_SKIP_TEST_IF(IsDawnValidationSkipped());
} }
@ -35,6 +36,7 @@ class DeprecationTests : public DawnTest {
EXPECT_EQ(mLastWarningCount, EXPECT_EQ(mLastWarningCount,
dawn_native::GetDeprecationWarningCountForTesting(device.Get())); dawn_native::GetDeprecationWarningCountForTesting(device.Get()));
} }
DawnTest::TearDown();
} }
size_t mLastWarningCount = 0; size_t mLastWarningCount = 0;

View File

@ -41,8 +41,8 @@ namespace {
class DepthSamplingTest : public DawnTest { class DepthSamplingTest : public DawnTest {
protected: protected:
void TestSetUp() override { void SetUp() override {
DawnTest::TestSetUp(); DawnTest::SetUp();
wgpu::BufferDescriptor uniformBufferDesc; wgpu::BufferDescriptor uniformBufferDesc;
uniformBufferDesc.usage = wgpu::BufferUsage::Uniform | wgpu::BufferUsage::CopyDst; uniformBufferDesc.usage = wgpu::BufferUsage::Uniform | wgpu::BufferUsage::CopyDst;

View File

@ -22,8 +22,8 @@ constexpr static unsigned int kRTSize = 64;
class DepthStencilStateTest : public DawnTest { class DepthStencilStateTest : public DawnTest {
protected: protected:
void TestSetUp() override { void SetUp() override {
DawnTest::TestSetUp(); DawnTest::SetUp();
wgpu::TextureDescriptor renderTargetDescriptor; wgpu::TextureDescriptor renderTargetDescriptor;
renderTargetDescriptor.dimension = wgpu::TextureDimension::e2D; renderTargetDescriptor.dimension = wgpu::TextureDimension::e2D;

View File

@ -21,8 +21,8 @@ constexpr uint32_t kRTSize = 4;
class DestroyTest : public DawnTest { class DestroyTest : public DawnTest {
protected: protected:
void TestSetUp() override { void SetUp() override {
DawnTest::TestSetUp(); DawnTest::SetUp();
DAWN_SKIP_TEST_IF(IsDawnValidationSkipped()); DAWN_SKIP_TEST_IF(IsDawnValidationSkipped());
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);

View File

@ -56,16 +56,16 @@ static const int fakeUserData = 0;
class DeviceLostTest : public DawnTest { class DeviceLostTest : public DawnTest {
protected: protected:
void TestSetUp() override { void SetUp() override {
DawnTest::SetUp();
DAWN_SKIP_TEST_IF(UsesWire()); DAWN_SKIP_TEST_IF(UsesWire());
DawnTest::TestSetUp();
mockDeviceLostCallback = std::make_unique<MockDeviceLostCallback>(); mockDeviceLostCallback = std::make_unique<MockDeviceLostCallback>();
mockFenceOnCompletionCallback = std::make_unique<MockFenceOnCompletionCallback>(); mockFenceOnCompletionCallback = std::make_unique<MockFenceOnCompletionCallback>();
} }
void TearDown() override { void TearDown() override {
DawnTest::TearDown();
mockDeviceLostCallback = nullptr; mockDeviceLostCallback = nullptr;
DawnTest::TearDown();
} }
void SetCallbackAndLoseForTesting() { void SetCallbackAndLoseForTesting() {

View File

@ -21,8 +21,8 @@ constexpr uint32_t kRTSize = 4;
class DrawIndexedIndirectTest : public DawnTest { class DrawIndexedIndirectTest : public DawnTest {
protected: protected:
void TestSetUp() override { void SetUp() override {
DawnTest::TestSetUp(); DawnTest::SetUp();
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);

View File

@ -21,8 +21,8 @@ constexpr uint32_t kRTSize = 4;
class DrawIndexedTest : public DawnTest { class DrawIndexedTest : public DawnTest {
protected: protected:
void TestSetUp() override { void SetUp() override {
DawnTest::TestSetUp(); DawnTest::SetUp();
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);

View File

@ -21,8 +21,8 @@ constexpr uint32_t kRTSize = 4;
class DrawIndirectTest : public DawnTest { class DrawIndirectTest : public DawnTest {
protected: protected:
void TestSetUp() override { void SetUp() override {
DawnTest::TestSetUp(); DawnTest::SetUp();
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);

View File

@ -21,8 +21,8 @@ constexpr uint32_t kRTSize = 4;
class DrawTest : public DawnTest { class DrawTest : public DawnTest {
protected: protected:
void TestSetUp() override { void SetUp() override {
DawnTest::TestSetUp(); DawnTest::SetUp();
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);

View File

@ -24,8 +24,8 @@ constexpr uint32_t kBindingSize = 8;
class DynamicBufferOffsetTests : public DawnTest { class DynamicBufferOffsetTests : public DawnTest {
protected: protected:
void TestSetUp() override { void SetUp() override {
DawnTest::TestSetUp(); DawnTest::SetUp();
// Mix up dynamic and non dynamic resources in one bind group and using not continuous // Mix up dynamic and non dynamic resources in one bind group and using not continuous
// binding number to cover more cases. // binding number to cover more cases.

View File

@ -60,8 +60,8 @@ class FenceTests : public DawnTest {
FenceTests() : mCallIndex(0) { FenceTests() : mCallIndex(0) {
} }
void TestSetUp() override { void SetUp() override {
DawnTest::TestSetUp(); DawnTest::SetUp();
mockFenceOnCompletionCallback = std::make_unique<MockFenceOnCompletionCallback>(); mockFenceOnCompletionCallback = std::make_unique<MockFenceOnCompletionCallback>();
mockPopErrorScopeCallback = std::make_unique<MockPopErrorScopeCallback>(); mockPopErrorScopeCallback = std::make_unique<MockPopErrorScopeCallback>();
} }

View File

@ -22,8 +22,8 @@ constexpr uint32_t kRTSize = 400;
class IndexFormatTest : public DawnTest { class IndexFormatTest : public DawnTest {
protected: protected:
void TestSetUp() override { void SetUp() override {
DawnTest::TestSetUp(); DawnTest::SetUp();
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
} }

View File

@ -20,8 +20,8 @@
class MultisampledRenderingTest : public DawnTest { class MultisampledRenderingTest : public DawnTest {
protected: protected:
void TestSetUp() override { void SetUp() override {
DawnTest::TestSetUp(); DawnTest::SetUp();
InitTexturesForTest(); InitTexturesForTest();
} }

View File

@ -20,8 +20,8 @@
class NonzeroTextureCreationTests : public DawnTest { class NonzeroTextureCreationTests : public DawnTest {
protected: protected:
void TestSetUp() override { void SetUp() override {
DawnTest::TestSetUp(); DawnTest::SetUp();
} }
constexpr static uint32_t kSize = 128; constexpr static uint32_t kSize = 128;

View File

@ -20,8 +20,8 @@
class OpArrayLengthTest : public DawnTest { class OpArrayLengthTest : public DawnTest {
protected: protected:
void TestSetUp() { void SetUp() {
DawnTest::TestSetUp(); DawnTest::SetUp();
// Create buffers of various size to check the length() implementation // Create buffers of various size to check the length() implementation
wgpu::BufferDescriptor bufferDesc; wgpu::BufferDescriptor bufferDesc;

View File

@ -145,8 +145,8 @@ constexpr static float kVertices[] = {
class PrimitiveTopologyTest : public DawnTest { class PrimitiveTopologyTest : public DawnTest {
protected: protected:
void TestSetUp() override { void SetUp() override {
DawnTest::TestSetUp(); DawnTest::SetUp();
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);

View File

@ -26,8 +26,8 @@ const RGBA8 kColors[2] = {RGBA8::kGreen, RGBA8::kBlue};
// tested in all other rendering tests. // tested in all other rendering tests.
class RenderBundleTest : public DawnTest { class RenderBundleTest : public DawnTest {
protected: protected:
void TestSetUp() override { void SetUp() override {
DawnTest::TestSetUp(); DawnTest::SetUp();
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);

View File

@ -54,8 +54,8 @@ class DrawQuad {
class RenderPassLoadOpTests : public DawnTest { class RenderPassLoadOpTests : public DawnTest {
protected: protected:
void TestSetUp() override { void SetUp() override {
DawnTest::TestSetUp(); DawnTest::SetUp();
wgpu::TextureDescriptor descriptor; wgpu::TextureDescriptor descriptor;
descriptor.dimension = wgpu::TextureDimension::e2D; descriptor.dimension = wgpu::TextureDimension::e2D;

View File

@ -22,8 +22,8 @@ constexpr wgpu::TextureFormat kFormat = wgpu::TextureFormat::RGBA8Unorm;
class RenderPassTest : public DawnTest { class RenderPassTest : public DawnTest {
protected: protected:
void TestSetUp() override { void SetUp() override {
DawnTest::TestSetUp(); DawnTest::SetUp();
// Shaders to draw a bottom-left triangle in blue. // Shaders to draw a bottom-left triangle in blue.
mVSModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"( mVSModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(

View File

@ -50,8 +50,8 @@ namespace {
class SamplerTest : public DawnTest { class SamplerTest : public DawnTest {
protected: protected:
void TestSetUp() override { void SetUp() override {
DawnTest::TestSetUp(); DawnTest::SetUp();
mRenderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); mRenderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
auto vsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"( auto vsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(

View File

@ -23,7 +23,8 @@
class SwapChainTests : public DawnTest { class SwapChainTests : public DawnTest {
public: public:
void TestSetUp() override { void SetUp() override {
DawnTest::SetUp();
DAWN_SKIP_TEST_IF(UsesWire()); DAWN_SKIP_TEST_IF(UsesWire());
glfwSetErrorCallback([](int code, const char* message) { glfwSetErrorCallback([](int code, const char* message) {
@ -58,6 +59,7 @@ class SwapChainTests : public DawnTest {
if (window != nullptr) { if (window != nullptr) {
glfwDestroyWindow(window); glfwDestroyWindow(window);
} }
DawnTest::TearDown();
} }
void ClearTexture(wgpu::TextureView view, wgpu::Color color) { void ClearTexture(wgpu::TextureView view, wgpu::Color color) {

View File

@ -24,7 +24,8 @@
class SwapChainValidationTests : public DawnTest { class SwapChainValidationTests : public DawnTest {
public: public:
void TestSetUp() override { void SetUp() override {
DawnTest::SetUp();
DAWN_SKIP_TEST_IF(UsesWire()); DAWN_SKIP_TEST_IF(UsesWire());
DAWN_SKIP_TEST_IF(IsDawnValidationSkipped()); DAWN_SKIP_TEST_IF(IsDawnValidationSkipped());
@ -59,6 +60,7 @@ class SwapChainValidationTests : public DawnTest {
if (window != nullptr) { if (window != nullptr) {
glfwDestroyWindow(window); glfwDestroyWindow(window);
} }
DawnTest::TearDown();
} }
protected: protected:

View File

@ -112,8 +112,8 @@ class ExpectFloat16 : public detail::Expectation {
class TextureFormatTest : public DawnTest { class TextureFormatTest : public DawnTest {
protected: protected:
void TestSetUp() { void SetUp() {
DawnTest::TestSetUp(); DawnTest::SetUp();
} }
// Structure containing all the information that tests need to know about the format. // Structure containing all the information that tests need to know about the format.

View File

@ -78,8 +78,8 @@ protected:
return static_cast<int>(level * 10) + static_cast<int>(layer + 1); return static_cast<int>(level * 10) + static_cast<int>(layer + 1);
} }
void TestSetUp() override { void SetUp() override {
DawnTest::TestSetUp(); DawnTest::SetUp();
mRenderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); mRenderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);

View File

@ -32,9 +32,9 @@
class TextureZeroInitTest : public DawnTest { class TextureZeroInitTest : public DawnTest {
protected: protected:
void TestSetUp() override { void SetUp() override {
DawnTest::SetUp();
DAWN_SKIP_TEST_IF(UsesWire()); DAWN_SKIP_TEST_IF(UsesWire());
DawnTest::TestSetUp();
} }
wgpu::TextureDescriptor CreateTextureDescriptor(uint32_t mipLevelCount, wgpu::TextureDescriptor CreateTextureDescriptor(uint32_t mipLevelCount,
uint32_t arrayLayerCount, uint32_t arrayLayerCount,

View File

@ -46,8 +46,8 @@ std::vector<destType> BitCast(std::vector<srcType> data) {
class VertexFormatTest : public DawnTest { class VertexFormatTest : public DawnTest {
protected: protected:
void TestSetUp() override { void SetUp() override {
DawnTest::TestSetUp(); DawnTest::SetUp();
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
} }

View File

@ -36,8 +36,8 @@ constexpr static unsigned int kRTCellSize = 100;
class VertexStateTest : public DawnTest { class VertexStateTest : public DawnTest {
protected: protected:
void TestSetUp() override { void SetUp() override {
DawnTest::TestSetUp(); DawnTest::SetUp();
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
} }

View File

@ -92,7 +92,7 @@ class BufferUploadPerf : public DawnPerfTestWithParams<BufferUploadParams> {
} }
~BufferUploadPerf() override = default; ~BufferUploadPerf() override = default;
void TestSetUp() override; void SetUp() override;
private: private:
void Step() override; void Step() override;
@ -101,8 +101,8 @@ class BufferUploadPerf : public DawnPerfTestWithParams<BufferUploadParams> {
std::vector<uint8_t> data; std::vector<uint8_t> data;
}; };
void BufferUploadPerf::TestSetUp() { void BufferUploadPerf::SetUp() {
DawnPerfTestWithParams<BufferUploadParams>::TestSetUp(); DawnPerfTestWithParams<BufferUploadParams>::SetUp();
wgpu::BufferDescriptor desc = {}; wgpu::BufferDescriptor desc = {};
desc.size = data.size(); desc.size = data.size();

View File

@ -227,7 +227,7 @@ class DrawCallPerf : public DawnPerfTestWithParams<DrawCallParamForTest> {
} }
~DrawCallPerf() override = default; ~DrawCallPerf() override = default;
void TestSetUp() override; void SetUp() override;
protected: protected:
DrawCallParam GetParam() const { DrawCallParam GetParam() const {
@ -267,8 +267,8 @@ class DrawCallPerf : public DawnPerfTestWithParams<DrawCallParamForTest> {
wgpu::RenderBundle mRenderBundle; wgpu::RenderBundle mRenderBundle;
}; };
void DrawCallPerf::TestSetUp() { void DrawCallPerf::SetUp() {
DawnPerfTestWithParams::TestSetUp(); DawnPerfTestWithParams::SetUp();
// Compute aligned uniform / vertex data sizes. // Compute aligned uniform / vertex data sizes.
mAlignedUniformSize = Align(kUniformSize, kMinDynamicBufferOffsetAlignment); mAlignedUniformSize = Align(kUniformSize, kMinDynamicBufferOffsetAlignment);

View File

@ -33,7 +33,8 @@ using namespace dawn_native::d3d12;
class D3D12DescriptorHeapTests : public DawnTest { class D3D12DescriptorHeapTests : public DawnTest {
protected: protected:
void TestSetUp() override { void SetUp() override {
DawnTest::SetUp();
DAWN_SKIP_TEST_IF(UsesWire()); DAWN_SKIP_TEST_IF(UsesWire());
mD3DDevice = reinterpret_cast<Device*>(device.Get()); mD3DDevice = reinterpret_cast<Device*>(device.Get());

View File

@ -34,7 +34,8 @@ constexpr wgpu::BufferUsage kNonMappableBufferUsage = wgpu::BufferUsage::CopyDst
class D3D12ResidencyTests : public DawnTest { class D3D12ResidencyTests : public DawnTest {
protected: protected:
void TestSetUp() override { void SetUp() override {
DawnTest::SetUp();
DAWN_SKIP_TEST_IF(UsesWire()); DAWN_SKIP_TEST_IF(UsesWire());
// Restrict Dawn's budget to create an artificial budget. // Restrict Dawn's budget to create an artificial budget.

View File

@ -20,7 +20,8 @@ using namespace dawn_native::metal;
class MetalAutoreleasePoolTests : public DawnTest { class MetalAutoreleasePoolTests : public DawnTest {
private: private:
void TestSetUp() override { void SetUp() override {
DawnTest::SetUp();
DAWN_SKIP_TEST_IF(UsesWire()); DAWN_SKIP_TEST_IF(UsesWire());
mMtlDevice = reinterpret_cast<Device*>(device.Get()); mMtlDevice = reinterpret_cast<Device*>(device.Get());

View File

@ -25,7 +25,8 @@ namespace {
class VulkanErrorInjectorTests : public DawnTest { class VulkanErrorInjectorTests : public DawnTest {
public: public:
void TestSetUp() override { void SetUp() override {
DawnTest::SetUp();
DAWN_SKIP_TEST_IF(UsesWire()); DAWN_SKIP_TEST_IF(UsesWire());
mDeviceVk = reinterpret_cast<dawn_native::vulkan::Device*>(device.Get()); mDeviceVk = reinterpret_cast<dawn_native::vulkan::Device*>(device.Get());

View File

@ -34,7 +34,7 @@ namespace dawn_native { namespace vulkan {
class VulkanImageWrappingTestBase : public DawnTest { class VulkanImageWrappingTestBase : public DawnTest {
public: public:
void TestSetUp() override { void SetUp() override {
DAWN_SKIP_TEST_IF(UsesWire()); DAWN_SKIP_TEST_IF(UsesWire());
gbmDevice = CreateGbmDevice(); gbmDevice = CreateGbmDevice();
@ -264,8 +264,8 @@ namespace dawn_native { namespace vulkan {
// These tests are skipped if the harness is using the wire. // These tests are skipped if the harness is using the wire.
class VulkanImageWrappingUsageTests : public VulkanImageWrappingTestBase { class VulkanImageWrappingUsageTests : public VulkanImageWrappingTestBase {
public: public:
void TestSetUp() override { void SetUp() override {
VulkanImageWrappingTestBase::TestSetUp(); VulkanImageWrappingTestBase::SetUp();
if (UsesWire()) { if (UsesWire()) {
return; return;
} }

View File

@ -31,7 +31,8 @@ namespace dawn_native { namespace vulkan {
class VulkanImageWrappingTestBase : public DawnTest { class VulkanImageWrappingTestBase : public DawnTest {
public: public:
void TestSetUp() override { void SetUp() override {
DawnTest::SetUp();
if (UsesWire()) { if (UsesWire()) {
return; return;
} }
@ -200,8 +201,8 @@ namespace dawn_native { namespace vulkan {
class VulkanImageWrappingValidationTests : public VulkanImageWrappingTestBase { class VulkanImageWrappingValidationTests : public VulkanImageWrappingTestBase {
public: public:
void TestSetUp() override { void SetUp() override {
VulkanImageWrappingTestBase::TestSetUp(); VulkanImageWrappingTestBase::SetUp();
if (UsesWire()) { if (UsesWire()) {
return; return;
} }
@ -352,8 +353,8 @@ namespace dawn_native { namespace vulkan {
// These tests are skipped if the harness is using the wire. // These tests are skipped if the harness is using the wire.
class VulkanImageWrappingUsageTests : public VulkanImageWrappingTestBase { class VulkanImageWrappingUsageTests : public VulkanImageWrappingTestBase {
public: public:
void TestSetUp() override { void SetUp() override {
VulkanImageWrappingTestBase::TestSetUp(); VulkanImageWrappingTestBase::SetUp();
if (UsesWire()) { if (UsesWire()) {
return; return;
} }