mirror of https://github.com/ARMmbed/mbed-os.git
Removing need for memap to printed through toolchains
parent
655c37715c
commit
0e4b841cb3
|
@ -455,12 +455,26 @@ def build_project(src_paths, build_path, target, toolchain_name,
|
|||
# Link Program
|
||||
res, _ = toolchain.link_program(resources, build_path, name)
|
||||
|
||||
memap_instance = getattr(toolchain, 'memap_instance', None)
|
||||
memap_table = ''
|
||||
if memap_instance:
|
||||
# Write output to stdout in text (pretty table) format
|
||||
memap_table = memap_instance.generate_output('table', silent=silent)
|
||||
|
||||
# Write output to file in JSON format
|
||||
map_out = join(build_path, name + "_map.json")
|
||||
memap_instance.generate_output('json', map_out)
|
||||
|
||||
# Write output to file in CSV format for the CI
|
||||
map_csv = join(build_path, name + "_map.csv")
|
||||
memap_instance.generate_output('csv-ci', map_csv)
|
||||
|
||||
resources.detect_duplicates(toolchain)
|
||||
|
||||
if report != None:
|
||||
end = time()
|
||||
cur_result["elapsed_time"] = end - start
|
||||
cur_result["output"] = toolchain.get_output()
|
||||
cur_result["output"] = toolchain.get_output() + memap_table
|
||||
cur_result["result"] = "OK"
|
||||
cur_result["memory_usage"] = toolchain.map_outputs
|
||||
|
||||
|
|
|
@ -2097,8 +2097,16 @@ def build_test_worker(*args, **kwargs):
|
|||
ret['bin_file'] = bin_file
|
||||
ret['kwargs'] = kwargs
|
||||
|
||||
except NotSupportedException, e:
|
||||
ret['reason'] = e
|
||||
except ToolException, e:
|
||||
ret['reason'] = e
|
||||
except KeyboardInterrupt, e:
|
||||
ret['reason'] = e
|
||||
except:
|
||||
ret['reason'] = sys.exc_info()[1]
|
||||
# Print unhandled exceptions here
|
||||
import traceback
|
||||
traceback.print_exc(file=sys.stdout)
|
||||
|
||||
return ret
|
||||
|
||||
|
@ -2132,7 +2140,6 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name,
|
|||
|
||||
jobs_count = int(jobs if jobs else cpu_count())
|
||||
p = Pool(processes=jobs_count)
|
||||
|
||||
results = []
|
||||
for test_name, test_path in tests.iteritems():
|
||||
test_build_path = os.path.join(build_path, test_path)
|
||||
|
@ -2166,51 +2173,61 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name,
|
|||
p.terminate()
|
||||
p.join()
|
||||
raise ToolException("Compile did not finish in 10 minutes")
|
||||
else:
|
||||
sleep(0.01)
|
||||
pending = 0
|
||||
for r in results:
|
||||
if r.ready() is True:
|
||||
try:
|
||||
worker_result = r.get()
|
||||
results.remove(r)
|
||||
|
||||
sleep(0.01)
|
||||
pending = 0
|
||||
for r in results:
|
||||
if r.ready() is True:
|
||||
try:
|
||||
worker_result = r.get()
|
||||
results.remove(r)
|
||||
|
||||
# Take report from the kwargs and merge it into existing report
|
||||
report_entry = worker_result['kwargs']['report'][target_name][toolchain_name]
|
||||
for test_key in report_entry.keys():
|
||||
report[target_name][toolchain_name][test_key] = report_entry[test_key]
|
||||
|
||||
# Set the overall result to a failure if a build failure occurred
|
||||
if not worker_result['result'] and not isinstance(worker_result['reason'], NotSupportedException):
|
||||
result = False
|
||||
|
||||
# Adding binary path to test build result
|
||||
if worker_result['result'] and 'bin_file' in worker_result:
|
||||
bin_file = norm_relative_path(worker_result['bin_file'], execution_directory)
|
||||
|
||||
test_build['tests'][worker_result['kwargs']['project_id']] = {
|
||||
"binaries": [
|
||||
{
|
||||
"path": bin_file
|
||||
}
|
||||
]
|
||||
}
|
||||
# Take report from the kwargs and merge it into existing report
|
||||
report_entry = worker_result['kwargs']['report'][target_name][toolchain_name]
|
||||
for test_key in report_entry.keys():
|
||||
report[target_name][toolchain_name][test_key] = report_entry[test_key]
|
||||
|
||||
test_key = worker_result['kwargs']['project_id'].upper()
|
||||
print report[target_name][toolchain_name][test_key][0][0]['output'].rstrip()
|
||||
print 'Image: %s\n' % bin_file
|
||||
# Set the overall result to a failure if a build failure occurred
|
||||
if not worker_result['result'] and not isinstance(worker_result['reason'], NotSupportedException):
|
||||
result = False
|
||||
break
|
||||
|
||||
except ToolException, err:
|
||||
if p._taskqueue.queue:
|
||||
p._taskqueue.queue.clear()
|
||||
sleep(0.5)
|
||||
p.terminate()
|
||||
p.join()
|
||||
raise ToolException(err)
|
||||
else:
|
||||
pending += 1
|
||||
if pending >= jobs_count:
|
||||
break
|
||||
# Adding binary path to test build result
|
||||
if worker_result['result'] and 'bin_file' in worker_result:
|
||||
bin_file = norm_relative_path(worker_result['bin_file'], execution_directory)
|
||||
|
||||
test_build['tests'][worker_result['kwargs']['project_id']] = {
|
||||
"binaries": [
|
||||
{
|
||||
"path": bin_file
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
test_key = worker_result['kwargs']['project_id'].upper()
|
||||
print report[target_name][toolchain_name][test_key][0][0]['output'].rstrip()
|
||||
print 'Image: %s\n' % bin_file
|
||||
|
||||
except:
|
||||
if p._taskqueue.queue:
|
||||
p._taskqueue.queue.clear()
|
||||
sleep(0.5)
|
||||
p.terminate()
|
||||
p.join()
|
||||
raise
|
||||
else:
|
||||
pending += 1
|
||||
if pending >= jobs_count:
|
||||
break
|
||||
|
||||
# Break as soon as possible if there is a failure and we are not
|
||||
# continuing on build failures
|
||||
if not result and not continue_on_build_fail:
|
||||
if p._taskqueue.queue:
|
||||
p._taskqueue.queue.clear()
|
||||
sleep(0.5)
|
||||
p.terminate()
|
||||
break
|
||||
|
||||
p.join()
|
||||
|
||||
|
|
|
@ -1075,16 +1075,8 @@ class mbedToolchain:
|
|||
self.info("Unknown toolchain for memory statistics %s" % toolchain)
|
||||
return None
|
||||
|
||||
# Write output to stdout in text (pretty table) format
|
||||
self.info(memap.generate_output('table', silent=True))
|
||||
|
||||
# Write output to file in JSON format
|
||||
map_out = splitext(map)[0] + "_map.json"
|
||||
memap.generate_output('json', map_out)
|
||||
|
||||
# Write output to file in CSV format for the CI
|
||||
map_csv = splitext(map)[0] + "_map.csv"
|
||||
memap.generate_output('csv-ci', map_csv)
|
||||
# Store the memap instance for later use
|
||||
self.memap_instance = memap
|
||||
|
||||
# Here we return memory statistics structure (constructed after
|
||||
# call to generate_output) which contains raw data in bytes
|
||||
|
|
Loading…
Reference in New Issue