| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright 2013 Google Inc. | 2  * Copyright 2013 Google Inc. | 
| 3  * | 3  * | 
| 4  * Use of this source code is governed by a BSD-style license that can be | 4  * Use of this source code is governed by a BSD-style license that can be | 
| 5  * found in the LICENSE file. | 5  * found in the LICENSE file. | 
| 6  */ | 6  */ | 
| 7 | 7 | 
| 8 #include "DMJsonWriter.h" | 8 #include "DMJsonWriter.h" | 
| 9 #include "DMSrcSink.h" | 9 #include "DMSrcSink.h" | 
| 10 #include "DMSrcSinkAndroid.h" | 10 #include "DMSrcSinkAndroid.h" | 
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 64 | 64 | 
| 65 DEFINE_string2(readPath, r, "", "If set check for equality with golden results i
      n this directory."); | 65 DEFINE_string2(readPath, r, "", "If set check for equality with golden results i
      n this directory."); | 
| 66 | 66 | 
| 67 DEFINE_string(uninterestingHashesFile, "", | 67 DEFINE_string(uninterestingHashesFile, "", | 
| 68         "File containing a list of uninteresting hashes. If a result hashes to s
      omething in " | 68         "File containing a list of uninteresting hashes. If a result hashes to s
      omething in " | 
| 69         "this list, no image is written for that result."); | 69         "this list, no image is written for that result."); | 
| 70 | 70 | 
| 71 DEFINE_int32(shards, 1, "We're splitting source data into this many shards."); | 71 DEFINE_int32(shards, 1, "We're splitting source data into this many shards."); | 
| 72 DEFINE_int32(shard,  0, "Which shard do I run?"); | 72 DEFINE_int32(shard,  0, "Which shard do I run?"); | 
| 73 | 73 | 
|  | 74 DEFINE_string2(solo, s, nullptr, | 
|  | 75                "Run the specified tests alone, before creating multiple threads.
      \n" | 
|  | 76                "Test names must match exactly.  Multiple tests may be separated 
      by spaces."); | 
|  | 77 | 
| 74 DEFINE_string(mskps, "", "Directory to read mskps from, or a single mskp file.")
      ; | 78 DEFINE_string(mskps, "", "Directory to read mskps from, or a single mskp file.")
      ; | 
| 75 | 79 | 
| 76 DEFINE_string(svgs, "", "Directory to read SVGs from, or a single SVG file."); | 80 DEFINE_string(svgs, "", "Directory to read SVGs from, or a single SVG file."); | 
| 77 | 81 | 
| 78 using namespace DM; | 82 using namespace DM; | 
| 79 using sk_gpu_test::GrContextFactory; | 83 using sk_gpu_test::GrContextFactory; | 
| 80 using sk_gpu_test::GLTestContext; | 84 using sk_gpu_test::GLTestContext; | 
| 81 using sk_gpu_test::ContextInfo; | 85 using sk_gpu_test::ContextInfo; | 
| 82 | 86 | 
| 83 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ~~~~~~~~~~~~~~~~*/ | 87 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ~~~~~~~~~~~~~~~~*/ | 
| (...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1199                 return; | 1203                 return; | 
| 1200             } | 1204             } | 
| 1201         } | 1205         } | 
| 1202     } | 1206     } | 
| 1203 }; | 1207 }; | 
| 1204 | 1208 | 
| 1205 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ~~~~~~~~~~~~~~~~*/ | 1209 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ~~~~~~~~~~~~~~~~*/ | 
| 1206 | 1210 | 
| 1207 // Unit tests don't fit so well into the Src/Sink model, so we give them special
       treatment. | 1211 // Unit tests don't fit so well into the Src/Sink model, so we give them special
       treatment. | 
| 1208 | 1212 | 
| 1209 static SkTDArray<skiatest::Test> gParallelTests, gSerialTests; | 1213 static SkTDArray<skiatest::Test> gParallelTests, gSerialTests, gSoloTests; | 
| 1210 | 1214 | 
| 1211 static void gather_tests() { | 1215 static void gather_tests() { | 
| 1212     if (!FLAGS_src.contains("tests")) { | 1216     if (!FLAGS_src.contains("tests")) { | 
| 1213         return; | 1217         return; | 
| 1214     } | 1218     } | 
| 1215     for (const skiatest::TestRegistry* r = skiatest::TestRegistry::Head(); r; r 
      = r->next()) { | 1219     for (const skiatest::TestRegistry* r = skiatest::TestRegistry::Head(); r; r 
      = r->next()) { | 
| 1216         if (!in_shard()) { | 1220         if (!in_shard()) { | 
| 1217             continue; | 1221             continue; | 
| 1218         } | 1222         } | 
| 1219         // Despite its name, factory() is returning a reference to | 1223         // Despite its name, factory() is returning a reference to | 
| 1220         // link-time static const POD data. | 1224         // link-time static const POD data. | 
| 1221         const skiatest::Test& test = r->factory(); | 1225         const skiatest::Test& test = r->factory(); | 
| 1222         if (SkCommandLineFlags::ShouldSkip(FLAGS_match, test.name)) { | 1226         if (SkCommandLineFlags::ShouldSkip(FLAGS_match, test.name)) { | 
| 1223             continue; | 1227             continue; | 
| 1224         } | 1228         } | 
|  | 1229         if (FLAGS_solo.contains(test.name)) { | 
|  | 1230             gSoloTests.push(test); | 
|  | 1231             continue; | 
|  | 1232         } | 
| 1225         if (test.needsGpu && gpu_supported()) { | 1233         if (test.needsGpu && gpu_supported()) { | 
| 1226             (FLAGS_gpu_threading ? gParallelTests : gSerialTests).push(test); | 1234             (FLAGS_gpu_threading ? gParallelTests : gSerialTests).push(test); | 
| 1227         } else if (!test.needsGpu && FLAGS_cpu) { | 1235         } else if (!test.needsGpu && FLAGS_cpu) { | 
| 1228             gParallelTests.push(test); | 1236             gParallelTests.push(test); | 
| 1229         } | 1237         } | 
| 1230     } | 1238     } | 
| 1231 } | 1239 } | 
| 1232 | 1240 | 
| 1233 static void run_test(skiatest::Test test) { | 1241 static void run_test(skiatest::Test test) { | 
| 1234     struct : public skiatest::Reporter { | 1242     struct : public skiatest::Reporter { | 
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1310     gather_gold(); | 1318     gather_gold(); | 
| 1311     gather_uninteresting_hashes(); | 1319     gather_uninteresting_hashes(); | 
| 1312 | 1320 | 
| 1313     if (!gather_srcs()) { | 1321     if (!gather_srcs()) { | 
| 1314         return 1; | 1322         return 1; | 
| 1315     } | 1323     } | 
| 1316     if (!gather_sinks()) { | 1324     if (!gather_sinks()) { | 
| 1317         return 1; | 1325         return 1; | 
| 1318     } | 1326     } | 
| 1319     gather_tests(); | 1327     gather_tests(); | 
|  | 1328 | 
|  | 1329     // First, run memory intensive tests serially. | 
|  | 1330     if (gSoloTests.count() > 0) { | 
|  | 1331         info("Running %d tests serially...\n", gSoloTests.count()); | 
|  | 1332         for (auto test : gSoloTests) { run_test(test); } | 
|  | 1333     } | 
|  | 1334 | 
| 1320     gPending = gSrcs.count() * gSinks.count() + gParallelTests.count() + gSerial
      Tests.count(); | 1335     gPending = gSrcs.count() * gSinks.count() + gParallelTests.count() + gSerial
      Tests.count(); | 
| 1321     info("%d srcs * %d sinks + %d tests == %d tasks", | 1336     info("%d srcs * %d sinks + %d tests == %d tasks", | 
| 1322          gSrcs.count(), gSinks.count(), gParallelTests.count() + gSerialTests.co
      unt(), gPending); | 1337          gSrcs.count(), gSinks.count(), gParallelTests.count() + gSerialTests.co
      unt(), gPending); | 
| 1323     SkAutoTDelete<SkThread> statusThread(start_status_thread()); | 1338     SkAutoTDelete<SkThread> statusThread(start_status_thread()); | 
| 1324 | 1339 | 
| 1325     // Kick off as much parallel work as we can, making note of any serial work 
      we'll need to do. | 1340     // Kick off as much parallel work as we can, making note of any serial work 
      we'll need to do. | 
| 1326     SkTaskGroup parallel; | 1341     SkTaskGroup parallel; | 
| 1327     SkTArray<Task> serial; | 1342     SkTArray<Task> serial; | 
| 1328 | 1343 | 
| 1329     for (auto& sink : gSinks) | 1344     for (auto& sink : gSinks) | 
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1435 #endif | 1450 #endif | 
| 1436 } | 1451 } | 
| 1437 } // namespace skiatest | 1452 } // namespace skiatest | 
| 1438 | 1453 | 
| 1439 #if !defined(SK_BUILD_FOR_IOS) | 1454 #if !defined(SK_BUILD_FOR_IOS) | 
| 1440 int main(int argc, char** argv) { | 1455 int main(int argc, char** argv) { | 
| 1441     SkCommandLineFlags::Parse(argc, argv); | 1456     SkCommandLineFlags::Parse(argc, argv); | 
| 1442     return dm_main(); | 1457     return dm_main(); | 
| 1443 } | 1458 } | 
| 1444 #endif | 1459 #endif | 
| OLD | NEW | 
|---|