Commit 4a236935 authored by Łukasz Nowak's avatar Łukasz Nowak

Improve try information formatting

parent c4c881e9
......@@ -87,7 +87,7 @@ def main():
result_found = False
while 1:
finished = False
try_info = 'Try %s/%s.' % (try_num, TRY_AMOUNT)
try_info = 'Try %s/%s: ' % (try_num, TRY_AMOUNT)
test_result_glob = os.path.join(
args.partition_path,
'..',
......@@ -96,27 +96,27 @@ def main():
'public',
'test-script-result',
)
print(try_info + ' Waiting for data in %r.' % (test_result_glob,))
print(try_info + 'Waiting for data in %r.' % (test_result_glob,))
result_list = glob.glob(test_result_glob)
if len(result_list) > 0:
print(try_info + ' Data directory found, looking for results.')
print(try_info + 'Data directory found, looking for results.')
result_path = result_list[0]
result_file_list = list((os.path.join(dirname, filename)
for dirname, dirnames, filenames in os.walk(result_path)
for filename in filenames
))
if len(result_file_list):
print(try_info + ' No result posted, will check next try.')
print(try_info + 'No result posted, will check next try.')
for result_file in result_file_list:
print(try_info + ' Data found.')
print(try_info + 'Data found.')
result_found = True
result_file = os.path.abspath(result_file)
status_dict['command'] = result_file
result = open(result_file).read()
# remove result, as it is not required anymore
os.unlink(result_file)
print(try_info + ' Analysis of result %r:' % (result_file,))
print(try_info + ' ' + result)
print(try_info + 'Analysis of result %r:' % (result_file,))
print(try_info + result)
status_dict['stderr'] = 'Last result:\n%s' % (result,)
if 'FATAL: all hosts have already failed -- aborting' in result:
# failed
......@@ -127,8 +127,8 @@ def main():
error_count=0
)
finished = False
status_dict['stdout'] = try_info + ' Build not yet successful.'
print(try_info + ' %r: Found not yet finished run.' % (result_file,))
status_dict['stdout'] = try_info + 'Build not yet successful.'
print(try_info + '%r: Found not yet finished run.' % (result_file,))
elif "\"msg\": \"[u'Build successful, connect to:', u'" in result:
# success
status_dict.update(
......@@ -138,8 +138,8 @@ def main():
error_count=0
)
finished = True
print(try_info + ' %r: Found finished successful run.' % (result_file,))
status_dict['stdout'] = try_info + ' Build successful.'
print(try_info + '%r: Found finished successful run.' % (result_file,))
status_dict['stdout'] = try_info + 'Build successful.'
break
else:
# unknown
......@@ -150,22 +150,22 @@ def main():
error_count=1
)
status_dict['stdout'] = \
try_info + ' Cannot find success nor failure result in the output'
print(try_info + ' %r: Found unknown run.' % (result_file,))
try_info + 'Cannot find success nor failure result in the output'
print(try_info + '%r: Found unknown run.' % (result_file,))
finished = False
if finished:
break
if try_num >= TRY_AMOUNT:
msg = try_info + ' Time exceeded, success not found.'
msg = try_info + 'Time exceeded, success not found.'
print(msg)
status_dict.setdefault('stdout', '')
status_dict['stdout'] = '\n'.join([status_dict['stdout'], msg])
break
try_num += 1
print(try_info + ' Sleeping for %ss.' %(SLEEP_TIME,))
print(try_info + 'Sleeping for %ss.' %(SLEEP_TIME,))
sleep(SLEEP_TIME)
if not result_found:
status_dict['stdout'] = try_info + ' Test timed out and no result found.'
status_dict['stdout'] = try_info + 'Test timed out and no result found.'
status_dict.update(
test_count=1,
skip_count=0,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment