Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: tests/skia_test.cpp

Issue 14063005: add extended option to Test (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/Test.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/skia_test.cpp
===================================================================
--- tests/skia_test.cpp (revision 8570)
+++ tests/skia_test.cpp (working copy)
@@ -61,12 +61,21 @@
class DebugfReporter : public Reporter {
public:
- DebugfReporter() : fIndex(0), fTotal(0) {}
+ DebugfReporter(bool allowExtendedTest)
+ : fIndex(0)
+ , fTotal(0)
+ , fAllowExtendedTest(allowExtendedTest) {
+ }
void setIndexOfTotal(int index, int total) {
fIndex = index;
fTotal = total;
}
+
+ virtual bool allowExtendedTest() const {
+ return fAllowExtendedTest;
+ }
+
protected:
virtual void onStart(Test* test) {
SkDebugf("[%d/%d] %s...\n", fIndex+1, fTotal, test->getName());
@@ -81,6 +90,7 @@
}
private:
int fIndex, fTotal;
+ bool fAllowExtendedTest;
};
static const char* make_canonical_dir_path(const char* path, SkString* storage) {
@@ -116,13 +126,16 @@
#if SK_ENABLE_INST_COUNT
gPrintInstCount = true;
#endif
+ bool allowExtendedTest = false;
+ bool verboseOutput = false;
+
SkGraphics::Init();
const char* matchStr = NULL;
char* const* stop = argv + argc;
for (++argv; argv < stop; ++argv) {
- if (strcmp(*argv, "--match") == 0) {
+ if (0 == strcmp(*argv, "--match") || 0 == strcmp(*argv, "-m")) {
++argv;
if (argv < stop && **argv) {
matchStr = *argv;
@@ -130,7 +143,7 @@
SkDebugf("no following argument to --match\n");
return -1;
}
- } else if (0 == strcmp(*argv, "--tmpDir")) {
+ } else if (0 == strcmp(*argv, "--tmpDir") || 0 == strcmp(*argv, "-t")) {
++argv;
if (argv < stop && **argv) {
make_canonical_dir_path(*argv, &gTmpDir);
@@ -138,12 +151,27 @@
SkDebugf("no following argument to --tmpDir\n");
return -1;
}
- } else if ((0 == strcmp(*argv, "--resourcePath")) ||
- (0 == strcmp(*argv, "-i"))) {
+ } else if (0 == strcmp(*argv, "--resourcePath") || 0 == strcmp(*argv, "-i")) {
argv++;
if (argv < stop && **argv) {
make_canonical_dir_path(*argv, &gResourcePath);
}
+ } else if (0 == strcmp(*argv, "--extendedTest") || 0 == strcmp(*argv, "-x")) {
+ allowExtendedTest = true;
+ } else if (0 == strcmp(*argv, "--verbose") || 0 == strcmp(*argv, "-v")) {
+ verboseOutput = true;
+ } else {
+ if (0 != strcmp(*argv, "--help") && 0 != strcmp(*argv, "-h")
+ && 0 != strcmp(*argv, "-?")) {
+ SkDebugf("Unknown option %s. ", *argv);
+ }
+ SkDebugf("Skia UnitTests options are:\n");
+ SkDebugf(" -m --match [test-name-substring]\n");
+ SkDebugf(" -t --tmpDir [dir]\n");
+ SkDebugf(" -i --resourcePath [dir]\n");
+ SkDebugf(" -x --extendedTest\n");
+ SkDebugf(" -v --verbose\n");
+ return 1;
}
}
@@ -171,7 +199,7 @@
SkDebugf("%s\n", header.c_str());
}
- DebugfReporter reporter;
+ DebugfReporter reporter(allowExtendedTest);
Iter iter(&reporter);
Test* test;
@@ -194,7 +222,10 @@
SkDebugf("Finished %d tests, %d failures, %d skipped.\n",
count, failCount, skipCount);
-
+ int testCount = reporter.countTests();
+ if (verboseOutput && testCount > 0) {
+ SkDebugf("Ran %d Internal tests.\n", testCount);
+ }
#if SK_SUPPORT_GPU
#if GR_CACHE_STATS
« no previous file with comments | « tests/Test.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698