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

Side by Side Diff: compute_engine_scripts/telemetry/telemetry_slave_scripts/write_json_summary_test.py

Issue 183763025: vm_run_skia_try/write_json_summary: run skpdiff within imagediffdb, not on its own (Closed) Base URL: https://skia.googlesource.com/buildbot.git@master
Patch Set: ravi's comments Created 6 years, 9 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 unified diff | Download patch
« no previous file with comments | « compute_engine_scripts/telemetry/telemetry_slave_scripts/write_json_summary.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Tests for module write_json_summary.py""" 6 """Tests for module write_json_summary.py"""
7 7
8 import filecmp 8 import filecmp
9 import os 9 import os
10 import shutil 10 import shutil
11 import tempfile 11 import tempfile
12 import unittest 12 import unittest
13 13
14 import write_json_summary 14 import write_json_summary
15 15
16 16
17 class TestWriteJsonSummary(unittest.TestCase): 17 class TestWriteJsonSummary(unittest.TestCase):
18 18
19 def setUp(self): 19 def setUp(self):
20 self._test_json_dir = os.path.join( 20 self._test_json_dir = os.path.join(
21 os.path.dirname(os.path.realpath(__file__)), 'test_data') 21 os.path.dirname(os.path.realpath(__file__)), 'test_data')
22 self._output_file_name = 'summary.json' 22 self._output_file_name = 'summary.json'
23 self._gm_json_path = os.path.join(self._test_json_dir, 'gm_json_mock.py') 23 self._gm_json_path = os.path.join(self._test_json_dir, 'gm_json_mock.py')
24 self._imagediffdb_path = os.path.join(self._test_json_dir, 24 self._imagediffdb_path = os.path.join(self._test_json_dir,
25 'imagediffdb_mock.py') 25 'imagediffdb_mock.py')
26 self._skpdiff_output_csv = os.path.join(self._test_json_dir, 'output.csv')
27 self._actual_output_dir = tempfile.mkdtemp() 26 self._actual_output_dir = tempfile.mkdtemp()
28 self._actual_output_file_path = os.path.join(self._actual_output_dir, 27 self._actual_output_file_path = os.path.join(self._actual_output_dir,
29 self._output_file_name) 28 self._output_file_name)
30 self._gs_output_dir = 'gs://dummy-bucket/output-dir' 29 self._gs_output_dir = 'gs://dummy-bucket/output-dir'
31 self._gs_skp_dir = 'gs://dummy-bucket/skps' 30 self._gs_skp_dir = 'gs://dummy-bucket/skps'
32 self._img_root = '/tmp/' 31 self._img_root = '/tmp/'
33 self._nopatch_img_dir_name = 'nopatch' 32 self._nopatch_images_base_url = 'file://fake/path/to/nopatch'
34 self._withpatch_img_dir_name = 'withpatch' 33 self._withpatch_images_base_url = 'file://fake/path/to/withpatch'
35 self._slave_num = 1 34 self._slave_num = 1
36 35
37 def tearDown(self): 36 def tearDown(self):
38 shutil.rmtree(self._actual_output_dir) 37 shutil.rmtree(self._actual_output_dir)
39 38
40 def test_DifferentFiles(self): 39 def test_DifferentFiles(self):
41 write_json_summary.WriteJsonSummary( 40 write_json_summary.WriteJsonSummary(
42 img_root=self._img_root, 41 img_root=self._img_root,
43 nopatch_json=os.path.join(self._test_json_dir, 'output1.json'), 42 nopatch_json=os.path.join(self._test_json_dir, 'output1.json'),
44 nopatch_img_dir_name=self._nopatch_img_dir_name, 43 nopatch_images_base_url=self._nopatch_images_base_url,
45 withpatch_json=os.path.join(self._test_json_dir, 'output2.json'), 44 withpatch_json=os.path.join(self._test_json_dir, 'output2.json'),
46 withpatch_img_dir_name=self._withpatch_img_dir_name, 45 withpatch_images_base_url=self._withpatch_images_base_url,
47 output_file_path=self._actual_output_file_path, 46 output_file_path=self._actual_output_file_path,
48 gs_output_dir=self._gs_output_dir, 47 gs_output_dir=self._gs_output_dir,
49 gs_skp_dir=self._gs_skp_dir, 48 gs_skp_dir=self._gs_skp_dir,
50 slave_num=self._slave_num, 49 slave_num=self._slave_num,
51 gm_json_path=self._gm_json_path, 50 gm_json_path=self._gm_json_path,
52 imagediffdb_path=self._imagediffdb_path, 51 imagediffdb_path=self._imagediffdb_path)
53 skpdiff_output_csv=self._skpdiff_output_csv)
54 52
55 self.assertTrue( 53 self.assertTrue(
56 filecmp.cmp(os.path.join(self._test_json_dir, self._output_file_name), 54 filecmp.cmp(os.path.join(self._test_json_dir, self._output_file_name),
57 self._actual_output_file_path)) 55 self._actual_output_file_path))
58 56
59 def test_NoDifferentFiles(self): 57 def test_NoDifferentFiles(self):
60 write_json_summary.WriteJsonSummary( 58 write_json_summary.WriteJsonSummary(
61 img_root=self._img_root, 59 img_root=self._img_root,
62 nopatch_json=os.path.join(self._test_json_dir, 'output1.json'), 60 nopatch_json=os.path.join(self._test_json_dir, 'output1.json'),
63 nopatch_img_dir_name=self._nopatch_img_dir_name, 61 nopatch_images_base_url=self._nopatch_images_base_url,
64 withpatch_json=os.path.join(self._test_json_dir, 'output1.json'), 62 withpatch_json=os.path.join(self._test_json_dir, 'output1.json'),
65 withpatch_img_dir_name=self._withpatch_img_dir_name, 63 withpatch_images_base_url=self._withpatch_images_base_url,
66 output_file_path=self._actual_output_file_path, 64 output_file_path=self._actual_output_file_path,
67 gs_output_dir=self._gs_output_dir, 65 gs_output_dir=self._gs_output_dir,
68 gs_skp_dir=self._gs_skp_dir, 66 gs_skp_dir=self._gs_skp_dir,
69 slave_num=self._slave_num, 67 slave_num=self._slave_num,
70 gm_json_path=self._gm_json_path, 68 gm_json_path=self._gm_json_path,
71 imagediffdb_path=self._imagediffdb_path, 69 imagediffdb_path=self._imagediffdb_path)
72 skpdiff_output_csv=self._skpdiff_output_csv)
73 70
74 self.assertFalse(os.path.isfile(self._actual_output_file_path)) 71 self.assertFalse(os.path.isfile(self._actual_output_file_path))
75 72
76 73
77 if __name__ == '__main__': 74 if __name__ == '__main__':
78 unittest.main() 75 unittest.main()
79
OLDNEW
« no previous file with comments | « compute_engine_scripts/telemetry/telemetry_slave_scripts/write_json_summary.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698