Fixes to get ctest up and running again.

We had a major issue because the latest dev channel release pre-dates the virtio change.  Because of this, ctest was connecting to update that channel using virtio (which is unsupported for that).  This change drops a file telling the vm lib to use e1000 as before.

Also, fixed stateful change logic.

Change-Id: I394a8cece71bdd0d55efa21ba5b6d24804432c6b

BUG=chromium-os:10434
TEST=Ran it with ctest and cros_au_test_harness on images with/without the file.

Review URL: http://codereview.chromium.org/5928005
This commit is contained in:
Chris Sosa 2010-12-17 13:15:05 -08:00
parent d523d23f2e
commit 40fa0ded27
3 changed files with 43 additions and 19 deletions

View File

@ -85,14 +85,14 @@ class AUTest(object):
if self.use_delta_updates:
try:
self.source_image = src_image
self._UpdateImageReportError(image)
self._UpdateImageReportError(image, stateful_change)
except:
Warning('Delta update failed, disabling delta updates and retrying.')
self.use_delta_updates = False
self.source_image = ''
self._UpdateImageReportError(image)
self._UpdateImageReportError(image, stateful_change)
else:
self._UpdateImageReportError(image)
self._UpdateImageReportError(image, stateful_change)
def _UpdateImageReportError(self, image_path, stateful_change='old',
proxy_port=None):
@ -125,8 +125,8 @@ class AUTest(object):
self.PrepareBase(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
# 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
proxy = cros_test_proxy.CrosTestProxy(port_in=proxy_port,
@ -298,15 +298,15 @@ class AUTest(object):
class InterruptionFilter(cros_test_proxy.Filter):
"""This filter causes the proxy to interrupt the download 3 times
It does this by closing the first three connections to transfer
2M total in the outbound connection after they transfer the
2M total in the outbound connection after they transfer the
2M.
"""
def __init__(self):
"""Defines variable shared across all connections"""
self.close_count = 0
def setup(self):
"""Called once at the start of each connection."""
self.data_size = 0
@ -321,9 +321,9 @@ class AUTest(object):
if self.data_size > (2 * 1024 * 1024):
self.close_count += 1
return None
self.data_size += len(data)
return data
return data
self._AttemptUpdateWithFilter(InterruptionFilter())
@ -332,7 +332,7 @@ class AUTest(object):
class DelayedFilter(cros_test_proxy.Filter):
"""Causes intermittent delays in data transmission.
It does this by inserting 3 20 second delays when transmitting
data after 2M has been sent.
"""
@ -351,13 +351,23 @@ class AUTest(object):
if self.data_size > (2 * 1024 * 1024):
self.delay_count += 1
time.sleep(20)
self.data_size += len(data)
return data
self.data_size += len(data)
return data
self._AttemptUpdateWithFilter(DelayedFilter())
def SimpleTest(self):
"""A simple update that updates the target image to itself.
We explicitly don't use test prefix so that isn't run by default. Can be
run using test_prefix option.
"""
self.PrepareBase(target_image_path)
self.UpdateImage(target_image_path)
self.VerifyImage(100)
class RealAUTest(unittest.TestCase, AUTest):
"""Test harness for updating real images."""
@ -380,7 +390,7 @@ class RealAUTest(unittest.TestCase, AUTest):
]
if proxy_port:
cmd.append('--proxy_port=%s' % proxy_port)
cmd.append('--proxy_port=%s' % proxy_port)
if self.verbose:
try:
@ -406,7 +416,7 @@ class RealAUTest(unittest.TestCase, AUTest):
]
if proxy_port:
cmd.append('--proxy_port=%s' % proxy_port)
cmd.append('--proxy_port=%s' % proxy_port)
if self.verbose:
try:
@ -491,7 +501,7 @@ class VirtualAUTest(unittest.TestCase, AUTest):
]
if proxy_port:
cmd.append('--proxy_port=%s' % proxy_port)
cmd.append('--proxy_port=%s' % proxy_port)
if self.verbose:
try:
@ -524,7 +534,7 @@ class VirtualAUTest(unittest.TestCase, AUTest):
]
if proxy_port:
cmd.append('--proxy_port=%s' % proxy_port)
cmd.append('--proxy_port=%s' % proxy_port)
if self.verbose:
try:

View File

@ -22,6 +22,7 @@ from cros_build_lib import RunCommand
from cros_build_lib import Warning
_IMAGE_TO_EXTRACT = 'chromiumos_test_image.bin'
_NEW_STYLE_VERSION = '0.9.131.0'
class HTMLDirectoryParser(HTMLParser.HTMLParser):
"""HTMLParser for parsing the default apache file index."""
@ -216,6 +217,13 @@ def GrabZipAndExtractImage(zip_url, download_folder, image_name) :
fh.write(zip_url)
fh.close()
version = zip_url.split('/')[-2]
if not _GreaterVersion(version, _NEW_STYLE_VERSION) == version:
# If the version isn't ready for new style, touch file to use old style.
old_style_touch_path = os.path.join(download_folder, '.use_e1000')
fh = open(old_style_touch_path, 'w+')
fh.close()
def RunAUTestHarness(board, channel, latest_url_base, zip_server_base,
no_graphics, type, remote):

View File

@ -70,11 +70,17 @@ function start_kvm() {
snapshot="-snapshot"
fi
local net_option="-net nic,model=virtio"
if [ -f "$(dirname $1)/.use_e1000" ]; then
info "Detected older image, using e1000 instead of virtio."
net_option="-net nic,model=e1000"
fi
sudo kvm -m 1024 \
-vga std \
-pidfile "${KVM_PID_FILE}" \
-daemonize \
-net nic,model=virtio \
${net_option} \
${nographics} \
${snapshot} \
-net user,hostfwd=tcp::${FLAGS_ssh_port}-:22 \