CN107729239A - A kind of code coverage statistical method, system, device and computer-readable storage medium - Google Patents
A kind of code coverage statistical method, system, device and computer-readable storage medium Download PDFInfo
- Publication number
- CN107729239A CN107729239A CN201710936141.8A CN201710936141A CN107729239A CN 107729239 A CN107729239 A CN 107729239A CN 201710936141 A CN201710936141 A CN 201710936141A CN 107729239 A CN107729239 A CN 107729239A
- Authority
- CN
- China
- Prior art keywords
- nfs
- ganesha
- source codes
- compiling
- files
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3676—Test management for coverage analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Stored Programmes (AREA)
Abstract
The invention discloses a kind of code coverage statistical method, system, device and computer-readable storage medium, applied to User space NFS NFS Ganesha, the correct NFS Ganesha source codes of compilation run are obtained, and gcov/lcov function libraries, genhtml function libraries and lib library files are added in NFS Ganesha source codes;Switch option and the compiling parameter set in advance of automatic loading function storehouse and lib library files during for indicating to compile are added in NFS Ganesha source codes;After switch option is open mode and compiling parameter addition, NFS Ganesha source codes generation .gcno files are compiled according to the compiler directive of user, and run the NFS Ganesha source codes generation .gcda files after compiling.Programming count code coverage while the application realizes compiling NFS Ganesha source codes.
Description
Technical field
The present invention relates to code quality testing field, more particularly to a kind of code coverage statistical method, system, device
And computer-readable storage medium.
Background technology
NFS-Ganesha (Network File System user-space, User space NFS) refers to only
The access internal memory that can be limited, it is impossible to the ancillary equipment such as access hard disk, network interface card, occupancy CPU (Central Processing Unit,
Central processing unit) ability be deprived of, the NFS that cpu resource can be obtained by other programs.Go out in system service
Under the scene of existing failure, compared to NFS (Network File System, kernel state NFS), NFS-Ganesha
With preferably it is managerial and maintainable, so as to big data magnanimity distributed objects storage scene in have a wide range of applications
Prospect.
Specifically, NFS-Ganesha belongs to open source projects, and its code belongs to Open Source Code, and the quality of Open Source Code needs
Carry out constantly perfect.Generally retouched in the prior art using code coverage as the criterion for weighing code quality, code coverage
The ratio and degree that code is tested in system are stated, the quality of the higher code of code coverage is higher.But in the prior art, do not have
There is the code coverage statistical method for NFS-Ganesha, so that can not be according to code coverage statistical result come perfect
NFS-Ganesha code quality so that NFS-Ganesha ease for maintenance and Easy Test are poor, add code maintenance
Cost.
Therefore, how to provide a kind of scheme for solving above-mentioned technical problem is that those skilled in the art needs to solve at present
The problem of.
The content of the invention
It is real it is an object of the invention to provide a kind of code coverage statistical method, system, device and computer-readable storage medium
Automation carries out code coverage statistics while having showed compiling NFS-Ganesha source codes, contributes to user according to obtained generation
Code coverage rate statistics improves NFS-Ganesha code quality, improves NFS-Ganesha ease for maintenance and easily surveys
Examination property, reduces code maintenance cost.
In order to solve the above technical problems, the invention provides a kind of code coverage statistical method, applied to User space net
Network file system NFS-Ganesha, including:
The correct NFS-Ganesha source codes of compilation run are obtained, and gcov/ is added in the NFS-Ganesha source codes
Lcov function libraries, genhtml function libraries and lib library files;
The function library and the lib are loaded automatically when being added in the NFS-Ganesha source codes for indicating compiling
The switch option of library file and compiling parameter set in advance;
After the switch option is open mode and the compiling parameter addition, compiled according to the compiler directive of user
The NFS-Ganesha source codes generate .gcno files, and run the NFS-Ganesha source codes generation .gcda texts after compiling
Part.
Preferably, the process of the acquisition correct NFS-Ganesha source codes of compilation run is specially:
The selection instruction of user is received, and NFS-Ganesha source codes environment, compilation tool are determined according to the selection instruction
With NFS-Ganesha source codes;
The NFS-Ganesha source codes are compiled in outside compiling catalogue by the compilation tool, obtained according to compiling result
Take the correct NFS-Ganesha source codes of compilation run.
Preferably, the compilation tool is cmake;
It is then described that gcov/lcov function libraries, genhtml function libraries and lib storehouses are added in the NFS-Ganesha source codes
The process of file is specially:
Added in the modules in cmake subdirectories in the NFS-Ganesha source codes gcov/lcov function libraries,
Genhtml function libraries and lib library files;
It is then described to be added in the NFS-Ganesha source codes for loading the function library and institute automatically during instruction compiling
State lib library files switch option and it is set in advance compiling parameter process be specially:
Add automatically when being added in the CMakeLists.txt files in the NFS-Ganesha source codes for indicating compiling
Carry the switch option of the function library and the lib library files and compiling parameter set in advance.
Preferably, the compiling parameter set in advance includes compiling option and the link option.
Preferably, the process of the addition compiling option is specially:
When the CMakeLists.txt files are the CMakeLists.txt files write manually, according to adding for user
Instruction is added to add the compiling option;
When the CMakeLists.txt files are the CMakeLists.txt files automatically generated, operation/
Configure-h, pass through the addition compiling option that sets.
Preferably, this method also includes:
The lcov orders of user are received, and according to the institute of the lcov orders, the .gcno files of generation and generation
State the overall code coverage condition of NFS-Ganesha source codes described in .gcda file acquisitions.
Preferably, this method also includes:
The genhtml orders of user are received, and according to the genhtml orders, the .gcno files of generation and generation
The .gcda file acquisitions described in NFS-Ganesha source codes overall code coverage rate view and webpage view.
In order to solve the above technical problems, present invention also offers a kind of code coverage statistical system, applied to User space
NFS NFS-Ganesha, including:
Acquisition module, for obtaining the correct NFS-Ganesha source codes of compilation run, and in the NFS-Ganesha sources
Gcov/lcov function libraries, genhtml function libraries and lib library files are added in code;
Add module, the letter is loaded automatically when being used to indicate compiling for being added in the NFS-Ganesha source codes
Number storehouse and switch option and the compiling parameter set in advance of the lib library files;
Statistical module, after being open mode and the compiling parameter addition for the switch option, according to user
Compiler directive compile NFS-Ganesha source codes generation .gcno files, and run the NFS-Ganesha after compiling
Source code generates .gcda files.
In order to solve the above technical problems, present invention also offers a kind of code coverage statistic device, applied to User space
NFS NFS-Ganesha, including:
Memory, for storing computer program;
Processor, code coverage statistical method described in any of the above-described is realized during for performing the computer program
Step.
In order to solve the above technical problems, present invention also offers a kind of computer-readable recording medium, applied to User space
NFS NFS-Ganesha, computer program, the computer journey are stored with the computer-readable recording medium
The step of code coverage statistical method described in any of the above-described is realized when sequence is executed by processor.
The invention provides a kind of code coverage statistical method, applied to User space NFS NFS-
Ganesha, including:The correct NFS-Ganesha source codes of compilation run are obtained, and gcov/ is added in NFS-Ganesha source codes
Lcov function libraries, genhtml function libraries and lib library files;It is automatic when being added in NFS-Ganesha source codes for indicating compiling
The switch option and compiling parameter set in advance of loading function storehouse and lib library files;Switch option is open mode and compiling
After parameter is added, NFS-Ganesha source codes generation .gcno files are compiled according to the compiler directive of user, and run compiling
NFS-Ganesha source codes generation .gcda files afterwards.
It can be seen that the application is in NFS-Ganesha source codes due to the addition of switch option, when the switch option of addition to beat
, can automatic loading function storehouse and the generation of lib library files while being compiled to NFS-Ganesha source codes during open state
.gcno file, and generate .gcda files, namely NFS-Ganesha source codes in the NFS-Ganesha source codes after operation compiles
Code coverage statistics, realize compiling NFS-Ganesha source codes while automation carry out code coverage statistics.
The present invention contributes to user according to obtained code coverage statistics to improve NFS-Ganesha code quality, improves
NFS-Ganesha ease for maintenance and Easy Test, reduce code maintenance cost.
Present invention also offers a kind of code coverage statistical system, device and computer-readable storage medium, has as described above
Method identical beneficial effect.
Brief description of the drawings
Technical scheme in order to illustrate the embodiments of the present invention more clearly, below will be to institute in prior art and embodiment
The accompanying drawing needed to use is briefly described, it should be apparent that, drawings in the following description are only some implementations of the present invention
Example, for those of ordinary skill in the art, on the premise of not paying creative work, can also be obtained according to these accompanying drawings
Obtain other accompanying drawings.
Fig. 1 is a kind of process flow diagram flow chart of code coverage statistical method provided by the invention;
Fig. 2 is a kind of structural representation of code coverage statistical system provided by the invention.
Embodiment
The core of the present invention is to provide a kind of code coverage statistical method, system, device and computer-readable storage medium, real
Automation carries out code coverage statistics while having showed compiling NFS-Ganesha source codes, contributes to user according to obtained generation
Code coverage rate statistics improves NFS-Ganesha code quality, improves NFS-Ganesha ease for maintenance and easily surveys
Examination property, reduces code maintenance cost.
To make the purpose, technical scheme and advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention
In accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is
Part of the embodiment of the present invention, rather than whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art
The every other embodiment obtained under the premise of creative work is not made, belongs to the scope of protection of the invention.
It refer to Fig. 1, Fig. 1 is a kind of process flow diagram flow chart of code coverage statistical method provided by the invention, this method
Applied to User space NFS NFS-Ganesha, including:
Step S11:The correct NFS-Ganesha source codes of compilation run are obtained, and are added in NFS-Ganesha source codes
Gcov/lcov function libraries, genhtml function libraries and lib library files;
Specifically, it is contemplated that generally from GitHub open source community clone NFS-Ganesha source codes in practical application,
The quality of NFS-Ganesha source codes in GitHub open source communities is uneven, and the NFS-Ganesha source codes that clone is obtained can
Can be the source code for being capable of normal compilation operation, it is also possible to be unable to the source code of normal compilation operation.When desired to NFS-Ganesha
When source code carries out code coverage statistics, then the source code for being capable of normal compilation operation is needed to use, therefore, the application needs to obtain
The correct NFS-Ganesha source codes of compilation run, so as to ensure that being smoothed out for code coverage statistics.
It should be noted that the application is realized to NFS-Ganesha using gcov/lcov code coverages statistical tool
The test of source code.Gcov/lcov is a kind of Console program of command line mode, with GCC (GNU Compiler
Collection, GNU compiler external member) issue, coordinate GCC to realize jointly to the sentence coverage test of C/C++ files and branch
Coverage test.For Gcov as one of GNU/GCC work packages, application method is simple, and can solve existing shortage and be directed to
The problem of NFS-Ganesha code coverage statistical method.
Step S12:Automatic loading function storehouse and lib library texts during for indicating compiling are added in NFS-Ganesha source codes
The switch option of part and compiling parameter set in advance;
Specifically, in order to effectively improve code coverage statistical efficiency, the application with the addition of in NFS-Ganesha source codes
The switch option of automatic loading function storehouse and lib library files during for indicating to compile, when switch option is open mode, NFS-
Ganesha source codes when compiling can loading function storehouse and lib library files automatically, realize and compile NFS-Ganesha source codes
Automation carries out code coverage statistics.It can be seen that the application only needs progress source code compiling to obtain code coverage operation
As a result, so as to efficiently enter line code monitoring and solve the defects of NFS-Ganesha functional modules and failure, and then can be with
Provide the user stable and code easy to maintain and NFS service.
In addition, realize that the test to NFS-Ganesha source codes also needs using gcov/lcov code coverages statistical tool
Compiling parameter set in advance is added in NFS-Ganesha source codes, with the addition of and preset in NFS-Ganesha source codes
Compiling parameter after, compile source code when can just generate code coverage statistics.It can be seen that when NFS-Ganesha source codes
File it is more when, can just for certain in NFS-Ganesha source codes it is several individually files carry out code coverage statistics, tool
Body, compiling parameter set in advance is added in the file of pending code coverage statistics, other files do not add pre-
The compiling parameter first set, it can be directed to during compiling and with the addition of the file of compiling parameter set in advance and carry out code coverage system
Meter, so that code coverage statistics is targeted, improve statistical efficiency.
Step S13:After switch option is open mode and compiling parameter addition, compiled according to the compiler directive of user
NFS-Ganesha source codes generate .gcno files, and run the NFS-Ganesha source codes generation .gcda files after compiling.
Specifically, after switch option is open mode and compiling parameter addition, when receiving the compiling instruction of user,
The application can while according to the compiling compiling of instruction NFS-Ganesha source codes of reception automatic loading function storehouse and lib storehouses
File .gcno files are generated, and run the NFS-Ganesha source codes after compiling, pass through single test case or test case
Group, generate .gcda files.Wherein .gcno files refer to include rebuilding basic block chart and assign the message file of line number,
.gcda file refers to include the file of the frequency of operation per line code in code, namely the code of NFS-Ganesha source codes covers
Lid rate statistics.In addition, single test case refers to start NFS-Ganesha services, read, write and deletes etc. and grasp substantially
Make;Test case group refers to write a series of file system operations of shell script automated execution.It can be seen that the present invention passes through compiling
The mode of NFS-Ganesha source codes carries out code coverage statistics, has ease for operation, high efficiency and Integrated Trait, simultaneously
Maintenance is easily managed, contributes to developer's Optimized code quality.
The invention provides a kind of code coverage statistical method, applied to User space NFS NFS-
Ganesha, including:The correct NFS-Ganesha source codes of compilation run are obtained, and gcov/ is added in NFS-Ganesha source codes
Lcov function libraries, genhtml function libraries and lib library files;It is automatic when being added in NFS-Ganesha source codes for indicating compiling
The switch option and compiling parameter set in advance of loading function storehouse and lib library files;Switch option is open mode and compiling
After parameter is added, NFS-Ganesha source codes generation .gcno files are compiled according to the compiler directive of user, and run compiling
NFS-Ganesha source codes generation .gcda files afterwards.
It can be seen that the application is in NFS-Ganesha source codes due to the addition of switch option, when the switch option of addition to beat
, can automatic loading function storehouse and the generation of lib library files while being compiled to NFS-Ganesha source codes during open state
.gcno file, and generate .gcda files, namely NFS-Ganesha source codes in the NFS-Ganesha source codes after operation compiles
Code coverage statistics, realize compiling NFS-Ganesha source codes while automation carry out code coverage statistics.
The present invention contributes to user according to obtained code coverage statistics to improve NFS-Ganesha code quality, improves
NFS-Ganesha ease for maintenance and Easy Test, reduce code maintenance cost.
On the basis of above-described embodiment:
As a kind of preferred embodiment, the process for obtaining the correct NFS-Ganesha source codes of compilation run is specially:
Receive user selection instruction, and according to selection instruction determine NFS-Ganesha source codes environment, compilation tool and
NFS-Ganesha source codes;
NFS-Ganesha source codes are compiled in outside compiling catalogue by compilation tool, compiling fortune is obtained according to compiling result
The correct NFS-Ganesha source codes of row.
Specifically, compile before NFS-Ganesha source codes it needs to be determined that source code environment and compilation tool, the application according to
The selection instruction at family, corresponding with the selection instruction of user source code environment and compilation tool are selected, improves Consumer's Experience.Specifically
Ground, source code environment can be the version environment of CentOS 7.2, and certainly, source code environment here can also be other guide, this hair
It is bright not to be particularly limited herein.
In addition, it is contemplated that the NFS-Ganesha source codes that the application carries out code coverage statistics need to be normally to compile
The source code of operation is translated, therefore, it is necessary to be obtained to clone after the GitHub open source community clone NFS-Ganesha source codes
NFS-Ganesha source codes are compiled, and using be capable of the source code of normal compilation operation as it is of the invention can select be used for into
The NFS-Ganesha source codes of line code coverage rate statistics.Specifically, the application is in outside compiling catalogue compiling NFS-Ganesha
Source code, outside compiling catalogue refer to that source code can be not being changed with the newly-built build catalogues under src peers catalogues, outside compiling
In the case of structure, automation compiling NFS-Ganesha source codes are realized, improve code maintenance and compiling efficiency.
As a kind of preferred embodiment, compilation tool cmake;
The mistake of gcov/lcov function libraries, genhtml function libraries and lib library files is then added in NFS-Ganesha source codes
Journey is specially:
Added in the modules in cmake subdirectories in NFS-Ganesha source codes gcov/lcov function libraries,
Genhtml function libraries and lib library files;
Automatic loading function storehouse and lib library files are opened when then being added in NFS-Ganesha source codes for indicating to compile
Close option and it is set in advance compiling parameter process be specially:
Letter is loaded automatically when being added in the CMakeLists.txt files in NFS-Ganesha source codes for indicating compiling
Number storehouse and switch option and the compiling parameter set in advance of lib library files.
Specifically, the compilation tool of the application can be cmake-2.6.4, make-3.82, automake-1.13.4,
The versions of gcov/lcov 1.12.After switch option is open mode and compiling parameter addition, according to the compiler directive of user
Cmake can be performed successively in outside compiling catalogue, make, make install orders, be when compiling NFS-Ganesha source codes
System will be directed to each NFS-Ganesha sound code files generation .gcno suffix files.What above-mentioned compilation tool was write
The language of CMakeLists.txt files has stronger readability, it can be readily appreciated that reducing the workload of developer simultaneously.
When compilation tool is cmake, in the modules in cmake subdirectories of the application in NFS-Ganesha source codes
Gcov/lcov function libraries, genhtml function libraries and lib library files are added, catalogue is clear, reduces developer and writes code
Error rate.Code is specifically as follows:
When compilation tool is cmake, CMakeLists.txt text of the application under NFS-Ganesha source code src catalogues
The switch option of automatic loading function storehouse and lib library files during for indicating to compile is added in part, it is switch option to set ON
Open mode, when switch option is ON, it can be automated while compiling NFS-Ganesha source codes and carry out code coverage system
Meter, it is achieved thereby that automation compiling deployment code coverage external member.Code is specifically as follows:
option(COVERAGE“add flag to generate coverage data at runtime”ON)
As a kind of preferred embodiment, compiling parameter set in advance includes compiling option and the link option.
Specifically, gcov/lcov compiling option is-fprofile-arcs-ftest-coverage, NFS-Ganesha
It with the addition of compiling option in source code .gcno files can be generated during compiling, ensure that being smoothed out for code coverage statistics.
The link option is-lgcov or-coverage, with the addition of the link option in NFS-Ganesha source codes, can be automatic during compiling
Search and carry out the required compiling file of code coverage statistics, improve the efficiency of statistics codes coverage rate.
As a kind of preferred embodiment, the process of addition compiling option is specially:
When CMakeLists.txt files are the CMakeLists.txt files write manually, referred to according to the addition of user
Order addition compiling option;
When CMakeLists.txt files are the CMakeLists.txt files automatically generated, operation ./configure-
H, pass through the addition compiling option that sets.
Specifically, can basis when CMakeLists.txt files are the CMakeLists.txt files write manually
The addition instruction of user directly increase compiling option is-fprofile-arcs-ftest-coverage, the link option is-
Lgcov or-coverage, it is convenient, flexible.When CMakeLists.txt files be automatically generate CMakeLists.txt text
During part ./configure-h can be run and check increase CMakeLists.txt compiling link options.Specifically, the application is excellent
It is-fprofile-arcs-ftest-coverage first to set CMAKE_C_FLAGS environmental variances, you can increase compiling option
For-fprofile-arcs-ftest-coverage, the workload of developer is reduced.
The code of addition compiling parameter is specifically as follows in CMakeLists.txt files:
IF(COVERAGE)
set(CMAKE_C_FLAGS"${CMAKE_C_FLAGS}-fprofile-arcs-ftest-coverage")
ENDIF(COVERAGE)
As a kind of preferred embodiment, the lcov orders of user are received, and according to the .gcno texts of lcov orders, generation
The overall code coverage condition of part and the .gcda file acquisition NFS-Ganesha source codes of generation.
Specifically, it is contemplated that although .gcda files include the code coverage statistics of NFS-Ganesha source codes,
But the analysis to each source code is more scattered, it is not easy to arrange, and also statistics is not directly perceived, and legibility is poor.The application
Overall code coverage condition can be checked by lcov orders so that code coverage statistical result is more directly perceived.Lcov orders
It is specifically as follows:
lcov-directory.--capture--output-file NFS-Ganesha.info
As a kind of preferred embodiment, receive the genhtml orders of user, and according to genhtml orders, generation
.gcno the overall code coverage rate view and webpage view of file and the .gcda file acquisition NFS-Ganesha source codes of generation.
Specifically, the application can also check the overall code coverage rate of NFS-Ganesha source codes by genhtml orders
View and webpage view, and generate one based on Html (HyperText Markup Language, HyperText Markup Language)
Complete HTML trees, output general introduction, coverage rate percentage and chart, contribute to user's fast browsing coverage data.Meanwhile also
Catalog views, file view and source code view can be provided, the more formal code coverage statistical report of generation, improve use
Experience at family.Genhtml orders are specifically as follows:
genhtml-o/home/html_file NFS-Ganesha.info
It refer to Fig. 2, Fig. 2 is a kind of structural representation of code coverage statistical system provided by the invention, the system
Applied to User space NFS NFS-Ganesha, including:
Acquisition module 1, for obtaining the correct NFS-Ganesha source codes of compilation run, and in NFS-Ganesha source codes
Add gcov/lcov function libraries, genhtml function libraries and lib library files;
Add module 2, for added in NFS-Ganesha source codes be used for indicate compiling when automatic loading function storehouse and
The switch option of lib library files and compiling parameter set in advance;
Statistical module 3, after being open mode and compiling parameter addition for switch option, ordered according to the compiling of user
Order compiling NFS-Ganesha source code generation .gcno files, and run the NFS-Ganesha source codes generation .gcda texts after compiling
Part.
Introduction for system provided by the invention refer to above method embodiment, and the present invention will not be repeated here.
Present invention also offers a kind of code coverage statistic device, applied to User space NFS NFS-
Ganesha, including:
Memory, for storing computer program;
Processor, the step of realizing any of the above-described code coverage statistical method during for performing computer program.
Introduction for device provided by the invention refer to above method embodiment, and the present invention will not be repeated here.
Present invention also offers a kind of computer-readable recording medium, applied to User space NFS NFS-
Ganesha, it is characterised in that computer program is stored with computer-readable recording medium, computer program is held by processor
The step of any of the above-described code coverage statistical method is realized during row.
Introduction for computer-readable recording medium provided by the invention refer to above method embodiment, and the present invention exists
This is repeated no more.
Each embodiment is described by the way of progressive in this specification, what each embodiment stressed be and other
The difference of embodiment, between each embodiment identical similar portion mutually referring to.For system disclosed in embodiment,
For device and computer-readable storage medium, because it is corresponded to the method disclosed in Example, so fairly simple, the phase of description
Part is closed referring to method part illustration.
Professional further appreciates that, with reference to the unit of each example of the embodiments described herein description
And algorithm steps, can be realized with electronic hardware, computer software or the combination of the two, in order to clearly demonstrate hardware and
The interchangeability of software, the composition and step of each example are generally described according to function in the above description.These
Function is performed with hardware or software mode actually, application-specific and design constraint depending on technical scheme.Specialty
Technical staff can realize described function using distinct methods to each specific application, but this realization should not
Think beyond the scope of this invention.
The foregoing description of the disclosed embodiments, professional and technical personnel in the field are enable to realize or using the present invention.
A variety of modifications to these embodiments will be apparent for those skilled in the art, as defined herein
General Principle can be realized in other embodiments without departing from the spirit or scope of the present invention.Therefore, it is of the invention
The embodiments shown herein is not intended to be limited to, and is to fit to and principles disclosed herein and features of novelty phase one
The most wide scope caused.
Claims (10)
- A kind of 1. code coverage statistical method, applied to User space NFS NFS-Ganesha, it is characterised in that Including:The correct NFS-Ganesha source codes of compilation run are obtained, and gcov/lcov is added in the NFS-Ganesha source codes Function library, genhtml function libraries and lib library files;The function library and the lib library texts are loaded automatically when being added in the NFS-Ganesha source codes for indicating compiling The switch option of part and compiling parameter set in advance;After the switch option is open mode and the compiling parameter addition, according to the compiler directive of user compiling NFS-Ganesha source codes generate .gcno files, and run the NFS-Ganesha source codes generation .gcda files after compiling.
- 2. the method as described in claim 1, it is characterised in that the acquisition correct NFS-Ganesha source codes of compilation run Process be specially:Receive user selection instruction, and according to the selection instruction determine NFS-Ganesha source codes environment, compilation tool and NFS-Ganesha source codes;The NFS-Ganesha source codes are compiled in outside compiling catalogue by the compilation tool, is obtained and compiled according to compiling result Translate the correct NFS-Ganesha source codes of operation.
- 3. method as claimed in claim 2, it is characterised in that the compilation tool is cmake;It is then described that gcov/lcov function libraries, genhtml function libraries and lib library files are added in the NFS-Ganesha source codes Process be specially:Added in the modules in cmake subdirectories in the NFS-Ganesha source codes gcov/lcov function libraries, Genhtml function libraries and lib library files;It is then described to load the function library and described automatically when being added in the NFS-Ganesha source codes for indicating compiling The switch option of lib library files and it is set in advance compiling parameter process be specially:Institute is loaded automatically when being added in the CMakeLists.txt files in the NFS-Ganesha source codes for indicating compiling State the switch option of function library and the lib library files and compiling parameter set in advance.
- 4. method as claimed in claim 3, it is characterised in that the compiling parameter set in advance includes compiling option and chain Selecting item.
- 5. method as claimed in claim 4, it is characterised in that it is described addition compiling option process be specially:When the CMakeLists.txt files are the CMakeLists.txt files write manually, referred to according to the addition of user The compiling option is added in order;When the CMakeLists.txt files are the CMakeLists.txt files automatically generated, operation ./configure- H, pass through the addition compiling option that sets.
- 6. the method as described in claim any one of 1-5, it is characterised in that this method also includes:The lcov orders of user are received, and according to the lcov orders, the .gcno files of generation and generation .gcda the overall code coverage condition of NFS-Ganesha source codes described in file acquisition.
- 7. method as claimed in claim 6, it is characterised in that this method also includes:The genhtml orders of user are received, and according to the institute of the genhtml orders, the .gcno files of generation and generation State the overall code coverage rate view and webpage view of NFS-Ganesha source codes described in .gcda file acquisitions.
- A kind of 8. code coverage statistical system, applied to User space NFS NFS-Ganesha, it is characterised in that Including:Acquisition module, for obtaining the correct NFS-Ganesha source codes of compilation run, and in the NFS-Ganesha source codes Add gcov/lcov function libraries, genhtml function libraries and lib library files;Add module, the function library is loaded automatically when being used to indicate compiling for being added in the NFS-Ganesha source codes Switch option and compiling parameter set in advance with the lib library files;Statistical module, after being open mode and the compiling parameter addition for the switch option, according to the volume of user Translate order and compile the NFS-Ganesha source codes generation .gcno files, and run the NFS-Ganesha source codes after compiling Generate .gcda files.
- A kind of 9. code coverage statistic device, applied to User space NFS NFS-Ganesha, it is characterised in that Including:Memory, for storing computer program;Processor, the code coverage statistics as described in any one of claim 1 to 7 is realized during for performing the computer program The step of method.
- A kind of 10. computer-readable recording medium, applied to User space NFS NFS-Ganesha, it is characterised in that Computer program is stored with the computer-readable recording medium, is realized when the computer program is executed by processor as weighed Profit requires the step of any one of 1 to 7 code coverage statistical method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710936141.8A CN107729239A (en) | 2017-10-10 | 2017-10-10 | A kind of code coverage statistical method, system, device and computer-readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710936141.8A CN107729239A (en) | 2017-10-10 | 2017-10-10 | A kind of code coverage statistical method, system, device and computer-readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107729239A true CN107729239A (en) | 2018-02-23 |
Family
ID=61210150
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710936141.8A Pending CN107729239A (en) | 2017-10-10 | 2017-10-10 | A kind of code coverage statistical method, system, device and computer-readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107729239A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108829593A (en) * | 2018-06-05 | 2018-11-16 | 平安壹钱包电子商务有限公司 | Code coverage calculation and analysis methods, device, equipment and storage medium |
CN110928776A (en) * | 2019-11-15 | 2020-03-27 | 武汉极意网络科技有限公司 | Detection method, device and equipment for realizing incremental code coverage rate based on lcov |
CN112416773A (en) * | 2020-11-23 | 2021-02-26 | 通号万全信号设备有限公司 | Cross-platform data visualization method |
CN113934627A (en) * | 2021-09-26 | 2022-01-14 | 五八同城信息技术有限公司 | Code execution coverage rate statistical method and device, electronic equipment and readable medium |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106126430A (en) * | 2016-08-19 | 2016-11-16 | 浪潮(北京)电子信息产业有限公司 | The method of testing of a kind of code coverage and device |
-
2017
- 2017-10-10 CN CN201710936141.8A patent/CN107729239A/en active Pending
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106126430A (en) * | 2016-08-19 | 2016-11-16 | 浪潮(北京)电子信息产业有限公司 | The method of testing of a kind of code coverage and device |
Non-Patent Citations (3)
Title |
---|
KEVIN_JI: "覆盖率测试工具gcov&lcov使用手册", 《CSDN》 * |
MICHAEL STAPELBERG: "code_coverage testing in c with gcov and lcov", 《MICHAEL STAPELBERG》 * |
沈沛意: "《DAVINCI技术剖析及实战应用开发指南》", 30 April 2012 * |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108829593A (en) * | 2018-06-05 | 2018-11-16 | 平安壹钱包电子商务有限公司 | Code coverage calculation and analysis methods, device, equipment and storage medium |
CN108829593B (en) * | 2018-06-05 | 2023-12-05 | 平安壹钱包电子商务有限公司 | Code coverage rate calculation and analysis method, device, equipment and storage medium |
CN110928776A (en) * | 2019-11-15 | 2020-03-27 | 武汉极意网络科技有限公司 | Detection method, device and equipment for realizing incremental code coverage rate based on lcov |
CN112416773A (en) * | 2020-11-23 | 2021-02-26 | 通号万全信号设备有限公司 | Cross-platform data visualization method |
CN113934627A (en) * | 2021-09-26 | 2022-01-14 | 五八同城信息技术有限公司 | Code execution coverage rate statistical method and device, electronic equipment and readable medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11151018B2 (en) | Method and apparatus for testing a code file | |
US9612943B2 (en) | Prioritization of tests of computer program code | |
Mey et al. | Score-P: A unified performance measurement system for petascale applications | |
CN107729239A (en) | A kind of code coverage statistical method, system, device and computer-readable storage medium | |
CN104683180B (en) | A kind of method for monitoring performance, system and application server | |
CN109344076A (en) | A kind of automatic interface testing method and its device based on JMeter and Jenkins | |
CN104407980A (en) | Mobile application automated testing device and method | |
CN109302522A (en) | Test method, device and computer system and medium | |
CN108958992A (en) | test method and device | |
US7089535B2 (en) | Code coverage with an integrated development environment | |
US20120317556A1 (en) | Optimizing execution of kernels | |
US8839197B2 (en) | Automated analysis of composite applications | |
CN110674047B (en) | Software testing method and device and electronic equipment | |
CN110806970A (en) | Client test method and device based on simulation server response and electronic equipment | |
Waller | Performance benchmarking of application monitoring frameworks | |
CN113568839A (en) | Method, device, equipment and medium for software testing and statistical test coverage rate | |
Sottile et al. | Semi-automatic extraction of software skeletons for benchmarking large-scale parallel applications | |
CN106681783A (en) | Detection method and system for SVN code | |
CN110399187A (en) | A kind for the treatment of method and apparatus of language resource | |
Arteca et al. | npm-filter: Automating the mining of dynamic information from npm packages | |
CN103955425A (en) | Webpage (WEB) exploring testing device and method | |
Ruprecht et al. | Automatic feature selection in large-scale system-software product lines | |
CN113806231B (en) | Code coverage rate analysis method, device, equipment and medium | |
CN109902001A (en) | To the detection method and terminal device of uninitialized variable | |
Behnamghader et al. | A scalable and efficient approach for compiling and analyzing commit history |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180223 |