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

Side by Side Diff: au_test_harness/au_test.py

Issue 6815003: This CL updates the parallel job library in the au test harness to be more robust. (Closed) Base URL: http://git.chromium.org/git/crostestutils.git@master
Patch Set: Don's feedback Created 9 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | au_test_harness/au_worker.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Module containing a test suite that is run to test auto updates.""" 5 """Module containing a test suite that is run to test auto updates."""
6 6
7 import os 7 import os
8 import tempfile 8 import tempfile
9 import time 9 import time
10 import unittest 10 import unittest
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 def tearDown(self): 124 def tearDown(self):
125 """Overrides unittest.TestCase.tearDown and called after every test.""" 125 """Overrides unittest.TestCase.tearDown and called after every test."""
126 self.worker.CleanUp() 126 self.worker.CleanUp()
127 127
128 def testUpdateKeepStateful(self): 128 def testUpdateKeepStateful(self):
129 """Tests if we can update normally. 129 """Tests if we can update normally.
130 130
131 This test checks that we can update by updating the stateful partition 131 This test checks that we can update by updating the stateful partition
132 rather than wiping it. 132 rather than wiping it.
133 """ 133 """
134 self.worker.InitializeResultsDirectory() 134 self.worker.Initialize(9222)
135 # Just make sure some tests pass on original image. Some old images
136 # don't pass many tests.
135 self.worker.PrepareBase(self.base_image_path) 137 self.worker.PrepareBase(self.base_image_path)
136 138
137 # Update to 139 # Update to
138 self.worker.PerformUpdate(self.target_image_path, self.base_image_path) 140 self.worker.PerformUpdate(self.target_image_path, self.base_image_path)
139 self.worker.VerifyImage(self) 141 self.worker.VerifyImage(self)
140 142
141 # Update from 143 # Update from
142 self.worker.PerformUpdate(self.target_image_path, self.target_image_path) 144 self.worker.PerformUpdate(self.target_image_path, self.target_image_path)
143 self.worker.VerifyImage(self) 145 self.worker.VerifyImage(self)
144 146
145 def testUpdateWipeStateful(self): 147 def testUpdateWipeStateful(self):
146 """Tests if we can update after cleaning the stateful partition. 148 """Tests if we can update after cleaning the stateful partition.
147 149
148 This test checks that we can update successfully after wiping the 150 This test checks that we can update successfully after wiping the
149 stateful partition. 151 stateful partition.
150 """ 152 """
151 self.worker.InitializeResultsDirectory() 153 self.worker.Initialize(9223)
154 # Just make sure some tests pass on original image. Some old images
155 # don't pass many tests.
152 self.worker.PrepareBase(self.base_image_path) 156 self.worker.PrepareBase(self.base_image_path)
153 157
154 # Update to 158 # Update to
155 self.worker.PerformUpdate(self.target_image_path, self.base_image_path, 159 self.worker.PerformUpdate(self.target_image_path, self.base_image_path,
156 'clean') 160 'clean')
157 self.worker.VerifyImage(self) 161 self.worker.VerifyImage(self)
158 162
159 # Update from 163 # Update from
160 self.worker.PerformUpdate(self.target_image_path, self.target_image_path, 164 self.worker.PerformUpdate(self.target_image_path, self.target_image_path,
161 'clean') 165 'clean')
(...skipping 24 matching lines...) Expand all
186 outbound will be closed. 190 outbound will be closed.
187 """ 191 """
188 if self.close_count < 3: 192 if self.close_count < 3:
189 if self.data_size > (2 * 1024 * 1024): 193 if self.data_size > (2 * 1024 * 1024):
190 self.close_count += 1 194 self.close_count += 1
191 return None 195 return None
192 196
193 self.data_size += len(data) 197 self.data_size += len(data)
194 return data 198 return data
195 199
196 self.worker.InitializeResultsDirectory() 200 self.worker.Initialize(9224)
197 self.AttemptUpdateWithFilter(InterruptionFilter(), proxy_port=8082) 201 self.AttemptUpdateWithFilter(InterruptionFilter(), proxy_port=8082)
198 202
199 def testDelayedUpdate(self): 203 def testDelayedUpdate(self):
200 """Tests what happens if some data is delayed during update delivery""" 204 """Tests what happens if some data is delayed during update delivery"""
201 205
202 class DelayedFilter(cros_test_proxy.Filter): 206 class DelayedFilter(cros_test_proxy.Filter):
203 """Causes intermittent delays in data transmission. 207 """Causes intermittent delays in data transmission.
204 208
205 It does this by inserting 3 20 second delays when transmitting 209 It does this by inserting 3 20 second delays when transmitting
206 data after 2M has been sent. 210 data after 2M has been sent.
(...skipping 10 matching lines...) Expand all
217 are delayed by 20 seconds. 221 are delayed by 20 seconds.
218 """ 222 """
219 if self.delay_count < 3: 223 if self.delay_count < 3:
220 if self.data_size > (2 * 1024 * 1024): 224 if self.data_size > (2 * 1024 * 1024):
221 self.delay_count += 1 225 self.delay_count += 1
222 time.sleep(20) 226 time.sleep(20)
223 227
224 self.data_size += len(data) 228 self.data_size += len(data)
225 return data 229 return data
226 230
227 self.worker.InitializeResultsDirectory() 231 self.worker.Initialize(9225)
228 self.AttemptUpdateWithFilter(DelayedFilter(), proxy_port=8083) 232 self.AttemptUpdateWithFilter(DelayedFilter(), proxy_port=8083)
229 233
230 def SimpleTest(self): 234 def SimpleTest(self):
231 """A simple update that updates once from a base image to a target. 235 """A simple update that updates once from a base image to a target.
232 236
233 We explicitly don't use test prefix so that isn't run by default. Can be 237 We explicitly don't use test prefix so that isn't run by default. Can be
234 run using test_prefix option. 238 run using test_prefix option.
235 """ 239 """
236 self.worker.InitializeResultsDirectory() 240 self.worker.Initialize(9226)
237 self.worker.PrepareBase(self.base_image_path) 241 self.worker.PrepareBase(self.base_image_path)
238 self.worker.PerformUpdate(self.target_image_path, self.base_image_path) 242 self.worker.PerformUpdate(self.target_image_path, self.base_image_path)
239 self.worker.VerifyImage(self) 243 self.worker.VerifyImage(self)
240 244
241 # --- DISABLED TESTS --- 245 # --- DISABLED TESTS ---
242 246
243 # TODO(sosa): Get test to work with verbose. 247 # TODO(sosa): Get test to work with verbose.
244 def NotestPartialUpdate(self): 248 def NotestPartialUpdate(self):
245 """Tests what happens if we attempt to update with a truncated payload.""" 249 """Tests what happens if we attempt to update with a truncated payload."""
246 self.worker.InitializeResultsDirectory() 250 self.worker.Initialize(9227)
247 # Preload with the version we are trying to test. 251 # Preload with the version we are trying to test.
248 self.worker.PrepareBase(self.target_image_path) 252 self.worker.PrepareBase(self.target_image_path)
249 253
250 # Image can be updated at: 254 # Image can be updated at:
251 # ~chrome-eng/chromeos/localmirror/autest-images 255 # ~chrome-eng/chromeos/localmirror/autest-images
252 url = 'http://gsdview.appspot.com/chromeos-localmirror/' \ 256 url = 'http://gsdview.appspot.com/chromeos-localmirror/' \
253 'autest-images/truncated_image.gz' 257 'autest-images/truncated_image.gz'
254 payload = os.path.join(self.download_folder, 'truncated_image.gz') 258 payload = os.path.join(self.download_folder, 'truncated_image.gz')
255 259
256 # Read from the URL and write to the local file 260 # Read from the URL and write to the local file
257 urllib.urlretrieve(url, payload) 261 urllib.urlretrieve(url, payload)
258 262
259 expected_msg = 'download_hash_data == update_check_response_hash failed' 263 expected_msg = 'download_hash_data == update_check_response_hash failed'
260 self.AttemptUpdateWithPayloadExpectedFailure(payload, expected_msg) 264 self.AttemptUpdateWithPayloadExpectedFailure(payload, expected_msg)
261 265
262 # TODO(sosa): Get test to work with verbose. 266 # TODO(sosa): Get test to work with verbose.
263 def NotestCorruptedUpdate(self): 267 def NotestCorruptedUpdate(self):
264 """Tests what happens if we attempt to update with a corrupted payload.""" 268 """Tests what happens if we attempt to update with a corrupted payload."""
265 self.worker.InitializeResultsDirectory() 269 self.worker.Initialize(9228)
266 # Preload with the version we are trying to test. 270 # Preload with the version we are trying to test.
267 self.worker.PrepareBase(self.target_image_path) 271 self.worker.PrepareBase(self.target_image_path)
268 272
269 # Image can be updated at: 273 # Image can be updated at:
270 # ~chrome-eng/chromeos/localmirror/autest-images 274 # ~chrome-eng/chromeos/localmirror/autest-images
271 url = 'http://gsdview.appspot.com/chromeos-localmirror/' \ 275 url = 'http://gsdview.appspot.com/chromeos-localmirror/' \
272 'autest-images/corrupted_image.gz' 276 'autest-images/corrupted_image.gz'
273 payload = os.path.join(self.download_folder, 'corrupted.gz') 277 payload = os.path.join(self.download_folder, 'corrupted.gz')
274 278
275 # Read from the URL and write to the local file 279 # Read from the URL and write to the local file
276 urllib.urlretrieve(url, payload) 280 urllib.urlretrieve(url, payload)
277 281
278 # This update is expected to fail... 282 # This update is expected to fail...
279 expected_msg = 'zlib inflate() error:-3' 283 expected_msg = 'zlib inflate() error:-3'
280 self.AttemptUpdateWithPayloadExpectedFailure(payload, expected_msg) 284 self.AttemptUpdateWithPayloadExpectedFailure(payload, expected_msg)
OLDNEW
« no previous file with comments | « no previous file | au_test_harness/au_worker.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698