Skip to content

Commit 4abed9c

Browse files
author
Viviane Garese
committed
Merge branch 'garese/fix_manual_dump' into 'master'
Fix regressions for improved manual dump See merge request eng/cov/gnatcoverage!251 Fix regression in ada_manual_dump, kill ada_manual_no_dump_in_root and fix typo in test.opt of manual dump tests. Ref: #84
2 parents 0fe3ad9 + d3c5329 commit 4abed9c

File tree

16 files changed

+119
-73
lines changed

16 files changed

+119
-73
lines changed

doc/gnatcov/src_traces.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,18 @@ at which point the source traces will be created during the execution of the
288288
program. Therefore, the pragma or comment should be placed at a location at
289289
which such a function call would be appropriate.
290290

291+
A dump procedure is only able to dump the buffers of the project tree which
292+
root is the project it is called from. A dump procedure call done in a
293+
subproject will result in a trace containing all code of projects higher in the
294+
project tree marked as not covered.
295+
296+
One source trace is dumped per call to the dump buffers procedure. For the
297+
``bin-file`` dump configuration, each trace is written in a file which name
298+
depends on the selected trace file naming scheme. For the ``base64-stdout``
299+
dump configuration the traces are sequentially dumped in the same output file,
300+
from which the |gcv| command ``extrace-base64-trace`` will be able to produce a
301+
source trace file.
302+
291303
.. _instr-tracename:
292304

293305
Controlling trace file names

testsuite/SCOV/minicheck.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def build_and_run(gprsw, covlevel, mains, extra_coverage_args, scos=None,
108108
:param None|list[str] exec_args: List of arguments to pass to the
109109
executable. This will only work for native configurations.
110110
:param bool auto_languages: See SUITE.tutils.xcov.
111-
:param None|str manual_proj_name: when the dump trigger is manual, several
111+
:param None|str manual_prj_name: when the dump trigger is manual, several
112112
traces files (one per project) can be emitted if there are dump buffers
113113
procedure calls in at least two distinct projects. This is the name of
114114
the project which trace we want to consider.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
!src-traces DEAD Checks a feature specific the instrumenter
1+
!src-traces DEAD Checks a feature specific to the instrumenter

testsuite/tests/instr-cov/ada_manual_dump/test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,17 @@
3434
objdir="obj",
3535
deps=["lib1", "lib2"])
3636

37+
instr_warning = (r"warning: Manual dump trigger indications were found in.*")
38+
3739
build_run_and_coverage(
3840
gprsw=GPRswitches(root_project=p, units=["lib1", "main"]),
3941
covlevel='stmt',
4042
mains=['main'],
4143
extra_coverage_args=['-axcov', '--output-dir=xcov'],
4244
trace_mode='src',
4345
dump_trigger="manual",
44-
manual_prj_name="gen")
46+
manual_prj_name="gen",
47+
tolerate_instrument_messages=instr_warning)
4548

4649
# Check that gnatcov inserted the call to the dump buffers procedure in the
4750
# lib2.adb which is not a unit of interest

testsuite/tests/instr-cov/ada_manual_no_dump_in_root/src-lib1/lib1.adb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
with Lib3;
1+
with Lib2;
22

33
package body Lib1 is
44
function Foo return Integer
55
is
66
Res : Integer := 1;
77
begin
8-
Res := Res + Lib3.Baz;
8+
Res := Res + Lib2.Bar;
99
pragma Annotate (Xcov, Dump_Buffers);
1010
return Res;
1111
end Foo;

testsuite/tests/instr-cov/ada_manual_no_dump_in_root/src-lib2/lib2.adb renamed to testsuite/tests/instr-cov/ada_manual_no_dump_in_root/src-lib1/src-lib2/lib2.adb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package body Lib2 is
33
is
44
Res : constant Integer := 1;
55
begin
6-
pragma Annotate (Xcov, Dump_Buffers);
76
return Res;
87
end Bar;
98
end Lib2;

testsuite/tests/instr-cov/ada_manual_no_dump_in_root/src-lib2/lib2.ads renamed to testsuite/tests/instr-cov/ada_manual_no_dump_in_root/src-lib1/src-lib2/lib2.ads

File renamed without changes.

testsuite/tests/instr-cov/ada_manual_no_dump_in_root/src-lib1/src-lib3/lib3.adb

Lines changed: 0 additions & 8 deletions
This file was deleted.

testsuite/tests/instr-cov/ada_manual_no_dump_in_root/src-lib1/src-lib3/lib3.ads

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
pragma Ada_2012;
22

33
with Lib1;
4-
with Lib2;
54

65
procedure Main is
76

@@ -13,15 +12,7 @@ procedure Main is
1312

1413
I : Integer := 1;
1514
begin
16-
-- The only call that should not count as a violation when never executed
17-
-- is that of the dump buffers procedure.
18-
if 1 = I + 1 then
19-
pragma Annotate (Xcov, Dump_Buffers);
20-
I := I+ 1;
21-
end if;
22-
2315
Increment (I);
2416
I := I + Lib1.Foo;
25-
I := I + Lib2.Bar;
2617
Increment (I);
2718
end Main;

0 commit comments

Comments
 (0)