博客首页 注册 建议与交流 排行榜 加入友情链接
推荐 投诉 搜索: 帮助

黄富强

研究开源技术,推广开源技术,实施开源技术.
  fuqiang.cublog.cn

关于作者


|| << >> ||
我的分类


gcov—a Test Coverage Program
gcov is a tool you can use in conjunction with GCC to test code coverage in your programs.
http://gcc.gnu.org/onlinedocs/gcc/Gcov.html
覆盖率(白盒测试)
一、安装工作:
  ubuntu7.10源中有,但还要装libbfd-2.17.50.20070426.so,把它放到/usr/lib下。
二、功能应用:
  [gcov命令行式的,ggcov(GTK图形式的)]
fuqiang@fuqiang-laptop:~/linuxcexample/time/gcovex$ gcov
用法:gconv [选项]... 源文件

显示代码覆盖信息。

-h, --help               打印此帮助并退出
-v, --version             打印版本号并退出
-a, --all-blocks           显示每个基本块的信息
-b, --branch-probabilities     输出包含分支概率
-c, --branch-counts         给出跳转的分支数,而不是百分比
-n, --no-output           不创建输出文件
-l, --long-file-names       为包含进来的源文件使用长输出文件名
-f, --function-summaries     输出每个函数的小结信息
-o, --object-directory DIR|FILE 在 DIR 中搜索目标文件,或搜索名为 FILE 的目标文件
-p, --preserve-paths         保留所有路径名
-u, --unconditional-branches   同时显示无条件跳转数

提交错误报告的具体步骤请参见:
<URL:http://gcc.gnu.org/bugs.html>。

For Debian GNU/Linux specific bug reporting instructions, please see:
<URL:file:///usr/share/doc/gcc-4.1/README.Bugs>.
fuqiang@fuqiang-laptop:~/linuxcexample/time/gcovex$ ls
timeex.c
fuqiang@fuqiang-laptop:~/linuxcexample/time/gcovex$ gcc -fprofile-arcs -ftest-coverage timeex.c
fuqiang@fuqiang-laptop:~/linuxcexample/time/gcovex$ ls
a.out timeex.c timeex.gcno
fuqiang@fuqiang-laptop:~/linuxcexample/time/gcovex$ ./a.out
biggest = Tue Jan 19 03:14:07 2038
fuqiang@fuqiang-laptop:~/linuxcexample/time/gcovex$ ls
a.out timeex.c timeex.gcda timeex.gcno
fuqiang@fuqiang-laptop:~/linuxcexample/time/gcovex$ ggcov timeex.c
相关图在:http://www.infocptech.cn/htm_data/11/0804/360.html

发表于: 2008-04-21,修改于: 2008-04-21 13:10,已浏览134次,有评论0条 推荐 投诉


网友评论
 发表评论