From patchwork Fri Nov 16 00:45:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Doan X-Patchwork-Id: 12881 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 22FC323EFB for ; Fri, 16 Nov 2012 00:45:22 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id A51EFA188DF for ; Fri, 16 Nov 2012 00:45:21 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so2778340iej.11 for ; Thu, 15 Nov 2012 16:45:21 -0800 (PST) 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=vRidECxh7+jccYNALLfl7cM6Lxf+arvk0rjPq75yVag=; b=QoXTXpZFLxfQ8GLrV4ooFR7Db66H+wAlnEjncfxRfqvTzEqyXCmfZtjEVPHOY2H5kg zAo9e+Ht4ClPcEv5ZS6MnEFc7gzSptjkz9PhEeLeVxFDCfFggrI2nxvmrM8FCgtwxsLh BKkAEqQDcoJkaXOBBlbofMd9p2d+24eCdzE5jVHZGB297aU7bB6Sm1ZpdrLiDThe0xek jHvYICnWAIIkKxaAd49LdOAv9JnDZuBiqLnG1v6WnnuAWPizF6Et63rajM6fnBwaYt+E 8eMhmXl0S32Xkg2w8KmHFm6CqZcNQMZJ98PJOQaE3B1Yrn4PaeqQi+uQYG1k9r11RNPD pP8w== Received: by 10.50.186.199 with SMTP id fm7mr1479854igc.62.1353026721058; Thu, 15 Nov 2012 16:45:21 -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.50.67.148 with SMTP id n20csp876300igt; Thu, 15 Nov 2012 16:45:20 -0800 (PST) Received: by 10.216.217.214 with SMTP id i64mr1212234wep.124.1353026719345; Thu, 15 Nov 2012 16:45:19 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id eg6si20926719wib.24.2012.11.15.16.45.18 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 15 Nov 2012 16:45:19 -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 1TZA3a-0006OI-Eu for ; Fri, 16 Nov 2012 00:45:18 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 607FBE028C for ; Fri, 16 Nov 2012 00:45:18 +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: 451 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 451: simplify the sync/power_off logic in device implementations Message-Id: <20121116004518.13378.73320.launchpad@ackee.canonical.com> Date: Fri, 16 Nov 2012 00:45:18 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="16272"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 16fe0e71063f1953c832815cac2b01f54ce84b56 X-Gm-Message-State: ALoCoQn8BJiSzYkoMlTVeRDdaTRCrFEQq6EuqOonqraddv4ic9xkMz/i4qalqN9zKzViU0VG9j+5 Merge authors: Andy Doan (doanac) Related merge proposals: https://code.launchpad.net/~doanac/lava-dispatcher/sync-sanity/+merge/134569 proposed by: Andy Doan (doanac) ------------------------------------------------------------ revno: 451 [merge] committer: Andy Doan branch nick: lava-dispatcher timestamp: Thu 2012-11-15 18:44:40 -0600 message: simplify the sync/power_off logic in device implementations modified: lava_dispatcher/actions/lava_test.py lava_dispatcher/device/fastmodel.py lava_dispatcher/device/master.py lava_dispatcher/device/qemu.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.py' --- lava_dispatcher/actions/lava_test.py 2012-10-24 01:15:37 +0000 +++ lava_dispatcher/actions/lava_test.py 2012-11-15 21:23:20 +0000 @@ -95,6 +95,10 @@ logging.exception("killing test failed, rebooting") self.client.boot_linaro_image() raise + finally: + # try to make sure the test bundle is safely written to disk + session.run('sync', timeout=60) + if rc is None: raise OperationFailed("test case getting return value failed") elif rc != 0: === modified file 'lava_dispatcher/device/fastmodel.py' --- lava_dispatcher/device/fastmodel.py 2012-11-15 22:07:29 +0000 +++ lava_dispatcher/device/fastmodel.py 2012-11-16 00:44:40 +0000 @@ -185,17 +185,8 @@ return ("%s --image=%s --block-device=%s --network=nat %s") % ( self._sim_binary, self._axf, self._sd_image, options) - 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() + def power_off(self, proc): + super(FastModelTarget, self).power_off(proc) if self._sim_proc is not None: self._sim_proc.close() === modified file 'lava_dispatcher/device/master.py' --- lava_dispatcher/device/master.py 2012-11-15 22:07:29 +0000 +++ lava_dispatcher/device/master.py 2012-11-16 00:44:40 +0000 @@ -90,7 +90,7 @@ self._boot_linaro_image() return self.proc - def _power_off(self, proc): + def power_off(self, proc): # we always leave master image devices powered on pass === modified file 'lava_dispatcher/device/qemu.py' --- lava_dispatcher/device/qemu.py 2012-11-09 20:25:51 +0000 +++ lava_dispatcher/device/qemu.py 2012-11-15 21:23:20 +0000 @@ -69,10 +69,6 @@ tb = download_image(tarball_url, self.context, decompress=False) extract_targz(tb, '%s/%s' % (mntdir, directory)) - def _power_off(self, proc): - if proc is not None: - proc.close() - def power_on(self): qemu_cmd = ('%s -M %s -drive if=%s,cache=writeback,file=%s ' '-clock unix -device usb-kbd -device usb-mouse -usb ' === modified file 'lava_dispatcher/device/target.py' --- lava_dispatcher/device/target.py 2012-11-09 20:25:51 +0000 +++ lava_dispatcher/device/target.py 2012-11-15 21:23:20 +0000 @@ -86,11 +86,6 @@ """ raise NotImplementedError('power_on') - def _power_off(self, proc): - """ responsible for powering off the target device. - """ - raise NotImplementedError('_power_off') - def deploy_linaro(self, hwpack, rfs): raise NotImplementedError('deploy_image') @@ -101,16 +96,8 @@ raise NotImplementedError('deploy_linaro_prebuilt') def power_off(self, proc): - """ tries to safely power off the device by running a sync - operation first - """ - runner = self._get_runner(proc) - try: - logging.info('attempting a filesystem sync before power_off') - runner.run('sync', timeout=20) - except: - logging.exception('calling sync failed') - self._power_off(proc) + if proc is not None: + proc.close() @contextlib.contextmanager def file_system(self, partition, directory): === modified file 'lava_test_shell/lava-test-runner-android' --- lava_test_shell/lava-test-runner-android 2012-11-02 08:33:10 +0000 +++ lava_test_shell/lava-test-runner-android 2012-11-15 21:21:10 +0000 @@ -35,8 +35,19 @@ [ -f ${pkgs} ] || pm list packages -v > ${pkgs} } +cleanup() +{ + # just adds a little handy debugging + ls ${RESULTSDIR} + echo "${PREFIX} calling sync" + sync + echo "${PREFIX} exiting" +} + # in background, since we don't have this working as a proper android service { + trap cleanup INT TERM EXIT + export PATH=${BINDIR}:${PATH} echo "${PREFIX} started" [ -d ${RESULTSDIR} ] || mkdir -p ${RESULTSDIR} @@ -85,11 +96,5 @@ 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-11-02 08:33:10 +0000 +++ lava_test_shell/lava-test-runner-ubuntu 2012-11-15 21:21:10 +0000 @@ -28,6 +28,17 @@ [ -f ${pkgs} ] || dpkg-query -W -f '${status} ${package} : ${version}\n' | sed -n 's/^install ok installed/package:/p' > ${pkgs} } + +cleanup() +{ + # just adds a little handy debugging + ls ${RESULTSDIR} + echo "${PREFIX} calling sync" + sync + echo "${PREFIX} exiting" +} +trap cleanup INT TERM EXIT + export PATH=${BINDIR}:${PATH} echo "${PREFIX} started" [ -d ${RESULTSDIR} ] || mkdir -p ${RESULTSDIR} @@ -70,8 +81,3 @@ 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" -