diff options
| author | Martin Pitt <martin.pitt@ubuntu.com> | 2015-12-11 12:27:43 (GMT) |
|---|---|---|
| committer | Martin Pitt <martin.pitt@ubuntu.com> | 2015-12-11 12:27:43 (GMT) |
| commit | 30800f874f8c5d189a9a6a2939be5d202ea9f6d2 (patch) | |
| tree | b938ebc5db05eaf09147fb225292787a1f9829c1 | |
| parent | d637e10206dc1a157eb7df975b43abd5581087cf (diff) | |
worker: Add "test-git" and "test-bzr" options
This allows AMQP requests to specify a VCS branch which will be checked out and
used as --unbuilt-tree. The specified package name will then (only) be used for
the resulting swift path, and be invisible to the actual test.
| -rwxr-xr-x | worker/worker | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/worker/worker b/worker/worker index 412560b..8945c5e 100755 --- a/worker/worker +++ b/worker/worker @@ -196,7 +196,8 @@ def request(msg): big_pkg = pkgname in cfg.get('autopkgtest', 'big_packages').strip().split() # build adt-run command line - out_dir = tempfile.mkdtemp(prefix='adt-run.out.') + work_dir = tempfile.mkdtemp(prefix='adt-work.') + out_dir = os.path.join(work_dir, 'out') autopkgtest_checkout = cfg.get('autopkgtest', 'checkout_dir').strip() if autopkgtest_checkout: argv = [os.path.join(autopkgtest_checkout, 'run-from-checkout')] @@ -253,7 +254,19 @@ def request(msg): pocket_arg += '=' + ','.join(trigs) argv += [pocket_arg, '--apt-upgrade'] - argv.append(pkgname) + # determine which test to run + if 'test-git' in params: + checkout_dir = os.path.join(work_dir, 'checkout') + subprocess.check_call(['git', 'clone', params['test-git'], checkout_dir]) + testargs = ['--no-built-binaries', '--unbuilt-tree', checkout_dir] + elif 'test-bzr' in params: + checkout_dir = os.path.join(work_dir, 'checkout') + subprocess.check_call(['bzr', 'checkout', '--lightweight', params['test-bzr'], checkout_dir]) + testargs = ['--no-built-binaries', '--unbuilt-tree', checkout_dir] + else: + testargs = [pkgname] + + argv += testargs if args.debug: argv.append('--debug') if pkgname in cfg.get('autopkgtest', 'long_tests').strip().split(): @@ -373,7 +386,7 @@ def request(msg): content_length=os.path.getsize(path)) swift_con.close() - shutil.rmtree(out_dir) + shutil.rmtree(work_dir) logging.info('Acknowledging request %s' % msg.body) msg.channel.basic_ack(msg.delivery_tag) |
