Use different proxy ports, and log port conflicts. Hopefully works around

build problems, and will give better diagnostics if not.

Change-Id: I2f7a5d9b2e0c63a8189ad212125c7a5c0178c3c4

BUG=10567
TEST=

Review URL: http://codereview.chromium.org/6331007
This commit is contained in:
Don Garrett 2011-01-19 13:41:23 -08:00
parent 2a517638ef
commit e70ccb91b1
2 changed files with 13 additions and 9 deletions

View File

@ -139,15 +139,14 @@ class AUTest(object):
Warning(err.stdout)
self.fail('We managed to update when failure was expected')
def AttemptUpdateWithFilter(self, filter):
def AttemptUpdateWithFilter(self, filter, proxy_port=8081):
"""Update through a proxy, with a specified filter, and expect success."""
self.PrepareBase(self.target_image_path)
# The devserver runs at port 8080 by default. We assume that here, and
# start our proxy at 8081. We then tell our update tools to have the
# client connect to 8081 instead of 8080.
proxy_port = 8081
# start our proxy at a different. We then tell our update tools to
# have the client connect to our proxy_port instead of 8080.
proxy = cros_test_proxy.CrosTestProxy(port_in=proxy_port,
address_out='127.0.0.1',
port_out=8080,
@ -350,7 +349,7 @@ class AUTest(object):
self.data_size += len(data)
return data
self.AttemptUpdateWithFilter(InterruptionFilter())
self.AttemptUpdateWithFilter(InterruptionFilter(), proxy_port=8082)
def testDelayedUpdate(self):
"""Tests what happens if some data is delayed during update delivery"""
@ -380,7 +379,7 @@ class AUTest(object):
self.data_size += len(data)
return data
self.AttemptUpdateWithFilter(DelayedFilter())
self.AttemptUpdateWithFilter(DelayedFilter(), proxy_port=8083)
def SimpleTest(self):
"""A simple update that updates once from a base image to a target.

View File

@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import select
import socket
import SocketServer
@ -100,9 +101,13 @@ class CrosTestProxy(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
self.port_out = port_out
self.filter = filter
SocketServer.TCPServer.__init__(self,
('', port_in),
self._Handler)
try:
SocketServer.TCPServer.__init__(self,
('', port_in),
self._Handler)
except socket.error:
os.system('sudo netstat -l --tcp -n -p')
raise
def serve_forever_in_thread(self):
"""Helper method to start the server in a new background thread."""