Skip to content

Commit b7b713d

Browse files
committed
Enable use of the TestCase driver infr with instr warnings
We do that by adding an optional tolerate_messages parameter to the TestCase constructor and passing it down to gnatcov instrument invocations.
1 parent c233f9a commit b7b713d

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

testsuite/SCOV/internals/driver.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,8 @@ def mode_build(self):
13011301
dump_trigger=self.dump_trigger,
13021302
gprsw=instrument_gprsw,
13031303
gpr_obj_dir=self.gpr_obj_dir,
1304-
out=out)
1304+
out=out,
1305+
tolerate_messages=self.testcase.tolerate_messages)
13051306

13061307
# When exception propagation is not available, a test ending with an
13071308
# unhandled exception goes straight to the last_chance_handler from
@@ -1328,11 +1329,12 @@ def mode_build(self):
13281329
# Standard output might contain warnings indicating instrumentation
13291330
# issues. This should not happen, so simply fail as soon as the output
13301331
# file is not empty.
1331-
thistest.fail_if(
1332-
os.path.getsize(out) > 0,
1333-
'xcov instrument standard output not empty ({}):'
1334-
'\n--'
1335-
'\n{}'.format(out, contents_of(out)))
1332+
if not self.testcase.tolerate_messages:
1333+
thistest.fail_if(
1334+
os.path.getsize(out) > 0,
1335+
'xcov instrument standard output not empty ({}):'
1336+
'\n--'
1337+
'\n{}'.format(out, contents_of(out)))
13361338

13371339
# Now we can build, instructing gprbuild to fetch the instrumented
13381340
# sources in their dedicated subdir:

testsuite/SCOV/tc.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,16 @@ def __drivers_from(self, cspec):
123123
# match this expression
124124
return [drv for drv in self.all_drivers if re.search(drv_expr, drv)]
125125

126-
def __init__(self, extradrivers="", extracargs="", category=CAT.auto):
126+
def __init__(self, extradrivers="", extracargs="", category=CAT.auto,
127+
tolerate_messages=None):
127128
# By default, these test cases expect no error from subprocesses (xrun,
128129
# xcov, etc.)
129130
self.expect_failures = False
130131

132+
# Pass tolerate_messages to gnatcov instrument invocations (see the doc
133+
# for xcov_instrument).
134+
self.tolerate_messages = tolerate_messages
135+
131136
# Step 1: Compute the list of drivers and consolidation specs
132137
# to exercise
133138
# ------------------------------------------------------------

0 commit comments

Comments
 (0)