Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Don't include lcov; it skews github to think this is a Perl project

  • Loading branch information...
commit c5c00fab4f54a3bf07c35946e9afcfa6c074045e 1 parent a1bdf83
Jon Reid jonreid authored
3  .gitignore
View
@@ -4,6 +4,5 @@ build/
*.perspectivev3
project.xcworkspace/
xcuserdata/
-Source/TestSupport/env.sh
-
Source/TestSupport/environment.sh
+Source/TestSupport/lcov-1.9
419 Source/TestSupport/lcov-1.9/CHANGES
View
@@ -1,419 +0,0 @@
-Version 1.9
-===========
-
-genhtml:
-- Improved wording for branch representation tooltip text
-- Fixed vertical alignment of HTML branch representation
-
-geninfo:
-- Improved warning message about --initial not generating branch coverage data
-- Debugging messages are now printed to STDERR instead of STDOUT
-- Fixed problem with some .gcno files. Reported by gui@futarque.com.
- (file.gcno: reached unexpected end of file)
-- Fixed problem with relative build paths. Reported by zhanbiao2000@gmail.com.
- (cannot find an entry for ^#src#test.c.gcov in .gcno file, skipping file!)
-- Fixed problem where coverage data is missing for some files. Reported by
- weston_schmidt@open-roadster.com
-- Fixed problem where exclusion markers are ignored when gathering
- initial coverage data. Reported by ahmed_osman@mentor.com.
-- Fixed large execution counts showing as negative numbers in HTML output.
- Reported by kkyriako@yahoo.com.
-- Fixed problem that incorrectly associated branches outside of a block with
- branches inside the first block
-
-lcov:
-- Fixed problem that made lcov ignore --kernel-directory parameters when
- specifying --initial. Reported by hjia@redhat.com.
-- Added --list-full-path option to prevent lcov from truncating paths in list
- output
-- Added lcov_list_width and lcov_list_truncate_max directives to the
- lcov configuration file to allow for list output customization
-- Improved list output
-
-COPYING:
-- Added license text to better comply with GPL recommendations
-
-
-Version 1.8
-===========
-
-gendesc:
-- Fixed problem with single word descriptions
-
-genhtml:
-- Added support for branch coverage measurements
-- Added --demangle-cpp option to convert C++ function names to human readable
- format. Based on a patch by slava.semushin@gmail.com.
-- Improved color legend: legend display takes up less space in HTML output
-- Improved coverage rate limits: all coverage types use the same limits
- unless specified otherwise
-- Fixed CRLF line breaks in source code when generating html output. Based
- on patch by michael.knigge@set-software.de.
-- Fixed warning when $HOME is not set
-- Fixed problem with --baseline-file option. Reported by sixarm@gmail.com.
- (Undefined subroutine &main::add_fnccounts called at genhtml line 4560.)
-- Fixed problem with --baseline-file option and files without function
- coverage data (Can't use an undefined value as a HASH reference at genhtml
- line 4441.)
-- Fixed short-name option ambiguities
-- Fixed --highlight option not showing line data from converted test data
-- Fixed warnings about undefined value used. Reported by nikita@zhuk.fi.
-- Fixed error when processing tracefiles without function data. Reported
- by richard.corden@gmail.com (Can't use an undefined value as a HASH
- reference at genhtml line 1506.)
-
-geninfo:
-- Added support for branch coverage measurements
-- Added support for exclusion markers: Users can exclude lines of code from
- coverage reports by adding keywords to the source code.
-- Added --derive-func-data option
-- Added --debug option to better debug problems with graph files
-- Fixed CRLF line breaks in source code when generating tracefiles. Based on
- patch by michael.knigge@set-software.de.
-- Fixed problems with unnamed source files
-- Fixed warning when $HOME is not set. Reported by acalando@free.fr.
-- Fixed errors when processing unnamed source files
-- Fixed help text typo
-- Fixed errors when processing incomplete function names in .bb files
-- Fixed filename prefix detection
-- Fixed problem with matching filename
-- Fixed problem when LANG is set to non-english locale. Reported by
- benoit_belbezet@yahoo.fr.
-- Fixed short-name option ambiguities
-
-genpng:
-- Fixed runtime-warning
-
-lcov:
-- Added support for branch coverage measurements
-- Added support for the linux-2.6.31 upstream gcov kernel support
-- Added --from-package and --to-package options
-- Added --derive-func-data option
-- Added overall coverage result output for more operations
-- Improved output of lcov --list
-- Improved gcov-kernel handling
-- Fixed minor problem with --diff
-- Fixed double-counting of function data
-- Fixed warning when $HOME is not set. Reported by acalando@free.fr.
-- Fixed error when combining tracefiles without function data. Reported by
- richard.corden@gmail.com. (Can't use an undefined value as a HASH reference
- at lcov line 1341.)
-- Fixed help text typo
-- Fixed filename prefix detection
-- Fixed lcov ignoring information about converted test data
-
-README:
-- Added note to mention required -lgcov switch during linking
-
-
-Version 1.7:
-============
-
-gendesc:
-- Updated error and warning messages
-- Updated man page
-
-genhtml:
-- Added function coverage data display patch by tomzo@nefkom.net (default is on)
-- Added --function-coverage to enable function coverage display
-- Added --no-function-coverage to disable function coverage display
-- Added sorting option in HTLM output (default is on)
-- Added --sort to enable sorting
-- Added --no-sort to disable sorting
-- Added --html-gzip to create gzip-compressed HTML output (patch by
- dnozay@vmware.com)
-- Fixed problem when using --baseline-file on coverage data files that
- contain data for files not found in the baseline file
-- Updated error and warning messages
-- Updated man page
-
-geninfo:
-- Added function coverage data collection patch by tomzo@nefkom.net
-- Added more verbose output when a "ERROR: reading string" error occurs
- (patch by scott.heavner@philips.com)
-- Fixed geninfo not working with directory names containing spaces (reported
- by jeffconnelly@users.sourceforge.net)
-- Fixed "ERROR: reading string" problem with gcc 4.1
-- Fixed problem with function names that contain non-alphanumerical characters
-- Fixed problem with gcc versions before 3.3
-- Updated error and warning messages
-- Updated man page
-
-genpng:
-- Updated error and warning messages
-- Updated man page
-
-lcov:
-- Added support for function coverage data for adding/diffing tracefiles
-- Added --no-recursion option to disable recursion into sub-directories
- while scanning for gcov data files
-- Fixed lcov -z not working with directory names containing spaces (reported
- by Jeff Connelly)
-- Updated error and warning messages
-- Updated man page
-
-lcov.spec:
-- Updated of description and title information
-
-lcovrc:
-- Added genhtml_function_hi_limit
-- Added genhtml_function_med_limit
-- Added genhtml_function_coverage
-- Added genhtml_sort
-- Updated man page
-
-Makefile:
-- Updated info text
-
-
-Version 1.6:
-============
-
-geninfo:
-- Added libtool compatibility patch by thomas@apestaart.org (default is on)
-- Added --compat-libtool option to enable libtool compatibility mode
-- Added --no-compat-libtool option to disable libtool compatibility mode
-- Changed default for line checksumming to off
-- Added --checksum option to enable line checksumming
-- Added --gcov-tool option
-- Added --ignore-errors option
-- Added --initial option to generate zero coverage from graph files
-- Removed automatic test name modification on s390
-- Added --checksum option
-- Updated man page
-
-lcov:
-- Added libtool compatibility patch by thomas@apestaart.org
-- Added --compat-libtool option to enable libtool compatibility mode
-- Added --no-compat-libtool option to disable libtool compatibility mode
-- Added --checksum option to enable line checksumming
-- Added --gcov-tool option
-- Added --ignore-errors option
-- Added --initial option to generate zero coverage from graph files
-- Updated help text
-- Updated man page
-- Fixed lcov not working when -k is specified more than once
-- Fixed lcov not deleting .gcda files when specifying -z and -d
-
-lcovrc:
-- Added geninfo_compat_libtool option
-- Added geninfo_checksum option
-- Removed geninfo_no_checksum option from example lcovrc
-- Updated man page
-
-README:
-- Added description of lcovrc file
-
-
-Version 1.5:
-============
-
-genhtml:
-- Added check for invalid characters in test names
-- Added --legend option
-- Added --html-prolog option
-- Added --html-epilog option
-- Added --html-extension option
-- Added warning when specifying --no-prefix and --prefix
-- Reworked help text to make it more readable
-
-geninfo:
-- Renamed 'sles9' compatibility mode to 'hammer' compatibility mode
-- Added support for mandrake gcc 3.3.2
-- Fixed bbg file reading in hammer compatibility mode
-- Added check for invalid characters in test names
-- Added --base-directory option
-
-lcov:
-- Added check for invalid characters in test names
-- Added --base-directory option
-
-
-Version 1.4:
-============
-
-All:
-- Added configuration file support
-
-genhtml:
-- Fixed help text message
-- Fixed handling of special characters in file- and directory names
-- Added description of --css-file option to man page
-
-geninfo:
-- Added support for GCOV file format as used by GCC 3.3.3 on SUSE SLES9
-- Fixed error text message
-- Added check to abort processing if no source code file is available
-- Added workaround for a problem where geninfo could not find source code
- files for a C++ project
-- Fixed 'branch'-statement parsing for GCC>=3.3 .gcov files
-- Fixed exec count-statement parsing for GCC>=3.3 .gcov files
-- Fixed .gcno-file parser (some lines were not counted as being instrumented)
-
-lcov:
-- Modified path for temporary files from '.' to '/tmp'
-- Fixed comments
-- Removed unused function 'escape_shell'
-
-lcovrc:
-- Introduced sample configuration file
-
-Makefile:
-- Added rule to install configuration file
-- Fixed installation path for man pages
-
-
-Version 1.3:
-============
-
-All:
-- Added compatibility for gcc-3.4
-
-lcov:
-- Modified --diff function to better cope with ambiguous entries in patch files
-- Modified --capture option to use modprobe before insmod (needed for 2.6)
-- Added --path option required for --diff function
-
-
-Version 1.2:
-============
-
-All:
-- Added compatibility for gcc-3.3
-- Adjusted LCOV-URL (http://ltp.sourceforge.net/coverage/lcov.php)
-- Minor changes to whitespaces/line breaks/spelling
-- Modified call mechanism so that parameters for external commands are not
- parsed by the shell mechanism anymore (no more problems with special
- characters in paths/filenames)
-- Added checksumming mechanism: each tracefile now contains a checksum for
- each instrumented line to detect incompatible data
-
-Makefile:
-- Added rule to build source RPM
-- Changed install path for executables (/usr/local/bin -> /usr/bin)
-
-lcov.spec:
-- Modified to support building source rpms
-
-updateversion.pl:
-- Modified to include update of release number in spec file
-
-genhtml:
-- Fixed bug which would not correctly associate data sets with an empty
- test name (only necessary when using --show-details in genhtml)
-- Implemented new command line option '--nochecksum' to suppress generation
- of checksums
-- Implemented new command line option '--highlight' which highlights lines of
- code which were only covered in converted tracefiles (see '--diff' option of
- lcov)
-
-geninfo:
-- Added workaround for a bug in gcov shipped with gcc-3.2 which aborts when
- encountering empty .da files
-- Fixed geninfo so that it does not abort after encountering empty .bb files
-- Added function to collect branch coverage data
-- Added check for gcov tool
-- Added check for the '--preserve-paths' option of gcov; if available, this
- will prevent losing .gcov files in some special cases (include files with
- same name in different subdirectories)
-- Implemented new command line option '--follow' to control whether or not
- links should be followed while searching for .da files.
-- Implemented new command line option '--nochecksum' to suppress generation
- of checksums
-
-lcov:
-- Fixed bug which would not correctly associate data sets with an empty
- test name (only necessary when using --show-details in genhtml)
-- Cleaned up internal command line option check
-- Files are now processed in alphabetical order
-- Added message when reading tracefiles
-- Implemented new command line option '--nochecksum' to suppress generation
- of checksums
-- Implemented new command line option '--diff' which allows converting
- coverage data from an older source code version by using a diff file
- to map line numbers
-- Implemented new command line option '--follow' to control whether or not
- links should be followed while searching for .da files.
-
-genpng:
-- Added support for the highlighting option of genhtml
-- Corrected tab to spaces conversion
-- Modified genpng to take number of spaces to use in place of tab as input
- instead of replacement string
-
-
-Version 1.1:
-============
-
-- Added CHANGES file
-- Added Makefile implementing the following targets:
- * install : install LCOV scripts and man pages
- * uninstall : revert previous installation
- * dist : create lcov.tar.gz file and lcov.rpm file
- * clean : clean up example directory, remove .tar and .rpm files
-- Added man pages for all scripts
-- Added example program to demonstrate the use of LCOV with a userspace
- application
-- Implemented RPM build process
-- New directory structure:
- * bin : contains all executables
- * example : contains a userspace example for LCOV
- * man : contains man pages
- * rpm : contains files required for the RPM build process
-- LCOV-scripts are now in bin/
-- Removed .pl-extension from LCOV-script files
-- Renamed readme.txt to README
-
-README:
-- Adjusted mailing list address to ltp-coverage@lists.sourceforge.net
-- Fixed incorrect parameter '--output-filename' in example LCOV call
-- Removed tool descriptions and turned them into man pages
-- Installation instructions now refer to RPM and tarball
-
-descriptions.tests:
-- Fixed some spelling errors
-
-genhtml:
-- Fixed bug which resulted in an error when trying to combine .info files
- containing data without a test name
-- Fixed bug which would not correctly handle data files in directories
- with names containing some special characters ('+', etc.)
-- Added check for empty tracefiles to prevent division-by-zeros
-- Implemented new command line option --num-spaces / the number of spaces
- which replace a tab in source code view is now user defined
-- Fixed tab expansion so that in source code view, a tab doesn't produce a
- fixed number of spaces, but as many spaces as are needed to advance to the
- next tab position
-- Output directory is now created if it doesn't exist
-- Renamed "overview page" to "directory view page"
-- HTML output pages are now titled "LCOV" instead of "GCOV"
-- Information messages are now printed to STDERR instead of STDOUT
-
-geninfo:
-- Fixed bug which would not allow .info files to be generated in directories
- with names containing some special characters
-- Information messages are now printed to STDERR instead of STDOUT
-
-lcov:
-- Fixed bug which would cause lcov to fail when the tool is installed in
- a path with a name containing some special characters
-- Implemented new command line option '--add-tracefile' which allows the
- combination of data from several tracefiles
-- Implemented new command line option '--list' which lists the contents
- of a tracefile
-- Implemented new command line option '--extract' which allows extracting
- data for a particular set of files from a tracefile
-- Implemented new command line option '--remove' which allows removing
- data for a particular set of files from a tracefile
-- Renamed '--reset' to '--zerocounters' to avoid a naming ambiguity with
- '--remove'
-- Changed name of gcov kernel directory from /proc/gcov to a global constant
- so that it may be changed easily when required in future versions
-- Information messages are now printed to STDERR instead of STDOUT
-
-
-Version 1.0 (2002-09-05):
-=========================
-
-- Initial version
-
339 Source/TestSupport/lcov-1.9/COPYING
View
@@ -1,339 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
99 Source/TestSupport/lcov-1.9/Makefile
View
@@ -1,99 +0,0 @@
-#
-# Makefile for LCOV
-#
-# Make targets:
-# - install: install LCOV tools and man pages on the system
-# - uninstall: remove tools and man pages from the system
-# - dist: create files required for distribution, i.e. the lcov.tar.gz
-# and the lcov.rpm file. Just make sure to adjust the VERSION
-# and RELEASE variables below - both version and date strings
-# will be updated in all necessary files.
-# - clean: remove all generated files
-#
-
-VERSION := 1.9
-RELEASE := 1
-
-CFG_DIR := $(PREFIX)/etc
-BIN_DIR := $(PREFIX)/usr/bin
-MAN_DIR := $(PREFIX)/usr/share/man
-TMP_DIR := /tmp/lcov-tmp.$(shell echo $$$$)
-FILES := $(wildcard bin/*) $(wildcard man/*) README CHANGES Makefile \
- $(wildcard rpm/*) lcovrc
-
-.PHONY: all info clean install uninstall rpms
-
-all: info
-
-info:
- @echo "Available make targets:"
- @echo " install : install binaries and man pages in PREFIX (default /)"
- @echo " uninstall : delete binaries and man pages from PREFIX (default /)"
- @echo " dist : create packages (RPM, tarball) ready for distribution"
-
-clean:
- rm -f lcov-*.tar.gz
- rm -f lcov-*.rpm
- make -C example clean
-
-install:
- bin/install.sh bin/lcov $(BIN_DIR)/lcov -m 755
- bin/install.sh bin/genhtml $(BIN_DIR)/genhtml -m 755
- bin/install.sh bin/geninfo $(BIN_DIR)/geninfo -m 755
- bin/install.sh bin/genpng $(BIN_DIR)/genpng -m 755
- bin/install.sh bin/gendesc $(BIN_DIR)/gendesc -m 755
- bin/install.sh man/lcov.1 $(MAN_DIR)/man1/lcov.1 -m 644
- bin/install.sh man/genhtml.1 $(MAN_DIR)/man1/genhtml.1 -m 644
- bin/install.sh man/geninfo.1 $(MAN_DIR)/man1/geninfo.1 -m 644
- bin/install.sh man/genpng.1 $(MAN_DIR)/man1/genpng.1 -m 644
- bin/install.sh man/gendesc.1 $(MAN_DIR)/man1/gendesc.1 -m 644
- bin/install.sh man/lcovrc.5 $(MAN_DIR)/man5/lcovrc.5 -m 644
- bin/install.sh lcovrc $(CFG_DIR)/lcovrc -m 644
-
-uninstall:
- bin/install.sh --uninstall bin/lcov $(BIN_DIR)/lcov
- bin/install.sh --uninstall bin/genhtml $(BIN_DIR)/genhtml
- bin/install.sh --uninstall bin/geninfo $(BIN_DIR)/geninfo
- bin/install.sh --uninstall bin/genpng $(BIN_DIR)/genpng
- bin/install.sh --uninstall bin/gendesc $(BIN_DIR)/gendesc
- bin/install.sh --uninstall man/lcov.1 $(MAN_DIR)/man1/lcov.1
- bin/install.sh --uninstall man/genhtml.1 $(MAN_DIR)/man1/genhtml.1
- bin/install.sh --uninstall man/geninfo.1 $(MAN_DIR)/man1/geninfo.1
- bin/install.sh --uninstall man/genpng.1 $(MAN_DIR)/man1/genpng.1
- bin/install.sh --uninstall man/gendesc.1 $(MAN_DIR)/man1/gendesc.1
- bin/install.sh --uninstall man/lcovrc.5 $(MAN_DIR)/man5/lcovrc.5
- bin/install.sh --uninstall lcovrc $(CFG_DIR)/lcovrc
-
-dist: lcov-$(VERSION).tar.gz lcov-$(VERSION)-$(RELEASE).noarch.rpm \
- lcov-$(VERSION)-$(RELEASE).src.rpm
-
-lcov-$(VERSION).tar.gz: $(FILES)
- mkdir $(TMP_DIR)
- mkdir $(TMP_DIR)/lcov-$(VERSION)
- cp -r * $(TMP_DIR)/lcov-$(VERSION)
- find $(TMP_DIR)/lcov-$(VERSION) -name CVS -type d | xargs rm -rf
- make -C $(TMP_DIR)/lcov-$(VERSION) clean
- bin/updateversion.pl $(TMP_DIR)/lcov-$(VERSION) $(VERSION) $(RELEASE)
- cd $(TMP_DIR) ; \
- tar cfz $(TMP_DIR)/lcov-$(VERSION).tar.gz lcov-$(VERSION)
- mv $(TMP_DIR)/lcov-$(VERSION).tar.gz .
- rm -rf $(TMP_DIR)
-
-lcov-$(VERSION)-$(RELEASE).noarch.rpm: rpms
-lcov-$(VERSION)-$(RELEASE).src.rpm: rpms
-
-rpms: lcov-$(VERSION).tar.gz
- mkdir $(TMP_DIR)
- mkdir $(TMP_DIR)/BUILD
- mkdir $(TMP_DIR)/RPMS
- mkdir $(TMP_DIR)/SOURCES
- mkdir $(TMP_DIR)/SRPMS
- cp lcov-$(VERSION).tar.gz $(TMP_DIR)/SOURCES
- cd $(TMP_DIR)/BUILD ; \
- tar xfz $(TMP_DIR)/SOURCES/lcov-$(VERSION).tar.gz \
- lcov-$(VERSION)/rpm/lcov.spec
- rpmbuild --define '_topdir $(TMP_DIR)' \
- -ba $(TMP_DIR)/BUILD/lcov-$(VERSION)/rpm/lcov.spec
- mv $(TMP_DIR)/RPMS/noarch/lcov-$(VERSION)-$(RELEASE).noarch.rpm .
- mv $(TMP_DIR)/SRPMS/lcov-$(VERSION)-$(RELEASE).src.rpm .
- rm -rf $(TMP_DIR)
137 Source/TestSupport/lcov-1.9/README
View
@@ -1,137 +0,0 @@
--------------------------------------------------
-- README file for the LTP GCOV extension (LCOV) -
-- Last changes: 2010-08-06 -
--------------------------------------------------
-
-Description
------------
- LCOV is an extension of GCOV, a GNU tool which provides information about
- what parts of a program are actually executed (i.e. "covered") while running
- a particular test case. The extension consists of a set of PERL scripts
- which build on the textual GCOV output to implement the following enhanced
- functionality:
-
- * HTML based output: coverage rates are additionally indicated using bar
- graphs and specific colors.
-
- * Support for large projects: overview pages allow quick browsing of
- coverage data by providing three levels of detail: directory view,
- file view and source code view.
-
- LCOV was initially designed to support Linux kernel coverage measurements,
- but works as well for coverage measurements on standard user space
- applications.
-
-
-Further README contents
------------------------
- 1. Included files
- 2. Installing LCOV
- 3. An example of how to access kernel coverage data
- 4. An example of how to access coverage data for a user space program
- 5. Questions and Comments
-
-
-
-1. Important files
-------------------
- README - This README file
- CHANGES - List of changes between releases
- bin/lcov - Tool for capturing LCOV coverage data
- bin/genhtml - Tool for creating HTML output from LCOV data
- bin/gendesc - Tool for creating description files as used by genhtml
- bin/geninfo - Internal tool (creates LCOV data files)
- bin/genpng - Internal tool (creates png overviews of source files)
- bin/install.sh - Internal tool (takes care of un-/installing)
- descriptions.tests - Test descriptions for the LTP suite, use with gendesc
- man - Directory containing man pages for included tools
- example - Directory containing an example to demonstrate LCOV
- lcovrc - LCOV configuration file
- Makefile - Makefile providing 'install' and 'uninstall' targets
-
-
-2. Installing LCOV
-------------------
-The LCOV package is available as either RPM or tarball from:
-
- http://ltp.sourceforge.net/coverage/lcov.php
-
-To install the tarball, unpack it to a directory and run:
-
- make install
-
-Use anonymous CVS for the most recent (but possibly unstable) version:
-
- cvs -d:pserver:anonymous@ltp.cvs.sourceforge.net:/cvsroot/ltp login
-
-(simply press the ENTER key when asked for a password)
-
- cvs -z3 -d:pserver:anonymous@ltp.cvs.sourceforge.net:/cvsroot/ltp export -D now utils
-
-Change to the utils/analysis/lcov directory and type:
-
- make install
-
-
-3. An example of how to access kernel coverage data
----------------------------------------------------
-Requirements: get and install the gcov-kernel package from
-
- http://sourceforge.net/projects/ltp
-
-Copy the resulting gcov kernel module file to either the system wide modules
-directory or the same directory as the PERL scripts. As root, do the following:
-
- a) Resetting counters
-
- lcov --zerocounters
-
- b) Capturing the current coverage state to a file
-
- lcov --capture --output-file kernel.info
-
- c) Getting HTML output
-
- genhtml kernel.info
-
-Point the web browser of your choice to the resulting index.html file.
-
-
-4. An example of how to access coverage data for a user space program
----------------------------------------------------------------------
-Requirements: compile the program in question using GCC with the options
--fprofile-arcs and -ftest-coverage. During linking, make sure to specify
--lgcov or -coverage.
-
-Assuming the compile directory is called "appdir", do the following:
-
- a) Resetting counters
-
- lcov --directory appdir --zerocounters
-
- b) Capturing the current coverage state to a file (works only after the
- application has been started and stopped at least once)
-
- lcov --directory appdir --capture --output-file app.info
-
- c) Getting HTML output
-
- genhtml app.info
-
-Point the web browser of your choice to the resulting index.html file.
-
-Please note that independently of where the application is installed or
-from which directory it is run, the --directory statement needs to
-point to the directory in which the application was compiled.
-
-For further information on the gcc profiling mechanism, please also
-consult the gcov man page.
-
-
-5. Questions and comments
--------------------------
-See the included man pages for more information on how to use the LCOV tools.
-
-Please email further questions or comments regarding this tool to the
-LTP Mailing list at ltp-coverage@lists.sourceforge.net
-
226 Source/TestSupport/lcov-1.9/bin/gendesc
View
@@ -1,226 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Copyright (c) International Business Machines Corp., 2002
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or (at
-# your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-#
-# gendesc
-#
-# This script creates a description file as understood by genhtml.
-# Input file format:
-#
-# For each test case:
-# <test name><optional whitespace>
-# <at least one whitespace character (blank/tab)><test description>
-#
-# Actual description may consist of several lines. By default, output is
-# written to stdout. Test names consist of alphanumeric characters
-# including _ and -.
-#
-#
-# History:
-# 2002-09-02: created by Peter Oberparleiter <Peter.Oberparleiter@de.ibm.com>
-#
-
-use strict;
-use File::Basename;
-use Getopt::Long;
-
-
-# Constants
-our $lcov_version = 'LCOV version 1.9';
-our $lcov_url = "http://ltp.sourceforge.net/coverage/lcov.php";
-our $tool_name = basename($0);
-
-
-# Prototypes
-sub print_usage(*);
-sub gen_desc();
-sub warn_handler($);
-sub die_handler($);
-
-
-# Global variables
-our $help;
-our $version;
-our $output_filename;
-our $input_filename;
-
-
-#
-# Code entry point
-#
-
-$SIG{__WARN__} = \&warn_handler;
-$SIG{__DIE__} = \&die_handler;
-
-# Prettify version string
-$lcov_version =~ s/\$\s*Revision\s*:?\s*(\S+)\s*\$/$1/;
-
-# Parse command line options
-if (!GetOptions("output-filename=s" => \$output_filename,
- "version" =>\$version,
- "help|?" => \$help
- ))
-{
- print(STDERR "Use $tool_name --help to get usage information\n");
- exit(1);
-}
-
-$input_filename = $ARGV[0];
-
-# Check for help option
-if ($help)
-{
- print_usage(*STDOUT);
- exit(0);
-}
-
-# Check for version option
-if ($version)
-{
- print("$tool_name: $lcov_version\n");
- exit(0);
-}
-
-
-# Check for input filename
-if (!$input_filename)
-{
- die("No input filename specified\n".
- "Use $tool_name --help to get usage information\n");
-}
-
-# Do something
-gen_desc();
-
-
-#
-# print_usage(handle)
-#
-# Write out command line usage information to given filehandle.
-#
-
-sub print_usage(*)
-{
- local *HANDLE = $_[0];
-
- print(HANDLE <<END_OF_USAGE)
-Usage: $tool_name [OPTIONS] INPUTFILE
-
-Convert a test case description file into a format as understood by genhtml.
-
- -h, --help Print this help, then exit
- -v, --version Print version number, then exit
- -o, --output-filename FILENAME Write description to FILENAME
-
-For more information see: $lcov_url
-END_OF_USAGE
- ;
-}
-
-
-#
-# gen_desc()
-#
-# Read text file INPUT_FILENAME and convert the contained description to a
-# format as understood by genhtml, i.e.
-#
-# TN:<test name>
-# TD:<test description>
-#
-# If defined, write output to OUTPUT_FILENAME, otherwise to stdout.
-#
-# Die on error.
-#
-
-sub gen_desc()
-{
- local *INPUT_HANDLE;
- local *OUTPUT_HANDLE;
- my $empty_line = "ignore";
-
- open(INPUT_HANDLE, $input_filename)
- or die("ERROR: cannot open $input_filename!\n");
-
- # Open output file for writing
- if ($output_filename)
- {
- open(OUTPUT_HANDLE, ">$output_filename")
- or die("ERROR: cannot create $output_filename!\n");
- }
- else
- {
- *OUTPUT_HANDLE = *STDOUT;
- }
-
- # Process all lines in input file
- while (<INPUT_HANDLE>)
- {
- chomp($_);
-
- if (/^(\w[\w-]*)(\s*)$/)
- {
- # Matched test name
- # Name starts with alphanum or _, continues with
- # alphanum, _ or -
- print(OUTPUT_HANDLE "TN: $1\n");
- $empty_line = "ignore";
- }
- elsif (/^(\s+)(\S.*?)\s*$/)
- {
- # Matched test description
- if ($empty_line eq "insert")
- {
- # Write preserved empty line
- print(OUTPUT_HANDLE "TD: \n");
- }
- print(OUTPUT_HANDLE "TD: $2\n");
- $empty_line = "observe";
- }
- elsif (/^\s*$/)
- {
- # Matched empty line to preserve paragraph separation
- # inside description text
- if ($empty_line eq "observe")
- {
- $empty_line = "insert";
- }
- }
- }
-
- # Close output file if defined
- if ($output_filename)
- {
- close(OUTPUT_HANDLE);
- }
-
- close(INPUT_HANDLE);
-}
-
-sub warn_handler($)
-{
- my ($msg) = @_;
-
- warn("$tool_name: $msg");
-}
-
-sub die_handler($)
-{
- my ($msg) = @_;
-
- die("$tool_name: $msg");
-}
5,648 Source/TestSupport/lcov-1.9/bin/genhtml
View
0 additions, 5,648 deletions not shown
3,068 Source/TestSupport/lcov-1.9/bin/geninfo
View
@@ -1,3068 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Copyright (c) International Business Machines Corp., 2002,2010
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or (at
-# your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-#
-# geninfo
-#
-# This script generates .info files from data files as created by code
-# instrumented with gcc's built-in profiling mechanism. Call it with
-# --help and refer to the geninfo man page to get information on usage
-# and available options.
-#
-#
-# Authors:
-# 2002-08-23 created by Peter Oberparleiter <Peter.Oberparleiter@de.ibm.com>
-# IBM Lab Boeblingen
-# based on code by Manoj Iyer <manjo@mail.utexas.edu> and
-# Megan Bock <mbock@us.ibm.com>
-# IBM Austin
-# 2002-09-05 / Peter Oberparleiter: implemented option that allows file list
-# 2003-04-16 / Peter Oberparleiter: modified read_gcov so that it can also
-# parse the new gcov format which is to be introduced in gcc 3.3
-# 2003-04-30 / Peter Oberparleiter: made info write to STDERR, not STDOUT
-# 2003-07-03 / Peter Oberparleiter: added line checksum support, added
-# --no-checksum
-# 2003-09-18 / Nigel Hinds: capture branch coverage data from GCOV
-# 2003-12-11 / Laurent Deniel: added --follow option
-# workaround gcov (<= 3.2.x) bug with empty .da files
-# 2004-01-03 / Laurent Deniel: Ignore empty .bb files
-# 2004-02-16 / Andreas Krebbel: Added support for .gcno/.gcda files and
-# gcov versioning
-# 2004-08-09 / Peter Oberparleiter: added configuration file support
-# 2008-07-14 / Tom Zoerner: added --function-coverage command line option
-# 2008-08-13 / Peter Oberparleiter: modified function coverage
-# implementation (now enabled per default)
-#
-
-use strict;
-use File::Basename;
-use File::Spec::Functions qw /abs2rel catdir file_name_is_absolute splitdir
- splitpath/;
-use Getopt::Long;
-use Digest::MD5 qw(md5_base64);
-
-
-# Constants
-our $lcov_version = 'LCOV version 1.9';
-our $lcov_url = "http://ltp.sourceforge.net/coverage/lcov.php";
-our $gcov_tool = "gcov";
-our $tool_name = basename($0);
-
-our $GCOV_VERSION_3_4_0 = 0x30400;
-our $GCOV_VERSION_3_3_0 = 0x30300;
-our $GCNO_FUNCTION_TAG = 0x01000000;
-our $GCNO_LINES_TAG = 0x01450000;
-our $GCNO_FILE_MAGIC = 0x67636e6f;
-our $BBG_FILE_MAGIC = 0x67626267;
-
-our $COMPAT_HAMMER = "hammer";
-
-our $ERROR_GCOV = 0;
-our $ERROR_SOURCE = 1;
-our $ERROR_GRAPH = 2;
-
-our $EXCL_START = "LCOV_EXCL_START";
-our $EXCL_STOP = "LCOV_EXCL_STOP";
-our $EXCL_LINE = "LCOV_EXCL_LINE";
-
-our $BR_LINE = 0;
-our $BR_BLOCK = 1;
-our $BR_BRANCH = 2;
-our $BR_TAKEN = 3;
-our $BR_VEC_ENTRIES = 4;
-our $BR_VEC_WIDTH = 32;
-
-our $UNNAMED_BLOCK = 9999;
-
-# Prototypes
-sub print_usage(*);
-sub gen_info($);
-sub process_dafile($$);
-sub match_filename($@);
-sub solve_ambiguous_match($$$);
-sub split_filename($);
-sub solve_relative_path($$);
-sub read_gcov_header($);
-sub read_gcov_file($);
-sub info(@);
-sub get_gcov_version();
-sub system_no_output($@);
-sub read_config($);
-sub apply_config($);
-sub get_exclusion_data($);
-sub apply_exclusion_data($$);
-sub process_graphfile($$);
-sub filter_fn_name($);
-sub warn_handler($);
-sub die_handler($);
-sub graph_error($$);
-sub graph_expect($);
-sub graph_read(*$;$);
-sub graph_skip(*$;$);
-sub sort_uniq(@);
-sub sort_uniq_lex(@);
-sub graph_cleanup($);
-sub graph_find_base($);
-sub graph_from_bb($$$);
-sub graph_add_order($$$);
-sub read_bb_word(*;$);
-sub read_bb_value(*;$);
-sub read_bb_string(*$);
-sub read_bb($$);
-sub read_bbg_word(*;$);
-sub read_bbg_value(*;$);
-sub read_bbg_string(*);
-sub read_bbg_lines_record(*$$$$$$);
-sub read_bbg($$);
-sub read_gcno_word(*;$);
-sub read_gcno_value(*$;$);
-sub read_gcno_string(*$);
-sub read_gcno_lines_record(*$$$$$$$);
-sub read_gcno_function_record(*$$$$);
-sub read_gcno($$);
-sub get_gcov_capabilities();
-sub get_overall_line($$$$);
-sub print_overall_rate($$$$$$$$$);
-sub br_gvec_len($);
-sub br_gvec_get($$);
-sub debug($);
-sub int_handler();
-
-
-# Global variables
-our $gcov_version;
-our $graph_file_extension;
-our $data_file_extension;
-our @data_directory;
-our $test_name = "";
-our $quiet;
-our $help;
-our $output_filename;
-our $base_directory;
-our $version;
-our $follow;
-our $checksum;
-our $no_checksum;
-our $compat_libtool;
-our $no_compat_libtool;
-our $adjust_testname;
-our $config; # Configuration file contents
-our $compatibility; # Compatibility version flag - used to indicate
- # non-standard GCOV data format versions
-our @ignore_errors; # List of errors to ignore (parameter)
-our @ignore; # List of errors to ignore (array)
-our $initial;
-our $no_recursion = 0;
-our $maxdepth;
-our $no_markers = 0;
-our $opt_derive_func_data = 0;
-our $debug = 0;
-our $gcov_caps;
-our @gcov_options;
-
-our $cwd = `pwd`;
-chomp($cwd);
-
-
-#
-# Code entry point
-#
-
-# Register handler routine to be called when interrupted
-$SIG{"INT"} = \&int_handler;
-$SIG{__WARN__} = \&warn_handler;
-$SIG{__DIE__} = \&die_handler;
-
-# Prettify version string
-$lcov_version =~ s/\$\s*Revision\s*:?\s*(\S+)\s*\$/$1/;
-
-# Set LANG so that gcov output will be in a unified format
-$ENV{"LANG"} = "C";
-
-# Read configuration file if available
-if (defined($ENV{"HOME"}) && (-r $ENV{"HOME"}."/.lcovrc"))
-{
- $config = read_config($ENV{"HOME"}."/.lcovrc");
-}
-elsif (-r "/etc/lcovrc")
-{
- $config = read_config("/etc/lcovrc");
-}
-
-if ($config)
-{
- # Copy configuration file values to variables
- apply_config({
- "geninfo_gcov_tool" => \$gcov_tool,
- "geninfo_adjust_testname" => \$adjust_testname,
- "geninfo_checksum" => \$checksum,
- "geninfo_no_checksum" => \$no_checksum, # deprecated
- "geninfo_compat_libtool" => \$compat_libtool});
-
- # Merge options
- if (defined($no_checksum))
- {
- $checksum = ($no_checksum ? 0 : 1);
- $no_checksum = undef;
- }
-}
-
-# Parse command line options
-if (!GetOptions("test-name|t=s" => \$test_name,
- "output-filename|o=s" => \$output_filename,
- "checksum" => \$checksum,
- "no-checksum" => \$no_checksum,
- "base-directory|b=s" => \$base_directory,
- "version|v" =>\$version,
- "quiet|q" => \$quiet,
- "help|h|?" => \$help,
- "follow|f" => \$follow,
- "compat-libtool" => \$compat_libtool,
- "no-compat-libtool" => \$no_compat_libtool,
- "gcov-tool=s" => \$gcov_tool,
- "ignore-errors=s" => \@ignore_errors,
- "initial|i" => \$initial,
- "no-recursion" => \$no_recursion,
- "no-markers" => \$no_markers,
- "derive-func-data" => \$opt_derive_func_data,
- "debug" => \$debug,
- ))
-{
- print(STDERR "Use $tool_name --help to get usage information\n");
- exit(1);
-}
-else
-{
- # Merge options
- if (defined($no_checksum))
- {
- $checksum = ($no_checksum ? 0 : 1);
- $no_checksum = undef;
- }
-
- if (defined($no_compat_libtool))
- {
- $compat_libtool = ($no_compat_libtool ? 0 : 1);
- $no_compat_libtool = undef;
- }
-}
-
-@data_directory = @ARGV;
-
-# Check for help option
-if ($help)
-{
- print_usage(*STDOUT);
- exit(0);
-}
-
-# Check for version option
-if ($version)
-{
- print("$tool_name: $lcov_version\n");
- exit(0);
-}
-
-# Make sure test names only contain valid characters
-if ($test_name =~ s/\W/_/g)
-{
- warn("WARNING: invalid characters removed from testname!\n");
-}
-
-# Adjust test name to include uname output if requested
-if ($adjust_testname)
-{
- $test_name .= "__".`uname -a`;
- $test_name =~ s/\W/_/g;
-}
-
-# Make sure base_directory contains an absolute path specification
-if ($base_directory)
-{
- $base_directory = solve_relative_path($cwd, $base_directory);
-}
-
-# Check for follow option
-if ($follow)
-{
- $follow = "-follow"
-}
-else
-{
- $follow = "";
-}
-
-# Determine checksum mode
-if (defined($checksum))
-{
- # Normalize to boolean
- $checksum = ($checksum ? 1 : 0);
-}
-else
-{
- # Default is off
- $checksum = 0;
-}
-
-# Determine libtool compatibility mode
-if (defined($compat_libtool))
-{
- $compat_libtool = ($compat_libtool? 1 : 0);
-}
-else
-{
- # Default is on
- $compat_libtool = 1;
-}
-
-# Determine max depth for recursion
-if ($no_recursion)
-{
- $maxdepth = "-maxdepth 1";
-}
-else
-{
- $maxdepth = "";
-}
-
-# Check for directory name
-if (!@data_directory)
-{
- die("No directory specified\n".
- "Use $tool_name --help to get usage information\n");
-}
-else
-{
- foreach (@data_directory)
- {
- stat($_);
- if (!-r _)
- {
- die("ERROR: cannot read $_!\n");
- }
- }
-}
-
-if (@ignore_errors)
-{
- my @expanded;
- my $error;
-
- # Expand comma-separated entries
- foreach (@ignore_errors) {
- if (/,/)
- {
- push(@expanded, split(",", $_));
- }
- else
- {
- push(@expanded, $_);
- }
- }
-
- foreach (@expanded)
- {
- /^gcov$/ && do { $ignore[$ERROR_GCOV] = 1; next; } ;
- /^source$/ && do { $ignore[$ERROR_SOURCE] = 1; next; };
- /^graph$/ && do { $ignore[$ERROR_GRAPH] = 1; next; };
- die("ERROR: unknown argument for --ignore-errors: $_\n");
- }
-}
-
-if (system_no_output(3, $gcov_tool, "--help") == -1)
-{
- die("ERROR: need tool $gcov_tool!\n");
-}
-
-$gcov_version = get_gcov_version();
-
-if ($gcov_version < $GCOV_VERSION_3_4_0)
-{
- if (defined($compatibility) && $compatibility eq $COMPAT_HAMMER)
- {
- $data_file_extension = ".da";
- $graph_file_extension = ".bbg";
- }
- else
- {
- $data_file_extension = ".da";
- $graph_file_extension = ".bb";
- }
-}
-else
-{
- $data_file_extension = ".gcda";
- $graph_file_extension = ".gcno";
-}
-
-# Determine gcov options
-$gcov_caps = get_gcov_capabilities();
-push(@gcov_options, "-b") if ($gcov_caps->{'branch-probabilities'});
-push(@gcov_options, "-c") if ($gcov_caps->{'branch-counts'});
-push(@gcov_options, "-a") if ($gcov_caps->{'all-blocks'});
-push(@gcov_options, "-p") if ($gcov_caps->{'preserve-paths'});
-
-# Check output filename
-if (defined($output_filename) && ($output_filename ne "-"))
-{
- # Initially create output filename, data is appended
- # for each data file processed
- local *DUMMY_HANDLE;
- open(DUMMY_HANDLE, ">$output_filename")
- or die("ERROR: cannot create $output_filename!\n");
- close(DUMMY_HANDLE);
-
- # Make $output_filename an absolute path because we're going
- # to change directories while processing files
- if (!($output_filename =~ /^\/(.*)$/))
- {
- $output_filename = $cwd."/".$output_filename;
- }
-}
-
-# Do something
-foreach my $entry (@data_directory) {
- gen_info($entry);
-}
-
-if ($initial) {
- warn("Note: --initial does not generate branch coverage ".
- "data\n");
-}
-info("Finished .info-file creation\n");
-
-exit(0);
-
-
-
-#
-# print_usage(handle)
-#
-# Print usage information.
-#
-
-sub print_usage(*)
-{
- local *HANDLE = $_[0];
-
- print(HANDLE <<END_OF_USAGE);
-Usage: $tool_name [OPTIONS] DIRECTORY
-
-Traverse DIRECTORY and create a .info file for each data file found. Note
-that you may specify more than one directory, all of which are then processed
-sequentially.
-
- -h, --help Print this help, then exit
- -v, --version Print version number, then exit
- -q, --quiet Do not print progress messages
- -i, --initial Capture initial zero coverage data
- -t, --test-name NAME Use test case name NAME for resulting data
- -o, --output-filename OUTFILE Write data only to OUTFILE
- -f, --follow Follow links when searching .da/.gcda files
- -b, --base-directory DIR Use DIR as base directory for relative paths
- --(no-)checksum Enable (disable) line checksumming
- --(no-)compat-libtool Enable (disable) libtool compatibility mode
- --gcov-tool TOOL Specify gcov tool location
- --ignore-errors ERROR Continue after ERROR (gcov, source, graph)
- --no-recursion Exclude subdirectories from processing
- --function-coverage Capture function call counts
- --no-markers Ignore exclusion markers in source code
- --derive-func-data Generate function data from line data
-
-For more information see: $lcov_url
-END_OF_USAGE
- ;
-}
-
-#
-# get_common_prefix(min_dir, filenames)
-#
-# Return the longest path prefix shared by all filenames. MIN_DIR specifies
-# the minimum number of directories that a filename may have after removing
-# the prefix.
-#
-
-sub get_common_prefix($@)
-{
- my ($min_dir, @files) = @_;
- my $file;
- my @prefix;
- my $i;
-
- foreach $file (@files) {
- my ($v, $d, $f) = splitpath($file);
- my @comp = splitdir($d);
-
- if (!@prefix) {
- @prefix = @comp;
- next;
- }
- for ($i = 0; $i < scalar(@comp) && $i < scalar(@prefix); $i++) {
- if ($comp[$i] ne $prefix[$i] ||
- ((scalar(@comp) - ($i + 1)) <= $min_dir)) {
- delete(@prefix[$i..scalar(@prefix)]);
- last;
- }
- }
- }
-
- return catdir(@prefix);
-}
-
-#
-# gen_info(directory)
-#
-# Traverse DIRECTORY and create a .info file for each data file found.
-# The .info file contains TEST_NAME in the following format:
-#
-# TN:<test name>
-#
-# For each source file name referenced in the data file, there is a section
-# containing source code and coverage data:
-#
-# SF:<absolute path to the source file>
-# FN:<line number of function start>,<function name> for each function
-# DA:<line number>,<execution count> for each instrumented line
-# LH:<number of lines with an execution count> greater than 0
-# LF:<number of instrumented lines>
-#
-# Sections are separated by:
-#
-# end_of_record
-#
-# In addition to the main source code file there are sections for each
-# #included file containing executable code. Note that the absolute path
-# of a source file is generated by interpreting the contents of the respective
-# graph file. Relative filenames are prefixed with the directory in which the
-# graph file is found. Note also that symbolic links to the graph file will be
-# resolved so that the actual file path is used instead of the path to a link.
-# This approach is necessary for the mechanism to work with the /proc/gcov
-# files.
-#
-# Die on error.
-#
-
-sub gen_info($)
-{
- my $directory = $_[0];
- my @file_list;
- my $file;
- my $prefix;
- my $type;
- my $ext;
-
- if ($initial) {
- $type = "graph";
- $ext = $graph_file_extension;
- } else {
- $type = "data";
- $ext = $data_file_extension;
- }
-
- if (-d $directory)
- {
- info("Scanning $directory for $ext files ...\n");
-
- @file_list = `find "$directory" $maxdepth $follow -name \\*$ext -type f 2>/dev/null`;
- chomp(@file_list);
- @file_list or
- die("ERROR: no $ext files found in $directory!\n");
- $prefix = get_common_prefix(1, @file_list);
- info("Found %d %s files in %s\n", $#file_list+1, $type,
- $directory);
- }
- else
- {
- @file_list = ($directory);
- $prefix = "";
- }
-
- # Process all files in list
- foreach $file (@file_list) {
- # Process file
- if ($initial) {
- process_graphfile($file, $prefix);
- } else {
- process_dafile($file, $prefix);
- }
- }
-}
-
-
-sub derive_data($$$)
-{
- my ($contentdata, $funcdata, $bbdata) = @_;
- my @gcov_content = @{$contentdata};
- my @gcov_functions = @{$funcdata};
- my %fn_count;
- my %ln_fn;
- my $line;
- my $maxline;
- my %fn_name;
- my $fn;
- my $count;
-
- if (!defined($bbdata)) {
- return @gcov_functions;
- }
-
- # First add existing function data
- while (@gcov_functions) {
- $count = shift(@gcov_functions);
- $fn = shift(@gcov_functions);
-
- $fn_count{$fn} = $count;
- }
-
- # Convert line coverage data to function data
- foreach $fn (keys(%{$bbdata})) {
- my $line_data = $bbdata->{$fn};
- my $line;
-
- if ($fn eq "") {
- next;
- }
- # Find the lowest line count for this function
- $count = 0;
- foreach $line (@$line_data) {
- my $lcount = $gcov_content[ ( $line - 1 ) * 3 + 1 ];
-
- if (($lcount > 0) &&
- (($count == 0) || ($lcount < $count))) {
- $count = $lcount;
- }
- }
- $fn_count{$fn} = $count;
- }
-
-
- # Check if we got data for all functions
- foreach $fn (keys(%fn_name)) {
- if ($fn eq "") {
- next;
- }
- if (defined($fn_count{$fn})) {
- next;
- }
- warn("WARNING: no derived data found for function $fn\n");
- }
-
- # Convert hash to list in @gcov_functions format
- foreach $fn (sort(keys(%fn_count))) {
- push(@gcov_functions, $fn_count{$fn}, $fn);
- }
-
- return @gcov_functions;
-}
-
-#
-# get_filenames(directory, pattern)
-#
-# Return a list of filenames found in directory which match the specified
-# pattern.
-#
-# Die on error.
-#
-
-sub get_filenames($$)
-{
- my ($dirname, $pattern) = @_;
- my @result;
- my $directory;
- local *DIR;
-
- opendir(DIR, $dirname) or
- die("ERROR: cannot read directory $dirname\n");
- while ($directory = readdir(DIR)) {
- push(@result, $directory) if ($directory =~ /$pattern/);
- }
- closedir(DIR);
-
- return @result;
-}
-
-#
-# process_dafile(da_filename, dir)
-#
-# Create a .info file for a single data file.
-#
-# Die on error.
-#
-
-sub process_dafile($$)
-{
- my ($file, $dir) = @_;
- my $da_filename; # Name of data file to process
- my $da_dir; # Directory of data file
- my $source_dir; # Directory of source file
- my $da_basename; # data filename without ".da/.gcda" extension
- my $bb_filename; # Name of respective graph file
- my $bb_basename; # Basename of the original graph file
- my $graph; # Contents of graph file
- my $instr; # Contents of graph file part 2
- my $gcov_error; # Error code of gcov tool
- my $object_dir; # Directory containing all object files
- my $source_filename; # Name of a source code file
- my $gcov_file; # Name of a .gcov file
- my @gcov_content; # Content of a .gcov file
- my $gcov_branches; # Branch content of a .gcov file
- my @gcov_functions; # Function calls of a .gcov file
- my @gcov_list; # List of generated .gcov files
- my $line_number; # Line number count
- my $lines_hit; # Number of instrumented lines hit
- my $lines_found; # Number of instrumented lines found
- my $funcs_hit; # Number of instrumented functions hit
- my $funcs_found; # Number of instrumented functions found
- my $br_hit;
- my $br_found;
- my $source; # gcov source header information
- my $object; # gcov object header information
- my @matches; # List of absolute paths matching filename
- my @unprocessed; # List of unprocessed source code files
- my $base_dir; # Base directory for current file
- my @tmp_links; # Temporary links to be cleaned up
- my @result;
- my $index;
- my $da_renamed; # If data file is to be renamed
- local *INFO_HANDLE;
-
- info("Processing %s\n", abs2rel($file, $dir));
- # Get path to data file in absolute and normalized form (begins with /,
- # contains no more ../ or ./)
- $da_filename = solve_relative_path($cwd, $file);
-
- # Get directory and basename of data file
- ($da_dir, $da_basename) = split_filename($da_filename);
-
- # avoid files from .libs dirs
- if ($compat_libtool && $da_dir =~ m/(.*)\/\.libs$/) {
- $source_dir = $1;
- } else {
- $source_dir = $da_dir;
- }
-
- if (-z $da_filename)
- {
- $da_renamed = 1;
- }
- else
- {
- $da_renamed = 0;
- }
-
- # Construct base_dir for current file
- if ($base_directory)
- {
- $base_dir = $base_directory;
- }
- else
- {
- $base_dir = $source_dir;
- }
-
- # Check for writable $base_dir (gcov will try to write files there)
- stat($base_dir);
- if (!-w _)
- {
- die("ERROR: cannot write to directory $base_dir!\n");
- }
-
- # Construct name of graph file
- $bb_basename = $da_basename.$graph_file_extension;
- $bb_filename = "$da_dir/$bb_basename";
-
- # Find out the real location of graph file in case we're just looking at
- # a link
- while (readlink($bb_filename))
- {
- my $last_dir = dirname($bb_filename);
-
- $bb_filename = readlink($bb_filename);
- $bb_filename = solve_relative_path($last_dir, $bb_filename);
- }
-
- # Ignore empty graph file (e.g. source file with no statement)
- if (-z $bb_filename)
- {
- warn("WARNING: empty $bb_filename (skipped)\n");
- return;
- }
-
- # Read contents of graph file into hash. We need it later to find out
- # the absolute path to each .gcov file created as well as for
- # information about functions and their source code positions.
- if ($gcov_version < $GCOV_VERSION_3_4_0)
- {
- if (defined($compatibility) && $compatibility eq $COMPAT_HAMMER)
- {
- ($instr, $graph) = read_bbg($bb_filename, $base_dir);
- }
- else
- {
- ($instr, $graph) = read_bb($bb_filename, $base_dir);
- }
- }
- else
- {
- ($instr, $graph) = read_gcno($bb_filename, $base_dir);
- }
-
- # Set $object_dir to real location of object files. This may differ
- # from $da_dir if the graph file is just a link to the "real" object
- # file location.
- $object_dir = dirname($bb_filename);
-
- # Is the data file in a different directory? (this happens e.g. with
- # the gcov-kernel patch)
- if ($object_dir ne $da_dir)
- {
- # Need to create link to data file in $object_dir
- system("ln", "-s", $da_filename,
- "$object_dir/$da_basename$data_file_extension")
- and die ("ERROR: cannot create link $object_dir/".
- "$da_basename$data_file_extension!\n");
- push(@tmp_links,
- "$object_dir/$da_basename$data_file_extension");
- # Need to create link to graph file if basename of link
- # and file are different (CONFIG_MODVERSION compat)
- if ((basename($bb_filename) ne $bb_basename) &&
- (! -e "$object_dir/$bb_basename")) {
- symlink($bb_filename, "$object_dir/$bb_basename") or
- warn("WARNING: cannot create link ".
- "$object_dir/$bb_basename\n");
- push(@tmp_links, "$object_dir/$bb_basename");
- }
- }
-
- # Change to directory containing data files and apply GCOV
- chdir($base_dir);
-
- if ($da_renamed)
- {
- # Need to rename empty data file to workaround
- # gcov <= 3.2.x bug (Abort)
- system_no_output(3, "mv", "$da_filename", "$da_filename.ori")
- and die ("ERROR: cannot rename $da_filename\n");
- }
-
- # Execute gcov command and suppress standard output
- $gcov_error = system_no_output(1, $gcov_tool, $da_filename,
- "-o", $object_dir, @gcov_options);
-
- if ($da_renamed)
- {
- system_no_output(3, "mv", "$da_filename.ori", "$da_filename")
- and die ("ERROR: cannot rename $da_filename.ori");
- }
-
- # Clean up temporary links
- foreach (@tmp_links) {
- unlink($_);
- }
-
- if ($gcov_error)
- {
- if ($ignore[$ERROR_GCOV])
- {
- warn("WARNING: GCOV failed for $da_filename!\n");
- return;
- }
- die("ERROR: GCOV failed for $da_filename!\n");
- }
-
- # Collect data from resulting .gcov files and create .info file
- @gcov_list = get_filenames('.', '\.gcov$');
-
- # Check for files
- if (!@gcov_list)
- {
- warn("WARNING: gcov did not create any files for ".
- "$da_filename!\n");
- }
-
- # Check whether we're writing to a single file
- if ($output_filename)
- {
- if ($output_filename eq "-")
- {
- *INFO_HANDLE = *STDOUT;
- }
- else
- {
- # Append to output file
- open(INFO_HANDLE, ">>$output_filename")
- or die("ERROR: cannot write to ".
- "$output_filename!\n");
- }
- }
- else
- {
- # Open .info file for output
- open(INFO_HANDLE, ">$da_filename.info")
- or die("ERROR: cannot create $da_filename.info!\n");
- }
-
- # Write test name
- printf(INFO_HANDLE "TN:%s\n", $test_name);
-
- # Traverse the list of generated .gcov files and combine them into a
- # single .info file
- @unprocessed = keys(%{$instr});
- foreach $gcov_file (sort(@gcov_list))
- {
- my $i;
- my $num;
-
- ($source, $object) = read_gcov_header($gcov_file);
-
- if (defined($source))
- {
- $source = solve_relative_path($base_dir, $source);
- }
-
- # gcov will happily create output even if there's no source code
- # available - this interferes with checksum creation so we need
- # to pull the emergency brake here.
- if (defined($source) && ! -r $source && $checksum)
- {
- if ($ignore[$ERROR_SOURCE])
- {
- warn("WARNING: could not read source file ".
- "$source\n");
- next;
- }
- die("ERROR: could not read source file $source\n");
- }
-
- @matches = match_filename(defined($source) ? $source :
- $gcov_file, keys(%{$instr}));
-
- # Skip files that are not mentioned in the graph file
- if (!@matches)
- {
- warn("WARNING: cannot find an entry for ".$gcov_file.
- " in $graph_file_extension file, skipping ".
- "file!\n");
- unlink($gcov_file);
- next;
- }
-
- # Read in contents of gcov file
- @result = read_gcov_file($gcov_file);
- if (!defined($result[0])) {
- warn("WARNING: skipping unreadable file ".
- $gcov_file."\n");
- unlink($gcov_file);
- next;
- }
- @gcov_content = @{$result[0]};
- $gcov_branches = $result[1];
- @gcov_functions = @{$result[2]};
-
- # Skip empty files
- if (!@gcov_content)
- {
- warn("WARNING: skipping empty file ".$gcov_file."\n");
- unlink($gcov_file);
- next;
- }
-
- if (scalar(@matches) == 1)
- {
- # Just one match
- $source_filename = $matches[0];
- }
- else
- {
- # Try to solve the ambiguity
- $source_filename = solve_ambiguous_match($gcov_file,
- \@matches, \@gcov_content);
- }
-
- # Remove processed file from list
- for ($index = scalar(@unprocessed) - 1; $index >= 0; $index--)
- {
- if ($unprocessed[$index] eq $source_filename)
- {
- splice(@unprocessed, $index, 1);
- last;
- }
- }
-
- # Write absolute path of source file
- printf(INFO_HANDLE "SF:%s\n", $source_filename);
-
- # If requested, derive function coverage data from
- # line coverage data of the first line of a function
- if ($opt_derive_func_data) {
- @gcov_functions =
- derive_data(\@gcov_content, \@gcov_functions,
- $graph->{$source_filename});
- }
-
- # Write function-related information
- if (defined($graph->{$source_filename}))
- {
- my $fn_data = $graph->{$source_filename};
- my $fn;
-
- foreach $fn (sort
- {$fn_data->{$a}->[0] <=> $fn_data->{$b}->[0]}
- keys(%{$fn_data})) {
- my $ln_data = $fn_data->{$fn};
- my $line = $ln_data->[0];
-
- # Skip empty function
- if ($fn eq "") {
- next;
- }
- # Remove excluded functions
- if (!$no_markers) {
- my $gfn;
- my $found = 0;
-
- foreach $gfn (@gcov_functions) {
- if ($gfn eq $fn) {
- $found = 1;
- last;
- }
- }
- if (!$found) {
- next;
- }
- }
-
- # Normalize function name
- $fn = filter_fn_name($fn);
-
- print(INFO_HANDLE "FN:$line,$fn\n");
- }
- }
-
- #--
- #-- FNDA: <call-count>, <function-name>
- #-- FNF: overall count of functions
- #-- FNH: overall count of functions with non-zero call count
- #--
- $funcs_found = 0;
- $funcs_hit = 0;
- while (@gcov_functions)
- {
- my $count = shift(@gcov_functions);
- my $fn = shift(@gcov_functions);
-
- $fn = filter_fn_name($fn);
- printf(INFO_HANDLE "FNDA:$count,$fn\n");
- $funcs_found++;
- $funcs_hit++ if ($count > 0);
- }
- if ($funcs_found > 0) {
- printf(INFO_HANDLE "FNF:%s\n", $funcs_found);
- printf(INFO_HANDLE "FNH:%s\n", $funcs_hit);
- }
-
- # Write coverage information for each instrumented branch:
- #
- # BRDA:<line number>,<block number>,<branch number>,<taken>
- #
- # where 'taken' is the number of times the branch was taken
- # or '-' if the block to which the branch belongs was never
- # executed
- $br_found = 0;
- $br_hit = 0;
- $num = br_gvec_len($gcov_branches);
- for ($i = 0; $i < $num; $i++) {
- my ($line, $block, $branch, $taken) =
- br_gvec_get($gcov_branches, $i);
-
- print(INFO_HANDLE "BRDA:$line,$block,$branch,$taken\n");
- $br_found++;
- $br_hit++ if ($taken ne '-' && $taken > 0);
- }
- if ($br_found > 0) {
- printf(INFO_HANDLE "BRF:%s\n", $br_found);
- printf(INFO_HANDLE "BRH:%s\n", $br_hit);
- }
-
- # Reset line counters
- $line_number = 0;
- $lines_found = 0;
- $lines_hit = 0;
-
- # Write coverage information for each instrumented line
- # Note: @gcov_content contains a list of (flag, count, source)
- # tuple for each source code line
- while (@gcov_content)
- {
- $line_number++;
-
- # Check for instrumented line
- if ($gcov_content[0])
- {
- $lines_found++;
- printf(INFO_HANDLE "DA:".$line_number.",".
- $gcov_content[1].($checksum ?
- ",". md5_base64($gcov_content[2]) : "").
- "\n");
-
- # Increase $lines_hit in case of an execution
- # count>0
- if ($gcov_content[1] > 0) { $lines_hit++; }
- }
-
- # Remove already processed data from array
- splice(@gcov_content,0,3);
- }
-
- # Write line statistics and section separator
- printf(INFO_HANDLE "LF:%s\n", $lines_found);
- printf(INFO_HANDLE "LH:%s\n", $lines_hit);
- print(INFO_HANDLE "end_of_record\n");
-
- # Remove .gcov file after processing
- unlink($gcov_file);
- }
-
- # Check for files which show up in the graph file but were never
- # processed
- if (@unprocessed && @gcov_list)
- {
- foreach (@unprocessed)
- {
- warn("WARNING: no data found for $_\n");
- }
- }
-
- if (!($output_filename && ($output_filename eq "-")))
- {
- close(INFO_HANDLE);
- }
-
- # Change back to initial directory
- chdir($cwd);
-}
-
-
-#
-# solve_relative_path(path, dir)
-#
-# Solve relative path components of DIR which, if not absolute, resides in PATH.
-#
-
-sub solve_relative_path($$)
-{
- my $path = $_[0];
- my $dir = $_[1];
- my $result;
-
- $result = $dir;
- # Prepend path if not absolute
- if ($dir =~ /^[^\/]/)
- {
- $result = "$path/$result";
- }
-
- # Remove //
- $result =~ s/\/\//\//g;
-
- # Remove .
- $result =~ s/\/\.\//\//g;
-
- # Solve ..
- while ($result =~ s/\/[^\/]+\/\.\.\//\//)
- {
- }
-
- # Remove preceding ..
- $result =~ s/^\/\.\.\//\//g;
-
- return $result;
-}
-
-
-#
-# match_filename(gcov_filename, list)
-#
-# Return a list of those entries of LIST which match the relative filename
-# GCOV_FILENAME.
-#
-
-sub match_filename($@)
-{
- my ($filename, @list) = @_;
- my ($vol, $dir, $file) = splitpath($filename);
- my @comp = splitdir($dir);
- my $comps = scalar(@comp);
- my $entry;
- my @result;
-
-entry:
- foreach $entry (@list) {
- my ($evol, $edir, $efile) = splitpath($entry);
- my @ecomp;
- my $ecomps;
- my $i;
-
- # Filename component must match
- if ($efile ne $file) {
- next;
- }
- # Check directory components last to first for match
- @ecomp = splitdir($edir);
- $ecomps = scalar(@ecomp);
- if ($ecomps < $comps) {
- next;
- }
- for ($i = 0; $i < $comps; $i++) {
- if ($comp[$comps - $i - 1] ne
- $ecomp[$ecomps - $i - 1]) {
- next entry;
- }
- }
- push(@result, $entry),
- }
-
- return @result;
-}
-
-#
-# solve_ambiguous_match(rel_filename, matches_ref, gcov_content_ref)
-#
-# Try to solve ambiguous matches of mapping (gcov file) -> (source code) file
-# by comparing source code provided in the GCOV file with that of the files
-# in MATCHES. REL_FILENAME identifies the relative filename of the gcov
-# file.
-#
-# Return the one real match or die if there is none.
-#
-
-sub solve_ambiguous_match($$$)
-{
- my $rel_name = $_[0];
- my $matches = $_[1];
- my $content = $_[2];
- my $filename;
- my $index;
- my $no_match;
- local *SOURCE;
-
- # Check the list of matches
- foreach $filename (@$matches)
- {
-
- # Compare file contents
- open(SOURCE, $filename)
- or die("ERROR: cannot read $filename!\n");
-
- $no_match = 0;
- for ($index = 2; <SOURCE>; $index += 3)
- {
- chomp;
-
- # Also remove CR from line-end
- s/\015$//;
-
- if ($_ ne @$content[$index])
- {
- $no_match = 1;
- last;
- }
- }
-
- close(SOURCE);
-
- if (!$no_match)
- {
- info("Solved source file ambiguity for $rel_name\n");
- return $filename;
- }
- }
-
- die("ERROR: could not match gcov data for $rel_name!\n");
-}
-
-
-#
-# split_filename(filename)
-#
-# Return (path, filename, extension) for a given FILENAME.
-#
-
-sub split_filename($)
-{
- my @path_components = split('/', $_[0]);
- my @file_components = split('\.', pop(@path_components));
- my $extension = pop(@file_components);
-
- return (join("/",@path_components), join(".",@file_components),
- $extension);
-}
-
-
-#
-# read_gcov_header(gcov_filename)
-#
-# Parse file GCOV_FILENAME and return a list containing the following
-# information:
-#
-# (source, object)
-#
-# where:
-#
-# source: complete relative path of the source code file (gcc >= 3.3 only)
-# object: name of associated graph file
-#
-# Die on error.
-#
-
-sub read_gcov_header($)
-{
- my $source;
- my $object;
- local *INPUT;
-
- if (!open(INPUT, $_[0]))
- {
- if ($ignore_errors[$ERROR_GCOV])
- {
- warn("WARNING: cannot read $_[0]!\n");
- return (undef,undef);
- }
- die("ERROR: cannot read $_[0]!\n");
- }
-
- while (<INPUT>)
- {
- chomp($_);
-
- # Also remove CR from line-end
- s/\015$//;
-
- if (/^\s+-:\s+0:Source:(.*)$/)
- {
- # Source: header entry
- $source = $1;
- }
- elsif (/^\s+-:\s+0:Object:(.*)$/)
- {
- # Object: header entry
- $object = $1;
- }
- else
- {
- last;
- }
- }
-
- close(INPUT);
-
- return ($source, $object);
-}
-
-
-#
-# br_gvec_len(vector)
-#
-# Return the number of entries in the branch coverage vector.
-#
-
-sub br_gvec_len($)
-{
- my ($vec) = @_;
-
- return 0 if (!defined($vec));
- return (length($vec) * 8 / $BR_VEC_WIDTH) / $BR_VEC_ENTRIES;
-}
-
-
-#
-# br_gvec_get(vector, number)
-#
-# Return an entry from the branch coverage vector.
-#
-
-sub br_gvec_get($$)
-{
- my ($vec, $num) = @_;
- my $line;
- my $block;
- my $branch;
- my $taken;
- my $offset = $num * $BR_VEC_ENTRIES;
-
- # Retrieve data from vector
- $line = vec($vec, $offset + $BR_LINE, $BR_VEC_WIDTH);
- $block = vec($vec, $offset + $BR_BLOCK, $BR_VEC_WIDTH);
- $branch = vec($vec, $offset + $BR_BRANCH, $BR_VEC_WIDTH);
- $taken = vec($vec, $offset + $BR_TAKEN, $BR_VEC_WIDTH);
-
- # Decode taken value from an integer
- if ($taken == 0) {
- $taken = "-";
- } else {
- $taken--;
- }
-
- return ($line, $block, $branch, $taken);
-}
-
-
-#
-# br_gvec_push(vector, line, block, branch, taken)
-#
-# Add an entry to the branch coverage vector.
-#
-
-sub br_gvec_push($$$$$)
-{
- my ($vec, $line, $block, $branch, $taken) = @_;
- my $offset;
-
- $vec = "" if (!defined($vec));
- $offset = br_gvec_len($vec) * $BR_VEC_ENTRIES;
-
- # Encode taken value into an integer
- if ($taken eq "-") {
- $taken = 0;
- } else {
- $taken++;
- }
-
- # Add to vector
- vec($vec, $offset + $BR_LINE, $BR_VEC_WIDTH) = $line;
- vec($vec, $offset + $BR_BLOCK, $BR_VEC_WIDTH) = $block;
- vec($vec, $offset + $BR_BRANCH, $BR_VEC_WIDTH) = $branch;
- vec($vec, $offset + $BR_TAKEN, $BR_VEC_WIDTH) = $taken;
-
- return $vec;
-}
-
-
-#
-# read_gcov_file(gcov_filename)
-#
-# Parse file GCOV_FILENAME (.gcov file format) and return the list:
-# (reference to gcov_content, reference to gcov_branch, reference to gcov_func)
-#
-# gcov_content is a list of 3 elements
-# (flag, count, source) for each source code line:
-#
-# $result[($line_number-1)*3+0] = instrumentation flag for line $line_number
-# $result[($line_number-1)*3+1] = execution count for line $line_number
-# $result[($line_number-1)*3+2] = source code text for line $line_number
-#
-# gcov_branch is a vector of 4 4-byte long elements for each branch:
-# line number, block number, branch number, count + 1 or 0
-#
-# gcov_func is a list of 2 elements
-# (number of calls, function name) for each function
-#
-# Die on error.
-#
-
-sub read_gcov_file($)
-{
- my $filename = $_[0];
- my @result = ();
- my $branches = "";
- my @functions = ();
- my $number;
- my $exclude_flag = 0;
- my $exclude_line = 0;
- my $last_block = $UNNAMED_BLOCK;
- my $last_line = 0;
- local *INPUT;
-
- if (!open(INPUT, $filename)) {
- if ($ignore_errors[$ERROR_GCOV])
- {
- warn("WARNING: cannot read $filename!\n");
- return (undef, undef, undef);
- }
- die("ERROR: cannot read $filename!\n");
- }
-
- if ($gcov_version < $GCOV_VERSION_3_3_0)
- {
- # Expect gcov format as used in gcc < 3.3
- while (<INPUT>)
- {
- chomp($_);
-
- # Also remove CR from line-end
- s/\015$//;
-
- if (/^branch\s+(\d+)\s+taken\s+=\s+(\d+)/) {
- next if ($exclude_line);
- $branches = br_gvec_push($branches, $last_line,
- $last_block, $1, $2);
- } elsif (/^branch\s+(\d+)\s+never\s+executed/) {
- next if ($exclude_line);
- $branches = br_gvec_push($branches, $last_line,
- $last_block, $1, '-');
- }
- elsif (/^call/ || /^function/)
- {
- # Function call return data
- }
- else
- {
- $last_line++;
- # Check for exclusion markers
- if (!$no_markers) {