diff options
Diffstat (limited to 'gcc/testsuite/lib')
-rw-r--r-- | gcc/testsuite/lib/htmltest.py | 90 | ||||
-rw-r--r-- | gcc/testsuite/lib/target-supports.exp | 35 |
2 files changed, 119 insertions, 6 deletions
diff --git a/gcc/testsuite/lib/htmltest.py b/gcc/testsuite/lib/htmltest.py index b249ea6..8e42a8c 100644 --- a/gcc/testsuite/lib/htmltest.py +++ b/gcc/testsuite/lib/htmltest.py @@ -7,3 +7,93 @@ def html_tree_from_env(): html_filename += '.html' print('html_filename: %r' % html_filename) return ET.parse(html_filename) + +XHTML = 'http://www.w3.org/1999/xhtml' +ns = {'xhtml': XHTML} + +def make_tag(local_name): + return f'{{{XHTML}}}' + local_name + +def assert_tag(element, expected): + assert element.tag == make_tag(expected) + +def assert_class(element, expected): + assert element.attrib['class'] == expected + +def assert_quoted_line(tr, expected_line_num, expected_src): + """Verify that tr is a line of quoted source.""" + tds = tr.findall('xhtml:td', ns) + assert len(tds) == 3 + assert_class(tds[0], 'linenum') + assert tds[0].text == expected_line_num + assert_class(tds[1], 'left-margin') + assert tds[1].text == ' ' + assert_class(tds[2], 'source') + assert tds[2].text == expected_src + +def assert_annotation_line(tr, expected_src, + expected_line_num=' ', + expected_left_margin=' '): + """Verify that tr is an annotation line.""" + tds = tr.findall('xhtml:td', ns) + assert len(tds) == 3 + assert_class(tds[0], 'linenum') + assert tds[0].text == expected_line_num + assert_class(tds[1], 'left-margin') + assert tds[1].text == expected_left_margin + assert_class(tds[2], 'annotation') + assert tds[2].text == expected_src + +def assert_frame(frame, expected_fnname): + """ + Assert that frame is of class 'stack-frame' + and has a child showing the expected fnname. + """ + assert_class(frame, 'stack-frame') + funcname = frame[0] + assert_class(funcname, 'frame-funcname') + span = funcname[0] + assert_tag(span, 'span') + assert span.text == expected_fnname + +def assert_event_range_with_margin(element): + """ + Verify that "element" is an event-range-with-margin + """ + assert_tag(element, 'table') + assert_class(element, 'event-range-with-margin') + tr = element.find('xhtml:tr', ns) + assert tr is not None + td = tr.find('xhtml:td', ns) + assert_class(td, 'event-range') + + events_hdr = td.find('xhtml:div', ns) + assert_class(events_hdr, 'events-hdr') + + #...etc + +def get_diag_by_index(html_tree, index): + 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_class(diag_list, 'gcc-diagnostic-list') + + diags = diag_list.findall('xhtml:div', ns) + diag = diags[index] + assert_class(diag, 'gcc-diagnostic') + return diag + +def get_message_within_diag(diag_element): + msg = diag_element.find('xhtml:span', ns) + assert_class(msg, 'gcc-message') + return msg + +def get_locus_within_diag(diag_element): + src = diag_element.find('xhtml:table', ns) + assert_class(src, 'locus') + return src diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 6286e36..75d723c 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -759,7 +759,13 @@ proc check_effective_target_keeps_null_pointer_checks { } { # this allows parallelism of 16 and higher of parallel gcc-auto-profile proc profopt-perf-wrapper { } { global srcdir - return "$srcdir/../config/i386/gcc-auto-profile --all -m8 " + if { [check_effective_target_x86] } { + return "$srcdir/../config/i386/gcc-auto-profile -m8" + } + if { [istarget aarch64*-*-*] } { + return "$srcdir/../config/aarch64/gcc-auto-profile -m8" + } + return "" } # Return true if profiling is supported on the target. @@ -778,8 +784,7 @@ proc check_profiling_available { test_what } { } if { $test_what == "-fauto-profile" } { - if { !([check_effective_target_x86] && [istarget *-*-linux*]) } { - verbose "autofdo only supported on linux" + if { !([check_effective_target_autofdo]) } { return 0 } # not cross compiling? @@ -787,13 +792,14 @@ proc check_profiling_available { test_what } { verbose "autofdo not supported for non native builds" return 0 } - set event [profopt-perf-wrapper] - if {$event == "" } { + set wrapper [profopt-perf-wrapper] + if {$wrapper == "" } { verbose "autofdo not supported" return 0 } + puts $wrapper global srcdir - set status [remote_exec host "$srcdir/../config/i386/gcc-auto-profile" "-m8 true -v >/dev/null"] + set status [remote_exec host "$wrapper true -v >/dev/null"] if { [lindex $status 0] != 0 } { verbose "autofdo not supported because perf does not work" return 0 @@ -1423,6 +1429,23 @@ proc check_effective_target_fpic { } { return 0 } +# Check if target supports autofdo. + +proc check_effective_target_autofdo { } { + if { !([istarget *-*-linux*]) } { + verbose "autofdo only supported on linux" + return 0 + } + if { [check_effective_target_x86] } { + return 1 + } + if { [istarget aarch64*-*-*] } { + return 1 + } + return 0 +} + + # On AArch64, if -fpic is not supported, then we will fall back to -fPIC # silently. So, we can't rely on above "check_effective_target_fpic" as it # assumes compiler will give warning if -fpic not supported. Here we check |