340 {
342
343
344
345
346
347 std::string testUndeclaredOutputsDir;
348 if (
char* envVar =
std::getenv(
"TEST_UNDECLARED_OUTPUTS_DIR")) {
349 testUndeclaredOutputsDir = envVar;
350 }
351 bool isBazelTest = !testUndeclaredOutputsDir.empty();
352
353
355 if (!isBazelTest) {
357 }
366
367 std::string outputDir =
368 FLAGS_outputDir.isEmpty() ? testUndeclaredOutputsDir : FLAGS_outputDir[0];
369
370 auto knownDigests = std::set<std::string>();
371 if (!FLAGS_knownDigestsFile.isEmpty()) {
374 "Read %zu known digests from: %s", knownDigests.size(), FLAGS_knownDigestsFile[0]);
375 }
376
377 std::map<std::string, std::string> keyValuePairs;
378 for (
int i = 1;
i < FLAGS_key.size();
i += 2) {
379 keyValuePairs[FLAGS_key[
i - 1]] = FLAGS_key[
i];
380 }
381 std::string config = FLAGS_surfaceConfig[0];
382 std::string cpuName = FLAGS_cpuName.isEmpty() ? "" : FLAGS_cpuName[0];
383 std::string gpuName = FLAGS_gpuName.isEmpty() ? "" : FLAGS_gpuName[0];
384
385
387 std::string errorMsg =
f();
388 if (errorMsg != "") {
389 SK_ABORT(
"Error while gathering GMs: %s", errorMsg.c_str());
390 }
391 }
393 std::unique_ptr<skiagm::GM> gm =
f();
394
398 continue;
399 }
400
401 run_gm(std::move(gm), config, keyValuePairs, cpuName, gpuName, outputDir, knownDigests);
402 }
403
404
405
408 "%d successful GMs (images written to %s).",
gNumSuccessfulGMs, outputDir.c_str());
412}
void run_gm(std::unique_ptr< skiagm::GM > gm, std::string config, std::map< std::string, std::string > keyValuePairs, std::string cpuName, std::string gpuName, std::string outputDir, std::set< std::string > knownDigests)
static int gNumSkippedGMs
static int gNumSuccessfulGMs
std::set< std::string > read_known_digests_file(std::string path)
#define SK_ABORT(message,...)
static void Parse(int argc, const char *const *argv)
void StringEven(std::string name, CommandLineFlags::StringArray flag)
void StringNonEmpty(std::string name, CommandLineFlags::StringArray flag)
void StringAtMostOne(std::string name, CommandLineFlags::StringArray flag)
bool ShouldRunTestCase(const char *name, CommandLineFlags::StringArray &matchFlag, CommandLineFlags::StringArray &skipFlag)
void Log(const char *format,...) SK_PRINTF_LIKE(1
void InitAndLogCmdlineArgs(int argc, char **argv)
std::function< std::unique_ptr< skiagm::GM >()> GMFactory
std::function< std::string()> GMRegistererFn