X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=scripts%2Flttng-baremetal-tests%2Flava-submit.py;h=77abff970b13e0d1946ec47d7506821fc1959b44;hb=64d4186531e1d38372a06e35100a70ea9bb7a7c1;hp=2115718acb2cafbbff91165a3eabadeb100e4b65;hpb=8cef2adf49d3f3df4110c62a665db6393b0537c7;p=lttng-ci.git diff --git a/scripts/lttng-baremetal-tests/lava-submit.py b/scripts/lttng-baremetal-tests/lava-submit.py index 2115718..77abff9 100644 --- a/scripts/lttng-baremetal-tests/lava-submit.py +++ b/scripts/lttng-baremetal-tests/lava-submit.py @@ -20,7 +20,7 @@ import json import os import sys import time -import xmlrpclib +import xmlrpc.client from collections import OrderedDict from enum import Enum @@ -37,8 +37,8 @@ def get_job_bundle_content(server, job): try: bundle_sha = server.scheduler.job_status(str(job))['bundle_sha1'] bundle = server.dashboard.get(bundle_sha) - except Fault as f: - print 'Error while fetching results bundle', f + except xmlrpc.client.Fault as f: + print('Error while fetching results bundle', f.faultString) return json.loads(bundle['content']) @@ -85,7 +85,7 @@ def fetch_benchmark_results(server, job): for a in res['attachments']: # We only save the results file if a['pathname'] in testcases: - with open(a['pathname'],'w') as f: + with open(a['pathname'],'wb') as f: # Convert the b64 representation of the # result file and write it to a file # in the current working directory @@ -103,7 +103,7 @@ def print_test_output(server, job): # Decode the base64 file and split on newlines to iterate # on list - testoutput = base64.b64decode(attachment['content']).split('\n') + testoutput = str(base64.b64decode(bytes(attachment['content'], encoding='UTF-8'))).split('\n') # Create a generator to iterate on the lines and keeping # the state of the iterator across the two loops. @@ -150,7 +150,8 @@ def get_boot_cmd(): def get_config_cmd(build_device): packages=['bsdtar', 'psmisc', 'wget', 'python3', 'python3-pip', \ 'libglib2.0-dev', 'libffi-dev', 'elfutils', 'libdw-dev', \ - 'libelf-dev', 'libmount-dev', 'libxml2', 'libpfm4-dev'] + 'libelf-dev', 'libmount-dev', 'libxml2', 'libpfm4-dev', \ + 'libnuma-dev'] command = OrderedDict({ 'command': 'lava_command_run', 'parameters': { @@ -158,7 +159,8 @@ def get_config_cmd(build_device): 'cat /etc/resolv.conf', 'echo nameserver 172.18.0.12 > /etc/resolv.conf', 'groupadd tracing' - ] + ], + 'timeout':300 } }) if build_device in 'x86': @@ -354,9 +356,9 @@ def main(): lava_api_key = None try: - lava_api_key = os.environ['LAVA_FRDESO_TOKEN'] - except Exception, e: - print('LAVA_FRDESO_TOKEN not found in the environment variable. Exiting...') + lava_api_key = os.environ['LAVA_JENKINS_TOKEN'] + except Exception as e: + print('LAVA_JENKINS_TOKEN not found in the environment variable. Exiting...', e ) return -1 if test_type is TestType.baremetal_benchmarks: @@ -395,11 +397,12 @@ def main(): else: assert False, 'Unknown test type' - server = xmlrpclib.ServerProxy('http://%s:%s@%s/RPC2' % (USERNAME, lava_api_key, HOSTNAME)) + server = xmlrpc.client.ServerProxy('http://%s:%s@%s/RPC2' % (USERNAME, lava_api_key, HOSTNAME)) jobid = server.scheduler.submit_job(json.dumps(j)) print('Lava jobid:{}'.format(jobid)) + print('Lava job URL: http://lava-master.internal.efficios.com/scheduler/job/{}/log_file'.format(jobid)) #Check the status of the job every 30 seconds jobstatus = server.scheduler.job_status(jobid)['job_status'] @@ -411,8 +414,6 @@ def main(): time.sleep(30) jobstatus = server.scheduler.job_status(jobid)['job_status'] - passed, failed=check_job_all_test_cases_state_count(server, jobid) - if test_type is TestType.kvm_tests or test_type is TestType.baremetal_tests: print_test_output(server, jobid) elif test_type is TestType.baremetal_benchmarks: @@ -422,12 +423,13 @@ def main(): if jobstatus not in 'Complete': return -1 else: + passed, failed=check_job_all_test_cases_state_count(server, jobid) print('With {} passed and {} failed Lava test cases.'.format(passed, failed)) - if failed == 0: - return 0 - else: - return -1 + if failed == 0: + return 0 + else: + return -1 if __name__ == "__main__": sys.exit(main())