=== modified file 'lava_dispatcher/actions/launch_control.py'
@@ -168,8 +168,8 @@
for bundle in all_bundles:
test_runs += bundle['test_runs']
- self.context.test_data.add_seriallog(
- self.context.client.get_seriallog())
+ attachments = self.client.get_test_data_attachments()
+ self.context.test_data.add_attachments(attachments)
main_bundle['test_runs'].append(self.context.test_data.get_test_run())
=== modified file 'lava_dispatcher/client/base.py'
@@ -33,6 +33,8 @@
from cStringIO import StringIO
from tempfile import mkdtemp
+from lava_dispatcher.test_data import create_attachment
+
class CommandRunner(object):
"""A convenient way to run a shell command and wait for a shell prompt.
@@ -424,9 +426,6 @@
self.setup_proxy(self.tester_str)
logging.info("System is in test image now")
- def get_seriallog(self):
- return self.sio.getvalue()
-
def get_www_scratch_dir(self):
''' returns a temporary directory available for downloads that's gets
deleted when the process exits '''
@@ -436,6 +435,10 @@
os.chmod(d, 0755)
return d
+ def get_test_data_attachments(self):
+ '''returns attachments to go in the "lava_results" test run'''
+ return [ create_attachment('serial.log', self.sio.getvalue()) ]
+
# Android stuff
def get_android_adb_interface(self):
=== modified file 'lava_dispatcher/client/fastmodel.py'
@@ -19,7 +19,9 @@
# with this program; if not, see <http://www.gnu.org/licenses>.
import atexit
+import codecs
import contextlib
+import cStringIO
import logging
import os
import pexpect
@@ -40,6 +42,9 @@
from lava_dispatcher.downloader import (
download_image,
)
+from lava_dispatcher.test_data import (
+ create_attachment,
+ )
from lava_dispatcher.utils import (
logging_spawn,
logging_system,
@@ -192,6 +197,17 @@
if self._sim_proc is not None:
self._sim_proc.close()
+ def _drain_sim_proc(self):
+ '''pexpect will continue to get data for the simproc process. We need
+ to keep this pipe drained so that it won't get full and then stop block
+ the process from continuing to execute'''
+
+ # NOTE: the RTSM binary uses the windows code page(cp1252), but the
+ # dashboard needs this with a utf-8 encoding
+ f = cStringIO.StringIO()
+ self._sim_proc.logfile = codecs.EncodedFile(f, 'cp1252', 'utf-8')
+ _pexpect_drain(self._sim_proc).start()
+
def _boot_linaro_image(self):
self._stop()
@@ -215,7 +231,7 @@
if match == 0:
raise RuntimeError("fast model license check failed")
- _pexpect_drain(self._sim_proc).start()
+ self._drain_sim_proc()
logging.info('simulator is started connecting to serial port')
self.proc = logging_spawn(
@@ -242,6 +258,16 @@
tarfile, mnt, self.context.lava_result_dir))
return 'pass', '', tarfile
+ def get_test_data_attachments(self):
+ '''returns attachments to go in the "lava_results" test run'''
+ a = super(LavaFastModelClient, self).get_test_data_attachments()
+
+ # if the simulator never got started we won't even get to a logfile
+ if getattr(self._sim_proc, 'logfile', None) is not None:
+ content = self._sim_proc.logfile.getvalue()
+ a.append( create_attachment('rtsm.log', content) )
+ return a
+
class _pexpect_drain(threading.Thread):
''' The simulator process can dump a lot of information to its console. If
don't actively read from it, the pipe will get full and the process will
@@ -254,5 +280,4 @@
def run(self):
# change simproc's stdout so it doesn't overlap the stdout from our
# serial console logging
- self.proc.logfile = open('/dev/null', 'w')
self.proc.drain()
=== modified file 'lava_dispatcher/test_data.py'
@@ -22,6 +22,14 @@
from uuid import uuid1
import base64
+
+def create_attachment(pathname, content, mime_type='text/plain'):
+ return {
+ 'pathname': pathname,
+ 'mime_type': mime_type,
+ 'content': base64.b64encode(content),
+ }
+
class LavaTestData(object):
def __init__(self, test_id='lava'):
self.job_status = 'pass'
@@ -48,8 +56,8 @@
}
self._test_run['test_results'].append(result_data)
- def add_attachment(self, attachment):
- self._test_run['attachments'].append(attachment)
+ def add_attachments(self, attachments):
+ self._test_run['attachments'].extend(attachments)
def add_tag(self, tag):
self._test_run['tags'].append(tag)
@@ -68,13 +76,3 @@
self.add_result('job_complete', self.job_status)
return self._test_run
- def add_seriallog(self, serial_log):
- """
- Add serial log to the "attachments" field, it aligns bundle 1.2 format
- """
- serial_log_base64 = base64.b64encode(serial_log)
- attachment = {
- "pathname": "serial.log",
- "mime_type": "text/plain",
- "content": serial_log_base64 }
- self.add_attachment(attachment)