- content = get_job_bundle_content(server, job)
- found = False
-
- for run in content['test_runs']:
- if run['test_id'] in 'lttng-kernel-test':
- for attachment in run['attachments']:
- if attachment['pathname'] in 'stdout.log':
-
- # Decode the base64 file and split on newlines to iterate
- # on list
- testoutput = str(base64.b64decode(bytes(attachment['content'], encoding='UTF-8')))
-
- testoutput = testoutput.replace('\\n', '\n')
-
- # Create a generator to iterate on the lines and keeping
- # the state of the iterator across the two loops.
- testoutput_iter = iter(testoutput.split('\n'))
- for line in testoutput_iter:
-
- # Find the header of the test case and start printing
- # from there
- if 'LAVA_SIGNAL_STARTTC run-tests' in line:
- print('---- TEST SUITE OUTPUT BEGIN ----')
- for line in testoutput_iter:
- if 'LAVA_SIGNAL_ENDTC run-tests' not in line:
- print(line)
- else:
- # Print until we reach the end of the
- # section
- break
-
- print('----- TEST SUITE OUTPUT END -----')
- break
+ job_finished, log = server.scheduler.jobs.logs(str(job))
+ logs = yaml.load(log.data.decode('ascii'))
+ print_line = False
+ for line in logs:
+ if line['lvl'] != 'target':
+ continue
+ if line['msg'] == '<LAVA_SIGNAL_STARTTC run-tests>':
+ print('---- TEST SUITE OUTPUT BEGIN ----')
+ print_line = True
+ continue
+ if line['msg'] == '<LAVA_SIGNAL_ENDTC run-tests>':
+ print('----- TEST SUITE OUTPUT END -----')
+ break
+ if print_line:
+ print("{} {}".format(line['dt'], line['msg']))