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>
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:
DawnTestWithParams();
~DawnTestWithParams() override = default;
virtual void TestSetUp() {
void SetUp() override {
DawnTestBase::SetUp();
}
void TearDown() override {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -145,8 +145,8 @@ constexpr static float kVertices[] = {
class PrimitiveTopologyTest : public DawnTest {
protected:
void TestSetUp() override {
DawnTest::TestSetUp();
void SetUp() override {
DawnTest::SetUp();
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.
class RenderBundleTest : public DawnTest {
protected:
void TestSetUp() override {
DawnTest::TestSetUp();
void SetUp() override {
DawnTest::SetUp();
renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -112,8 +112,8 @@ class ExpectFloat16 : public detail::Expectation {
class TextureFormatTest : public DawnTest {
protected:
void TestSetUp() {
DawnTest::TestSetUp();
void SetUp() {
DawnTest::SetUp();
}
// 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);
}
void TestSetUp() override {
DawnTest::TestSetUp();
void SetUp() override {
DawnTest::SetUp();
mRenderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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