Merge lp:~liuyq0307/linaro-android-build-tools/multiple-devices-support into lp:linaro-android-build-tools

Proposed by Yongqin Liu
Status: Merged
Approved by: Milo Casagrande
Approved revision: 636
Merged at revision: 637
Proposed branch: lp:~liuyq0307/linaro-android-build-tools/multiple-devices-support
Merge into: lp:linaro-android-build-tools
Diff against target: 538 lines (+297/-178)
1 file modified
build-scripts/post-build-lava.py (+297/-178)
To merge this branch: bzr merge lp:~liuyq0307/linaro-android-build-tools/multiple-devices-support
Reviewer Review Type Date Requested Status
Milo Casagrande (community) Approve
Review via email: mp+171554@code.launchpad.net

This proposal supersedes a proposal from 2013-06-26.

Description of the change

updated according to the review comments.

1. add support for submitting jobs to multiple device target or device types
2. refactor the lava related part in the main method, so that the concept is more clear there,
   and make it more easier to maintain

To post a comment you must log in.
Revision history for this message
Milo Casagrande (milo) wrote : Posted in a previous version of this proposal
Download full text (5.6 KiB)

Hello Yongqin,

thanks for working on this! Overall the refactoring looks good.
What follows are my suggestions.

=== modified file 'build-scripts/post-build-lava.py'
+class LAVADeviceBase(object):
+ """
+ Base class for defination of the device type and target in lava job
+ """

Typo: defination → definition
Also, please make them sentences (end them with a dot).

+
+ def __init__(self, name=None):
+ self.name = name
+
+
+class LAVADeviceType(LAVADeviceBase):
+ """
+ Representation the defination of the device type in lava job
+ """
+
+
+class LAVADeviceTarget(LAVADeviceBase):
+ """
+ Representation the defination of the device target in lava job
+ """

+def get_build_url():
+ # Build url, defined by android-build, e.g.
+ # https://android-build.linaro.org/jenkins/job/linaro-android_leb-panda/61/
+ build_url = os.environ.get("BUILD_URL")
+
+ return build_url
+
+
+def get_target_product():
+ # Target product name, user defined, e.g. pandaboard
+ target_product = os.environ.get("TARGET_PRODUCT")
+ return target_product

Why not make a generic "get_env_variable()" function instead of each specialized
functions to get a specific env variable? Maybe also with a default named args:

def get_env_variable(name, default=None):
 ...

Also, maybe the evn variable might be defined at the top of the file as module attribute:

TARGET_PRODUCT_ENV="TARGET_PRODUCT"
BUILD_URL_ENV="BUILD_URL"

+
+
+def get_schema_and_url():
+ lava_server = os.environ.get("LAVA_SERVER")
+ if lava_server == None:

Better write this as:

if lava_server is None:

+ schema = 'https'
+ url_no_schema = "validation.linaro.org/lava-server/RPC2/"

Not sure about these variables, but even if they will not change that much, it might
make sense to move them at the top of the file as module attribute:

DEFAULT_SCHEMA="https"
DEFAULT_VALIDATION_URL="validation..."

+ elif lava_server.find('://') >= 0:
+ schema = lava_server[:lava_server.find('://')]
+ url_no_schema = lava_server[lava_server.find('://') + len('://'):]
+ else:
+ ## the case that no https and http specified in the url
+ ## like: validation.linaro.org/lava-server/RPC2/
+ schema = 'https'
+ url_no_schema = lava_server
+ return (schema, url_no_schema)
+

-def main():
- """Script entry point: return some JSON based on calling args.
- We should be called from Jenkins and expect the following to
- be defined: $TARGET_PRODUCT $JOB_NAME $BUILD_NUMBER $BUILD_URL"""
+def gen_deploy_action():

- # Target product name, user defined, e.g. pandaboard
- target_product = os.environ.get("TARGET_PRODUCT")
     # Job name, defined by android-build, e.g. linaro-android_leb-panda
     job_name = os.environ.get("JOB_NAME")
     frontend_job_name = "~" + job_name.replace("_", "/", 1)
+
     # Build number, defined by android-build, e.g. 61
     build_number = os.environ.get("BUILD_NUMBER")
- # Build url, defined by android-build, e.g.
- # https://android-build.linaro.org/jenkins/job/linaro-android_leb-panda/61/
- build_url = os.environ.get("BUILD_URL")
+
     # download base URL, this may diffe...

Read more...

review: Needs Fixing
Revision history for this message
Milo Casagrande (milo) wrote :

Hi,

just a couple of small fixes:

+
+ if wait_for_homescreen == False:
+ boot_action["parameters"] = {"wait_for_home_screen": False}
+ return boot_action
+

Please use "wait_for_homescreen is False".

+ lava_token_f = get_env_var(ENV_LAVA_TOKEN_FILE)
+ if lava_token_f == None:
+ lava_token_f = DEFAULT_LAVA_TOKEN_FILE

Same thing here, better use "lava_token_f is None".
When those are fixed, ping me on IRC, no need to re-send another MP, just push here and the diff will get updated.

review: Needs Fixing
636. By Yongqin Liu

change == None to is None according to review comments

Revision history for this message
Milo Casagrande (milo) wrote :

Thanks!
Looks good to go.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'build-scripts/post-build-lava.py'
2--- build-scripts/post-build-lava.py 2013-06-18 08:23:21 +0000
3+++ build-scripts/post-build-lava.py 2013-06-27 08:39:27 +0000
4@@ -53,6 +53,130 @@
5 # reboot in between test actions.
6 REBOOT_TOKEN = '[system-reboot]'
7
8+# CONSTANTS DEFINITION
9+DEFAULT_LAVA_SCHEMA = 'https'
10+DEFAULT_LAVA_URL = 'validation.linaro.org/lava-server/RPC2/'
11+DEFAULT_LAVA_STREAM = '/private/team/linaro/android-daily/'
12+DEFAULT_LAVA_DIR = '/var/run/lava/'
13+DEFAULT_LAVA_USER_FILE = '%s/lava-user' % DEFAULT_LAVA_DIR
14+DEFAULT_LAVA_TOKEN_FILE = '%s/lava-token' % DEFAULT_LAVA_DIR
15+DEFAULT_DOWNLOAD_BASE_URL = 'http://snapshots.linaro.org/android/'
16+DEFAULT_TIMEOUT_VALUE = 18000
17+
18+# Environment variables name
19+ENV_LAVA_SERVER = 'LAVA_SERVER'
20+ENV_LAVA_DEVICE = 'LAVA_DEVICE'
21+ENV_LAVA_DEVICE_TYPE = 'LAVA_DEVICE_TYPE'
22+ENV_LAVA_TEST_PLAN = 'LAVA_TEST_PLAN'
23+ENV_LAVA_TEST_PLAN_SEC_PRE = 'LAVA_TEST_PLAN_SECONDARY_'
24+ENV_LAVA_TOKEN_FILE = 'LAVA_TOKEN_FILE'
25+ENV_LAVA_USER = 'LAVA_USER'
26+# Build url, defined by android-build, e.g.
27+# https://android-build.linaro.org/jenkins/job/linaro-android_leb-panda/61/
28+ENV_BUILD_URL = 'BUILD_URL'
29+ENV_DEFAULT_TIMEOUT = 'DEFAULT_TIMEOUT'
30+# Target product name, user defined, e.g. pandaboard
31+ENV_TARGET_PRODUCT = 'TARGET_PRODUCT'
32+
33+
34+class LAVADeviceBase(object):
35+ """
36+ Base class for definition of the device type and target in lava job.
37+ """
38+
39+ def __init__(self, name=None):
40+ self.name = name
41+
42+
43+class LAVADeviceType(LAVADeviceBase):
44+ """
45+ Representation the definition of the device type in lava job.
46+ """
47+
48+
49+class LAVADeviceTarget(LAVADeviceBase):
50+ """
51+ Representation the definition of the device target in lava job.
52+ """
53+
54+
55+def get_env_var(name, default=None):
56+ return os.environ.get(name, default)
57+
58+
59+def get_lava_device_type_or_target():
60+ '''
61+ Here we support the specification by both,
62+ LAVA_DEVICE or LAVA_DEVICE_TYPE, and we can specify
63+ both of them at the same time.
64+ '''
65+ devices = []
66+
67+ # allow to submit to a specific device
68+ test_device = get_env_var(ENV_LAVA_DEVICE)
69+ if test_device:
70+ targets = test_device.split(',')
71+ for dev_target in targets:
72+ dev_target = dev_target.strip()
73+ if dev_target:
74+ devices.append(LAVADeviceTarget(name=dev_target))
75+
76+ # allow overload lava device_type by build config
77+ test_device_type = get_env_var(ENV_LAVA_DEVICE_TYPE)
78+
79+ target_product = get_env_var(ENV_TARGET_PRODUCT)
80+ # only use the default device type when neither of
81+ # LAVA_DEVICE or LAVA_DEVICE_TYPE is specified.
82+ # or say we will not use the value when any of
83+ # LAVA_DEVICE or LAVA_DEVICE_TYPE is specified.
84+ if (not test_device_type) and (not test_device):
85+ test_device_type = PRODUCT_MAP[target_product]["test_device_type"]
86+ if test_device_type:
87+ types = test_device_type.split(',')
88+ for dev_type in types:
89+ dev_type = dev_type.strip()
90+ if dev_type:
91+ devices.append(LAVADeviceType(name=dev_type))
92+
93+ return devices
94+
95+
96+def get_schema_and_url():
97+ lava_server = get_env_var(ENV_LAVA_SERVER)
98+ if lava_server is None:
99+ schema = DEFAULT_LAVA_SCHEMA
100+ url_no_schema = DEFAULT_LAVA_URL
101+ elif lava_server.find('://') >= 0:
102+ schema = lava_server[:lava_server.find('://')]
103+ url_no_schema = lava_server[lava_server.find('://') + len('://'):]
104+ else:
105+ ## the case that no https and http specified in the url
106+ ## like: validation.linaro.org/lava-server/RPC2/
107+ schema = DEFAULT_LAVA_SCHEMA
108+ url_no_schema = lava_server
109+ return (schema, url_no_schema)
110+
111+
112+def get_plan_list():
113+ plan_list = [ENV_LAVA_TEST_PLAN]
114+ sec_plan_prefix = ENV_LAVA_TEST_PLAN_SEC_PRE
115+
116+ for var in os.environ.keys():
117+ if var.startswith(sec_plan_prefix):
118+ plan_list.append(var)
119+ plan_list.sort()
120+
121+ return plan_list
122+
123+
124+def check_target_product():
125+ # Board-specific parameters
126+ target_product = get_env_var(ENV_TARGET_PRODUCT)
127+ if target_product not in PRODUCT_MAP:
128+ # We don't know how to test this job, so skip testing.
129+ print "Don't know how to test this board. Skip testing."
130+ sys.exit(1)
131+
132
133 def gen_lava_test_shell_action(test_name=None, test_para=None):
134 if not test_para or not test_name:
135@@ -96,7 +220,7 @@
136 if key_value_hash.get('testdef'):
137 repo["testdef"] = key_value_hash.get('testdef')
138
139- parameters["testdef_repos"] = [repo]
140+ parameters["testdef_repos"] = [repo]
141 action = {
142 "command": "lava_test_shell",
143 "parameters": parameters
144@@ -171,7 +295,7 @@
145 test_option = ''
146 if test.find('(') >= 0 and test.rfind(')') > test.find('(') \
147 and test[:test.find('(')].strip():
148- test_option = test[test.find('(') + 1 : test.rfind(')')]
149+ test_option = test[test.find('(') + 1: test.rfind(')')]
150 test = test[:test.find('(')].strip()
151
152 if test.startswith('lava-test-shell'):
153@@ -240,9 +364,9 @@
154
155
156 def gen_test_plan_actions(test_plan=None):
157- if test_plan == None:
158+ if test_plan is None:
159 test_plan = os.environ.get("LAVA_TEST_PLAN")
160- if test_plan == None:
161+ if test_plan is None:
162 test_plan = '0xbench, glmark2, monkey'
163 test_plans = test_plan.split(',')
164 for index in range(len(test_plans)):
165@@ -324,204 +448,199 @@
166 return test_actions
167
168
169-def main():
170- """Script entry point: return some JSON based on calling args.
171- We should be called from Jenkins and expect the following to
172- be defined: $TARGET_PRODUCT $JOB_NAME $BUILD_NUMBER $BUILD_URL"""
173+def gen_deploy_action():
174
175- # Target product name, user defined, e.g. pandaboard
176- target_product = os.environ.get("TARGET_PRODUCT")
177 # Job name, defined by android-build, e.g. linaro-android_leb-panda
178 job_name = os.environ.get("JOB_NAME")
179 frontend_job_name = "~" + job_name.replace("_", "/", 1)
180+
181 # Build number, defined by android-build, e.g. 61
182 build_number = os.environ.get("BUILD_NUMBER")
183- # Build url, defined by android-build, e.g.
184- # https://android-build.linaro.org/jenkins/job/linaro-android_leb-panda/61/
185- build_url = os.environ.get("BUILD_URL")
186+
187 # download base URL, this may differ from job URL if we don't host
188 # downloads in Jenkins any more
189- download_url = "http://snapshots.linaro.org/android/%s/%s/" % \
190- (frontend_job_name, build_number)
191- # User can disable the installation of android binaries (doing this will
192- # disable hardware acceleration)
193- enable_android_install_binaries = os.environ.get("LAVA_ANDROID_BINARIES")
194+ download_url = "%s/%s/%s/" % (DEFAULT_DOWNLOAD_BASE_URL,
195+ frontend_job_name,
196+ build_number)
197+
198+ # Set the file extension based on the type of artifacts
199+ artifact_type = os.environ.get("MAKE_TARGETS", "tarball")
200+ if artifact_type == "droidcore":
201+ file_extension = "img"
202+ else:
203+ file_extension = "tar.bz2"
204+
205+ action = {"command": "deploy_linaro_android_image",
206+ "parameters": {
207+ "boot": "%s%s%s" % (download_url,
208+ "/boot.", file_extension),
209+ "system": "%s%s%s" % (download_url,
210+ "/system.", file_extension),
211+ "data": "%s%s%s" % (download_url,
212+ "/userdata.", file_extension)
213+ },
214+ "metadata": {
215+ "android.name": job_name,
216+ "android.build": '%s' % build_number,
217+ "android.url": get_env_var(ENV_BUILD_URL)
218+ }
219+ }
220+ return action
221+
222+
223+def gen_boot_action():
224 # Some devices need not boot to GUI like the Tiny Android builds and builds
225 # which need a proprietary binary overlay to be installed before expecting
226 # GUI.
227- wait_for_homescreen = os.environ.get("LAVA_WAIT_FOR_HOMESCREEN")
228- if wait_for_homescreen == None:
229- wait_for_homescreen = True
230- elif wait_for_homescreen.lower() in ['0','false','no']:
231- wait_for_homescreen = False
232- # Not set, default to False, because this is relevant only for panda
233+ boot_action = {"command": "boot_linaro_android_image"}
234+
235+ wait_for_homescreen = os.environ.get("LAVA_WAIT_FOR_HOMESCREEN", 'true')
236+ if wait_for_homescreen.lower() in ['0', 'false', 'no']:
237+ boot_action["parameters"] = {"wait_for_home_screen": False}
238+ return boot_action
239+
240+
241+def gen_install_binaries_action():
242+ # User can disable the installation of android binaries (doing this will
243+ # disable hardware acceleration)
244+ ENV_LAVA_ANDROID_BINARIES = 'LAVA_ANDROID_BINARIES'
245+ enable_binaries = get_env_var(ENV_LAVA_ANDROID_BINARIES, 'false')
246+
247+ # Not set, default to False, because this is relevant only for panda
248 # from Vishal
249- if enable_android_install_binaries == None:
250- enable_android_install_binaries = False
251- elif enable_android_install_binaries.lower() in ['1', 'true', 'yes']:
252- enable_android_install_binaries = True
253- else:
254- enable_android_install_binaries = False
255-
256- # Set the default timeout for all test,
257+ if enable_binaries.lower() in ['1', 'true', 'yes']:
258+ return {"command": "android_install_binaries"}
259+
260+
261+def gen_submit_action():
262+
263+ (schema, url_no_schema) = get_schema_and_url()
264+ schema_url = '%s://%s' % (schema, url_no_schema)
265+
266+ target_product = get_env_var(ENV_TARGET_PRODUCT)
267+ submit_action = {"command": "submit_results_on_host",
268+ "parameters": {
269+ "server": schema_url,
270+ "stream": PRODUCT_MAP[target_product].get(
271+ "test_stream", DEFAULT_LAVA_STREAM)
272+ }
273+ }
274+
275+ return submit_action
276+
277+
278+def gen_config(actions=[], device=None):
279+ if not isinstance(device, LAVADeviceBase):
280+ print "Not supported type of device %s" % type(device)
281+ return None
282+
283+ # Set the default timeout for all test, also used as the timeout value of
284+ # the total job when it's value bigger than 24 * 60 * 60
285 # if this value is not set, then use the 18000 seconds as the default value
286- default_timeout = os.environ.get("DEFAULT_TIMEOUT", 18000)
287-
288- # Set the file extension based on the type of artifacts
289- artifact_type = os.environ.get("MAKE_TARGETS", "tarball")
290- if artifact_type == "droidcore":
291- file_extension = "img"
292+ default_timeout = get_env_var(ENV_DEFAULT_TIMEOUT, DEFAULT_TIMEOUT_VALUE)
293+
294+ config_json = {"job_name": get_env_var(ENV_BUILD_URL),
295+ "image_type": 'android',
296+ "timeout": int(default_timeout),
297+ "actions": actions
298+ }
299+
300+ # test_device set will win over test_device_type
301+ # LAVA parameter naming could use more consistency
302+ if isinstance(device, LAVADeviceType):
303+ config_json["device_type"] = device.name
304 else:
305- file_extension = "tar.bz2"
306-
307- # Board-specific parameters
308- if target_product not in PRODUCT_MAP:
309- # We don't know how to test this job, so skip testing.
310- print "Don't know how to test this board. Skip testing."
311+ config_json["target"] = device.name
312+
313+ config = json.dumps(config_json, indent=4)
314+
315+ print config
316+ return config
317+
318+
319+def submit_job(config=None, plan=None):
320+ if (not config) or (not plan):
321+ print "Config or plan is None"
322 return
323
324- lava_server = os.environ.get("LAVA_SERVER")
325- if lava_server == None:
326- schema = 'https'
327- url_no_schema = "validation.linaro.org/lava-server/RPC2/"
328- elif lava_server.find('://') >= 0:
329- schema = lava_server[:lava_server.find('://')]
330- url_no_schema = lava_server[lava_server.find('://') + len('://'):]
331+ # get the lava token used for submit job
332+ lava_token_f = get_env_var(ENV_LAVA_TOKEN_FILE)
333+ if lava_token_f is None:
334+ lava_token_f = DEFAULT_LAVA_TOKEN_FILE
335 else:
336- ## the case that no https and http specified in the url
337- ## like: validation.linaro.org/lava-server/RPC2/
338- schema = 'https'
339- url_no_schema = lava_server #for compare with above condition
340- schema_url = '%s://%s' % (schema, url_no_schema)
341- lava_server = url_no_schema
342-
343- lava_user = os.environ.get("LAVA_USER")
344- if lava_user == None:
345- f = open('/var/run/lava/lava-user')
346+ lava_token_f = '%s/%s' % (DEFAULT_LAVA_DIR, lava_token_f)
347+
348+ with open(lava_token_f) as fd:
349+ lava_token = fd.read().strip()
350+
351+ # get the lava user used for submit job
352+ lava_user = get_env_var(ENV_LAVA_USER)
353+ if lava_user is None:
354+ f = open(DEFAULT_LAVA_USER_FILE)
355 lava_user = f.read().strip()
356 f.close()
357- default_stream = '/private/team/linaro/android-daily/'
358-
359- common_actions = [
360- {
361- "command": "deploy_linaro_android_image",
362- "parameters":
363- {
364- "boot": "%s%s%s" % (download_url,
365- "/boot.", file_extension),
366- "system":"%s%s%s" % (download_url,
367- "/system.", file_extension),
368- "data":"%s%s%s" % (download_url,
369- "/userdata.", file_extension)
370- },
371- "metadata":
372- {
373- "android.name": job_name,
374- "android.build": '%s' % build_number,
375- "android.url": build_url
376- }
377- }]
378-
379- if enable_android_install_binaries:
380- common_actions.append({"command": "android_install_binaries"})
381-
382- if wait_for_homescreen == False:
383- common_actions.append({"command": "boot_linaro_android_image",
384- "parameters": {
385- "wait_for_home_screen": False
386- }
387- })
388+
389+ (schema, lava_server_no_schema) = get_schema_and_url()
390+ try:
391+ report_url = ("%(schema)s://%(lava_user)s:%(lava_token)s@"
392+ "%(lava_server_no_schema)s") % dict(
393+ schema=schema,
394+ lava_user=lava_user,
395+ lava_token=lava_token,
396+ lava_server_no_schema=lava_server_no_schema)
397+ server = xmlrpclib.ServerProxy(report_url)
398+ lava_job_id = server.scheduler.submit_job(config)
399+ lava_server_root = lava_server_no_schema.rstrip("/")
400+ if lava_server_root.endswith("/RPC2"):
401+ lava_server_root = lava_server_root[:-len("/RPC2")]
402+ except xmlrpclib.ProtocolError, e:
403+ print "Error making a LAVA request:", obfuscate_credentials(str(e))
404+ return
405+
406+ print "LAVA Job Id: %s, URL: %s://%s/scheduler/job/%s" % \
407+ (lava_job_id, schema, lava_server_root, lava_job_id)
408+
409+ if plan == "LAVA_TEST_PLAN":
410+ json.dump({
411+ 'lava_url': "%s://%s" % (schema, lava_server_root),
412+ 'job_id': lava_job_id,
413+ }, open('out/lava-job-info', 'w'))
414 else:
415- common_actions.append({"command": "boot_linaro_android_image"})
416-
417- plan_list = ["LAVA_TEST_PLAN"]
418- sec_plan_prefix = "LAVA_TEST_PLAN_SECONDARY_"
419-
420- for var in os.environ.keys():
421- if var.startswith(sec_plan_prefix):
422- plan_list.append(var)
423- plan_list.sort()
424+ json.dump({
425+ 'lava_url': "%s://%s" % (schema, lava_server_root),
426+ 'job_id': lava_job_id,
427+ }, open('out/lava-job-info-' + plan, 'w'))
428+
429+
430+def main():
431+ """Script entry point: return some JSON based on calling args.
432+ We should be called from Jenkins and expect the following to
433+ be defined: $TARGET_PRODUCT $JOB_NAME $BUILD_NUMBER $BUILD_URL"""
434+
435+ check_target_product()
436+
437+ common_actions = [gen_deploy_action()]
438+
439+ install_binaries_action = gen_install_binaries_action()
440+ if install_binaries_action:
441+ common_actions.append(install_binaries_action)
442+
443+ common_actions.append(gen_boot_action())
444+
445+ plan_list = get_plan_list()
446 # Create a copy of common actions
447 for plan in plan_list:
448 actions = copy.deepcopy(common_actions)
449 if plan == "LAVA_TEST_PLAN":
450- actions.extend(gen_test_actions())
451- else:
452- actions.extend(gen_test_plan_actions(os.environ.get(plan)))
453- actions.append(
454- {
455- "command": "submit_results_on_host",
456- "parameters":
457- {
458- "server": schema_url,
459- "stream": PRODUCT_MAP[target_product].get(
460- "test_stream", default_stream)
461- }
462- })
463-
464- config_json = {"job_name": build_url,
465- "image_type": 'android',
466- "timeout": int(default_timeout),
467- "actions": actions
468- }
469-
470- # allow overload lava device_type by build config
471- test_device_type = os.environ.get("LAVA_DEVICE_TYPE")
472- if not test_device_type:
473- test_device_type = PRODUCT_MAP[target_product]["test_device_type"]
474-
475- # allow to submit to a specific device
476- test_device = os.environ.get("LAVA_DEVICE")
477-
478- # test_device set will win over test_device_type
479- # LAVA parameter naming could use more consistency
480- if test_device:
481- config_json["target"] = test_device
482- else:
483- config_json["device_type"] = test_device_type
484-
485- config = json.dumps(config_json, indent=4)
486-
487- print config
488-
489- lava_token_f = os.environ.get("LAVA_TOKEN_FILE")
490- if lava_token_f == None:
491- lava_token_f = '/var/run/lava/lava-token'
492- else:
493- lava_token_f = '/var/run/lava/%s' % lava_token_f
494-
495- with open(lava_token_f) as fd:
496- lava_token = fd.read().strip()
497-
498- try:
499- report_url = ("%(schema)s://"
500- "%(lava_user)s:%(lava_token)s@%(lava_server)s") % dict(
501- schema=schema,
502- lava_user=lava_user,
503- lava_token=lava_token,
504- lava_server=lava_server)
505- server = xmlrpclib.ServerProxy(report_url)
506- lava_job_id = server.scheduler.submit_job(config)
507- lava_server_root = lava_server.rstrip("/")
508- if lava_server_root.endswith("/RPC2"):
509- lava_server_root = lava_server_root[:-len("/RPC2")]
510- except xmlrpclib.ProtocolError, e:
511- print "Error making a LAVA request:", obfuscate_credentials(str(e))
512- sys.exit(1)
513-
514- print "LAVA Job Id: %s, URL: %s://%s/scheduler/job/%s" % \
515- (lava_job_id, schema, lava_server_root, lava_job_id)
516-
517- if plan == "LAVA_TEST_PLAN":
518- json.dump({
519- 'lava_url': "%s://%s" % (schema, lava_server_root),
520- 'job_id': lava_job_id,
521- }, open('out/lava-job-info', 'w'))
522- else:
523- json.dump({
524- 'lava_url': "%s://%s" % (schema, lava_server_root),
525- 'job_id': lava_job_id,
526- }, open('out/lava-job-info-' + plan , 'w'))
527+ actions.extend(gen_test_actions())
528+ else:
529+ actions.extend(gen_test_plan_actions(get_env_var(plan)))
530+ actions.append(gen_submit_action())
531+
532+ devices = get_lava_device_type_or_target()
533+ for dev in devices:
534+ config = gen_config(actions=actions, device=dev)
535+ submit_job(config=config, plan=plan)
536
537
538 if __name__ == "__main__":

Subscribers

People subscribed via source and target branches