aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-23 17:21:19 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-23 17:21:19 +0000
commit6dda827913a3dbdb84934f4f1d79c0b702169e5c (patch)
tree9c55ea757a7ba627fb78ccf608af2abd514c82a2
parent4732df69415fbece99b3d4c033dc3bebe73d0117 (diff)
add leaks flag to show unref'd insts
Leaks are shown optionally instead of always for tests, gm, and bench. The current display does not show actual leaks necessarily, but shows global objects that were not deleted when the test ended. To enable the end-of-run leak display, pass --leaks or -l. BUG=skia: R=mtklein@google.com Author: caryclark@google.com Review URL: https://codereview.chromium.org/143943009 git-svn-id: http://skia.googlecode.com/svn/trunk@13151 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--bench/benchmain.cpp7
-rw-r--r--gm/gmmain.cpp15
-rw-r--r--tests/skia_test.cpp5
3 files changed, 18 insertions, 9 deletions
diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp
index f6bca712f5..b4bb2790bf 100644
--- a/bench/benchmain.cpp
+++ b/bench/benchmain.cpp
@@ -252,6 +252,7 @@ DEFINE_bool(forceBlend, false, "Force alpha blending?");
DEFINE_int32(gpuCacheBytes, -1, "GPU cache size limit in bytes. 0 to disable cache.");
DEFINE_int32(gpuCacheCount, -1, "GPU cache size limit in object count. 0 to disable cache.");
+DEFINE_bool2(leaks, l, false, "show leaked ref cnt'd objects.");
DEFINE_string(match, "", "[~][^]substring[$] [...] of test name to run.\n"
"Multiple matches may be separated by spaces.\n"
"~ causes a matching test to always be skipped\n"
@@ -291,11 +292,13 @@ static bool HasConverged(double prevPerLoop, double currPerLoop, double currRaw)
int tool_main(int argc, char** argv);
int tool_main(int argc, char** argv) {
+ SkCommandLineFlags::Parse(argc, argv);
#if SK_ENABLE_INST_COUNT
- gPrintInstCount = true;
+ if (FLAGS_leaks) {
+ gPrintInstCount = true;
+ }
#endif
SkAutoGraphics ag;
- SkCommandLineFlags::Parse(argc, argv);
// First, parse some flags.
SkBenchLogger logger;
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index 3b7e76a757..86d96fe288 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -1430,6 +1430,7 @@ DEFINE_string(ignoreErrorTypes, kDefaultIgnorableErrorTypes.asString(" ").c_str(
DEFINE_string(ignoreFailuresFile, "", "Path to file containing a list of tests for which we "
"should ignore failures.\n"
"The file should list one test per line, except for comment lines starting with #");
+DEFINE_bool2(leaks, l, false, "show leaked ref cnt'd objects.");
DEFINE_string(match, "", "[~][^]substring[$] [...] of test name to run.\n"
"Multiple matches may be separated by spaces.\n"
"~ causes a matching test to always be skipped\n"
@@ -2198,8 +2199,15 @@ static bool parse_flags_jpeg_quality() {
int tool_main(int argc, char** argv);
int tool_main(int argc, char** argv) {
+ SkString usage;
+ usage.printf("Run the golden master tests.\n");
+ SkCommandLineFlags::SetUsage(usage.c_str());
+ SkCommandLineFlags::Parse(argc, argv);
+
#if SK_ENABLE_INST_COUNT
- gPrintInstCount = true;
+ if (FLAGS_leaks) {
+ gPrintInstCount = true;
+ }
#endif
SkGraphics::Init();
@@ -2209,11 +2217,6 @@ int tool_main(int argc, char** argv) {
setSystemPreferences();
GMMain gmmain;
- SkString usage;
- usage.printf("Run the golden master tests.\n");
- SkCommandLineFlags::SetUsage(usage.c_str());
- SkCommandLineFlags::Parse(argc, argv);
-
SkTDArray<size_t> configs;
int moduloRemainder = -1;
diff --git a/tests/skia_test.cpp b/tests/skia_test.cpp
index 26a7701a8d..d489972574 100644
--- a/tests/skia_test.cpp
+++ b/tests/skia_test.cpp
@@ -32,6 +32,7 @@ DEFINE_string2(match, m, NULL, "[~][^]substring[$] [...] of test name to run.\n"
DEFINE_string2(tmpDir, t, NULL, "tmp directory for tests to use.");
DEFINE_string2(resourcePath, i, "resources", "directory for test resources.");
DEFINE_bool2(extendedTest, x, false, "run extended tests for pathOps.");
+DEFINE_bool2(leaks, l, false, "show leaked ref cnt'd objects.");
DEFINE_bool2(single, z, false, "run tests on a single thread internally.");
DEFINE_bool2(verbose, v, false, "enable verbose output.");
DEFINE_int32(threads, SkThreadPool::kThreadPerCore,
@@ -129,7 +130,9 @@ int tool_main(int argc, char** argv) {
SkCommandLineFlags::Parse(argc, argv);
#if SK_ENABLE_INST_COUNT
- gPrintInstCount = true;
+ if (FLAGS_leaks) {
+ gPrintInstCount = true;
+ }
#endif
SkGraphics::Init();