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
- GCC -fprofile-arcs-ftest-coverage -o test test.c
- ./test
- Gcov test.c
Gcov use: http://blog.csdn.net/lishenglong666/article/details/8056777
(2) code static test
- sudo apt-get install splint
- Splint test.c
Learning and use of splint: http://www.cnblogs.com/bangerlee/archive/2011/09/07/2166593.html
(3) memory leak test
- sudo apt-get install Valgrind
- ./test
- Valgrind--tool=memcheck--leak-check=yes./test
(4) Performance test
- GCC Test.c-pg-o Test
- ./test
- Gprof Test Gmon.out-p
(5) unit test cunit-2-0-1
- Aclocal
- Autoconf
- Autoheader
- chmod u+x Configure
- Libtoolize
- Automake--add-missing
- ./configure
- 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