From patchwork Mon Oct 22 20:57:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Doan X-Patchwork-Id: 12412 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 BD4C023EFB for ; Mon, 22 Oct 2012 20:57:16 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 514A7A18710 for ; Mon, 22 Oct 2012 20:57:16 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id f6so2333758iag.11 for ; Mon, 22 Oct 2012 13:57:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to: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=5Zo4AncyRNqtpUZ3t5vzGwE8GbUBBEaf1n9fynXt3bM=; b=fcODXMwY3w8/E15fZR53CSLcGl3jAUDglRy+VBi0R2fuaotLO67UaePrxIKSktMXEt Nbz8K0dClHXBkXD/Zp8y9+FiPQMIfooKF9iuM4n4I2LQJmWPAkQWBHnRt8nQvP/0STdc k9S4jcIV6CZjEcfKbVYYBZNVkFpxZtR9B2E2d6uknbK1LsuKQ2M5ikG3H5WL1eWVfJSM xXOuGYZwYnejWBhrI8jXrGV5fM1VlcmZAFuvWn/yTist575LfOMHvAL3Su1NxpIRQmMX 2zRYK/xb7yooJD+JKe2L87hJY8/vELTcvusyPr77yEU7QpS5Xn6oqkq5PMVcGWbTtMfA YKMA== Received: by 10.50.152.137 with SMTP id uy9mr10517293igb.62.1350939435536; Mon, 22 Oct 2012 13:57:15 -0700 (PDT) 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.50.67.148 with SMTP id n20csp306214igt; Mon, 22 Oct 2012 13:57:14 -0700 (PDT) Received: by 10.180.97.35 with SMTP id dx3mr23936374wib.14.1350939433473; Mon, 22 Oct 2012 13:57:13 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id d3si10694321wie.22.2012.10.22.13.57.12 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 22 Oct 2012 13:57:13 -0700 (PDT) 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 1TQP3g-00084M-RP for ; Mon, 22 Oct 2012 20:57:12 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id B4AE9E0418 for ; Mon, 22 Oct 2012 20:57:12 +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: 411 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 411: fixes for lava-test-shell Message-Id: <20121022205712.25600.90350.launchpad@ackee.canonical.com> Date: Mon, 22 Oct 2012 20:57:12 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="16165"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: e25e0aebb1bd78fdc584c12b5352ca2338a998b4 X-Gm-Message-State: ALoCoQlwCntPi+rYk0si3wX8t88zs1DQxuHg5rMS8iX5YbdGLLQhj2SP8H8QW2/kfLzdPRnsjInL Merge authors: Andy Doan (doanac) Related merge proposals: https://code.launchpad.net/~doanac/lava-dispatcher/lava-test-shell-fixes/+merge/130482 proposed by: Andy Doan (doanac) review: Approve - Michael Hudson-Doyle (mwhudson) ------------------------------------------------------------ revno: 411 [merge] committer: Andy Doan branch nick: lava-dispatcher timestamp: Mon 2012-10-22 15:45:12 -0500 message: fixes for lava-test-shell modified: lava_dispatcher/actions/lava_test_shell.py lava_dispatcher/device/fastmodel.py lava_dispatcher/device/target.py lava_test_shell/lava-test-runner-android lava_test_shell/lava-test-runner-ubuntu --- 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/actions/lava_test_shell.py' --- lava_dispatcher/actions/lava_test_shell.py 2012-10-17 16:52:36 +0000 +++ lava_dispatcher/actions/lava_test_shell.py 2012-10-18 19:46:30 +0000 @@ -46,7 +46,7 @@ Target.android_deployment_data['lava_test_runner'] = LAVA_TEST_ANDROID Target.android_deployment_data['lava_test_shell'] = LAVA_TEST_SHELL Target.android_deployment_data['lava_test_sh_cmd'] = '/system/bin/mksh' -Target.android_deployment_data['lava_test_dir'] = '/system/lava' +Target.android_deployment_data['lava_test_dir'] = '/data/lava' Target.android_deployment_data['lava_test_results_part_attr'] = 'data_part_android_org' Target.ubuntu_deployment_data['lava_test_runner'] = LAVA_TEST_UBUNTU @@ -82,7 +82,7 @@ def _configure_android_startup(etcdir): logging.info('hacking android start up job') with open('%s/mkshrc' % etcdir, 'a') as f: - f.write('\n/system/lava/bin/lava-test-runner\n') + f.write('\n/data/lava/bin/lava-test-runner\n') Target.android_deployment_data['lava_test_configure_startup'] = \ _configure_android_startup @@ -226,7 +226,10 @@ def _configure_target(self, target, testdef_urls): ldir = target.deployment_data['lava_test_dir'] - with target.file_system(target.config.root_part, 'lava') as d: + results_part = target.deployment_data['lava_test_results_part_attr'] + results_part = getattr(target.config, results_part) + + with target.file_system(results_part, 'lava') as d: self._mk_runner_dirs(d) self._copy_runner(d, target) testdirs = [] @@ -240,12 +243,13 @@ self._copy_test(hdir, tdir, testdef) testdirs.append(tdir) - with target.file_system(target.config.root_part, 'etc') as d: - target.deployment_data['lava_test_configure_startup'](d) with open('%s/lava-test-runner.conf' % d, 'w') as f: for testdir in testdirs: f.write('%s\n' % testdir) + with target.file_system(target.config.root_part, 'etc') as d: + target.deployment_data['lava_test_configure_startup'](d) + def _bundle_results(self, target): """ Pulls the results from the target device and builds a bundle """ === modified file 'lava_dispatcher/device/fastmodel.py' --- lava_dispatcher/device/fastmodel.py 2012-10-17 16:52:05 +0000 +++ lava_dispatcher/device/fastmodel.py 2012-10-19 05:16:51 +0000 @@ -200,6 +200,14 @@ def _power_off(self, proc): if proc is not None: + # attempt to turn off cleanly. lava-test-shell for ubuntu builds + # require this or the result files don't get flushed (even with + # the "sync" being called in self.power_off + try: + proc.sendline('halt') + proc.expect('Will now halt', timeout=20) + except: + logging.warn('timed out while trying to halt cleanly') proc.close() if self._sim_proc is not None: self._sim_proc.close() === modified file 'lava_dispatcher/device/target.py' --- lava_dispatcher/device/target.py 2012-10-17 16:52:05 +0000 +++ lava_dispatcher/device/target.py 2012-10-19 04:38:47 +0000 @@ -63,6 +63,7 @@ 'TESTER_PS1_INCLUDES_RC': True, } + def __init__(self, context, device_config): self.context = context self.config = device_config @@ -97,11 +98,7 @@ """ tries to safely power off the device by running a sync operation first """ - from lava_dispatcher.client.base import CommandRunner - runner = CommandRunner( - proc, - self.deployment_data['TESTER_PS1_PATTERN'], - self.deployment_data['TESTER_PS1_INCLUDES_RC']) + runner = self._get_runner(proc) try: logging.info('attempting a filesystem sync before power_off') runner.run('sync', timeout=20) @@ -135,16 +132,18 @@ proc = runner = None try: proc = self.power_on() - from lava_dispatcher.client.base import CommandRunner - runner = CommandRunner( - proc, - self.deployment_data['TESTER_PS1_PATTERN'], - self.deployment_data['TESTER_PS1_INCLUDES_RC']) + runner = self._get_runner(proc) yield runner finally: if proc and runner: self.power_off(proc) + def _get_runner(self, proc): + from lava_dispatcher.client.base import CommandRunner + pat = self.deployment_data['TESTER_PS1_PATTERN'] + incrc = self.deployment_data['TESTER_PS1_INCLUDES_RC'] + return CommandRunner(proc, pat, incrc) + def get_test_data_attachments(self): return [] === modified file 'lava_test_shell/lava-test-runner-android' --- lava_test_shell/lava-test-runner-android 2012-10-04 05:05:26 +0000 +++ lava_test_shell/lava-test-runner-android 2012-10-22 20:41:43 +0000 @@ -13,9 +13,9 @@ exec >/dev/console PREFIX=":" -WORKFILE="/etc/lava-test-runner.conf" +WORKFILE="/data/lava/lava-test-runner.conf" RESULTSDIR="/data/lava/results" -BINDIR="/system/lava/bin" +BINDIR="/data/lava/bin" hwcontext() { @@ -44,6 +44,12 @@ echo "${PREFIX} disabling suspend and waiting for home screen ..." disablesuspend.sh + # move the workfile to something timestamped and run that. This + # prevents us from running the same thing again after a reboot + TS=`date +%s` + mv ${WORKFILE} ${WORKFILE}-${TS} + WORKFILE=${WORKFILE}-${TS} + echo "${PREFIX} looking for installation work in ${WORKFILE}" while read line ; do test=`basename $line` @@ -79,6 +85,11 @@ lava-test-shell --output_dir ${odir} /system/bin/sh -e "${line}/run.sh" echo "${PREFIX} ${test} exited with: `cat ${odir}/return_code`" done < ${WORKFILE} + + # just adds a little handy debugging as to what result the target + # thinks exists + ls /data/lava/results + echo "${PREFIX} exiting" } & === modified file 'lava_test_shell/lava-test-runner-ubuntu' --- lava_test_shell/lava-test-runner-ubuntu 2012-10-04 05:05:26 +0000 +++ lava_test_shell/lava-test-runner-ubuntu 2012-10-22 20:41:43 +0000 @@ -4,7 +4,7 @@ exec >/dev/console PREFIX=":" -WORKFILE="/etc/lava-test-runner.conf" +WORKFILE="/lava/lava-test-runner.conf" RESULTSDIR="/lava/results" BINDIR="/lava/bin" @@ -32,6 +32,12 @@ echo "${PREFIX} started" [ -d ${RESULTSDIR} ] || mkdir -p ${RESULTSDIR} +# move the workfile to something timestamped and run that. This +# prevents us from running the same thing again after a reboot +TS=`date +%s` +mv ${WORKFILE} ${WORKFILE}-${TS} +WORKFILE=${WORKFILE}-${TS} + echo "${PREFIX} looking for installation work in ${WORKFILE}" while read line ; do test=`basename $line` @@ -63,5 +69,9 @@ lava-test-shell --output_dir ${odir} /bin/sh -e "${line}/run.sh" echo "${PREFIX} ${test} exited with: `cat ${odir}/return_code`" done < ${WORKFILE} + +# just adds a little handy debugging as to what result the target thinks exist +ls /lava/results + echo "${PREFIX} exiting"