diff options
author | David Brown <david.brown@linaro.org> | 2016-01-14 12:45:15 -0700 |
---|---|---|
committer | David Brown <david.brown@linaro.org> | 2016-01-14 12:45:15 -0700 |
commit | f14a77e88dcc9c9c8617a2cf8eb2d37d9cf7b813 (patch) | |
tree | 4a06215e95ca39faae705a862fa49d54f7ac0ee0 | |
parent | 08015cf1b3d91d284ba002bf6d7cc8428689197a (diff) |
Instead of a sample json that has to be hacked up to be used, this
python script generates the json, and invokes the job directly. It
still has to be edited, until everything can be parameterized.
-rwxr-xr-x | run-uderef.py | 150 |
1 files changed, 150 insertions, 0 deletions
diff --git a/run-uderef.py b/run-uderef.py new file mode 100755 index 0000000..ea9b5c4 --- /dev/null +++ b/run-uderef.py @@ -0,0 +1,150 @@ +#! /usr/bin/env python3 + +""" +Invoke a LAVA test for uderef + +This script configures and invokes a test. There are a number of +things currently hardcoded in the script, however: + + - Numerous places have my user-id hardcoded, search for + david.brown + - The kernel and dtb come from a specific hard-coded s3 bucket. + - The result bundle has my user-id in it as well. + +Eventually, the script should be configurable, and hopefully easier to +use than editing raw json. +""" + +import json +import netrc +import pprint +from xmlrpc.client import ServerProxy +import sys + +def get_server(host): + nrc = netrc.netrc() + auth = nrc.authenticators(host) + if not auth: + raise Exception("Unable to find .netrc for {}".format(host)) + srv = ServerProxy('https://{}:{}@{}/RPC2'.format(auth[0], auth[2], host), verbose=False) + return srv + +host = 'validation.linaro.org' +srv = get_server(host) +# print(srv) + +class Target(): + def __init__(self): + self.actions = [] + self.deploy = {} + self.boot = {} + self.tests = [] + self.make_deploy() + + self.final = [{ + "command": "submit_results", + "parameters": { + "server": "http://david.brown@validation.linaro.org/RPC2/", + "stream": "/anonymous/david.brown/", + }, + }] + + self.req = {} + self.req['actions'] = self.actions + self.req['device_type'] = 'panda' + self.req['health_check'] = False + self.req['job_name'] = 'davidb-panda-uderef' + self.req['timeout'] = 900 + + def make_deploy(self): + raise Exception("Abstract") + + def basic_test(self): + self.tests.append({ + 'command': 'lava_test_shell', + 'parameters': { + 'testdef_repos': [ + { + 'git-repo': 'https://git.linaro.org/qa/test-definitions.git', + 'testdef': 'openembedded/busybox.yaml', + } + ], + 'timeout': 900, + }, + }) + + def uderef_test(self): + self.tests.append({ + 'command': 'lava_test_shell', + 'parameters': { + 'testdef_repos': [ + { + 'git-repo': 'https://git.linaro.org/people/david.brown/lava-test.git', + 'testdef': 'uderef.yaml', + } + ], + }, + }) + + def get_req(self): + actions = [] + if self.deploy: + actions.append(self.deploy) + if self.boot: + actions.append(self.boot) + actions.extend(self.tests) + actions.extend(self.final) + self.req['actions'] = actions + return self.req + +class Panda(Target): + def __init__(self): + super(Panda, self).__init__() + self.req['device_type'] = 'panda' + self.req['job_name'] = 'davidb-panda-uderef' + + def make_deploy(self): + dp = {} + #dp['dtb'] = 'http://people.linaro.org/~david.brown/omap4-panda.dtb' + #dp['kernel'] = 'http://people.linaro.org/~david.brown/zImage' + dp['dtb'] = 'http://linaro-66b0e97f.s3.amazonaws.com/omap4-panda.dtb' + dp['kernel'] = 'http://linaro-66b0e97f.s3.amazonaws.com/zImage' + + dp['target_type'] = 'oe' + dp['nfsrootfs'] = 'http://releases.linaro.org/14.11/openembedded/images/minimal-armv7a/linaro-image-minimal-genericarmv7a-20141121-301.rootfs.tar.gz' + self.deploy['command'] = 'deploy_linaro_kernel' + self.deploy['parameters'] = dp + +class Arndale(Target): + def __init__(self): + super(Arndale, self).__init__() + self.req['device_type'] = 'arndale' + self.req['job_name'] = 'davidb-arndale-uderef' + + def make_deploy(self): + dp = {} + #dp['dtb'] = 'http://people.linaro.org/~david.brown/omap4-panda.dtb' + #dp['kernel'] = 'http://people.linaro.org/~david.brown/zImage' + dp['dtb'] = 'http://linaro-66b0e97f.s3.amazonaws.com/exynos5250-arndale.dtb' + dp['kernel'] = 'http://linaro-66b0e97f.s3.amazonaws.com/zImage' + + dp['target_type'] = 'oe' + # dp['nfsrootfs'] = 'http://releases.linaro.org/14.11/openembedded/images/minimal-armv7a/linaro-image-minimal-genericarmv7a-20141121-301.rootfs.tar.gz' + dp['ramdisk'] = 'http://storage.kernelci.org/images/rootfs/buildroot/armel/rootfs.cpio.gz' + self.deploy['command'] = 'deploy_linaro_kernel' + self.deploy['parameters'] = dp + +target = Panda() +target.uderef_test() +# pprint.pprint(target.get_req()) + +# TODO: State saving. +# Try running it. +if True: + job = srv.scheduler.submit_job(json.dumps(target.get_req())) + print(job) + print("https://validation.linaro.org/scheduler/job/{}".format(job)) +else: + job = 675154 + print(srv.scheduler.job_status(job)) +sys.exit(0) |