From patchwork Tue Jul 10 16:06:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Doan X-Patchwork-Id: 9934 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 8440C23E57 for ; Tue, 10 Jul 2012 16:06:14 +0000 (UTC) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by fiordland.canonical.com (Postfix) with ESMTP id 308D5A188FC for ; Tue, 10 Jul 2012 16:06:14 +0000 (UTC) Received: by vcbfk26 with SMTP id fk26so128436vcb.11 for ; Tue, 10 Jul 2012 09:06:13 -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=HM4DN64Ghe7gBDR3eDpaFFRXlu1UNQ/Q00qik4LEudQ=; b=Q8hRJLonTDg7AlYltIKwchkUNIpcSM83RF+ByxUqB/zjwMrL9C5C6kqgxH68JogKX+ Nc6VkhIZKOFwMAQKUhNJUS7UqcGLmGq68fGvf9i2D1XLCzG07BT2JwbwG1yKAT+bgX5K zSi8PDU/OWRDHfQw8O99i4QGckq/aaFPUra/c1EDXgo0g1CdadhpHv5TZ5vUcQNvpWkg VVDDPHupx+JUpTP7NJW5ZsF723T3gMyV/NJjMhErFYj7QJYw4+45y9FPvrNGvj0VucQF irZSceBMVHpvdLKhrT9NvVAMhCUJH3ujy8huVdO3wuFRLMXkpzd1yxTJ7in0qrr6WJVG A/xg== Received: by 10.42.68.65 with SMTP id w1mr4720555ici.57.1341936373444; Tue, 10 Jul 2012 09:06:13 -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.231.24.148 with SMTP id v20csp51973ibb; Tue, 10 Jul 2012 09:06:12 -0700 (PDT) Received: by 10.216.212.217 with SMTP id y67mr18862802weo.173.1341936372133; Tue, 10 Jul 2012 09:06:12 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id fe9si9456473wib.28.2012.07.10.09.06.11 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 10 Jul 2012 09:06:12 -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 1Socx1-0001U9-Do for ; Tue, 10 Jul 2012 16:06:11 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 5CE82E013E for ; Tue, 10 Jul 2012 16:06: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: 346 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 346: fix two bugs found while doing fastmodel testing Message-Id: <20120710160611.11043.99180.launchpad@ackee.canonical.com> Date: Tue, 10 Jul 2012 16:06: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="15584"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: b523f2af1b9964ebd17f3cdd73b7d4a490ac0ef7 X-Gm-Message-State: ALoCoQm9ongsbPnEGqhb0oh5PDBm9LiqVWQ3h9/nmndDjmCZV4IDXIk+tOhXn0xOaYt0NBifZhQz Merge authors: Andy Doan (doanac) Related merge proposals: https://code.launchpad.net/~doanac/lava-dispatcher/fm-perms-drain/+merge/114093 proposed by: Andy Doan (doanac) review: Approve - Michael Hudson-Doyle (mwhudson) ------------------------------------------------------------ revno: 346 [merge] committer: Andy Doan branch nick: lava-dispatcher timestamp: Tue 2012-07-10 11:05:19 -0500 message: fix two bugs found while doing fastmodel testing file permissions proper draining of fastmodel pexpect session modified: lava_dispatcher/client/fastmodel.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/fastmodel.py' --- lava_dispatcher/client/fastmodel.py 2012-06-29 01:26:45 +0000 +++ lava_dispatcher/client/fastmodel.py 2012-07-09 23:11:59 +0000 @@ -24,6 +24,7 @@ import os import pexpect import shutil +import stat import threading from lava_dispatcher.client.base import ( @@ -121,6 +122,17 @@ def _close_serial_proc(self): self.proc.close(True) + def _fix_perms(self): + ''' The directory created for the image download/creation gets created + with tempfile.mkdtemp which grants permission only to the creator of + the directory. We need group access because the dispatcher may run + the simulator as a different user + ''' + d = os.path.dirname(self._sd_image) + os.chmod(d, stat.S_IRWXG|stat.S_IRWXU) + os.chmod(self._sd_image, stat.S_IRWXG|stat.S_IRWXU) + os.chmod(self._axf, stat.S_IRWXG|stat.S_IRWXU) + def _get_sim_cmd(self): return ("%s -a coretile.cluster0.*=%s " "-C motherboard.smsc_91c111.enabled=1 " @@ -137,6 +149,7 @@ if self._sim_proc is not None: self._sim_proc.close() + self._fix_perms() sim_cmd = self._get_sim_cmd() # the simulator proc only has stdout/stderr about the simulator @@ -185,4 +198,4 @@ # 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.interact() + self.proc.drain() === modified file 'lava_dispatcher/utils.py' --- lava_dispatcher/utils.py 2012-06-15 20:35:05 +0000 +++ lava_dispatcher/utils.py 2012-07-09 23:10:24 +0000 @@ -22,6 +22,7 @@ import errno import logging import os +import sys import shutil import urllib2 import urlparse @@ -124,6 +125,15 @@ return super(logging_spawn, self).expect(*args, **kw) + def drain(self): + """this is a one-off of the pexect __interact that ignores STDIN and + handles an error that happens when we call read just after the process exits + """ + try: + self._spawn__interact_copy(escape_character=chr(29)) + except: + logging.warn(sys.exc_info()) + pass # XXX Duplication: we should reuse lava-test TestArtifacts def generate_bundle_file_name(test_name):