Skip to content

Commit b9bac05

Browse files
committed
[Exporter tests] changing variable names and respecting requirement kwargs
1 parent 986af0d commit b9bac05

File tree

5 files changed

+21
-14
lines changed

5 files changed

+21
-14
lines changed

tools/export/iar/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def generate(self):
122122
self.gen_file(self.get_ewp_template(), ctx, self.project_name + ".ewp")
123123

124124
@staticmethod
125-
def build(project_name, clean=True):
125+
def build(project_name, cleanup=True):
126126
""" Build IAR project """
127127
# > IarBuild [project_path] -build [project_name]
128128

@@ -149,7 +149,7 @@ def build(project_name, clean=True):
149149
if m is not None:
150150
num_errors = int(m.group(1))
151151

152-
if clean:
152+
if cleanup:
153153
os.remove(project_name + ".ewp")
154154
os.remove(project_name + ".ewd")
155155
os.remove(project_name + ".eww")

tools/export/makefile/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,15 @@ def generate(self):
106106
raise NotSupportedException("This make tool is in development")
107107

108108
@staticmethod
109-
def build(project_name, build_log="build_log.txt", project_loc=None, clean=True):
109+
def build(project_name, log_name="build_log.txt", cleanup=True):
110110
""" Build Make project """
111111
# > Make -C [project directory] -j
112112
cmd = ["make", "-j"]
113113
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
114114
ret = p.communicate()
115115
out, err = ret[0], ret[1]
116116
ret_code = p.returncode
117-
with open(build_log, 'w+') as f:
117+
with open(log_name, 'w+') as f:
118118
f.write("=" * 10 + "OUT" + "=" * 10 + "\n")
119119
f.write(out)
120120
f.write("=" * 10 + "ERR" + "=" * 10 + "\n")
@@ -123,13 +123,13 @@ def build(project_name, build_log="build_log.txt", project_loc=None, clean=True)
123123
f.write("SUCCESS")
124124
else:
125125
f.write("FAILURE")
126-
with open(build_log, 'r') as f:
126+
with open(log_name, 'r') as f:
127127
print "\n".join(f.readlines())
128128
sys.stdout.flush()
129129

130-
if clean:
130+
if cleanup:
131131
remove("Makefile")
132-
remove(build_log)
132+
remove(log_name)
133133
if exists('.build'):
134134
shutil.rmtree('.build')
135135
if ret_code != 0:

tools/export/uvision/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,14 @@ def generate(self):
206206
self.gen_file('uvision/uvision_debug.tmpl', ctx, self.project_name + ".uvoptx")
207207

208208
@staticmethod
209-
def build(project_name, log_name='build_log.txt', clean=True):
209+
def build(project_name, log_name='build_log.txt', cleanup=True):
210210
success = 0
211211
warn = 1
212212
cmd = ["UV4.exe", '-r', '-j0', '-o', log_name, project_name+".uvprojx"]
213213
ret_code = subprocess.call(cmd)
214214
with open(log_name, 'r') as build_log:
215215
print build_log.read()
216-
if clean:
216+
if cleanup:
217217
os.remove(log_name)
218218
os.remove(project_name+".uvprojx")
219219
os.remove(project_name+".uvoptx")

tools/test/examples/examples.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ def target_cross_toolchain(allowed_toolchains,
5959

6060

6161
def target_cross_ide(allowed_ides,
62-
targets=TARGET_MAP.keys()):
62+
features=[],
63+
ides=SUPPORTED_IDES,
64+
toolchains=SUPPORTED_TOOLCHAINS):
6365
"""Generate pairs of target and ides
6466
6567
Args:
@@ -68,7 +70,11 @@ def target_cross_ide(allowed_ides,
6870
"""
6971
for release_target, release_toolchains in get_mbed_official_release("5"):
7072
for ide in allowed_ides:
71-
if release_target in EXPORTERS[ide].TARGETS:
73+
if (release_target in EXPORTERS[ide].TARGETS and
74+
EXPORTERS[ide].TOOLCHAIN in toolchains and
75+
ide in ides and
76+
all(feature in TARGET_MAP[release_target].features
77+
for feature in features)):
7278
yield release_target, ide
7379

7480

@@ -101,7 +107,7 @@ def main():
101107

102108

103109
def do_export(args):
104-
110+
"""Do export and build step"""
105111
def print_message(message, name):
106112
print(message+ " %s"%name)
107113
sys.stdout.flush()
@@ -114,7 +120,8 @@ def print_message(message, name):
114120
if ex_name != "mbed-os-example-blinky":
115121
continue
116122
os.chdir(ex_name)
117-
for target, ide in target_cross_ide(args.ide):
123+
for target, ide in target_cross_ide(args.ide,
124+
**requirements):
118125
example_name = "{} {} {}".format(ex_name, target,
119126
ide)
120127
print_message("Export:",example_name)

tools/test/export/build_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def batch_tests(self, clean=False):
128128

129129
cwd = os.getcwd()
130130
os.chdir(exporter.export_dir)
131-
res = EXPORTERS[exporter.NAME.lower()].build(exporter.project_name, clean=False)
131+
res = EXPORTERS[exporter.NAME.lower()].build(exporter.project_name, cleanup=False)
132132
os.chdir(cwd)
133133
if res:
134134
self.failures.append("%s::%s\t%s" % (test_case.mcu,

0 commit comments

Comments
 (0)