Skip to content

Commit ba305c2

Browse files
committed
Script exits with the number of failures
1 parent 2722854 commit ba305c2

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

tools/test/export/build_test.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from os.path import join, abspath, dirname, exists, basename
2525
r=dirname(__file__)
2626
ROOT = abspath(join(r, "..","..",".."))
27-
print ROOT
2827
sys.path.insert(0, ROOT)
2928

3029
from tools.export import EXPORTERS
@@ -35,7 +34,7 @@
3534

3635

3736
class ProgenBuildTest():
38-
def __init__(self, desired_ides, tests, targets, clean=False):
37+
def __init__(self, desired_ides, tests, targets):
3938
#map of targets and the ides that can build programs for them
4039
self.target_ides = {}
4140
for target in targets:
@@ -47,10 +46,6 @@ def __init__(self, desired_ides, tests, targets, clean=False):
4746
if len(self.target_ides[target]) == 0:
4847
del self.target_ides[target]
4948

50-
self.clean = clean
51-
52-
successes, failures = self._generate_and_build(tests)
53-
print_results(successes, failures)
5449

5550
@staticmethod
5651
def get_pgen_targets(ides):
@@ -96,7 +91,7 @@ def handle_project_files(tool, project_dir, target, test, clean=False):
9691
shutil.rmtree(project_files_dir, ignore_errors=True)
9792
os.rename(project_dir, project_files_dir)
9893

99-
def _generate_and_build(self, tests):
94+
def generate_and_build(self, tests, clean=False):
10095

10196
#build results
10297
successes = []
@@ -115,7 +110,7 @@ def _generate_and_build(self, tests):
115110
else:
116111
failures.append("%s::%s\t%s for %s" % (mcu, ide, report['errormsg'], project_name))
117112

118-
ProgenBuildTest.handle_project_files(ide, project_temp, mcu, project_name, self.clean)
113+
ProgenBuildTest.handle_project_files(ide, project_temp, mcu, project_name, clean)
119114
return successes, failures
120115

121116

@@ -164,6 +159,10 @@ def _generate_and_build(self, tests):
164159
if any(ide not in accepted_ides for ide in ides):
165160
args_error(parser, "[ERROR] ide must be in %s" % ', '.join(accepted_ides))
166161

167-
b = ProgenBuildTest(ides, tests, targets, options.clean)
162+
b = ProgenBuildTest(ides, tests, targets)
163+
successes, failures = b.generate_and_build(tests, options.clean)
164+
print_results(successes, failures)
165+
sys.exit(len(failures))
166+
168167

169168

0 commit comments

Comments
 (0)