ページ更新: 2000-01-01 (土) (7776日前)
(作成中) gcc のカバレッジ測定機能と、それをレポートにするツールについて。 目次 [編集]情報源 #[編集]gcc #[編集]ツール #[編集]gcov #[編集]gcovr #
試しに Windows に pip で入れてみた: C:> pip install gcovr Downloading/unpacking gcovr Downloading gcovr-2.4.tar.gz Running setup.py egg_info for package gcovr Installing collected packages: gcovr Running setup.py install for gcovr Successfully installed gcovr Cleaning up... C:> python -c "import gcovr; help(gcovr)" Help on package gcovr: NAME gcovr FILE c:\python27\lib\site-packages\gcovr\__init__.py DESCRIPTION # _________________________________________________________________________ # # FAST: Python tools for software testing. # Copyright (c) 2008 Sandia Corporation. # This software is distributed under the BSD License. # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, # the U.S. Government retains certain rights in this software. # For more information, see the FAST README.txt file. # _________________________________________________________________________ PACKAGE CONTENTS C:> which gcovr C:\Python27\Scripts\gcovr C:> python C:\Python27\Scripts\gcovr --help Usage: gcovr [options] A utility to run gcov and generate a simple report that summarizes the coverage Options: -h, --help show this help message and exit --version Print the version number, then exit -v, --verbose Print progress messages --object-directory=OBJDIR Specify the directory that contains the gcov data files. gcovr must be able to identify the path between the *.gcda files and the directory where gcc was originally run. Normally, gcovr can guess correctly. This option overrides gcovr's normal path detection and can specify either the path from gcc to the gcda file (i.e. what was passed to gcc's '-o' option), or the path from the gcda file to gcc's original working directory. -o OUTPUT, --output=OUTPUT Print output to this filename -k, --keep Keep temporary gcov files -d, --delete Delete the coverage files after they are processed -f FILTER, --filter=FILTER Keep only the data files that match this regular expression -e EXCLUDE, --exclude=EXCLUDE Exclude data files that match this regular expression --gcov-filter=GCOV_FILTER Keep only gcov data files that match this regular expression --gcov-exclude=GCOV_EXCLUDE Exclude gcov data files that match this regular expression -r ROOT, --root=ROOT Defines the root directory. This is used to filter the files, and to standardize the output. -x, --xml Generate XML instead of the normal tabular output. -b, --branches Tabulate the branch coverage instead of the line coverage. -u, --sort-uncovered Sort entries by increasing number of uncovered lines. -p, --sort-percentage Sort entries by decreasing percentage of covered lines. Ubuntu 11.10: # apt-get install python-setuptools # easy_install pip # pip install gcovr Downloading/unpacking gcovr Downloading gcovr-2.4.tar.gz Running setup.py egg_info for package gcovr Installing collected packages: gcovr Running setup.py install for gcovr changing mode of build/scripts-2.7/gcovr from 644 to 755 changing mode of /usr/local/bin/gcovr to 755 Successfully installed gcovr Cleaning up... 2012-12-03
lcov #Perl で書かれている。 ちょっと見た限りでは pwd, uname, find, gzip, c++filt を呼び出しているので、これらのツールが別途必要になる。 Linux や NetBSD, FreeBSD, Cygwin で動かせたと思う。 [編集]ggcov #Ubuntu 10.04.4 LTS $ apt-cache search gcov lcov - Summarise Code coverage information from GCOV libdevel-cover-perl - Perl tool for determining code coverage metrics ggcov - gcov テストカバレッジデータを表示するためのグラフィカルなツール |