Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Unified Diff: gm/rebaseline_server/base_unittest.py

Issue 274623002: make compare_rendered_pictures_test.py run end-to-end test (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use subprocess.check_output() Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gm/rebaseline_server/compare_rendered_pictures_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/rebaseline_server/base_unittest.py
diff --git a/gm/rebaseline_server/base_unittest.py b/gm/rebaseline_server/base_unittest.py
index eec0c8da0a4e836a97392482e2054baf02ad59c1..0699db65d0af8e754b650b2f1e08dc9dd71787bc 100755
--- a/gm/rebaseline_server/base_unittest.py
+++ b/gm/rebaseline_server/base_unittest.py
@@ -17,6 +17,7 @@ import tempfile
import unittest
PARENT_DIR = os.path.dirname(os.path.realpath(__file__))
+TRUNK_DIR = os.path.dirname(os.path.dirname(PARENT_DIR))
TESTDATA_DIR = os.path.join(PARENT_DIR, 'testdata')
OUTPUT_DIR_ACTUAL = os.path.join(TESTDATA_DIR, 'outputs', 'actual')
OUTPUT_DIR_EXPECTED = os.path.join(TESTDATA_DIR, 'outputs', 'expected')
@@ -59,6 +60,30 @@ class TestCase(unittest.TestCase):
"""Tell unittest framework to not print docstrings for test cases."""
return None
+ def find_path_to_program(self, program):
+ """Returns path to an existing program binary.
+
+ Args:
+ program: Basename of the program to find (e.g., 'render_pictures').
+
+ Returns:
+ Absolute path to the program binary, as a string.
+
+ Raises:
+ Exception: unable to find the program binary.
+ """
+ possible_paths = [os.path.join(TRUNK_DIR, 'out', 'Release', program),
+ os.path.join(TRUNK_DIR, 'out', 'Debug', program),
+ os.path.join(TRUNK_DIR, 'out', 'Release',
+ program + '.exe'),
+ os.path.join(TRUNK_DIR, 'out', 'Debug',
+ program + '.exe')]
+ for try_path in possible_paths:
+ if os.path.isfile(try_path):
+ return try_path
+ raise Exception('cannot find %s in paths %s; maybe you need to '
+ 'build %s?' % (program, possible_paths, program))
+
def create_empty_dir(path):
"""Create an empty directory at the given path."""
« no previous file with comments | « no previous file | gm/rebaseline_server/compare_rendered_pictures_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698