Coverity的安装使用及常见错误

Coverity 5.5开始就需要安装两套工具

Coverity® 5.5.3 Integrity Manager  --- GUI

Coverity® 5.5.3 Static Analysis   ---  CLI 

 

Coverity® 5.5.3 Integrity Manager的安装

点击安装文件后,即可。 注意以下标红位置。

Where should Coverity Integrity Manager be installed?

[/home/fesu/coverity-integrity-manager] 这里可以修改cim安装路径

The directory:

/home/fesu/coverity-integrity-manager

already exists. Would you like to install to that directory anyway?

Yes [1], No [2]

1

How should Coverity Integrity Manager store information?

Coverity Integrity Manager requires a database to store information in. This

installer includes the PostgreSQL database software, which it can set up and

manage automatically. This is recommended for most cases. Alternatively,

organizations with existing database infrastructure and adminstrative

expertise can configure Integrity Manager to connect to an external

PostgreSQL (8.1 or higher) server.

Select one:

Use included PostgreSQL database (Recommended) [1, Enter], Connect to external PostgreSQL server [2]

Where should the database reside?

Specify a location for the database files, and an internal network port for

the database. The location should be on a local volume that has at least 2GB

of free space.

Location of database files:

[/home/fesu/coverity-integrity-manager/database]

Database port:

[5432]

Choose a level of database performance.

The default PostgreSQL configuration settings are designed to ensure that

the database will work on almost any computer. Although the database will

successfully start with default settings, it will not perform well. If

performance is important to you, you might choose the production database

configuration. However, if your system lacks sufficient resources, the

database will fail to start.

Tip: If you are not sure what setting to use, choose Small computer. After

the installation completes, see the System Administration Guide section

about tuning the PostgreSQL database.

Configure the database for a:

Small computer (not optimal performance) [1, Enter], Production system (might not start on a small computer) [2]

Server configuration

The installer creates an administrative account for Coverity Integrity

Manager. Administrators can use this account to log in with a web browser

and configure users, create projects, and manage other administrative

settings.

Please choose an administrator password.

Account name: admin 这里设置GUI admin的密码。

Password:

Confirm password:

Choose port numbers.

Users connect to the HTTP port to access the Integrity Manager via web

browsers and Web Services clients.

HTTP port number: 这里是访问GUI界面的端口

[8080]

9601

If you choose to provide HTTPS (Secure HTTP) service, HTTP requests are

rejected.

With HTTPS service, you will need to get a server certificate from a

certificate authority and install it. Please see the Administration and

Configuration Guide for more detailed instructions.

Provide HTTPS service?

Yes [y], No [n, Enter]

What ports should Integrity Manager use?

Build and analysis machines use the commit port to publish analysis results

to Integrity Manager.

Commit port: ß这里是cov-commit-defects执行是指定的commit端口

[9090]

9611

The control port is used for internal server communication. Use the default

value unless that port is unavailable.

Control port:

[8005]

Extracting files...

Downloading ...

Extracting files...

Configuring database

Creating database cluster

Adjusting file permissions

Starting database

Creating database schema

Stopping database

Database configured.

Starting Coverity Integrity Manager

Loading configuration

Starting controller

Starting database

Starting application

Done

Coverity Integrity Manager is installed and running at

http://xxxx.cn.alcatel-lucent.com:9601/这个是GUI的访问地址

Log in as "admin".

Finishing installation...

 

Coverity® 5.5.3 Static Analysi

这套工具公司是安装好的,我们需要了解它的常用命令及其工作方式:

 

 

常见问题:

cov-analyze报错:Looking for translation units Error: no matching translation units.**

或者cov-analyze的结果是0。

Analysis summary report:
------------------------
Files analyzed                 : 0
New defects found              : 0


解决方法:
1.检查一下cov-configure的选项

  cov-configure --config $CONFIG_FILE --compiler gcc --comptype gcc

   注意:在写--compiler的参数时,如果带/usr/bin/gcc,最后会解析不出结果,所以不要用绝对路径。

   有时候项目中会用到交叉编译的xxx-linux-gnu-gcc,它的路径是定义在makefile中,导致在命令行中运行coverity时候,环境变量中找不到xxx-linux-gnu-gcc。

   我通常是写一个shell脚本

  export PATH=/xxx-linux-gnu-gcc-path/:$PATH
  $COV_BIN/cov-configure --config $CONFIG_FILE --compiler xxx-linux-gnu-gcc --comptype gcc

2. 检查cov-analyze的选项

   cov-analyze的选项,发现要带上--all 才会有结果,如果再把--aggressiveness-level 调到high,这样检查的结果更多
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 15
    评论
### 回答1: Coverity是一个静态代码分析工具,可以帮助开发人员发现和修复软件代码中的缺陷和漏洞。以下是Coverity使用教程: 1. 安装Coverity:首先,需要从Coverity官方网站下载并安装Coverity软件。根据操作系统的要求,选择正确的版本进行安装。 2. 创建项目:安装完成后,打开Coverity软件并创建一个新项目。可以选择要分析的代码库路径,并为项目命名。 3. 配置项目:在创建项目后,需要配置一些项目属性。例如,可以选择要分析的语言(如C、C++、Java等),以及要检测的缺陷类型和规则。 4. 执行分析:配置完成后,可以通过点击“开始分析”按钮来启动分析过程。Coverity将会扫描代码库并检查其中的缺陷和漏洞。 5. 查看分析报告:分析完成后,Coverity将生成一个详细的分析报告,其中列出了代码中的所有问题,以及建议的修复措施。开发人员可以使用此报告来了解代码中存在的问题,并逐一进行修复。 6. 进行修复:根据分析报告,开发人员可以逐个修复代码中的问题。修复方法可能包括更改代码逻辑、添加缺失的代码或修复错误的语法。 7. 重新分析:修复完成后,可以重新运行Coverity的分析过程,以确保所有问题都已解决。重复执行分析和修复的步骤,直到代码中不存在更多的缺陷和漏洞为止。 8. 集成到开发流程:一旦代码中没有发现更多的问题,可以将Coverity集成到开发流程中。例如,可以将Coverity作为代码审查的一部分,确保新代码的质量和稳定性。 总而言之,Coverity是一个功能强大的静态代码分析工具,可以帮助开发人员提高代码的质量和可靠性。使用Coverity的教程包括安装软件、创建项目、配置属性、执行分析、修复问题和集成到开发流程等步骤。 ### 回答2: Coverity是一种用于静态代码分析的软件测试工具,它可以帮助开发人员及时发现和修复代码中的缺陷和安全漏洞。下面是一个简单的Coverity使用教程: 1. 配置Coverity:首先,需要在系统中安装Coverity软件,并进行基本的配置。配置信息包括源代码路径、编译器选项和构建脚本等。 2. 创建项目:在Coverity中创建一个新的项目,该项目可以是单个代码库,也可以是多个代码库的组合。项目创建后,需要指定要进行静态代码分析的特定代码部分。 3. 进行静态分析:在项目创建完毕后,可以开始进行静态代码分析。Coverity会扫描源代码,并检测其中的缺陷和潜在的安全漏洞。分析过程可能需要一些时间,具体时间取决于代码库的大小和复杂度。 4. 分析结果查看:分析完成后,Coverity会生成一个报告,其中包含了所有检测到的缺陷和漏洞。可以对报告进行过滤和排序,以便更好地查看和理解问题。 5. 问题修复:根据报告中的问题,开发人员可以逐个修复代码中的缺陷和漏洞。修复过程可能需要对代码进行重构或添加新的代码。 6. 再次分析:在代码修复后,可以再次运行Coverity进行静态代码分析。这样可以确保问题已经正确修复,没有引入新的缺陷。 7. 定期分析:为了保持代码的质量,建议定期运行Coverity进行静态代码分析。这样可以及时发现和修复新的缺陷和漏洞,保证代码的稳定性和安全性。 总之,Coverity使用教程主要包括配置Coverity、创建项目、进行静态分析、查看分析结果、修复问题、再次分析和定期分析等步骤。通过正确使用Coverity,开发人员可以提高代码质量,减少缺陷和漏洞的数量,从而提高软件的稳定性和安全性。 ### 回答3: Coverity是一种静态代码分析工具,用于检测源代码中的潜在缺陷和安全漏洞。下面是Coverity使用教程: 1. 安装Coverity:首先,需要从Coverity官方网站上下载并安装Coverity静态分析工具。安装过程可能需要一些配置,并且可能需要在系统环境变量中添加相关路径。 2. 创建项目:在使用Coverity之前,需要创建一个Coverity项目。进入Coverity工具,选择“创建项目”,然后提供项目名称和相关信息。 3. 导入源代码:在项目创建后,需要将源代码导入Coverity。选择“导入源代码”,然后选择源代码存储位置和相应的项目。 4. 构建项目:在成功导入源代码之后,需要进行项目构建。选择“构建项目”,然后选择相应的构建配置和各种编译选项。Coverity使用这些配置信息构建代码数据库。 5. 运行代码分析:在成功构建项目之后,可以选择“运行分析”来执行Coverity的静态代码分析。Coverity将在代码中查找潜在的缺陷和安全漏洞,并生成相应的报告。 6. 查看分析结果:Coverity将生成一个详细的报告,其中包含潜在缺陷和安全漏洞的列表。可以通过点击每个问题,查看更多详细信息,如问题的类型、位置和可能的修复方法。 7. 解决问题:对于每个问题,可以根据报告中提供的建议进行修复。修复完毕后,需要重新构建项目并重新运行分析,以验证问题是否已解决。 8. 导出报告:如果需要,可以将报告导出为不同的格式,例如HTML、PDF或CSV。这样可以方便地与团队或其他利益相关者共享分析结果。 总的来说,Coverity使用教程包括安装工具、创建项目、导入源代码、构建项目、运行代码分析、查看分析结果、解决问题和导出报告等步骤。通过按照这些步骤进行操作,可以有效地使用Coverity来检测代码中的潜在问题和漏洞,以提高代码质量和安全性。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 15
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值