diff options
author | caryclark <caryclark@google.com> | 2015-05-13 10:13:17 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-13 10:13:17 -0700 |
commit | 38a017bf44aa1ad25291ad0cbb4ccbe8bd31ab0b (patch) | |
tree | 0b0d4162932dd39d9e8508a2a3579aeab46f0eda /tests | |
parent | 8780bc65bd5a53a38ac4b0a53a5fb283e066ec40 (diff) |
clean up tests
Confirm that no path ops tests are flaky, and clean up errors around
that. The test framework was incorrectly checking for >= MAX_ERRORS for
failure and <= MAX_ERRORS for success.
TBR=reed@google.com
Review URL: https://codereview.chromium.org/1140563003
Diffstat (limited to 'tests')
-rw-r--r-- | tests/PathOpsExtendedTest.cpp | 37 | ||||
-rw-r--r-- | tests/PathOpsExtendedTest.h | 4 | ||||
-rwxr-xr-x | tests/PathOpsFuzz763Test.cpp | 2 | ||||
-rw-r--r-- | tests/PathOpsOpCircleThreadedTest.cpp | 2 | ||||
-rw-r--r-- | tests/PathOpsOpCubicThreadedTest.cpp | 2 | ||||
-rwxr-xr-x | tests/PathOpsOpLoopThreadedTest.cpp | 2 | ||||
-rw-r--r-- | tests/PathOpsOpRectThreadedTest.cpp | 2 |
7 files changed, 15 insertions, 36 deletions
diff --git a/tests/PathOpsExtendedTest.cpp b/tests/PathOpsExtendedTest.cpp index d2a677784c..a8079cf0a9 100644 --- a/tests/PathOpsExtendedTest.cpp +++ b/tests/PathOpsExtendedTest.cpp @@ -322,16 +322,16 @@ void ShowTestArray(const char* testName) { } SK_DECLARE_STATIC_MUTEX(compareDebugOut3); -SK_DECLARE_STATIC_MUTEX(compareDebugOut4); + static int comparePaths(skiatest::Reporter* reporter, const char* testName, const SkPath& one, const SkPath& scaledOne, const SkPath& two, const SkPath& scaledTwo, SkBitmap& bitmap, const SkPath& a, const SkPath& b, const SkPathOp shapeOp, const SkMatrix& scale, - bool expectSuccess, bool flaky) { + bool expectSuccess) { int errors2x2; const int MAX_ERRORS = 8; (void) pathsDrawTheSame(bitmap, scaledOne, scaledTwo, errors2x2); if (!expectSuccess) { - if (errors2x2 <= MAX_ERRORS && !flaky) { + if (errors2x2 < MAX_ERRORS) { REPORTER_ASSERT(reporter, 0); } return 0; @@ -339,20 +339,14 @@ static int comparePaths(skiatest::Reporter* reporter, const char* testName, cons if (errors2x2 == 0) { return 0; } - if (flaky) { - return 0; - } - if (errors2x2 > MAX_ERRORS) { + if (errors2x2 >= MAX_ERRORS) { SkAutoMutexAcquire autoM(compareDebugOut3); showPathOpPath(testName, one, two, a, b, scaledOne, scaledTwo, shapeOp, scale); SkDebugf("\n/*"); REPORTER_ASSERT(reporter, 0); SkDebugf(" */\n"); - } else if (errors2x2 == MAX_ERRORS || errors2x2 == MAX_ERRORS - 1) { - SkAutoMutexAcquire autoM(compareDebugOut4); - showPathOpPath(testName, one, two, a, b, scaledOne, scaledTwo, shapeOp, scale); } - return errors2x2 > MAX_ERRORS ? errors2x2 : 0; + return errors2x2 >= MAX_ERRORS ? errors2x2 : 0; } // Default values for when reporter->verbose() is false. @@ -498,8 +492,7 @@ static void showName(const SkPath& a, const SkPath& b, const SkPathOp shapeOp) { bool OpDebug(const SkPath& one, const SkPath& two, SkPathOp op, SkPath* result, bool expectSuccess); static bool innerPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b, - const SkPathOp shapeOp, const char* testName, bool threaded, bool expectSuccess, - bool flaky) { + const SkPathOp shapeOp, const char* testName, bool expectSuccess) { #if 0 && DEBUG_SHOW_TEST_NAME showName(a, b, shapeOp); #endif @@ -537,29 +530,24 @@ static bool innerPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkP scaledOut.addPath(out, scale); scaledOut.setFillType(out.getFillType()); int result = comparePaths(reporter, testName, pathOut, scaledPathOut, out, scaledOut, bitmap, - a, b, shapeOp, scale, expectSuccess, flaky); + a, b, shapeOp, scale, expectSuccess); reporter->bumpTestCount(); return result == 0; } bool testPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b, const SkPathOp shapeOp, const char* testName) { - return innerPathOp(reporter, a, b, shapeOp, testName, false, true, false); -} - -bool testPathOpFlaky(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b, - const SkPathOp shapeOp, const char* testName) { - return innerPathOp(reporter, a, b, shapeOp, testName, false, true, true); + return innerPathOp(reporter, a, b, shapeOp, testName, true); } bool testPathOpCheck(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b, const SkPathOp shapeOp, const char* testName, bool checkFail) { - return innerPathOp(reporter, a, b, shapeOp, testName, false, checkFail, false); + return innerPathOp(reporter, a, b, shapeOp, testName, checkFail); } bool testPathOpFailCheck(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b, const SkPathOp shapeOp, const char* testName) { - return innerPathOp(reporter, a, b, shapeOp, testName, false, false, true); + return innerPathOp(reporter, a, b, shapeOp, testName, false); } bool testPathFailOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b, @@ -579,11 +567,6 @@ bool testPathFailOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& return true; } -bool testThreadedPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b, - const SkPathOp shapeOp, const char* testName) { - return innerPathOp(reporter, a, b, shapeOp, testName, true, true, false); -} - SK_DECLARE_STATIC_MUTEX(gMutex); void initializeTests(skiatest::Reporter* reporter, const char* test) { diff --git a/tests/PathOpsExtendedTest.h b/tests/PathOpsExtendedTest.h index 46ee03b193..a604761a7d 100644 --- a/tests/PathOpsExtendedTest.h +++ b/tests/PathOpsExtendedTest.h @@ -37,12 +37,8 @@ extern bool testPathOpCheck(skiatest::Reporter* reporter, const SkPath& a, const const SkPathOp , const char* testName, bool checkFail); extern bool testPathOpFailCheck(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b, const SkPathOp , const char* testName); -extern bool testPathOpFlaky(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b, - const SkPathOp , const char* testName); extern bool testPathFailOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b, const SkPathOp , const char* testName); -extern bool testThreadedPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b, - const SkPathOp , const char* testName); extern bool testSimplify(SkPath& path, bool useXor, SkPath& out, PathOpsThreadState& state, const char* pathStr); extern bool testSimplify(skiatest::Reporter* reporter, const SkPath& path, const char* filename); diff --git a/tests/PathOpsFuzz763Test.cpp b/tests/PathOpsFuzz763Test.cpp index f782941d14..55525734fc 100755 --- a/tests/PathOpsFuzz763Test.cpp +++ b/tests/PathOpsFuzz763Test.cpp @@ -2198,7 +2198,7 @@ path.quadTo(SkBits2Float(0x424a2ff8), SkBits2Float(0xc02cd470), SkBits2Float(0x4 path.close(); SkPath path2(path); - testPathOpFlaky(reporter, path1, path2, (SkPathOp) 2, filename); + testPathOp(reporter, path1, path2, (SkPathOp) 2, filename); } static void fuzz763_2674194(skiatest::Reporter* reporter, const char* filename) { diff --git a/tests/PathOpsOpCircleThreadedTest.cpp b/tests/PathOpsOpCircleThreadedTest.cpp index 73abdec438..0bb75cc021 100644 --- a/tests/PathOpsOpCircleThreadedTest.cpp +++ b/tests/PathOpsOpCircleThreadedTest.cpp @@ -53,7 +53,7 @@ static void testOpCirclesMain(PathOpsThreadState* data) { if (progress) { outputProgress(state.fPathStr, pathStr, (SkPathOp) op); } - testThreadedPathOp(state.fReporter, pathA, pathB, (SkPathOp) op, "circles"); + testPathOp(state.fReporter, pathA, pathB, (SkPathOp) op, "circles"); } } } diff --git a/tests/PathOpsOpCubicThreadedTest.cpp b/tests/PathOpsOpCubicThreadedTest.cpp index 26617b885f..12eb71b906 100644 --- a/tests/PathOpsOpCubicThreadedTest.cpp +++ b/tests/PathOpsOpCubicThreadedTest.cpp @@ -64,7 +64,7 @@ static void testOpCubicsMain(PathOpsThreadState* data) { SkPathOpsDebug::OpStr((SkPathOp) op)); str += sprintf(str, "}\n"); } - if (!testThreadedPathOp(state.fReporter, pathA, pathB, (SkPathOp) op, "cubics")) { + if (!testPathOp(state.fReporter, pathA, pathB, (SkPathOp) op, "cubics")) { if (progress) { ++loopNo; goto skipToNext; diff --git a/tests/PathOpsOpLoopThreadedTest.cpp b/tests/PathOpsOpLoopThreadedTest.cpp index d8689bfc17..3f6d081e5d 100755 --- a/tests/PathOpsOpLoopThreadedTest.cpp +++ b/tests/PathOpsOpLoopThreadedTest.cpp @@ -85,7 +85,7 @@ static void testOpLoopsMain(PathOpsThreadState* data) { if (progress) { outputProgress(state.fPathStr, pathStr, kIntersect_SkPathOp); } - testThreadedPathOp(state.fReporter, pathA, pathB, kIntersect_SkPathOp, "loops"); + testPathOp(state.fReporter, pathA, pathB, kIntersect_SkPathOp, "loops"); } } } diff --git a/tests/PathOpsOpRectThreadedTest.cpp b/tests/PathOpsOpRectThreadedTest.cpp index d2fb1185ac..9195e4a616 100644 --- a/tests/PathOpsOpRectThreadedTest.cpp +++ b/tests/PathOpsOpRectThreadedTest.cpp @@ -71,7 +71,7 @@ static void testPathOpsRectsMain(PathOpsThreadState* data) if (progress) { outputProgress(state.fPathStr, pathStr, (SkPathOp) op); } - testThreadedPathOp(state.fReporter, pathA, pathB, (SkPathOp) op, "rects"); + testPathOp(state.fReporter, pathA, pathB, (SkPathOp) op, "rects"); } } } |