mirror of https://github.com/ARMmbed/mbed-os.git
[Exporter tests] changing variable names and respecting requirement kwargs
parent
986af0dd5e
commit
b9bac0516b
|
@ -122,7 +122,7 @@ class IAR(Exporter):
|
|||
self.gen_file(self.get_ewp_template(), ctx, self.project_name + ".ewp")
|
||||
|
||||
@staticmethod
|
||||
def build(project_name, clean=True):
|
||||
def build(project_name, cleanup=True):
|
||||
""" Build IAR project """
|
||||
# > IarBuild [project_path] -build [project_name]
|
||||
|
||||
|
@ -149,7 +149,7 @@ class IAR(Exporter):
|
|||
if m is not None:
|
||||
num_errors = int(m.group(1))
|
||||
|
||||
if clean:
|
||||
if cleanup:
|
||||
os.remove(project_name + ".ewp")
|
||||
os.remove(project_name + ".ewd")
|
||||
os.remove(project_name + ".eww")
|
||||
|
|
|
@ -106,7 +106,7 @@ class Makefile(Exporter):
|
|||
raise NotSupportedException("This make tool is in development")
|
||||
|
||||
@staticmethod
|
||||
def build(project_name, build_log="build_log.txt", project_loc=None, clean=True):
|
||||
def build(project_name, log_name="build_log.txt", cleanup=True):
|
||||
""" Build Make project """
|
||||
# > Make -C [project directory] -j
|
||||
cmd = ["make", "-j"]
|
||||
|
@ -114,7 +114,7 @@ class Makefile(Exporter):
|
|||
ret = p.communicate()
|
||||
out, err = ret[0], ret[1]
|
||||
ret_code = p.returncode
|
||||
with open(build_log, 'w+') as f:
|
||||
with open(log_name, 'w+') as f:
|
||||
f.write("=" * 10 + "OUT" + "=" * 10 + "\n")
|
||||
f.write(out)
|
||||
f.write("=" * 10 + "ERR" + "=" * 10 + "\n")
|
||||
|
@ -123,13 +123,13 @@ class Makefile(Exporter):
|
|||
f.write("SUCCESS")
|
||||
else:
|
||||
f.write("FAILURE")
|
||||
with open(build_log, 'r') as f:
|
||||
with open(log_name, 'r') as f:
|
||||
print "\n".join(f.readlines())
|
||||
sys.stdout.flush()
|
||||
|
||||
if clean:
|
||||
if cleanup:
|
||||
remove("Makefile")
|
||||
remove(build_log)
|
||||
remove(log_name)
|
||||
if exists('.build'):
|
||||
shutil.rmtree('.build')
|
||||
if ret_code != 0:
|
||||
|
|
|
@ -206,14 +206,14 @@ class Uvision(Exporter):
|
|||
self.gen_file('uvision/uvision_debug.tmpl', ctx, self.project_name + ".uvoptx")
|
||||
|
||||
@staticmethod
|
||||
def build(project_name, log_name='build_log.txt', clean=True):
|
||||
def build(project_name, log_name='build_log.txt', cleanup=True):
|
||||
success = 0
|
||||
warn = 1
|
||||
cmd = ["UV4.exe", '-r', '-j0', '-o', log_name, project_name+".uvprojx"]
|
||||
ret_code = subprocess.call(cmd)
|
||||
with open(log_name, 'r') as build_log:
|
||||
print build_log.read()
|
||||
if clean:
|
||||
if cleanup:
|
||||
os.remove(log_name)
|
||||
os.remove(project_name+".uvprojx")
|
||||
os.remove(project_name+".uvoptx")
|
||||
|
|
|
@ -59,7 +59,9 @@ def target_cross_toolchain(allowed_toolchains,
|
|||
|
||||
|
||||
def target_cross_ide(allowed_ides,
|
||||
targets=TARGET_MAP.keys()):
|
||||
features=[],
|
||||
ides=SUPPORTED_IDES,
|
||||
toolchains=SUPPORTED_TOOLCHAINS):
|
||||
"""Generate pairs of target and ides
|
||||
|
||||
Args:
|
||||
|
@ -68,7 +70,11 @@ def target_cross_ide(allowed_ides,
|
|||
"""
|
||||
for release_target, release_toolchains in get_mbed_official_release("5"):
|
||||
for ide in allowed_ides:
|
||||
if release_target in EXPORTERS[ide].TARGETS:
|
||||
if (release_target in EXPORTERS[ide].TARGETS and
|
||||
EXPORTERS[ide].TOOLCHAIN in toolchains and
|
||||
ide in ides and
|
||||
all(feature in TARGET_MAP[release_target].features
|
||||
for feature in features)):
|
||||
yield release_target, ide
|
||||
|
||||
|
||||
|
@ -101,7 +107,7 @@ def main():
|
|||
|
||||
|
||||
def do_export(args):
|
||||
|
||||
"""Do export and build step"""
|
||||
def print_message(message, name):
|
||||
print(message+ " %s"%name)
|
||||
sys.stdout.flush()
|
||||
|
@ -114,7 +120,8 @@ def do_export(args):
|
|||
if ex_name != "mbed-os-example-blinky":
|
||||
continue
|
||||
os.chdir(ex_name)
|
||||
for target, ide in target_cross_ide(args.ide):
|
||||
for target, ide in target_cross_ide(args.ide,
|
||||
**requirements):
|
||||
example_name = "{} {} {}".format(ex_name, target,
|
||||
ide)
|
||||
print_message("Export:",example_name)
|
||||
|
|
|
@ -128,7 +128,7 @@ class ExportBuildTest(object):
|
|||
|
||||
cwd = os.getcwd()
|
||||
os.chdir(exporter.export_dir)
|
||||
res = EXPORTERS[exporter.NAME.lower()].build(exporter.project_name, clean=False)
|
||||
res = EXPORTERS[exporter.NAME.lower()].build(exporter.project_name, cleanup=False)
|
||||
os.chdir(cwd)
|
||||
if res:
|
||||
self.failures.append("%s::%s\t%s" % (test_case.mcu,
|
||||
|
|
Loading…
Reference in New Issue