From c8fda30f0cc084626af70dea607fc081f67d95f1 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 29 Oct 2018 13:00:54 +0100 Subject: GCOV: introduce --json-format. 2018-10-29 Martin Liska * Makefile.in: Make dependency to json.o. * doc/gcov.texi: Document new JSON format, remove old intermediate format documentation. * gcov.c (struct function_info): Come up with m_name and m_demangled_name. (function_info::function_info): Initialize it. (function_info::~function_info): Release it. (main): Rename flag_intermediate_format to flag_json_format. (print_usage): Describe --json-format. (process_args): Set flag_json_format. (output_intermediate_line): Remove. (output_intermediate_json_line): Likewise. (get_gcov_intermediate_filename): Return new extension ".gcov.json.gz". (output_intermediate_file): Implement JSON emission. (output_json_intermediate_file): Implement JSON emission. (generate_results): Use ::get_name for function name. Handle JSON output file. (read_graph_file): Use ::get_name instead of cplus_demangle. (read_count_file): Likewise. (solve_flow_graph): Likewise. (add_line_counts): Likewise. (accumulate_line_counts): Use new flag_json_format. (output_function_details): Use ::get_name instead of cplus_demangle. (output_lines): Likewise. * json.cc (test_writing_literals): Add new tests. * json.h (class literal): Add new boolean constructor. 2018-10-29 Martin Liska * g++.dg/gcov/gcov-8.C: Do not check intermediate format. * lib/gcov.exp: Remove legacy verify-intermediate. From-SVN: r265587 --- gcc/testsuite/lib/gcov.exp | 55 ---------------------------------------------- 1 file changed, 55 deletions(-) (limited to 'gcc/testsuite/lib') diff --git a/gcc/testsuite/lib/gcov.exp b/gcc/testsuite/lib/gcov.exp index f35ca59..a7b8c0a 100644 --- a/gcc/testsuite/lib/gcov.exp +++ b/gcc/testsuite/lib/gcov.exp @@ -84,61 +84,6 @@ proc verify-lines { testname testcase file } { # -# verify-intermediate -- check that intermediate file has certain lines -# -# TESTNAME is the name of the test, including unique flags. -# TESTCASE is the name of the test. -# FILE is the name of the gcov output file. -# -# Checks are very loose, they are based on certain tags being present -# in the output. They do not check for exact expected execution -# counts. For that the regular gcov format should be checked. -# -proc verify-intermediate { testname testcase file } { - set failed 0 - set srcfile 0 - set function 0 - set lcount 0 - set branch 0 - set fd [open $file r] - while { [gets $fd line] >= 0 } { - if [regexp "^file:" $line] { - incr srcfile - } - if [regexp "^function:(\[0-9\]+),(\[0-9\]+),.*" $line] { - incr function - } - if [regexp "^lcount:(\[0-9\]+),(\[0-9\]+),(\[01\])" $line] { - incr lcount - } - if [regexp "^branch:(\[0-9\]+),(taken|nottaken|notexec)" $line] { - incr branch - } - } - - # We should see at least one tag of each type - if {$srcfile == 0} { - fail "$testname expected 'file:' tag not found" - incr failed - } - if {$function == 0} { - fail "$testname expected 'function:' tag not found" - incr failed - } - if {$lcount == 0} { - fail "$testname expected 'lcount:' tag not found" - incr failed - } - if {$branch == 0} { - fail "$testname expected 'branch:' tag not found" - incr failed - } - close $fd - return $failed -} - - -# # verify-branches -- check that branch percentages are as expected # # TESTNAME is the name of the test, including unique flags. -- cgit v1.1