From patchwork Fri Aug 19 01:35:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Larson X-Patchwork-Id: 3523 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 31A8F23F27 for ; Fri, 19 Aug 2011 01:35:19 +0000 (UTC) Received: from mail-ew0-f52.google.com (mail-ew0-f52.google.com [209.85.215.52]) by fiordland.canonical.com (Postfix) with ESMTP id 2335FA18384 for ; Fri, 19 Aug 2011 01:35:19 +0000 (UTC) Received: by ewy28 with SMTP id 28so1370500ewy.11 for ; Thu, 18 Aug 2011 18:35:19 -0700 (PDT) Received: by 10.213.14.67 with SMTP id f3mr2017063eba.56.1313717718664; Thu, 18 Aug 2011 18:35:18 -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.213.102.5 with SMTP id e5cs107856ebo; Thu, 18 Aug 2011 18:35:18 -0700 (PDT) Received: by 10.216.121.15 with SMTP id q15mr5708092weh.104.1313717715167; Thu, 18 Aug 2011 18:35:15 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com [91.189.90.7]) by mx.google.com with ESMTPS id w44si2193055wec.1.2011.08.18.18.35.14 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 18 Aug 2011 18:35:15 -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 1QuDzO-0003Qo-Lo for ; Fri, 19 Aug 2011 01:35:14 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 99FA3E019A for ; Fri, 19 Aug 2011 01:35:14 +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: 89 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 89: Merge out-of-tree support changes from ChiThu Message-Id: <20110819013514.14550.75544.launchpad@ackee.canonical.com> Date: Fri, 19 Aug 2011 01:35:14 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="13697"; Instance="initZopeless config overlay" X-Launchpad-Hash: 076edf5ff858631cc150ba3c6b3ed508346fda01 Merge authors: Le Chi Thu le.chi.thu@linaro.org Related merge proposals: https://code.launchpad.net/~le-chi-thu/lava-dispatcher/out-of-tree-tests/+merge/72034 proposed by: Le Chi Thu (le-chi-thu) ------------------------------------------------------------ revno: 89 [merge] committer: Paul Larson branch nick: lava-dispatcher timestamp: Thu 2011-08-18 21:38:38 +0100 message: Merge out-of-tree support changes from ChiThu added: doc/lava-out-of-tree-test-1.json doc/lava-out-of-tree-test-2.json modified: lava_dispatcher/actions/lava-test.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 === added file 'doc/lava-out-of-tree-test-1.json' --- doc/lava-out-of-tree-test-1.json 1970-01-01 00:00:00 +0000 +++ doc/lava-out-of-tree-test-1.json 2011-08-18 20:38:38 +0000 @@ -0,0 +1,48 @@ +{ + "job_name": "foo", + "target": "panda01", + "timeout": 18000, + "actions": [ + { + "command": "deploy_linaro_image", + "parameters": + { + "rootfs": "http://snapshots.linaro.org/11.05-daily/linaro-ubuntu-desktop/20110814/0/images/tar/linaro-n-ubuntu-desktop-tar-20110814-0.tar.gz", + "hwpack": "http://snapshots.linaro.org/11.05-daily/linaro-hwpacks/panda/20110814/0/images/hwpack/hwpack_linaro-panda_20110814-0_armel_supported.tar.gz" + } + }, + { + "command": "add_apt_repository", + "parameters": + { + "arg": ["ppa:linaro-graphics-wg/ppa"] + } + }, + { + "command": "lava_test_install", + "parameters": + { + "tests": ["glcompbench"], + "install_python": ["bzr+http//:bazaar.launchpad.net/~linaro-graphics-wg/+junk/linaro-graphics-wg-tests/#egg=linaro-graphics-wg-tests"] + } + }, + { + "command": "boot_linaro_image" + }, + { + "command": "lava_test_run", + "parameters": + { + "test_name": "glcompbench" + } + }, + { + "command": "submit_results", + "parameters": + { + "server": "http://validation.linaro.org/launch-control", + "stream": "/anonymous/panda01-tesing/" + } + } + ] +} === added file 'doc/lava-out-of-tree-test-2.json' --- doc/lava-out-of-tree-test-2.json 1970-01-01 00:00:00 +0000 +++ doc/lava-out-of-tree-test-2.json 2011-08-18 20:38:38 +0000 @@ -0,0 +1,41 @@ +{ + "job_name": "foo", + "target": "panda01", + "timeout": 18000, + "actions": [ + { + "command": "deploy_linaro_image", + "parameters": + { + "rootfs": "http://snapshots.linaro.org/11.05-daily/linaro-ubuntu-desktop/20110814/0/images/tar/linaro-n-ubuntu-desktop-tar-20110814-0.tar.gz", + "hwpack": "http://snapshots.linaro.org/11.05-daily/linaro-hwpacks/panda/20110814/0/images/hwpack/hwpack_linaro-panda_20110814-0_armel_supported.tar.gz" + } + }, + { + "command": "lava_test_install", + "parameters": + { + "tests": ["linaro.pmwg"], + "register": ["http://bazaar.launchpad.net/~linaro-validation/lava-test/trunk/download/head:/powermanagementtests-20110628125042-dnw8hkhbce7pqi0y-2/power-management-tests.json"] + } + }, + { + "command": "boot_linaro_image" + }, + { + "command": "lava_test_run", + "parameters": + { + "test_name": "linaro.pmwg" + } + }, + { + "command": "submit_results", + "parameters": + { + "server": "http://validation.linaro.org/launch-control", + "stream": "/anonymous/panda01-testing/" + } + } + ] +} === modified file 'lava_dispatcher/actions/lava-test.py' --- lava_dispatcher/actions/lava-test.py 2011-08-04 07:19:53 +0000 +++ lava_dispatcher/actions/lava-test.py 2011-08-18 20:38:38 +0000 @@ -27,6 +27,73 @@ from lava_dispatcher.client import OperationFailed from lava_dispatcher.config import LAVA_RESULT_DIR, MASTER_STR, TESTER_STR +def _setup_testrootfs(client): + #Make sure in master image + #, or exception can be caught and do boot_master_image() + try: + client.in_master_shell() + except: + client.boot_master_image() + + client.run_shell_command( + 'mkdir -p /mnt/root', + response=MASTER_STR) + client.run_shell_command( + 'mount /dev/disk/by-label/testrootfs /mnt/root', + response=MASTER_STR) + client.run_shell_command( + 'cp -f /mnt/root/etc/resolv.conf /mnt/root/etc/resolv.conf.bak', + response=MASTER_STR) + client.run_shell_command( + 'cp -L /etc/resolv.conf /mnt/root/etc', + response=MASTER_STR) + #eliminate warning: Can not write log, openpty() failed + # (/dev/pts not mounted?), does not work + client.run_shell_command( + 'mount --rbind /dev /mnt/root/dev', + response=MASTER_STR) + +def _teardown_testrootfs(client): + client.run_shell_command( + 'cp -f /mnt/root/etc/resolv.conf.bak /mnt/root/etc/resolv.conf', + response=MASTER_STR) + cmd = ('cat /proc/mounts | awk \'{print $2}\' | grep "^/mnt/root/dev"' + '| sort -r | xargs umount') + client.run_shell_command( + cmd, + response=MASTER_STR) + client.run_shell_command( + 'umount /mnt/root', + response=MASTER_STR) + +def _install_lava_test(client): + #install bazaar in tester image + client.run_shell_command( + 'chroot /mnt/root apt-get update', + response=MASTER_STR) + #Install necessary packages for build lava-test + cmd = ('chroot /mnt/root apt-get -y install bzr usbutils python-apt ' + 'python-setuptools python-simplejson lsb-release') + client.run_shell_command( + cmd, + response=MASTER_STR, timeout=2400) + client.run_shell_command( + 'chroot /mnt/root bzr branch lp:lava-test', + response=MASTER_STR) + client.run_shell_command( + 'chroot /mnt/root sh -c "cd lava-test && python setup.py install"', + response=MASTER_STR) + + #Test if lava-test installed + try: + client.run_shell_command( + 'chroot /mnt/root lava-test help', + response="list-test", timeout=10) + except: + tb = traceback.format_exc() + client.sio.write(tb) + _teardown_testrootfs(client) + raise OperationFailed("lava-test deployment failed") class cmd_lava_test_run(BaseAction): def run(self, test_name, timeout=-1): @@ -47,75 +114,46 @@ """ lava-test deployment to test image rootfs by chroot """ - def run(self, tests, timeout=2400): + def run(self, tests, install_python = None, register = None, timeout=2400): client = self.client - #Make sure in master image - #, or exception can be caught and do boot_master_image() - try: - client.in_master_shell() - except: - client.boot_master_image() - - #install bazaar in tester image - client.run_shell_command( - 'mkdir -p /mnt/root', - response=MASTER_STR) - client.run_shell_command( - 'mount /dev/disk/by-label/testrootfs /mnt/root', - response=MASTER_STR) - client.run_shell_command( - 'cp -f /mnt/root/etc/resolv.conf /mnt/root/etc/resolv.conf.bak', - response=MASTER_STR) - client.run_shell_command( - 'cp -L /etc/resolv.conf /mnt/root/etc', - response=MASTER_STR) - #eliminate warning: Can not write log, openpty() failed - # (/dev/pts not mounted?), does not work - client.run_shell_command( - 'mount --rbind /dev /mnt/root/dev', - response=MASTER_STR) - client.run_shell_command( - 'chroot /mnt/root apt-get update', - response=MASTER_STR) - #Install necessary packages for build lava-test - cmd = ('chroot /mnt/root apt-get -y install bzr usbutils python-apt ' - 'python-setuptools python-simplejson lsb-release') - client.run_shell_command( - cmd, - response=MASTER_STR, timeout=2400) - client.run_shell_command( - 'chroot /mnt/root bzr branch lp:lava-test', - response=MASTER_STR) - client.run_shell_command( - 'chroot /mnt/root sh -c "cd lava-test && python setup.py install"', - response=MASTER_STR) - - #Test if lava-test installed - try: - client.run_shell_command( - 'chroot /mnt/root lava-test help', - response="list-tests", timeout=10) - except: - tb = traceback.format_exc() - client.sio.write(tb) - raise OperationFailed("lava-test deployment failed") + + _setup_testrootfs(client) + _install_lava_test(client) + + if install_python: + for module in install_python: + client.run_shell_command("chroot /mnt/root apt-get -y install python-pip", response=MASTER_STR) + client.run_shell_command("chroot /mnt/root pip -e " + module, response=MASTER_STR) + + if register: + for test_def_url in register: + client.run_shell_command('chroot /mnt/root lava-test register-test ' + test_def_url, response=MASTER_STR) for test in tests: client.run_shell_command( 'chroot /mnt/root lava-test install %s' % test, response=MASTER_STR) - #clean up - client.run_shell_command( - 'cp -f /mnt/root/etc/resolv.conf.bak /mnt/root/etc/resolv.conf', - response=MASTER_STR) - client.run_shell_command( - 'rm -rf /mnt/root/lava-test', - response=MASTER_STR) - cmd = ('cat /proc/mounts | awk \'{print $2}\' | grep "^/mnt/root/dev"' - '| sort -r | xargs umount') - client.run_shell_command( - cmd, - response=MASTER_STR) - client.run_shell_command( - 'umount /mnt/root', - response=MASTER_STR) + + client.run_shell_command('rm -rf /mnt/root/lava-test', response=MASTER_STR) + + _teardown_testrootfs(client) + +class cmd_add_apt_repository(BaseAction): + """ + add apt repository to test image rootfs by chroot + arg could be 'deb uri distribution [component1] [component2][...]' or ppm: + """ + def run(self, arg): + client = self.client + _setup_testrootfs(client) + + #install add-apt-repository + client.run_shell_command('chroot /mnt/root apt-get -y install python-software-properties',response=MASTER_STR) + + #add ppa + client.run_shell_command('chroot /mnt/root add-apt-repository ' + arg[0], response=MASTER_STR) + client.run_shell_command('chroot /mnt/root apt-get update', response=MASTER_STR) + + _teardown_testrootfs(client) + + === modified file 'lava_dispatcher/utils.py' --- lava_dispatcher/utils.py 2011-08-15 10:44:10 +0000 +++ lava_dispatcher/utils.py 2011-08-18 20:38:38 +0000 @@ -32,7 +32,7 @@ filename = os.path.join(path,filename) fd = open(filename, "w") try: - response = urllib2.urlopen(urllib2.quote(url, safe=":/"), timeout=5) + response = urllib2.urlopen(urllib2.quote(url, safe=":/"), timeout=30) fd = open(filename, 'wb') shutil.copyfileobj(response,fd,0x10000) fd.close()