Linux tools for improving code quality

Source: Internet
Author: User
Tags gcov valgrind

Many IT companies have a rigorous division of software development, including design, testing, service support, and so on. But I've always thought that only developers are the ones who are really responsible for software quality. Without good software design, software quality is basically impossible to talk about. Of course, to do this requires additional tools to make sure. Because this period of time is developed on Linux, so the following tools are basically based on the Linux platform. Suppose the file name of the test is test.c.

(1) test code Coverage

    1. GCC -fprofile-arcs-ftest-coverage -o test test.c
    2. ./test
    3. Gcov test.c

Gcov use: http://blog.csdn.net/lishenglong666/article/details/8056777

(2) code static test

    1. sudo apt-get install splint
    2. Splint test.c
Learning and use of splint: http://www.cnblogs.com/bangerlee/archive/2011/09/07/2166593.html

(3) memory leak test

    1. sudo apt-get install Valgrind
    2. ./test
    3. Valgrind--tool=memcheck--leak-check=yes./test

(4) Performance test

    1. GCC Test.c-pg-o Test
    2. ./test
    3. Gprof Test Gmon.out-p

(5) unit test cunit-2-0-1

    1. Aclocal
    2. Autoconf
    3. Autoheader
    4. chmod u+x Configure
    5. Libtoolize
    6. Automake--add-missing
    7. ./configure
    8. Make

Because there is a test_cunit code in Cunit-2-0-1, you can look directly at how the unit tests are run and tested.

The above tools are a few tools under Linux testing, you can choose according to their own needs flexible. Of course, in the actual development, we need to integrate these tools into the makefile, so as to achieve the best test results.

Reference Link: http://blog.csdn.net/feixiaoxing/article/details/39716601

Linux tools for improving code quality

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.