Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.

Commit 0969648

Browse files
committed
[tests] Fixes #319. Test harness now includes an executive summary of counts of succeeded, failed and ignored tests.
1 parent 53ef6c4 commit 0969648

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

Changelog.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
17-Apr-2017 Fixes #319. Test harness now includes an executive summary of counts of succeeded, failed and ignored tests.
2+
13
17-Apr-2017 Fixes #318. Default macOS deployment version is now 10.6 (was the current SDK). Setting this as old as possible for maximum backward compatibility. The default can be overridden by implementing the interface Bam.Core.IPackageMetaDataConfigure<Clang.MetaData>. See the Cxx11Test1 example.
24

35
15-Apr-2017 Fixes #317. Added all missing current C++ standards to C.Cxx.ELanguageStandards enumeration. Added are Cxx03, GnuCxx03, GnuCxx11, Cxx14, GnuCxx14.

tests/runtests.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,14 @@ def _post_execute(builder, options, flavour, package, output_messages, error_mes
132132
return exit_code
133133
return 0
134134

135-
136-
def execute_tests(package, configuration, options, output_buffer):
135+
class Stats(object):
136+
def __init__(self):
137+
self._total = 0
138+
self._success = 0
139+
self._fail = 0
140+
self._ignore = 0
141+
142+
def execute_tests(package, configuration, options, output_buffer, stats):
137143
print_message("Package : %s" % package.get_id())
138144
if options.verbose:
139145
print_message("Description : %s" % package.get_description())
@@ -142,12 +148,16 @@ def execute_tests(package, configuration, options, output_buffer):
142148
output_buffer.write("IGNORED: Package '%s' does not support build mode '%s' in the test configuration\n" %
143149
(package.get_description(), options.buildmode))
144150
print_message("\tIgnored")
151+
stats._total += 1
152+
stats._ignore += 1
145153
return 0
146154
variation_args = configuration.get_variations(options.buildmode, options.excludedVariations, options.bitDepth)
147155
if len(variation_args) == 0:
148156
output_buffer.write("IGNORED: Package '%s' has no configuration with the current options\n" %
149157
package.get_description())
150158
print_message("\tIgnored")
159+
stats._total += 1
160+
stats._ignore += 1
151161
return 0
152162
if options.verbose:
153163
print_message("Test configurations: %s" % variation_args)
@@ -157,6 +167,7 @@ def execute_tests(package, configuration, options, output_buffer):
157167
the_builder = get_builder_details(options.buildmode)
158168
exit_code = 0
159169
for variation in variation_args:
170+
stats._total += 1
160171
iterations = 1
161172

162173
for it in range(0, iterations):
@@ -181,6 +192,7 @@ def execute_tests(package, configuration, options, output_buffer):
181192
message += " with extra arguments '%s'" % " ".join(extra_args)
182193
try:
183194
if returncode == 0:
195+
stats._success += 1
184196
output_buffer.write("SUCCESS: %s\n" % message)
185197
if options.verbose:
186198
if len(output_messages.getvalue()) > 0:
@@ -190,6 +202,7 @@ def execute_tests(package, configuration, options, output_buffer):
190202
output_buffer.write("Errors:\n")
191203
output_buffer.write(error_messages.getvalue())
192204
else:
205+
stats._fail += 1
193206
output_buffer.write("* FAILURE *: %s\n" % message)
194207
output_buffer.write("Command was: %s\n" % " ".join(arg_list))
195208
output_buffer.write("Executed in: %s\n" % package.get_path())
@@ -296,6 +309,7 @@ def find_bam_default_repository():
296309
raise RuntimeError("Unrecognized package '%s'" % test)
297310
tests = filteredTests
298311

312+
stats = Stats()
299313
output_buffer = StringIO.StringIO()
300314
for package in tests:
301315
try:
@@ -304,7 +318,7 @@ def find_bam_default_repository():
304318
if options.verbose:
305319
print_message("No configuration for package: '%s'" % str(e))
306320
continue
307-
exit_code += execute_tests(package, config, options, output_buffer)
321+
exit_code += execute_tests(package, config, options, output_buffer, stats)
308322

309323
if not options.keepFiles:
310324
# TODO: consider keeping track of all directories created instead
@@ -314,6 +328,9 @@ def find_bam_default_repository():
314328
print_message("| Results summary |")
315329
print_message("--------------------")
316330
print_message(output_buffer.getvalue())
331+
print_message("Success %s/%s" % (stats._success, stats._total))
332+
print_message("Failure %s/%s" % (stats._fail, stats._total))
333+
print_message("Ignored %s/%s" % (stats._ignore, stats._total))
317334

318335
logsDir = os.path.join(repoTestDir, "Logs")
319336
if not os.path.isdir(logsDir):

0 commit comments

Comments
 (0)