# Verify that interprocedural execution paths work in HTML output. from htmltest import * import pytest @pytest.fixture(scope='function', autouse=True) def html_tree(): return html_tree_from_env() def test_paths(html_tree): diag = get_diag_by_index(html_tree, 0) src = get_locus_within_diag (diag) tbody = src.find('xhtml:tbody', ns) assert_class(tbody, 'line-span') rows = tbody.findall('xhtml:tr', ns) quoted_src_tr = rows[0] assert_quoted_line(quoted_src_tr, ' 13', ' fprintf(stderr, "LOG: %s", msg); /* { dg-warning "call to \'fprintf\' from within signal handler" } */') annotation_tr = rows[1] assert_annotation_line(annotation_tr, ' ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~') event_ranges = diag.find('xhtml:div', ns) assert_class(event_ranges, 'event-ranges') test_frame_margin = event_ranges.find('xhtml:table', ns) assert_class(test_frame_margin, 'stack-frame-with-margin') tr = test_frame_margin.find('xhtml:tr', ns) assert tr is not None tds = tr.findall('xhtml:td', ns) assert len(tds) == 2 assert_class(tds[0], 'interprocmargin') test_frame = tds[1] assert_frame(test_frame, 'test') assert_event_range_with_margin(test_frame[1]) # For reference, generated HTML looks like this: """
test
test: events 1-2
27 {
^
|
(1) entering 'test'
28 register_handler ();
~~~~~~~~~~~~~~~~~~~
|
(2) calling 'register_handler'
register_handler
register_handler: events 3-4
22 {
^
|
(3) entering 'register_handler'
23 signal(SIGINT, int_handler);
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
(4) registering 'int_handler' as signal handler
event 5
(5): later on, when the signal is delivered to the process
int_handler
int_handler: events 6-7
17 {
^
|
(6) entering 'int_handler'
18 custom_logger("got signal");
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
(7) calling 'custom_logger'
custom_logger
custom_logger: events 8-9
12 {
^
|
(8) entering 'custom_logger'
13 fprintf(stderr, "LOG: %s", msg); /* { dg-warning "call to 'fprintf' from within signal handler" } */
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
(9) calling 'fprintf'
"""