9 Foods That Can Affect Your Stomach

It is critical to see what food varieties are doing you great and which are the ones you ought to stay away from. As a rule, arrangements that contain fat, seared ones or that have a lot of sugar…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Static Analysis using Jenkins job

Being involved in software engineering domain, I came to know the significance of software testing, thanks to my mentor and this is how static analysis popped up in my mind.

The implementation of static analysis job within Jenkins, the most popular open source tool for Continuous Integration and Continuous Deployment made it more interesting.

Why static analysis? Sometimes there may be a situation when compiler often fail to reveal all the bugs.Static code analysis helps in improving the situation a little.In this post we will take a look at clang job for analysis of Gluster on the CI system.

Clang is a free open-source cross-platform static analyzer, which comes as a part of so called “LLVM-stack”. Unlike Cppcheck, Clang Static Analyzer is much slower, but it can catch much more critical bugs.

Steps to build a clang-scan job:

NOTE: JJB should be setup and properly configured on your machine.

To illustrate how to configure jenkins job for clang scan,here is a clang.yml file as an example:

This job runs nightly so as to discover the bug reports on daily basis. In this YAML file I have added the post build actions to publish the scan-build results(see publishers list above).

To invoke scan-build from the command-line using make,you need to create a job with Build Step -execute shell script that takes care of generating clang reports (eg. clang.sh) such as:

CC is C compiler command.‘-o’ option is used to specify the directory (${WORKSPACE}/clangScanBuildReports) for reports.There are dozens of other options you can use to customize scan-build.There will be a lot of HTML reports generated in this directory for the publisher to find it.

Open it in a browser, the HTML report will define each bug of the code in more detail-

Following command is used to test out build of the JJb-

Now to update the jenkins server-

Once you are done with updating, you need to do a test build of the project.And once the project has been successfully built you will be able to access the scan-build reports of the project as shown in the screenshot below-

The graph here shows the clang scan-build trend and ultimately leading us to the status of improvement in the number of bugs.

All in all, clang static analyzer is a great tool to have at your disposal, especially if you are working on CI tasks.

Add a comment

Related posts:

The Way I Loved You.

Sudah 30 menit lamanya Chandra berdiri di aspal yang basah bekas rintikan hujan yang jatuh beriringan deras beberapa jam lalu. Dirinya sedari tadi hanya mondar-mandir menunggu seorang manusia bumi…

Her Soul

Nights awake he wondered Why something feels undone? He remembers when they were clustered, Her soul was only he couldn’t discover. Just for one glimpse of her He spent his age yearned; And…