aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@google.com>2016-10-04 10:01:04 -0400
committerGravatar Cary Clark <caryclark@google.com>2016-10-04 14:26:00 +0000
commitab87d7abf1df007c90bef2e916294ca325d81c81 (patch)
treec28fc9383e6886e5f8411ad3b50e90644d698f30 /tests
parent1818701746e4ea76631afd6934d6257e2b3d781b (diff)
coin debugging runs all tests in extended
This extends path ops concidence debugging to find unused algorithms and determine the extent of loops. This verifies that all 140M tests run without error in release and debug. TBR=reed@google.com BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2391733002 patch from issue 2391733002 at patchset 1 (http://crrev.com/2391733002#ps1) Change-Id: I02ca29764405c5ac3e7ca3b2621fba28dbaaffc2 Reviewed-on: https://skia-review.googlesource.com/2923 Reviewed-by: Cary Clark <caryclark@google.com>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/PathOpsDebug.cpp20
-rw-r--r--tests/Test.h1
-rw-r--r--tests/skia_test.cpp14
3 files changed, 34 insertions, 1 deletions
diff --git a/tests/PathOpsDebug.cpp b/tests/PathOpsDebug.cpp
index c9635ea079..2c029546e6 100755
--- a/tests/PathOpsDebug.cpp
+++ b/tests/PathOpsDebug.cpp
@@ -330,6 +330,26 @@ const SkOpSpanBase* SkPathOpsDebug::DebugSpanSpan(const SkOpSpanBase* span, int
return span->debugSpan(id);
}
+#if DEBUG_COIN
+void SkPathOpsDebug::DumpCoinDict() {
+ gCoinSumChangedDict.dump("unused coin algorithm", false);
+ gCoinSumVisitedDict.dump("visited coin function", true);
+}
+
+void SkPathOpsDebug::CoinDict::dump(const char* str, bool visitCheck) const {
+ int count = fDict.count();
+ for (int index = 0; index < count; ++index) {
+ const auto& entry = fDict[index];
+ if (visitCheck || entry.fGlitchType == kUninitialized_Glitch) {
+ SkDebugf("%s %s : line %d iteration %d", str, entry.fFunctionName,
+ entry.fLineNumber, entry.fIteration);
+ DumpGlitchType(entry.fGlitchType);
+ SkDebugf("\n");
+ }
+ }
+}
+#endif
+
void SkOpContour::dumpContours() const {
SkOpContour* contour = this->globalState()->contourHead();
do {
diff --git a/tests/Test.h b/tests/Test.h
index 2a1e20fff2..5a3339dad1 100644
--- a/tests/Test.h
+++ b/tests/Test.h
@@ -43,6 +43,7 @@ public:
virtual void reportFailed(const skiatest::Failure&) = 0;
virtual bool allowExtendedTest() const;
virtual bool verbose() const;
+ virtual void* stats() const { return nullptr; }
};
#define REPORT_FAILURE(reporter, cond, message) \
diff --git a/tests/skia_test.cpp b/tests/skia_test.cpp
index 9783db83a0..6f02b0b262 100644
--- a/tests/skia_test.cpp
+++ b/tests/skia_test.cpp
@@ -12,6 +12,7 @@
#include "SkCommonFlags.h"
#include "SkGraphics.h"
#include "SkOSFile.h"
+#include "SkPathOpsDebug.h"
#include "SkTArray.h"
#include "SkTaskGroup.h"
#include "SkTemplates.h"
@@ -27,6 +28,9 @@ using namespace skiatest;
using namespace sk_gpu_test;
DEFINE_bool2(extendedTest, x, false, "run extended tests for pathOps.");
+#if DEBUG_COIN
+DEFINE_bool2(coinTest, c, false, "detect unused coincidence algorithms.");
+#endif
// need to explicitly declare this, or we get some weird infinite loop llist
template TestRegistry* TestRegistry::gHead;
@@ -82,7 +86,7 @@ public:
void operator()() {
struct TestReporter : public skiatest::Reporter {
public:
- TestReporter() : fError(false), fTestCount(0) {}
+ TestReporter() : fError(false), fTestCount(0), fStats(nullptr) {}
void bumpTestCount() override { ++fTestCount; }
bool allowExtendedTest() const override {
return FLAGS_extendedTest;
@@ -92,6 +96,8 @@ public:
SkDebugf("\nFAILED: %s", failure.toString().c_str());
fError = true;
}
+ void* stats() { return fStats; }
+ void* fStats;
bool fError;
int fTestCount;
} reporter;
@@ -219,6 +225,12 @@ int test_main() {
}
SkDebugf("\n");
+#if DEBUG_COIN
+ if (FLAGS_coinTest) {
+ SkPathOpsDebug::DumpCoinDict();
+ }
+#endif
+
return (status.failCount() == 0) ? 0 : 1;
}