Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Functions | Variables
BazelUnitTestRunner.cpp File Reference
#include "include/core/SkString.h"
#include "include/core/SkTypes.h"
#include "include/private/base/SkDebug.h"
#include "tests/Test.h"
#include "tests/TestHarness.h"
#include "tools/flags/CommandLineFlags.h"
#include "tools/testrunners/common/TestRunner.h"
#include <ctime>
#include <cwchar>
#include <functional>
#include <iomanip>
#include <sstream>
#include <string>

Go to the source code of this file.

Classes

class  BazelReporter
 

Functions

static DEFINE_string (skip, "", "Space-separated list of test cases (regexps) to skip.")
 
static DEFINE_string (match, "", "Space-separated list of test cases (regexps) to run. Will run all tests if omitted.")
 
static DEFINE_string (key, "", "Ignored by this test runner.")
 
static DEFINE_string (cpuName, "", "Ignored by this test runner.")
 
static DEFINE_string (gpuName, "", "Ignored by this test runner.")
 
TestHarness CurrentTestHarness ()
 
void maybeRunTest (const char *name, std::function< void()> testFn)
 
int main (int argc, char **argv)
 

Variables

static bool unused
 

Function Documentation

◆ CurrentTestHarness()

TestHarness CurrentTestHarness ( )

Definition at line 141 of file BazelUnitTestRunner.cpp.

◆ DEFINE_string() [1/5]

static DEFINE_string ( cpuName  ,
""  ,
"Ignored by this test runner."   
)
static

◆ DEFINE_string() [2/5]

static DEFINE_string ( gpuName  ,
""  ,
"Ignored by this test runner."   
)
static

◆ DEFINE_string() [3/5]

static DEFINE_string ( key  ,
""  ,
"Ignored by this test runner."   
)
static

◆ DEFINE_string() [4/5]

static DEFINE_string ( match  ,
""  ,
"Space-separated list of test cases (regexps) to run. Will run all tests if omitted."   
)
static

◆ DEFINE_string() [5/5]

static DEFINE_string ( skip  ,
""  ,
"Space-separated list of test cases (regexps) to skip."   
)
static

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 154 of file BazelUnitTestRunner.cpp.

154 {
156
157 CommandLineFlags::Parse(argc, argv);
158
160 for (skiatest::Test test : skiatest::TestRegistry::Range()) {
161 if (test.fTestType == skiatest::TestType::kCPU) {
162 maybeRunTest(test.fName, [&]() { test.cpu(&reporter); });
163 }
164 }
165
166#if defined(SK_GANESH)
167 GrContextOptions grCtxOptions;
168 // TODO(kjlubick) DM has grContextOptions set via flags. Should this runner have that too?
169 grCtxOptions.fExecutor = nullptr;
170 grCtxOptions.fAllowPathMaskCaching = true;
171 grCtxOptions.fFailFlushTimeCallbacks = false;
172 grCtxOptions.fAllPathsVolatile = false;
173 grCtxOptions.fGpuPathRenderers = GpuPathRenderers::kDefault;
174 grCtxOptions.fDisableDriverCorrectnessWorkarounds = false;
175 grCtxOptions.fResourceCacheLimitOverride = -1;
177 for (skiatest::Test test : skiatest::TestRegistry::Range()) {
178 if (test.fTestType == skiatest::TestType::kGanesh) {
179 maybeRunTest(test.fName, [&]() { test.ganesh(&reporter, grCtxOptions); });
180 }
181 }
182#endif
183
184 // TODO(kjlubick) Graphite support
185
186 if (reporter.ok()) {
187 TestRunner::Log("PASS");
188 return 0;
189 }
190 TestRunner::Log("FAIL");
191 return 1;
192}
void maybeRunTest(const char *name, std::function< void()> testFn)
reporter
static void Parse(int argc, const char *const *argv)
void Log(const char *format,...) SK_PRINTF_LIKE(1
void InitAndLogCmdlineArgs(int argc, char **argv)
sk_tools::Registry< Test > TestRegistry
Definition Test.h:205
SkExecutor * fExecutor
bool fDisableDriverCorrectnessWorkarounds

◆ maybeRunTest()

void maybeRunTest ( const char *  name,
std::function< void()>  testFn 
)

Definition at line 143 of file BazelUnitTestRunner.cpp.

143 {
144 if (!TestRunner::ShouldRunTestCase(name, FLAGS_match, FLAGS_skip)) {
145 TestRunner::Log("Skipping %s", name);
146 return;
147 }
148
149 TestRunner::Log("Running %s", name);
150 testFn();
151 TestRunner::Log("\tDone");
152}
const char * name
Definition fuchsia.cc:50
bool ShouldRunTestCase(const char *name, CommandLineFlags::StringArray &matchFlag, CommandLineFlags::StringArray &skipFlag)

Variable Documentation

◆ unused

bool unused
static
Initial value:
=
SkFlagInfo::CreateStringFlag("device-specific-bazel-config",
nullptr,
nullptr,
"Ignored by this test runner.",
nullptr)
static bool CreateStringFlag(const char *name, const char *shortName, CommandLineFlags::StringArray *pStrings, const char *defaultValue, const char *helpString, const char *extendedHelpString)

Definition at line 51 of file BazelUnitTestRunner.cpp.