Name Test struct's member variables consistently
Change-Id: Ie853618fb496a77ffb79d6669f87048260df68b7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458979
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/dm/DM.cpp b/dm/DM.cpp
index df34344..fd72f02 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -1433,14 +1433,14 @@
if (!in_shard()) {
continue;
}
- if (CommandLineFlags::ShouldSkip(FLAGS_match, test.name)) {
+ if (CommandLineFlags::ShouldSkip(FLAGS_match, test.fName)) {
continue;
}
- if (test.needsGpu && FLAGS_gpu) {
+ if (test.fNeedsGpu && FLAGS_gpu) {
gSerialTests->push_back(test);
} else if (test.fNeedsGraphite && FLAGS_graphite) {
gSerialTests->push_back(test);
- } else if (!test.needsGpu && !test.fNeedsGraphite && FLAGS_cpu) {
+ } else if (!test.fNeedsGpu && !test.fNeedsGraphite && FLAGS_cpu) {
gParallelTests->push_back(test);
}
}
@@ -1457,16 +1457,16 @@
bool verbose() const override { return FLAGS_veryVerbose; }
} reporter;
- if (!FLAGS_dryRun && !should_skip("_", "tests", "_", test.name)) {
+ if (!FLAGS_dryRun && !should_skip("_", "tests", "_", test.fName)) {
AutoreleasePool pool;
GrContextOptions options = grCtxOptions;
test.modifyGrContextOptions(&options);
- skiatest::ReporterContext ctx(&reporter, SkString(test.name));
- start("unit", "test", "", test.name);
+ skiatest::ReporterContext ctx(&reporter, SkString(test.fName));
+ start("unit", "test", "", test.fName);
test.run(&reporter, options);
}
- done("unit", "test", "", test.name);
+ done("unit", "test", "", test.fName);
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
diff --git a/tests/Test.h b/tests/Test.h
index 340ba0b..4a732f1 100644
--- a/tests/Test.h
+++ b/tests/Test.h
@@ -71,20 +71,20 @@
typedef void (*ContextOptionsProc)(GrContextOptions*);
struct Test {
- Test(const char* n,
- bool gpu,
+ Test(const char* name,
+ bool needsGpu,
bool needsGraphite,
- TestProc p,
+ TestProc proc,
ContextOptionsProc optionsProc = nullptr)
- : name(n)
- , needsGpu(gpu)
+ : fName(name)
+ , fNeedsGpu(needsGpu)
, fNeedsGraphite(needsGraphite)
- , proc(p)
+ , fProc(proc)
, fContextOptionsProc(optionsProc) {}
- const char* name;
- bool needsGpu;
+ const char* fName;
+ bool fNeedsGpu;
bool fNeedsGraphite;
- TestProc proc;
+ TestProc fProc;
ContextOptionsProc fContextOptionsProc;
void modifyGrContextOptions(GrContextOptions* options) {
@@ -94,8 +94,8 @@
}
void run(skiatest::Reporter* r, const GrContextOptions& options) const {
- TRACE_EVENT1("test", TRACE_FUNC, "name", this->name/*these are static*/);
- this->proc(r, options);
+ TRACE_EVENT1("test", TRACE_FUNC, "name", this->fName/*these are static*/);
+ this->fProc(r, options);
}
};
diff --git a/tests/skia_test.cpp b/tests/skia_test.cpp
index df9c0a3..f6aa20b 100644
--- a/tests/skia_test.cpp
+++ b/tests/skia_test.cpp
@@ -117,12 +117,12 @@
} reporter;
const Timer timer;
- fTest.proc(&reporter, GrContextOptions());
+ fTest.fProc(&reporter, GrContextOptions());
SkMSec elapsed = timer.elapsedMsInt();
if (reporter.fError) {
fStatus->reportFailure();
}
- fStatus->endTest(fTest.name, !reporter.fError, elapsed, reporter.fTestCount);
+ fStatus->endTest(fTest.fName, !reporter.fError, elapsed, reporter.fTestCount);
}
private:
@@ -225,7 +225,7 @@
int toRun = 0;
for (const Test& test : TestRegistry::Range()) {
- if (should_run(test.name, test.needsGpu, test.fNeedsGraphite)) {
+ if (should_run(test.fName, test.fNeedsGpu, test.fNeedsGraphite)) {
toRun++;
}
total++;
@@ -241,9 +241,9 @@
Status status(toRun);
for (const Test& test : TestRegistry::Range()) {
- if (!should_run(test.name, test.needsGpu, test.fNeedsGraphite)) {
+ if (!should_run(test.fName, test.fNeedsGpu, test.fNeedsGraphite)) {
++skipCount;
- } else if (test.needsGpu || test.fNeedsGraphite) {
+ } else if (test.fNeedsGpu || test.fNeedsGraphite) {
gpuTests.push_back(&test);
} else {
cpuTests.add(SkTestRunnable(test, &status));
diff --git a/tools/fm/fm.cpp b/tools/fm/fm.cpp
index 720c313..8717a48 100644
--- a/tools/fm/fm.cpp
+++ b/tools/fm/fm.cpp
@@ -417,13 +417,13 @@
SkTHashMap<SkString, const skiatest::Test*> tests;
for (const skiatest::Test& test : skiatest::TestRegistry::Range()) {
- if (test.needsGpu || test.fNeedsGraphite) {
+ if (test.fNeedsGpu || test.fNeedsGraphite) {
continue; // TODO
}
if (FLAGS_listTests) {
- fprintf(stdout, "%s\n", test.name);
+ fprintf(stdout, "%s\n", test.fName);
} else {
- tests.set(SkString{test.name}, &test);
+ tests.set(SkString{test.fName}, &test);
}
}
diff --git a/tools/list_gpu_unit_tests.cpp b/tools/list_gpu_unit_tests.cpp
index a39a5f4..b40fc80 100644
--- a/tools/list_gpu_unit_tests.cpp
+++ b/tools/list_gpu_unit_tests.cpp
@@ -15,8 +15,8 @@
int main() {
std::vector<std::string> tests;
for (const skiatest::Test& test : skiatest::TestRegistry::Range()) {
- if (test.needsGpu) {
- tests.push_back(std::string(test.name));
+ if (test.fNeedsGpu) {
+ tests.push_back(std::string(test.fName));
}
}
std::sort(tests.begin(), tests.end());
diff --git a/tools/skqp/src/skqp.cpp b/tools/skqp/src/skqp.cpp
index 20a7e75..50ed9db 100644
--- a/tools/skqp/src/skqp.cpp
+++ b/tools/skqp/src/skqp.cpp
@@ -80,11 +80,11 @@
readlines(dat->data(), dat->size(), insert);
}
for (const skiatest::Test& test : skiatest::TestRegistry::Range()) {
- if ((testset.empty() || testset.count(std::string(test.name)) > 0) && test.needsGpu) {
+ if ((testset.empty() || testset.count(std::string(test.fName)) > 0) && test.fNeedsGpu) {
unitTests->push_back(&test);
}
}
- auto lt = [](SkQP::UnitTest u, SkQP::UnitTest v) { return strcmp(u->name, v->name) < 0; };
+ auto lt = [](SkQP::UnitTest u, SkQP::UnitTest v) { return strcmp(u->fName, v->fName) < 0; };
std::sort(unitTests->begin(), unitTests->end(), lt);
}
@@ -244,7 +244,7 @@
return std::string(gm ? gm->getName() : "");
}
-const char* SkQP::GetUnitTestName(SkQP::UnitTest t) { return t->name; }
+const char* SkQP::GetUnitTestName(SkQP::UnitTest t) { return t->fName; }
SkQP::SkQP() {}
@@ -355,7 +355,7 @@
if (test->fContextOptionsProc) {
test->fContextOptionsProc(&options);
}
- test->proc(&r, options);
+ test->fProc(&r, options);
fUnitTestResults.push_back(UnitTestResult{test, r.fErrors});
return r.fErrors;
}