FM, a dumber new testing tool

FM's a bit like DM, and a bit like the old GM tool, maybe closer to GM.

FM always does one serial run through of a list of GM, image, or .skp
sources (-s/--sources) into one drawing configuration, set at a high
level with -b/--backend, fine-tuned by flags like --ct, --at, --gamut,
--samples, etc.

FM prints all available GMs when run with no arguments, part of
how it integrates well with external parallelization like xargs:

   out/fm | time xargs -n4 -P32 out/fm -b cpu ... -s
   out/fm | time xargs -n32 -P8 out/fm -b gl ... -s
   ls *.skp | xargs ... out/fm ... -s
   ...

TODO later:
   vector backends: --backend pdf, svg, xps, skp
   --source *.svg, *.json (Skottie)
   Create/update a dm.json file

Change-Id: Idacbd2785deaf6f1d33674c66c4d984fa91dbd85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203520
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index 7ee1d9b..7e67d9d 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1850,6 +1850,34 @@
         ":skia",
       ]
     }
+    test_lib("hash_and_encode") {
+      public_include_dirs = [ "tools" ]
+      sources = [
+        "tools/HashAndEncode.cpp",
+        "tools/HashAndEncode.h",
+      ]
+      deps = [
+        ":flags",
+        ":skia",
+        "//third_party/libpng",
+      ]
+    }
+    test_app("fm") {
+      sources = [
+        "tools/fm/fm.cpp",
+      ]
+      deps = [
+        ":common_flags_aa",
+        ":common_flags_gpu",
+        ":flags",
+        ":gm",
+        ":gpu_tool_utils",
+        ":hash_and_encode",
+        ":skia",
+        ":tool_utils",
+        ":trace",
+      ]
+    }
     test_app("dm") {
       sources = [
         "dm/DM.cpp",
@@ -1866,6 +1894,7 @@
         ":flags",
         ":gm",
         ":gpu_tool_utils",
+        ":hash_and_encode",
         ":skia",
         ":tests",
         ":tool_utils",
@@ -1873,7 +1902,6 @@
         "modules/skottie",
         "modules/skottie:utils",
         "modules/sksg",
-        "//third_party/libpng",
       ]
 
       # NIMA does not build on Windows clang