Skip to content

Commit 5ad1609

Browse files
committed
Merge branch 'pmderodat/logs' into 'master'
Rework the verbose mode towards GNATCOLL.Traces-based logs See merge request eng/das/cov/gnatcoverage!336 For eng/das/cov/gnatcoverage#164
2 parents 37cec71 + 681a6fd commit 5ad1609

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+562
-479
lines changed

testsuite/SCOV/map.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def run(self):
5454

5555
# Run xcov map-routines and check absence of errors
5656
mapoutput = do(maybe_valgrind([
57-
XCOV, 'map-routines', '-v', f'--target={env.target.triplet}',
57+
XCOV, 'map-routines', f'--target={env.target.triplet}',
5858
'--scos=@{}'.format(list_to_file(self.alis)),
5959
] + self.execs))
6060

testsuite/tests/KB30-011-eargs-gnatemu/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828

2929
def check_eargs(output, eargs, exe, protect_eargs=False):
30-
m = re.search('exec:\n .*gnatemu.*', output)
30+
m = re.search('exec: .*gnatemu.*', output)
3131
e = m.group(0)
3232
if protect_eargs:
3333
eargs = ' '.join ([f"'{arg}'" for arg in eargs.split(" ")])

testsuite/tests/MB15-041-verbose-open-crc32/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
CWD_LINE_PREFIX = 'CWD = '
2121
LOG_OPEN_RE = re.compile(
22-
r'--- notice: open "(?P<file>[^"]+)"'
22+
r'\[GNATCOV\.MISC\] --- notice: open "(?P<file>[^"]+)"'
2323
r' \(CRC32 = 0x(?P<crc32>[0-9a-f]{8})\)'
2424
)
2525

testsuite/tests/S529-038-isi-ckpt/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def check_error(argv, log_name, expected_error):
106106
'--checkpoint', ckpt(1), trace(1)],
107107
out='leak.log')
108108
thistest.fail_if(
109-
'discarding source trace entry for unknown instrumented unit: body of'
110-
' main1' not in lines_of('leak.log'))
109+
'[GNATCOV.MISC] discarding source trace entry for unknown instrumented'
110+
' unit: body of main1' not in lines_of('leak.log'))
111111

112112
thistest.result()

testsuite/tests/U204-026-arch-mix/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def check_reports(xcov_dir):
165165
# 4. Check that we can use source traces produced on a different host
166166
#
167167

168-
thistest.log("== 3. src-traces mix ==")
168+
thistest.log("== 4. src-traces mix ==")
169169
mkdir("4-xcov")
170170
sid_list = "sids.txt"
171171
with open(sid_list, "w") as f:

testsuite/tests/instr-cov/file-context/test.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,20 @@ def do_instr(label, args):
5252
actual_lines = [
5353
line
5454
for line in lines_of(log)
55-
if line.startswith("Instrumenting ") or line.startswith("warning: ")
55+
if (
56+
line.startswith("[GNATCOV.MISC] Instrumenting ")
57+
or line.startswith("warning: ")
58+
)
5659
]
5760
thistest.fail_if_not_equal(
5861
f'"gnatcov instrument" output',
59-
"\n".join(actual_lines),
6062
"\n".join([
61-
"Instrumenting main.adb",
63+
"[GNATCOV.MISC] Instrumenting main.adb",
6264
"warning: Cannot find required source file: missing_a.ads",
6365
"warning: Cannot find required source file: missing_b.ads",
64-
"Instrumenting pkg.ads",
66+
"[GNATCOV.MISC] Instrumenting pkg.ads",
6567
]),
68+
"\n".join(actual_lines),
6669
)
6770

6871
thistest.result()

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
'--sid', unrelated_sid, trace_file],
4949
out='coverage.log')
5050
thistest.fail_if(
51-
'discarding source trace entry for unknown instrumented unit: body of pkg'
51+
'[GNATCOV.MISC] discarding source trace entry for unknown instrumented'
52+
' unit: body of pkg'
5253
not in lines_of('coverage.log'))
5354

5455
thistest.result()

tools/gnatcov/ali_files.adb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ with Files_Table; use Files_Table;
2828
with Get_SCOs;
2929
with Inputs; use Inputs;
3030
with Outputs; use Outputs;
31-
with Switches; use Switches;
3231

3332
package body ALI_Files is
3433

@@ -386,9 +385,7 @@ package body ALI_Files is
386385

387386
-- Here once the ALI file has been succesfully opened
388387

389-
if Verbose then
390-
Put_Line ("Loading SCOs from " & ALI_Filename);
391-
end if;
388+
SCOs_Trace.Trace ("Loading SCOs from " & ALI_Filename);
392389

393390
Expected_Annotation_Kind := Exempt_On;
394391
Expected_Annotation_Msg := null;

tools/gnatcov/annotations.adb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ package body Annotations is
562562

563563
Cur : constant Cursor := ALI_Annotations.Floor (Sloc);
564564
begin
565-
if not Debug_Ignore_Exemptions
565+
if not Ignore_Exemptions_Trace.Is_Active
566566
and then Cur /= No_Element
567567
and then Key (Cur).Source_File = Sloc.Source_File
568568
then

tools/gnatcov/cfg_dump.adb

Lines changed: 19 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ with Qemu_Traces;
4545
with SC_Obligations;
4646
with Strings;
4747
with Support_Files;
48-
with Switches;
4948
with Traces; use Traces;
5049
with Traces_Dbase;
5150
with Traces_Elf; use Traces_Elf;
@@ -1750,29 +1749,16 @@ package body CFG_Dump is
17501749
Context.Keep_Edges := Keep_Edges;
17511750
Context.Tag_Executed := Inputs.Length (Traces_Files_List) > 0;
17521751

1753-
if Switches.Verbose then
1754-
Report
1755-
(Msg => "Hello, this is the dumper!",
1756-
Kind => Notice);
1757-
Report
1758-
(Msg => "Dumping code from: " & Exec_Path,
1759-
Kind => Notice);
1760-
Report
1761-
(Msg =>
1762-
(if Output = null
1763-
then "To standard output"
1764-
else "To " & Output.all),
1765-
Kind => Notice);
1766-
Report
1767-
(Msg => "Format: " & Output_Format'Image (Format),
1768-
Kind => Notice);
1769-
Report
1770-
(Msg =>
1771-
(if Keep_Edges
1772-
then "Keep edges that follow exception raises"
1773-
else "Strip edges that follow exception raises"),
1774-
Kind => Notice);
1775-
end if;
1752+
CFG_Dump_Trace.Trace ("Dumping code from: " & Exec_Path);
1753+
CFG_Dump_Trace.Trace
1754+
(if Output = null
1755+
then "To standard output"
1756+
else "To " & Output.all);
1757+
CFG_Dump_Trace.Trace ("Format: " & Output_Format'Image (Format));
1758+
CFG_Dump_Trace.Trace
1759+
(if Keep_Edges
1760+
then "Keep edges that follow exception raises"
1761+
else "Strip edges that follow exception raises");
17761762

17771763
begin
17781764
Execs_Dbase.Open_Exec (Exec_Path, 0, Context.Exec);
@@ -1781,38 +1767,26 @@ package body CFG_Dump is
17811767
Fatal_Error ("Could not open " & Exec_Path);
17821768
end;
17831769

1784-
if Switches.Verbose then
1785-
Report (Msg => "Reading symbols...", Kind => Notice);
1786-
end if;
1770+
CFG_Dump_Trace.Trace ("Reading symbols...");
17871771
Build_Symbols (Context.Exec.all);
17881772

17891773
Translate_Locations (Ctx.Exec, Locations, Context.Locs);
17901774

17911775
if Context.Group_By_Condition then
17921776
Coverage.Set_Coverage_Levels ("stmt+mcdc");
1793-
if Switches.Verbose then
1794-
Report (Msg => "Loading ALI files...", Kind => Notice);
1795-
end if;
1777+
CFG_Dump_Trace.Trace ("Loading ALI files...");
17961778
Inputs.Iterate (SCO_Files_List, Load_SCOs'Access);
17971779
Coverage.Source.Initialize_SCI;
17981780

1799-
if Switches.Verbose then
1800-
Report (Msg => "Reading routine names...", Kind => Notice);
1801-
end if;
1781+
CFG_Dump_Trace.Trace ("Reading routine names...");
18021782
Read_Routine_Names (Context.Exec.all, Exclude => False);
18031783
end if;
18041784

1805-
if Switches.Verbose then
1806-
Report (Msg => "Reading debug line info...", Kind => Notice);
1807-
end if;
1785+
CFG_Dump_Trace.Trace ("Reading debug line info...");
18081786
Build_Debug_Lines (Context.Exec.all);
18091787

18101788
if Context.Group_By_Condition then
1811-
if Switches.Verbose then
1812-
Report
1813-
(Msg => "Performing static analysis for decisions...",
1814-
Kind => Notice);
1815-
end if;
1789+
CFG_Dump_Trace.Trace ("Performing static analysis for decisions...");
18161790
Decision_Map.Analyze (Context.Exec);
18171791
end if;
18181792

@@ -1826,13 +1800,10 @@ package body CFG_Dump is
18261800
exit when Section = null;
18271801

18281802
if Section.Section_Name.all = ".text" then
1829-
if Switches.Verbose then
1830-
Report
1831-
(Msg => "ELF section #"
1832-
& Strings.Img (Integer (Section.Section_Sec_Idx))
1833-
& " looks interesting: loading its instructions...",
1834-
Kind => Notice);
1835-
end if;
1803+
CFG_Dump_Trace.Trace
1804+
("ELF section #"
1805+
& Strings.Img (Integer (Section.Section_Sec_Idx))
1806+
& " looks interesting: loading its instructions...");
18361807
Load_Section_Content (Context.Exec.all, Section);
18371808
Collect_Instructions (Ctx, Section);
18381809
end if;

0 commit comments

Comments
 (0)