Flutter Engine
The Flutter Engine
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
158
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;
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
Definition: FontMgrTest.cpp:39
static void Parse(int argc, const char *const *argv)
char ** argv
Definition: library.h:9
void Log(const char *format,...) SK_PRINTF_LIKE(1
Definition: TestRunner.cpp:137
void InitAndLogCmdlineArgs(int argc, char **argv)
Definition: TestRunner.cpp:88
SkExecutor * fExecutor
Enable fReduceOpsTaskSplitting
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}
bool ShouldRunTestCase(const char *name, CommandLineFlags::StringArray &matchFlag, CommandLineFlags::StringArray &skipFlag)
Definition: TestRunner.cpp:113
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

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.