Skip to content

Commit cf74914

Browse files
committed
AAMP: copy the runtime to the test directory
As AAMP does not support library project, always copy the instrumentation runtime to the test directory as building an instrumented program builds it.
1 parent 381d1cb commit cf74914

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

testsuite/SCOV/instr.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
import os.path
44
import re
5+
import shutil
56

6-
from e3.fs import mkdir
7+
from e3.fs import mkdir, sync_tree
78

89
from SUITE.context import thistest
910
from SUITE.control import env
@@ -344,3 +345,21 @@ def maybe_relocate_binaries(object_dir, exe_dir, mains):
344345
if "aamp" in env.target.platform:
345346
for main in mains:
346347
copy_to_dir(object_dir, exe_dir, main)
348+
349+
350+
def maybe_copy_runtime(test_dir):
351+
"""
352+
Copy the Ada instrumentation runtime in test_dir for the AAMP target.
353+
"""
354+
if "aamp" in env.target.platform:
355+
rts_path = os.path.join(
356+
os.path.dirname(shutil.which("gnatcov")),
357+
"..",
358+
"share",
359+
"gnatcoverage",
360+
"gnatcov_ada_rts",
361+
)
362+
rts_dest_path = os.path.join(test_dir, "rts")
363+
mkdir(rts_dest_path)
364+
sync_tree(rts_path, rts_dest_path)
365+
env.add_search_path(env_var="GPR_PROJECT_PATH", path=rts_dest_path)

testsuite/SCOV/internals/driver.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
add_dumper_lch_hook,
3333
default_dump_channel,
3434
default_dump_trigger,
35+
maybe_copy_runtime,
3536
maybe_relocate_binaries,
3637
xcov_convert_base64,
3738
xcov_instrument,
@@ -1484,6 +1485,11 @@ def mode_build(self):
14841485
subdirs = None
14851486
instrument_gprsw = GPRswitches(root_project=self.gpr)
14861487

1488+
# The AAMP target does not support library project and requires
1489+
# rebuilding the instrumentation runtime: copy it in the test
1490+
# directory.
1491+
maybe_copy_runtime(os.getcwd())
1492+
14871493
# Instrument now, requesting the propagation of instrumentation
14881494
# issues on the test status. Note that we expect this to include
14891495
# a check on instrumentation warnings.

testsuite/SCOV/minicheck.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
from SCOV.instr import (
1919
default_dump_channel,
20+
maybe_copy_runtime,
2021
maybe_relocate_binaries,
2122
xcov_convert_base64,
2223
xcov_instrument,
@@ -267,6 +268,11 @@ def gprbuild_wrapper(root_project):
267268
if dump_channel == "auto":
268269
dump_channel = default_dump_channel()
269270

271+
# The AAMP target does not support library project and requires
272+
# rebuilding the instrumentation runtime: copy it in the test
273+
# directory.
274+
maybe_copy_runtime(os.getcwd())
275+
270276
# Instrument the project and build the result
271277
extra_instr_args = cov_or_instr_args + list(extra_instr_args or [])
272278
xcov_instrument(

0 commit comments

Comments
 (0)