From patchwork Mon Jan 21 20:19:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael-Doyle Hudson X-Patchwork-Id: 14190 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 4E4A823E39 for ; Mon, 21 Jan 2013 20:19:16 +0000 (UTC) Received: from mail-vb0-f47.google.com (mail-vb0-f47.google.com [209.85.212.47]) by fiordland.canonical.com (Postfix) with ESMTP id D227EA196AE for ; Mon, 21 Jan 2013 20:19:15 +0000 (UTC) Received: by mail-vb0-f47.google.com with SMTP id e21so5954754vbm.6 for ; Mon, 21 Jan 2013 12:19:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:content-type:mime-version:x-launchpad-project :x-launchpad-branch:x-launchpad-message-rationale :x-launchpad-branch-revision-number:x-launchpad-notification-type:to :from:subject:message-id:date:reply-to:sender:errors-to:precedence :x-generated-by:x-launchpad-hash:x-gm-message-state; bh=Nx/+Qmr+hHtgVaaGtQeh7x6lAIKrxA1I2wApLwftmr4=; b=iyGhVybB2oCJsHBtoUi1pSugk7byWudniIzlc+Ak2Vhli1aqIOwboIzwQhF0kZdOZ+ XO4r8NgHiiAeWWMguQMJeXLMMRvswBIfI/7+sYqce0vVwQy0cRp+wY2lqSdHzvmgHPD3 w9Twa/mAGNGo7Rhcn9V1n+U8c0Q/d76gnPMDOxJEDqxgXeDArE5+JQd8gs0bm3D9q30K NgiCYS5b06BW+Q990yTr5tv7EUUvAFXdZC3Aht3TfBKeNPStW8i303UmIZdS3MW5CET1 YbJOTlTl8J5vDTOYjt7jyq7wj3KxU+N6OYqBGtrq6oNAC04vM4jNCvnyUkStWDIe12ee mojQ== X-Received: by 10.52.16.6 with SMTP id b6mr15415425vdd.40.1358799555183; Mon, 21 Jan 2013 12:19:15 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp218905veb; Mon, 21 Jan 2013 12:19:14 -0800 (PST) X-Received: by 10.181.13.75 with SMTP id ew11mr17578163wid.9.1358799552737; Mon, 21 Jan 2013 12:19:12 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id ew8si4280636wib.86.2013.01.21.12.19.12 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 21 Jan 2013 12:19:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1TxNpo-0000qA-8u for ; Mon, 21 Jan 2013 20:19:12 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id F0901E0135 for ; Mon, 21 Jan 2013 20:19:11 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-dispatcher X-Launchpad-Branch: ~linaro-validation/lava-dispatcher/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 534 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 534: remove attempt to attach serial log to lava test run (which has been broken for months anyway) Message-Id: <20130121201911.9177.58192.launchpad@ackee.canonical.com> Date: Mon, 21 Jan 2013 20:19:11 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="16430"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 630d0fdf132cc99d24a14786bd4279dd0cddb5d8 X-Gm-Message-State: ALoCoQnXUhrNWHJ6WRFNlrmMonPWmN8ceZsboCDEYvF2kIPCqQGIEbay2oI35PR48xc6OP0ABsXz Merge authors: Michael Hudson-Doyle (mwhudson) Related merge proposals: https://code.launchpad.net/~mwhudson/lava-dispatcher/kill-SerialIO-sio-madness/+merge/143619 proposed by: Michael Hudson-Doyle (mwhudson) review: Approve - Antonio Terceiro (terceiro) ------------------------------------------------------------ revno: 534 [merge] committer: Michael Hudson-Doyle branch nick: trunk timestamp: Tue 2013-01-22 09:18:16 +1300 message: remove attempt to attach serial log to lava test run (which has been broken for months anyway) modified: lava_dispatcher/client/base.py lava_dispatcher/context.py lava_dispatcher/device/fastmodel.py lava_dispatcher/device/master.py lava_dispatcher/device/qemu.py lava_dispatcher/device/sdmux.py lava_dispatcher/device/target.py lava_dispatcher/job.py lava_dispatcher/utils.py --- lp:lava-dispatcher https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk You are subscribed to branch lp:lava-dispatcher. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription === modified file 'lava_dispatcher/client/base.py' --- lava_dispatcher/client/base.py 2013-01-19 03:43:23 +0000 +++ lava_dispatcher/client/base.py 2013-01-21 20:18:16 +0000 @@ -29,15 +29,12 @@ import lava_dispatcher.utils as utils -from cStringIO import StringIO - from lava_dispatcher.errors import ( GeneralError, NetworkError, OperationFailed, CriticalError, ) -from lava_dispatcher.test_data import create_attachment def wait_for_prompt(connection, prompt_pattern, timeout): @@ -345,7 +342,6 @@ self.context = context self.config = config self.hostname = config.hostname - self.sio = SerialIO(sys.stdout) self.proc = None # used for apt-get in lava-test.py self.aptget_cmd = "apt-get" @@ -436,7 +432,7 @@ def get_test_data_attachments(self): '''returns attachments to go in the "lava_results" test run''' - return [ create_attachment('serial.log', self.sio.getvalue()) ] + return [] def retrieve_results(self, result_disk): raise NotImplementedError(self.retrieve_results) @@ -510,21 +506,3 @@ session.run('echo 0>/sys/class/android_usb/android0/enable') -class SerialIO(file): - def __init__(self, logfile): - self.serialio = StringIO() - self.logfile = logfile - - def write(self, text): - self.serialio.write(text) - self.logfile.write(text) - - def close(self): - self.serialio.close() - self.logfile.close() - - def flush(self): - self.logfile.flush() - - def getvalue(self): - return self.serialio.getvalue() === modified file 'lava_dispatcher/context.py' --- lava_dispatcher/context.py 2012-12-18 19:50:48 +0000 +++ lava_dispatcher/context.py 2013-01-16 23:35:53 +0000 @@ -20,7 +20,7 @@ import atexit import os -import shutil +import sys import tempfile from lava_dispatcher.config import get_device_config @@ -33,6 +33,10 @@ def __init__(self, target, dispatcher_config, oob_file, job_data): self.config = dispatcher_config self.job_data = job_data + # This is the file-like object to send serial output from the device + # to. We just send it to stdout for now, but soon we'll do something + # cleverer. + self.logfile_read = sys.stdout device_config = get_device_config( target, dispatcher_config.config_dir) self._client = TargetBasedClient(self, device_config) === modified file 'lava_dispatcher/device/fastmodel.py' --- lava_dispatcher/device/fastmodel.py 2012-11-22 02:14:51 +0000 +++ lava_dispatcher/device/fastmodel.py 2013-01-16 23:27:28 +0000 @@ -200,7 +200,7 @@ logging.info('launching fastmodel with command %r' % sim_cmd) self._sim_proc = logging_spawn( sim_cmd, - logfile=self.sio, + logfile=self.client.context.logfile_read, timeout=1200) self._sim_proc.expect(self.PORT_PATTERN, timeout=300) self._serial_port = self._sim_proc.match.groups()[0] @@ -216,7 +216,8 @@ logging.info('simulator is started connecting to serial port') self.proc = logging_spawn( 'telnet localhost %s' % self._serial_port, - logfile=self._create_rtsm_ostream(self.sio), + logfile=self._create_rtsm_ostream( + self.client.context.logfile_read), timeout=1200) return self.proc === modified file 'lava_dispatcher/device/master.py' --- lava_dispatcher/device/master.py 2012-12-29 03:50:52 +0000 +++ lava_dispatcher/device/master.py 2013-01-16 23:27:28 +0000 @@ -23,12 +23,11 @@ import logging import os import time -import traceback import pexpect -import lava_dispatcher.device.boot_options as boot_options -import lava_dispatcher.tarballcache as tarballcache +from lava_dispatcher.device import boot_options +from lava_dispatcher import tarballcache from lava_dispatcher.client.base import ( NetworkCommandRunner, @@ -85,7 +84,7 @@ if config.pre_connect_command: logging_system(config.pre_connect_command) - self.proc = connect_to_serial(config, self.sio) + self.proc = connect_to_serial(config, self.context.logfile_read) def get_device_version(self): return self.device_version @@ -164,9 +163,7 @@ _deploy_linaro_rootfs(master, root_url) _deploy_linaro_bootfs(master, boot_url) except: - logging.error("Deployment failed") - tb = traceback.format_exc() - self.sio.write(tb) + logging.exception("Deployment failed") raise CriticalError("Deployment failed") def _format_testpartition(self, runner, fstype): @@ -185,9 +182,7 @@ _extract_partition(image_file, self.config.boot_part, boot_tgz) _extract_partition(image_file, self.config.root_part, root_tgz) except: - logging.error("Failed to generate tarballs") - tb = traceback.format_exc() - self.sio.write(tb) + logging.exception("Failed to generate tarballs") raise # we need to associate the deployment data with these so that we @@ -452,9 +447,7 @@ try: self.wait_network_up(timeout=20) except NetworkError: - msg = "Unable to reach LAVA server" - logging.error(msg) - self._client.sio.write(traceback.format_exc()) + logging.exception("Unable to reach LAVA server") raise pattern1 = "<(\d?\d?\d?\.\d?\d?\d?\.\d?\d?\d?\.\d?\d?\d?)>" === modified file 'lava_dispatcher/device/qemu.py' --- lava_dispatcher/device/qemu.py 2012-11-20 13:34:19 +0000 +++ lava_dispatcher/device/qemu.py 2013-01-16 23:27:28 +0000 @@ -79,7 +79,10 @@ self.config.qemu_drive_interface, self._sd_image) logging.info('launching qemu with command %r' % qemu_cmd) - proc = logging_spawn(qemu_cmd, logfile=self.sio, timeout=1200) + proc = logging_spawn( + qemu_cmd, + logfile=self.context.logfile_read, + timeout=1200) return proc def get_device_version(self): === modified file 'lava_dispatcher/device/sdmux.py' --- lava_dispatcher/device/sdmux.py 2013-01-04 19:26:51 +0000 +++ lava_dispatcher/device/sdmux.py 2013-01-16 23:27:28 +0000 @@ -22,7 +22,6 @@ import logging import os import subprocess -import sys import time from lava_dispatcher.errors import ( @@ -208,7 +207,8 @@ logging_system(self.config.power_off_cmd) def power_on(self): - self.proc = connect_to_serial(self.config, self.sio) + self.proc = connect_to_serial( + self.config, self.context.logfile_read) logging.info('powering on') logging_system(self.config.power_on_cmd) === modified file 'lava_dispatcher/device/target.py' --- lava_dispatcher/device/target.py 2012-11-15 21:23:20 +0000 +++ lava_dispatcher/device/target.py 2013-01-16 23:27:28 +0000 @@ -19,17 +19,13 @@ # with this program; if not, see . import contextlib -import logging import os -import sys from lava_dispatcher.client.lmc_utils import ( image_partition_mounted, ) import lava_dispatcher.utils as utils -from cStringIO import StringIO - def get_target(context, device_config): ipath = 'lava_dispatcher.device.%s' % device_config.client_type @@ -67,7 +63,6 @@ self.context = context self.config = device_config self.deployment_data = None - self.sio = SerialIO(sys.stdout) self.boot_options = [] self._scratch_dir = None @@ -175,23 +170,3 @@ # because we are doing pretty standard linux stuff, just # just no upstart or dash assumptions self._customize_oe(mnt) - - -class SerialIO(file): - def __init__(self, logfile): - self.serialio = StringIO() - self.logfile = logfile - - def write(self, text): - self.serialio.write(text) - self.logfile.write(text) - - def close(self): - self.serialio.close() - self.logfile.close() - - def flush(self): - self.logfile.flush() - - def getvalue(self): - return self.serialio.getvalue() === modified file 'lava_dispatcher/job.py' --- lava_dispatcher/job.py 2012-12-07 19:59:19 +0000 +++ lava_dispatcher/job.py 2013-01-16 23:27:28 +0000 @@ -206,6 +206,8 @@ finally: err_msg = "" if status == 'fail': + # XXX mwhudson, 2013-01-17: I have no idea what this + # code is doing. logging.warning( "[ACTION-E] %s is finished with error (%s)." % ( cmd['command'], err)) @@ -217,8 +219,7 @@ err_msg += "Lava failed on test: %s" % \ params.get('test_name', "Unknown") err_msg = err_msg + traceback.format_exc() - # output to both serial log and logfile - self.context.client.sio.write(err_msg) + print err_msg else: logging.info( "[ACTION-E] %s is finished successfully." % ( === modified file 'lava_dispatcher/utils.py' --- lava_dispatcher/utils.py 2013-01-04 00:03:43 +0000 +++ lava_dispatcher/utils.py 2013-01-16 23:27:28 +0000 @@ -214,7 +214,7 @@ timeout=1, lava_no_logging=1) -def connect_to_serial(device_config, sio): +def connect_to_serial(device_config, logfile_read): """ Attempts to connect to a serial console server like conmux or cyclades """ @@ -238,7 +238,7 @@ while retry_count < retry_limit: proc = logging_spawn(device_config.connection_command, timeout=1200) - proc.logfile_read = sio + proc.logfile_read = logfile_read logging.info('Attempting to connect to device') match = proc.expect(patterns, timeout=10) result = results[match]