intel/compiler: Prefer ctor/dtors in some Google Tests

Per Google Test FAQ recommendation, prefer consutrctors and destructors
unless there's a need to use SetUp/TearDown.

We will take advantage of this later to initialize an fs_builder.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26301>
This commit is contained in:
Caio Oliveira 2023-11-20 22:51:03 -08:00 committed by Marge Bot
parent d0db92b52d
commit 9540259e1c
4 changed files with 20 additions and 20 deletions

View file

@ -28,10 +28,10 @@
using namespace brw;
class cmod_propagation_test : public ::testing::Test {
virtual void SetUp();
virtual void TearDown();
protected:
cmod_propagation_test();
~cmod_propagation_test() override;
public:
struct brw_compiler *compiler;
struct brw_compile_params params;
struct intel_device_info *devinfo;
@ -64,7 +64,7 @@ public:
};
void cmod_propagation_test::SetUp()
cmod_propagation_test::cmod_propagation_test()
{
ctx = ralloc_context(NULL);
compiler = rzalloc(ctx, struct brw_compiler);
@ -84,7 +84,7 @@ void cmod_propagation_test::SetUp()
devinfo->verx10 = devinfo->ver * 10;
}
void cmod_propagation_test::TearDown()
cmod_propagation_test::~cmod_propagation_test()
{
delete v;
v = NULL;

View file

@ -28,10 +28,10 @@
using namespace brw;
class copy_propagation_test : public ::testing::Test {
virtual void SetUp();
virtual void TearDown();
protected:
copy_propagation_test();
~copy_propagation_test() override;
public:
struct brw_compiler *compiler;
struct brw_compile_params params;
struct intel_device_info *devinfo;
@ -53,7 +53,7 @@ public:
};
void copy_propagation_test::SetUp()
copy_propagation_test::copy_propagation_test()
{
ctx = ralloc_context(NULL);
compiler = rzalloc(ctx, struct brw_compiler);
@ -73,7 +73,7 @@ void copy_propagation_test::SetUp()
devinfo->verx10 = devinfo->ver * 10;
}
void copy_propagation_test::TearDown()
copy_propagation_test::~copy_propagation_test()
{
delete v;
v = NULL;

View file

@ -28,10 +28,10 @@
using namespace brw;
class saturate_propagation_test : public ::testing::Test {
virtual void SetUp();
virtual void TearDown();
protected:
saturate_propagation_test();
~saturate_propagation_test() override;
public:
struct brw_compiler *compiler;
struct brw_compile_params params;
struct intel_device_info *devinfo;
@ -53,7 +53,7 @@ public:
};
void saturate_propagation_test::SetUp()
saturate_propagation_test::saturate_propagation_test()
{
ctx = ralloc_context(NULL);
compiler = rzalloc(ctx, struct brw_compiler);
@ -73,7 +73,7 @@ void saturate_propagation_test::SetUp()
devinfo->verx10 = devinfo->ver * 10;
}
void saturate_propagation_test::TearDown()
saturate_propagation_test::~saturate_propagation_test()
{
delete v;
v = NULL;

View file

@ -28,10 +28,10 @@
using namespace brw;
class scoreboard_test : public ::testing::Test {
virtual void SetUp();
virtual void TearDown();
protected:
scoreboard_test();
~scoreboard_test() override;
public:
struct brw_compiler *compiler;
struct brw_compile_params params;
struct intel_device_info *devinfo;
@ -41,7 +41,7 @@ public:
fs_visitor *v;
};
void scoreboard_test::SetUp()
scoreboard_test::scoreboard_test()
{
ctx = ralloc_context(NULL);
compiler = rzalloc(ctx, struct brw_compiler);
@ -64,7 +64,7 @@ void scoreboard_test::SetUp()
}
void scoreboard_test::TearDown()
scoreboard_test::~scoreboard_test()
{
delete v;
v = NULL;