mark tests flaky for pathkit

retain flaky state to avoid manual edits

R=kjlubick@google.com

Bug: skia:
Change-Id: I2f30a90aed46c52a0b30af1ccb7d6235b6db6945
Reviewed-on: https://skia-review.googlesource.com/149800
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
diff --git a/tests/PathOpsDebug.cpp b/tests/PathOpsDebug.cpp
index 059ecaa..41f912e 100644
--- a/tests/PathOpsDebug.cpp
+++ b/tests/PathOpsDebug.cpp
@@ -15,6 +15,7 @@
 #include "SkString.h"
 
 bool PathOpsDebug::gJson;
+bool PathOpsDebug::gMarkJsonFlaky;
 bool PathOpsDebug::gOutFirst;
 bool PathOpsDebug::gCheckForDuplicateNames;
 bool PathOpsDebug::gOutputSVG;
diff --git a/tests/PathOpsDebug.h b/tests/PathOpsDebug.h
index 897bfa7..7fd7f03 100644
--- a/tests/PathOpsDebug.h
+++ b/tests/PathOpsDebug.h
@@ -13,6 +13,7 @@
 class PathOpsDebug {
 public:
     static bool gJson;
+    static bool gMarkJsonFlaky;
     static bool gOutFirst;
     static bool gCheckForDuplicateNames;
     static bool gOutputSVG;
diff --git a/tests/PathOpsExtendedTest.cpp b/tests/PathOpsExtendedTest.cpp
index 0fa41c4..857ba63 100644
--- a/tests/PathOpsExtendedTest.cpp
+++ b/tests/PathOpsExtendedTest.cpp
@@ -443,6 +443,13 @@
 #endif
 }
 
+void markTestFlakyForPathKit() {
+    if (PathOpsDebug::gJson) {
+        SkASSERT(!PathOpsDebug::gMarkJsonFlaky);
+        PathOpsDebug::gMarkJsonFlaky = true;
+    }
+}
+
 SK_DECLARE_STATIC_MUTEX(simplifyDebugOut);
 
 bool testSimplify(SkPath& path, bool useXor, SkPath& out, PathOpsThreadState& state,
@@ -481,6 +488,10 @@
     fprintf(PathOpsDebug::gOut, "  \"expectSuccess\": \"%s\",\n",
             ExpectSuccess::kNo == expectSuccess ? "no" :
             ExpectSuccess::kYes == expectSuccess ? "yes" : "flaky");
+    if (PathOpsDebug::gMarkJsonFlaky) {
+        expectMatch = ExpectMatch::kFlaky;
+        PathOpsDebug::gMarkJsonFlaky = false;
+    }
     fprintf(PathOpsDebug::gOut, "  \"expectMatch\": \"%s\",\n",
             ExpectMatch::kNo == expectMatch ? "no" :
             ExpectMatch::kYes == expectMatch ? "yes" : "flaky");
diff --git a/tests/PathOpsExtendedTest.h b/tests/PathOpsExtendedTest.h
index 5095a9d..37bc396 100644
--- a/tests/PathOpsExtendedTest.h
+++ b/tests/PathOpsExtendedTest.h
@@ -31,6 +31,7 @@
 }
 
 extern bool drawAsciiPaths(const SkPath& one, const SkPath& two, bool drawPaths);
+extern void markTestFlakyForPathKit();
 extern void showOp(const SkPathOp op);
 extern bool testPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
                        const SkPathOp , const char* testName);
diff --git a/tests/PathOpsOpTest.cpp b/tests/PathOpsOpTest.cpp
index cf2064a..6632a02 100644
--- a/tests/PathOpsOpTest.cpp
+++ b/tests/PathOpsOpTest.cpp
@@ -2213,6 +2213,7 @@
     pathB.moveTo(0,2);
     pathB.cubicTo(4,6, 1,0, 2,0);
     pathB.close();
+    markTestFlakyForPathKit();
     testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
 }
 
diff --git a/tests/PathOpsSimplifyTest.cpp b/tests/PathOpsSimplifyTest.cpp
index e758cfb..4ef7ac1 100644
--- a/tests/PathOpsSimplifyTest.cpp
+++ b/tests/PathOpsSimplifyTest.cpp
@@ -2443,6 +2443,7 @@
     path.lineTo(0, 0);
     path.quadTo(3, 0, 1, 2);
     path.close();
+    markTestFlakyForPathKit();
     testSimplify(reporter, path, filename);
 }
 
@@ -2730,6 +2731,7 @@
     path.lineTo(1, 1);
     path.quadTo(2, 1, 1, 2);
     path.close();
+    markTestFlakyForPathKit();
     testSimplify(reporter, path, filename);
 }
 
@@ -2992,6 +2994,7 @@
     path.lineTo(1, 1);
     path.quadTo(3, 2, 2, 3);
     path.close();
+    markTestFlakyForPathKit();
     testSimplify(reporter, path, filename);
 }
 
@@ -3580,6 +3583,7 @@
     path.lineTo(0, 1);
     path.lineTo(1, 2);
     path.close();
+    markTestFlakyForPathKit();
     testSimplify(reporter, path, filename);
 }
 
diff --git a/tests/skia_test.cpp b/tests/skia_test.cpp
index 7dfe003..99f9609 100644
--- a/tests/skia_test.cpp
+++ b/tests/skia_test.cpp
@@ -143,6 +143,7 @@
         PathOpsDebug::gOut = fopen(FLAGS_json[0], "wb");
         fprintf(PathOpsDebug::gOut, "{\n");
         FLAGS_threads = 0;
+        PathOpsDebug::gMarkJsonFlaky = false;
     }
     SetupCrashHandler();