Ensures that the gold output directory exists This will land after this CL https://chromium-review.googlesource.com/c/424575/ as a way of making sure it works as intended. TBR=borenet BUG=skia:5973 Review-Url: https://codereview.chromium.org/2629943002
diff --git a/testing/tools/gold.py b/testing/tools/gold.py index fda63b6..7598caf 100644 --- a/testing/tools/gold.py +++ b/testing/tools/gold.py
@@ -67,6 +67,10 @@ self._results = [] self._outputDir = outputDir + # make sure the output directory exists. + if not os.path.exists(outputDir): + os.makedirs(outputDir) + def AddTestResult(self, testName, md5Hash, outputImagePath): # Copy the image to <output_dir>/<md5Hash>.<image_extension> imgExt = os.path.splitext(outputImagePath)[1].lstrip(".")
diff --git a/testing/tools/test_runner.py b/testing/tools/test_runner.py index fad7a9c..92db911 100644 --- a/testing/tools/test_runner.py +++ b/testing/tools/test_runner.py
@@ -127,10 +127,11 @@ def HandleResult(self, input_filename, input_path, result): if self.gold_results: success, image_paths = result - for img_path, md5_hash in image_paths: - # the output filename (without extension becomes the test name) - test_name = os.path.splitext(os.path.split(img_path)[1])[0] - self.gold_results.AddTestResult(test_name, md5_hash, img_path) + if image_paths: + for img_path, md5_hash in image_paths: + # the output filename (without extension becomes the test name) + test_name = os.path.splitext(os.path.split(img_path)[1])[0] + self.gold_results.AddTestResult(test_name, md5_hash, img_path) if self.test_suppressor.IsResultSuppressed(input_filename): if result: