aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/plugin/diagnostic-test-paths-2.py
blob: f0fed45626efc66308b2812fb686756067b70b14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Verify that 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):
    root = html_tree.getroot ()
    assert root.tag == make_tag('html')

    body = root.find('xhtml:body', ns)
    assert body is not None

    diag_list = body.find('xhtml:div', ns)
    assert diag_list is not None
    assert diag_list.attrib['class'] == 'gcc-diagnostic-list'

    diag = diag_list.find('xhtml:div', ns)
    assert diag is not None
    assert diag.attrib['class'] == 'alert alert-danger'
    assert diag.attrib['id'] == 'gcc-diag-0'

    exec_path = diag.find("./xhtml:div[@id='execution-path']", ns)
    assert exec_path is not None

    label = exec_path.find('xhtml:label', ns)
    assert label.text == 'Execution path with 3 events'
    
    event_ranges = exec_path.find('xhtml:div', ns)
    assert_class(event_ranges, 'event-ranges')

    frame_margin = event_ranges.find('xhtml:table', ns)
    assert_class(frame_margin, 'stack-frame-with-margin')

    tr = 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, 'make_a_list_of_random_ints_badly')
    assert_event_range_with_margin(test_frame[1])