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

Side by Side Diff: Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py

Issue 489093002: Enabling archiving of test results by default in run-webkit-tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added unit_tests Created 6 years, 3 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
OLDNEW
1 # Copyright (C) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 Google Inc. All rights reserved.
2 # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sze ged 2 # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sze ged
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 port = host.port_factory.get('test-mac-leopard') 115 port = host.port_factory.get('test-mac-leopard')
116 manager = Manager(port, options=MockOptions(test_list=None, http=Tru e, max_locked_shards=1), printer=FakePrinter()) 116 manager = Manager(port, options=MockOptions(test_list=None, http=Tru e, max_locked_shards=1), printer=FakePrinter())
117 return manager 117 return manager
118 host = MockHost() 118 host = MockHost()
119 port = host.port_factory.get('test-mac-leopard') 119 port = host.port_factory.get('test-mac-leopard')
120 tests = ['failures/expected/crash.html'] 120 tests = ['failures/expected/crash.html']
121 expectations = test_expectations.TestExpectations(port, tests) 121 expectations = test_expectations.TestExpectations(port, tests)
122 run_results = TestRunResults(expectations, len(tests)) 122 run_results = TestRunResults(expectations, len(tests))
123 manager = get_manager() 123 manager = get_manager()
124 manager._look_for_new_crash_logs(run_results, time.time()) 124 manager._look_for_new_crash_logs(run_results, time.time())
125
126 def _make_fake_test_result(self, host, results_directory):
127 host.filesystem.maybe_make_directory(results_directory)
128 host.filesystem.write_binary_file(results_directory + '/results.html', ' This is a test results file')
129
130 def test_rename_results_folder(self):
131 host = MockHost()
132 port = host.port_factory.get('test-mac-leopard')
133
134 def get_manager():
135 manager = Manager(port, options=MockOptions(max_locked_shards=1), pr inter=FakePrinter())
136 return manager
137 self._make_fake_test_result(port.host, '/tmp/layout-test-results')
138 self.assertTrue(port.host.filesystem.exists('/tmp/layout-test-results'))
139 manager = get_manager()
140 manager._rename_results_folder()
141 self.assertFalse(port.host.filesystem.exists('/tmp/layout-test-results') )
142 self.assertTrue(port.host.filesystem.exists('/tmp/layout-test-results_19 70-01-01-05-30-00'))
143
144 def test_clobber_old_results(self):
145 host = MockHost()
146 port = host.port_factory.get('test-mac-leopard')
147
148 def get_manager():
149 manager = Manager(port, options=MockOptions(max_locked_shards=1), pr inter=FakePrinter())
150 return manager
151 self._make_fake_test_result(port.host, '/tmp/layout-test-results')
152 self.assertTrue(port.host.filesystem.exists('/tmp/layout-test-results'))
153 manager = get_manager()
154 manager._clobber_old_results()
155 self.assertFalse(port.host.filesystem.exists('/tmp/layout-test-results') )
156
157 def test_limit_archived_results_count(self):
158 host = MockHost()
159 port = host.port_factory.get('test-mac-leopard')
160
161 def get_manager():
162 manager = Manager(port, options=MockOptions(max_locked_shards=1), pr inter=FakePrinter())
163 return manager
164 for x in range(1, 31):
165 dir_name = '/tmp/layout-test-results' + '_' + str(x)
166 self._make_fake_test_result(port.host, dir_name)
167 manager = get_manager()
168 manager._limit_archived_results_count()
169 deleted_dir_count = 0
170 for x in range(1, 31):
171 dir_name = '/tmp/layout-test-results' + '_' + str(x)
172 if not port.host.filesystem.exists(dir_name):
173 deleted_dir_count = deleted_dir_count + 1
174 self.assertEqual(deleted_dir_count, 5)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698