Skip to content

Commit 30f795a

Browse files
committed
Fix live-observability regressions for block instrumentation
1 parent bf2b36c commit 30f795a

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

testsuite/tests/345-live-observability/test.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,31 @@
2424
extra_coverage_args=[],
2525
)
2626

27+
# In case block instrumentation is enabled, the number of bits set to 1 in the
28+
# buffers is not equivalent to the number of statements executed.
29+
if thistest.options.block:
30+
counts = [0, 0, 3]
31+
else:
32+
counts = [2, 4, 8]
33+
2734
OUTPUT = contents_of("main_output.txt")
2835

2936
thistest.fail_if_no_match(
30-
"Wrong first buffer sum", re.compile(r".*First: *2.*", re.S), OUTPUT
37+
"Wrong first buffer sum",
38+
re.compile(f".*First: *{counts[0]}.*", re.S),
39+
OUTPUT,
3140
)
3241

3342
thistest.fail_if_no_match(
34-
"Wrong second buffer sum", re.compile(r".*Second: *4.*", re.S), OUTPUT
43+
"Wrong second buffer sum",
44+
re.compile(f".*Second: *{counts[1]}.*", re.S),
45+
OUTPUT,
3546
)
3647

3748
thistest.fail_if_no_match(
38-
"Wrong third buffer sum", re.compile(r".*Third: *8.*", re.S), OUTPUT
49+
"Wrong third buffer sum",
50+
re.compile(f".*Third: *{counts[2]}.*", re.S),
51+
OUTPUT,
3952
)
4053

4154
thistest.result()

tools/gnatcov/instrument-ada_unit.adb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11152,15 +11152,15 @@ package body Instrument.Ada_Unit is
1115211152
Create_File (Prj, Body_File, Obs_Body_Filename);
1115311153

1115411154
Spec_File.Put_Line ("package " & Obs_Unit_Name & " is");
11155-
Spec_File.Put_Line (" function Sum_Buffer_Bits return Positive;");
11155+
Spec_File.Put_Line (" function Sum_Buffer_Bits return Natural;");
1115611156
Spec_File.Put_Line ("end " & Obs_Unit_Name & ";");
1115711157

1115811158
Body_File.Put_Line ("with Interfaces.C;");
1115911159
Body_File.Put_Line
1116011160
("with GNATcov_RTS.Buffers.Lists; use GNATcov_RTS.Buffers.Lists;");
1116111161
Body_File.New_Line;
1116211162
Body_File.Put_Line ("package body " & Obs_Unit_Name & " is");
11163-
Body_File.Put_Line (" function Sum_Buffer_Bits return Positive is");
11163+
Body_File.Put_Line (" function Sum_Buffer_Bits return Natural is");
1116411164
Body_File.Put_Line (" function Sum_Buffer_Bits_C");
1116511165
Body_File.Put_Line
1116611166
(" (C_List : GNATcov_RTS_Coverage_Buffers_Group_Array)");
@@ -11170,7 +11170,7 @@ package body Instrument.Ada_Unit is
1117011170
& " ""gnatcov_rts_sum_buffer_bits"");");
1117111171
Body_File.Put_Line (" begin");
1117211172
Body_File.Put_Line
11173-
(" return Positive(Sum_Buffer_Bits_C ("
11173+
(" return Natural(Sum_Buffer_Bits_C ("
1117411174
& Buf_List_Unit_Name & ".C_List));");
1117511175
Body_File.Put_Line (" end;");
1117611176
Body_File.Put_Line ("end " & Obs_Unit_Name & ";");

0 commit comments

Comments
 (0)