mirror of https://github.com/ARMmbed/mbed-os.git
Reflecting build failures in the status code of the process
parent
7a627b3fdd
commit
6dbc9601f8
|
@ -26,7 +26,7 @@ from os.path import join, exists, basename, abspath
|
||||||
from os import getcwd
|
from os import getcwd
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
from tools.utils import mkdir, run_cmd, run_cmd_ext, NotSupportedException
|
from tools.utils import mkdir, run_cmd, run_cmd_ext, NotSupportedException, ToolException
|
||||||
from tools.paths import MBED_TARGETS_PATH, MBED_LIBRARIES, MBED_API, MBED_HAL, MBED_COMMON
|
from tools.paths import MBED_TARGETS_PATH, MBED_LIBRARIES, MBED_API, MBED_HAL, MBED_COMMON
|
||||||
from tools.targets import TARGET_NAMES, TARGET_MAP
|
from tools.targets import TARGET_NAMES, TARGET_MAP
|
||||||
from tools.libraries import Library
|
from tools.libraries import Library
|
||||||
|
|
|
@ -130,8 +130,10 @@ if __name__ == '__main__':
|
||||||
build_report = {}
|
build_report = {}
|
||||||
build_properties = {}
|
build_properties = {}
|
||||||
|
|
||||||
|
library_build_success = True
|
||||||
|
try:
|
||||||
# Build sources
|
# Build sources
|
||||||
lib_build_res = build_library(base_source_paths, options.build_dir, target, options.tool,
|
build_library(base_source_paths, options.build_dir, target, options.tool,
|
||||||
options=options.options,
|
options=options.options,
|
||||||
jobs=options.jobs,
|
jobs=options.jobs,
|
||||||
clean=options.clean,
|
clean=options.clean,
|
||||||
|
@ -140,9 +142,14 @@ if __name__ == '__main__':
|
||||||
name="mbed-os",
|
name="mbed-os",
|
||||||
macros=options.macros,
|
macros=options.macros,
|
||||||
archive=False)
|
archive=False)
|
||||||
|
except Exception, e:
|
||||||
|
library_build_success = False
|
||||||
|
print "Failed to build library"
|
||||||
|
print e
|
||||||
|
|
||||||
|
if library_build_success:
|
||||||
# Build all the tests
|
# Build all the tests
|
||||||
test_build = build_tests(tests, [options.build_dir], options.build_dir, target, options.tool,
|
test_build_success, test_build = build_tests(tests, [options.build_dir], options.build_dir, target, options.tool,
|
||||||
options=options.options,
|
options=options.options,
|
||||||
clean=options.clean,
|
clean=options.clean,
|
||||||
report=build_report,
|
report=build_report,
|
||||||
|
@ -150,6 +157,9 @@ if __name__ == '__main__':
|
||||||
macros=options.macros,
|
macros=options.macros,
|
||||||
jobs=options.jobs)
|
jobs=options.jobs)
|
||||||
|
|
||||||
|
if not test_build_success:
|
||||||
|
print "Failed to build some tests, check build log for details"
|
||||||
|
|
||||||
# If a path to a test spec is provided, write it to a file
|
# If a path to a test spec is provided, write it to a file
|
||||||
if options.test_spec:
|
if options.test_spec:
|
||||||
test_spec_data = test_spec_from_test_build(test_build)
|
test_spec_data = test_spec_from_test_build(test_build)
|
||||||
|
@ -171,7 +181,11 @@ if __name__ == '__main__':
|
||||||
if options.build_report_junit:
|
if options.build_report_junit:
|
||||||
report_exporter = ReportExporter(ResultExporterType.JUNIT)
|
report_exporter = ReportExporter(ResultExporterType.JUNIT)
|
||||||
report_exporter.report_to_file(build_report, options.build_report_junit, test_suite_properties=build_properties)
|
report_exporter.report_to_file(build_report, options.build_report_junit, test_suite_properties=build_properties)
|
||||||
sys.exit()
|
|
||||||
|
if library_build_success and test_build_success:
|
||||||
|
sys.exit(0)
|
||||||
|
else:
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
except KeyboardInterrupt, e:
|
except KeyboardInterrupt, e:
|
||||||
print "\n[CTRL+c] exit"
|
print "\n[CTRL+c] exit"
|
||||||
|
|
|
@ -2029,7 +2029,10 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name,
|
||||||
options=None, clean=False, notify=None, verbose=False, jobs=1,
|
options=None, clean=False, notify=None, verbose=False, jobs=1,
|
||||||
macros=None, silent=False, report=None, properties=None):
|
macros=None, silent=False, report=None, properties=None):
|
||||||
"""Given the data structure from 'find_tests' and the typical build parameters,
|
"""Given the data structure from 'find_tests' and the typical build parameters,
|
||||||
build all the tests and return a test build data structure"""
|
build all the tests
|
||||||
|
|
||||||
|
Returns a tuple of the build result (True or False) followed by the test
|
||||||
|
build data structure"""
|
||||||
|
|
||||||
test_build = {
|
test_build = {
|
||||||
"platform": target.name,
|
"platform": target.name,
|
||||||
|
@ -2040,6 +2043,8 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name,
|
||||||
"tests": {}
|
"tests": {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result = True
|
||||||
|
|
||||||
for test_name, test_path in tests.iteritems():
|
for test_name, test_path in tests.iteritems():
|
||||||
test_build_path = os.path.join(build_path, test_path)
|
test_build_path = os.path.join(build_path, test_path)
|
||||||
src_path = base_source_paths + [test_path]
|
src_path = base_source_paths + [test_path]
|
||||||
|
@ -2056,6 +2061,7 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name,
|
||||||
verbose=verbose)
|
verbose=verbose)
|
||||||
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
result = False
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# If a clean build was carried out last time, disable it for the next build.
|
# If a clean build was carried out last time, disable it for the next build.
|
||||||
|
@ -2080,7 +2086,7 @@ def build_tests(tests, base_source_paths, build_path, target, toolchain_name,
|
||||||
test_builds["%s-%s" % (target.name, toolchain_name)] = test_build
|
test_builds["%s-%s" % (target.name, toolchain_name)] = test_build
|
||||||
|
|
||||||
|
|
||||||
return test_builds
|
return result, test_builds
|
||||||
|
|
||||||
|
|
||||||
def test_spec_from_test_build(test_builds):
|
def test_spec_from_test_build(test_builds):
|
||||||
|
|
Loading…
Reference in New Issue