CUnit和lcov安装和使用

CUnit

系统ubuntu 18.04 版本CUnit-2.1-3
1.在网址https://sourceforge.net/projects/cunit/ ,下载CUnit压缩包

  1. 解压缩
tar jxvf CUnit-2.1-3.tar.bz2
cd CUnit-2.1-3
  1. 安装相关工具
sudo apt install libtool
root# aclocal

warning : aclocal: warning: autoconf input should be named 'configure.ac', not 'configure.in'。

解决办法:
可以不用理会,或者将configure.in改名为configure.ac

autoconf    ( 注:autoconf 是用来生成自动配置软件源代码脚本(configure)的 工具)
root# automake

error:
required file 'config.h.in' not found 

解决办法:

root# autoheader

error:
 required file './compile' not found

参考:https://lists.gnu.org/archive/html/bug-gnulib/2012-11/msg00097.html

解决办法:

root# automake --add-missing
root# ./configure

error:
sed: can't read ./ltmain.sh: No such file or directory
mv: cannot stat 'libtoolT': No such file or directory
cp: cannot stat 'libtoolT': No such file or directory
chmod: cannot access 'libtool': No such file or directory

解决办法

root# libtoolize --automake --copy --debug --force
root# ./configure
root# make

error:
configure.in:158: error: required file './compile' not found
configure.in:158:   'automake --add-missing' can install 'compile'
configure.in:4: error: required file './missing' not found
configure.in:4:   'automake --add-missing' can install 'missing'
automake-1.15: warning: autoconf input should be named 'configure.ac', not 'configure.in'
CUnit/Sources/Automated/Makefile.am: error: required file './depcomp' not found
CUnit/Sources/Automated/Makefile.am:   'automake --add-missing' can install 'depcomp'
CUnit/Sources/Framework/Makefile.am:20: warning: '%'-style pattern rules are a GNU make extension
CUnit/Sources/Test/Makefile.am:12: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
Examples/AutomatedTest/Makefile.am:13: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
Examples/BasicTest/Makefile.am:13: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
Examples/ConsoleTest/Makefile.am:13: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
Examples/CursesTest/Makefile.am:13: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
Makefile:404: recipe for target 'Makefile.in' failed
make: *** [Makefile.in] Error 1

解决办法:

root# automake --add-missing
root# make
root# make install

需要超级用户权限

  1. 检测安装完成
root# ls /usr/local/lib/libcunit.so
  1. 将/usr/local/lib加入动态库路径,确保程序执行时,能够链接

lcov 安装

centos 7
1. 安装命令
sudo yum install lcov
2. BUG
  1. 缺少perl
root# lcov --rc lcov_branch_coverage=1 -c -d $(DIR_SRC) -o $(COVERAGE_FILE)

Can't locate IO/Uncompress/Gunzip.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/bin/geninfo line 62.
BEGIN failed--compilation aborted at /usr/local/bin/geninfo line 62.
  1. 解决方案
    根据IO/Uncompress/Gunzip.pm可以知道缺少perl包,通过命令安装对应包即可。
    a. 搜索对应信息,发现在该网页中有对应资源。https://metacpan.org/pod/IO::Uncompress::Unzip
    b. 推测是缺少perl包,根据路径,通过yum install perl-进行联想,得到对应的包
sudo yum install perl-IO-Compress.noarch
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值