A method and device for analyzing software in continuous integration

By using code change records and analysis results of historical versions of software, the analysis results of the new version of software are quickly determined, and the problem of low analysis efficiency of software system is solved, efficient software analysis is achieved, and privacy data protection needs are met.

CN115840695BActive Publication Date: 2024-12-31ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211482609.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-24
Publication Date
2024-12-31
Estimated Expiration
2042-11-24

AI Technical Summary

Technical Problem

In continuous integration, there are challenges in rapid analysis of large-scale software systems, especially when software systems are complex and frequently updated, it is difficult for existing technologies to effectively improve analysis efficiency, and enterprises are concerned about privacy data protection, making it difficult for them to make them more difficult. Software analysis is handed over to a third party for conduct.

Method used

By determining the code change record of the software to be analyzed relative to the historical version of the software, obtain the full or incremental analysis results of the historical version of the software, and determine the analysis results of the new version of the software based on these results, avoid re-performing the complete analysis and only perform the change part. analyze.

Benefits of technology

It significantly improves the efficiency of software analysis, reduces memory consumption, and meets the enterprise's needs for privacy data protection, and can conduct software analysis quickly and accurately.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115840695B_ABST
    Figure CN115840695B_ABST
Patent Text Reader

Abstract

The embodiments of this specification provide a method and apparatus for analyzing software in continuous integration. In this method, the memory can store full analysis results or incremental analysis results of each version of the software. The execution device determines the code change record of the new version of the software to be analyzed relative to the old version of the software, and obtains the full analysis result of the old version of the software based on the analysis results stored in the memory, and determines the analysis result for the first version of the software based on the code change record and the full analysis result of the first historical version of the software. If it is an incremental analysis result, the incremental analysis result can also be used to determine the full analysis result of the first historical version.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of the present specification relate to the field of computer technology, and more particularly, to a method and apparatus for analyzing software in continuous integration. Background Art

[0002] For software systems, such as enterprise-level software, the development process can include continuous integration (CI), continuous delivery (CD), and continuous deployment (DDP). Continuous integration is a software development practice. During the software update and iteration process, developers often integrate their work through automated builds to find errors in the integration as soon as possible. The continuous integration process of software is the process of continuous updating and iteration of multiple versions of software. After each new version of software is obtained, the software needs to be analyzed and tested based on the analysis results. The testing process before the delivery of the new version of software plays a vital role in ensuring the quality of the software. When the software system is large and complex, the analysis of different versions of software that are updated quickly will face new challenges. In addition, enterprises are paying more and more attention to the privacy data protection of their own software and will not directly hand over software analysis to a third party for implementation.

[0003] Therefore, we hope that there will be an improved solution so that the software can be analyzed more quickly when facing large-scale software systems. Summary of the invention

[0004] One or more embodiments of this specification describe a method and device for analyzing software in continuous integration, so as to analyze software more quickly when facing a large-scale software system. The specific technical solution is as follows.

[0005] In a first aspect, an embodiment provides a method for analyzing software in continuous integration, the method comprising:

[0006] Determine the code change record of the first version of the software to be analyzed relative to the first historical version of the software;

[0007] Obtaining a full analysis result of the first historical version of the software; wherein the full analysis result is a complete analysis result of the software;

[0008] Based on the code change record and the full analysis result of the first historical version of the software, an analysis result for the first version of the software is determined.

[0009] In one embodiment, the step of determining the analysis result for the first version of the software includes:

[0010] The full analysis result of the first historical version of the software is modified using the code change record to determine the full analysis result for the first version of the software.

[0011] In one embodiment, for any one of multiple versions of software, a full analysis result or an incremental analysis result of the version of software is stored in a memory; the incremental analysis result includes the change execution logic of the full analysis result of the version of software relative to the full analysis result of the historical version of software.

[0012] In one implementation, the step of obtaining the full analysis result of the first historical version of the software includes:

[0013] When the full analysis result of the first historical version of the software is stored in the memory, the full analysis result of the first historical version of the software is directly read from the memory.

[0014] In one implementation, the step of obtaining the full analysis result of the first historical version of the software includes:

[0015] When the memory stores the incremental analysis result of the first historical version of the software, the full analysis result of the most recent second historical version of the software and the incremental analysis results corresponding to the plurality of historical versions of the software between the second historical version of the software and the first historical version of the software are read from the memory;

[0016] The full analysis result of the first historical version software is determined by using the plurality of incremental analysis results and the full analysis result of the second historical version software.

[0017] In one implementation, the step of determining the full analysis result of the first historical version of the software includes:

[0018] In order from the second historical version software to the first historical version software, the full analysis result of the previous historical version software and the incremental analysis result of the current historical version software are logically merged to determine the full analysis result of the current historical version software.

[0019] In one embodiment, the full analysis result includes multiple elements; the step of determining the full analysis result of the current historical version of the software by logically combining the full analysis result of the previous historical version of the software with the incremental analysis result of the current historical version of the software includes:

[0020] When the change execution logic of the incremental analysis result includes a deletion operation and an addition operation for the first element, the deletion operation is first performed on the first element in the full analysis result of the previous historical version of the software, and then the addition operation is performed.

[0021] In one implementation, the first historical version software is the previous historical version software of the first version software.

[0022] In one embodiment, the full analysis results or the incremental analysis results are stored in the memory at intervals.

[0023] In one embodiment, the step of determining the analysis result for the first version of the software includes:

[0024] When the analysis result of the first version of the software to be determined is a full analysis result, the full analysis result of the first historical version of the software is modified using the code change record to obtain the full analysis result of the first version of the software;

[0025] When the analysis result of the first version of the software to be determined is an incremental analysis result, the code change record is used to determine the modifications that need to be made to the full analysis result of the first historical version of the software, and the incremental analysis result of the first version of the software is determined based on the modifications that need to be made.

[0026] In one implementation, the following method is used to determine whether the analysis result of the first version of the software to be determined is an incremental analysis result:

[0027] According to a preset interval rule for full analysis results and incremental analysis results, determining whether the analysis result of the first version of the software to be determined is an incremental analysis result; or,

[0028] Based on the received instruction for instructing to determine the incremental analysis result or the full analysis result of the first version of the software, it is determined whether the analysis result of the first version of the software to be determined is the incremental analysis result.

[0029] In one embodiment, the full analysis result includes a method call graph, wherein the method call graph includes points representing methods in the software and edges representing call relationships between methods in the software; the code change record includes operation execution logic for the first method in the software;

[0030] The step of using the code change record to determine the modifications that need to be made to the full analysis result of the first historical version of the software, and determining the incremental analysis result of the first version of the software based on the modifications that need to be made, includes:

[0031] Determine, from a method call graph included in the full analysis result of the first historical version of the software, a second method that has a call relationship with the first method;

[0032] Based on the operation execution logic, a change execution logic for the second method is determined, thereby obtaining an incremental analysis result of the first version of the software.

[0033] In a second aspect, an embodiment provides a method for obtaining software analysis results in continuous integration, wherein the memory stores full analysis results or incremental analysis results of several versions of software; the full analysis result is a complete analysis result for the software, and the incremental analysis result includes a change execution logic of the full analysis result of the corresponding version of the software relative to the full analysis result of the historical version of the software; the method includes:

[0034] Determine the second version of the software for obtaining the analysis results;

[0035] When the memory stores the incremental analysis result of the second version of the software, the full analysis result of the latest third historical version of the software and the incremental analysis results corresponding to several historical versions of the software between the third historical version of the software and the second version of the software are read from the memory;

[0036] The full analysis result of the second version of the software is determined by using several incremental analysis results and the full analysis result of the third historical version of the software.

[0037] In one embodiment, the step of determining the full analysis result of the second version of the software includes:

[0038] In order from the third historical version software to the second version software, the full analysis result of the previous historical version software and the incremental analysis result of the current version software are logically merged to determine the full analysis result of the current version software.

[0039] In one embodiment, the full analysis result includes multiple elements; the step of determining the full analysis result of the current historical version of the software by logically combining the full analysis result of the previous historical version of the software with the incremental analysis result of the current historical version of the software includes:

[0040] When the change execution logic of the incremental analysis result includes a deletion operation and an addition operation for the first element, the deletion operation is first performed on the first element in the full analysis result of the previous historical version of the software, and then the addition operation is performed.

[0041] In a third aspect, an embodiment provides a device for analyzing software in continuous integration, the device comprising:

[0042] A change determination module, configured to determine a code change record of a first version of software to be analyzed relative to a first historical version of software;

[0043] An analysis acquisition module is configured to acquire a full analysis result of the first historical version of the software; wherein the full analysis result is a complete analysis result of the software;

[0044] The result determination module is configured to determine the analysis result for the first version of the software based on the code change record and the full analysis result of the first historical version of the software.

[0045] In a fourth aspect, an embodiment provides a device for obtaining software analysis results in continuous integration, wherein the memory stores full analysis results or incremental analysis results of several versions of software; the full analysis result is a complete analysis result for the software, and the incremental analysis result includes a change execution logic of the full analysis result of the corresponding version of the software relative to the full analysis result of the historical version of the software; the device includes:

[0046] A software determination module, configured to determine a second version of software for which analysis results are to be obtained;

[0047] an analysis and reading module configured to read, when the memory stores the incremental analysis result of the second version of the software, the full analysis result of the most recent third historical version of the software and the incremental analysis results corresponding to the respective historical versions of the software between the third historical version of the software and the second version of the software from the memory;

[0048] The full determination module is configured to determine the full analysis result of the second version software by using several incremental analysis results and the full analysis result of the third historical version software.

[0049] In a fifth aspect, an embodiment provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute any one of the methods in the first aspect and the second aspect.

[0050] In a sixth aspect, an embodiment provides a computing device, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method described in any one of the first aspect and the second aspect is implemented.

[0051] In the method and device provided in the embodiments of this specification, the analysis results of the new version of the software are determined based on the specific content of the code changes and the full analysis results of the old version of the software. It is only necessary to perform software analysis based on the specific content of the code changes on the basis of the complete analysis results of the old version of the software, and there is no need to re-analyze the entire new version of the software. This improves the efficiency of software analysis, especially when facing a large-scale software system, and can significantly improve the efficiency of software analysis. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0053] Figure 1 A flowchart of a method for analyzing software in continuous integration provided by an embodiment;

[0054] Figure 2 A schematic diagram of a framework for intermittent storage of full and incremental analysis results provided by an embodiment;

[0055] Figure 3 This is a schematic diagram of the structure of a method call graph;

[0056] Figure 4 A flowchart of a method for obtaining software analysis results in continuous integration provided by an embodiment;

[0057] Figure 5 A schematic block diagram of a device for analyzing software in continuous integration provided by an embodiment;

[0058] Figure 6 A schematic block diagram of a device for obtaining software analysis results in continuous integration provided in an embodiment. DETAILED DESCRIPTION

[0059] The solution provided in this specification is described below in conjunction with the accompanying drawings.

[0060] Software is a collection of computer data and instructions organized in a specific order. It is the intangible part of a computer and also the computer programs, procedures, rules, and possible files, documents, and data related to the operation of a computer system. Computers achieve various functions and certain performance through the cooperation of software and hardware.

[0061] In some application software, including but not limited to enterprise-level software, the development process can be summarized as CI / CD, where CI stands for continuous integration and CD includes continuous delivery and continuous deployment. In the CI stage, the same software is continuously updated and iterated by developers, and different versions of the software are continuously developed. New versions of software need to go through testing, modification and other processes before they can be delivered. Generally speaking, analyzing the new version of software and obtaining the analysis results is a process that needs to be relied upon when testing the new version of software. For large and complex software, frequently performing complete software analysis on the new version of software is time-consuming and memory-consuming.

[0062] In order to improve the efficiency of software analysis, this specification embodiment provides a software analysis method. Figure 1 The present specification will now be described with reference to the embodiments.

[0063] Figure 1 A flowchart of a method for analyzing software in continuous integration provided in an embodiment. The method can be executed by a computer device, and the computer device can be implemented by any device, equipment, platform, device cluster, etc. with computing and processing capabilities. The method includes the following steps.

[0064] Step S110 , determining the code change record of the first version software S1 to be analyzed relative to the first historical version software H1 .

[0065] The first version software S1 can be any version of the software generated in the continuous integration. In the continuous integration of software, different versions of software will be generated. Generally speaking, different versions of software can be distinguished by version numbers, and the version numbers can be coded in sequence, such as version 1.0 software, version 2.0 software, version 3.0 software, etc. The first version software S1 can be the latest version of the current software, and one or more versions of software before the first version software S1 can be called historical version software.

[0066] The first historical version software H1 can be any one of several historical version software. Usually, software updates are performed based on the previous version software. Therefore, the first historical version software H1 can be the previous historical version software of the first version software S1. In this way, it will be easier to determine the code change record. The first historical version software H1 can also be other historical version software except the previous historical version software.

[0067] Software can be implemented by written code. Code can contain multiple elements, such as multiple methods and the calling relationship between methods. Methods can also be called functions. Functions include but are not limited to summation functions, sorting functions, and rounding functions.

[0068] The code change record reflects the differences between the first version software S1 and the first historical version software H1. The code change record may include the operation execution logic of one or more methods in the software, such as deleting or adding a method, deleting or adding the calling relationship between certain methods, etc.

[0069] The code change record may be read directly from a storage space. For example, when developing or generating the first version of software S1, a code change record of the first version of software S1 relative to the previous historical version of software is generated and stored in the above storage space. The code change record may also be determined based on the comparison between the first version of software S1 and the first historical version of software H1 when executing step S110.

[0070] Step S120, obtaining a full analysis result of the first historical version software H1, wherein the full analysis result is a complete analysis result for the software.

[0071] The full analysis results can include method call graphs and / or data flow analysis for the software. The method call graph contains points representing methods in the software and edges representing the call relationships between methods in the software. Data flow analysis contains the semantic information of the program in the software, as well as the definition and use of variables in the program. Data flow analysis can help understand the program and discover the behavior of the software at runtime without actually running the software.

[0072] In summary, the full analysis results can include multiple elements, such as methods in the software and the calling relationships between methods.

[0073] Step S130 , based on the code change record and the full analysis result of the first historical version software H1 , determine the analysis result for the first version software S1 .

[0074] When this step is specifically performed, the full analysis result of the first historical version software H1 can be modified using the code change record to determine the full analysis result for the first version software S1. For example, the corresponding element in the full analysis result is modified using the operation execution logic contained in the code change record, so that the modified full analysis result is determined as the full analysis result of the first version software S1.

[0075] In one implementation, the code change record may be used to determine the modifications that need to be made to the full analysis result, and the modifications that need to be made and the full analysis result of the first historical version software H1 may be used together as the full analysis result of the first version software S1, without implementing the modifications that need to be made in the full analysis result of the first historical version software H1. This implementation is also feasible.

[0076] This step may also include a variety of implementation methods during specific implementation. All implementation methods are feasible as long as they can implement the analysis of the first version software S1 based on the code change record and the full analysis results of the first historical version software H1.

[0077] In this embodiment, based on the full analysis results of the old version of the software, software analysis is performed based on the specific content of the code changes. There is no need to re-analyze the entire new version of the software, only the changed parts need to be analyzed. This can improve the efficiency of software analysis and reduce memory consumption when determining the analysis results.

[0078] After determining the analysis result for the first version software S1, the analysis result can be directly used to test the first version software S1, so as to determine whether there are malicious codes, hidden program errors (bugs), and content that the program does not want to access, etc. in the first version software S1. Alternatively, the above analysis result is stored in a non-volatile memory, and when the first version software S1 needs to be tested, the analysis result is read from the memory.

[0079] In the continuous integration process of software, the update and iteration process of the software may be very frequent, and the content of the code update may not be very large. Storing the full analysis results of a large number of software versions in the memory one by one will take up a large storage space, resulting in a waste of storage space.

[0080] In order to reduce the waste of storage space and improve the efficiency of software analysis, this specification also provides another embodiment. In this embodiment, for any one of multiple versions of software, such as a version of software a, the full analysis result or incremental analysis result of the version of software a is stored in the memory. Among them, the analysis result includes the full analysis result or the incremental analysis result, and the incremental analysis result includes the change execution logic of the full analysis result of the version of software a relative to the full analysis result of the historical version of software.

[0081] In one embodiment, for multiple versions of software, the analysis results can be determined in a manner that multiple consecutive versions of the software determine the full analysis results, and multiple consecutive versions of the software determine the incremental analysis results. That is, the analysis results are stored in a manner that multiple consecutive versions of the software store the full analysis results, and multiple consecutive versions of the software store the incremental analysis results.

[0082] Alternatively, the full analysis results or the incremental analysis results are stored in the memory at intervals. In one embodiment, the full analysis results and the incremental analysis results can be determined and stored according to a preset interval rule for the full analysis results and the incremental analysis results. For example, n full analysis results and m incremental analysis results appear alternately at intervals. Both n and m are natural numbers, for example, n is 1, and m is 3, 4, or 5. Alternatively, the execution entity determines and stores the full analysis results or the incremental analysis results of the software according to the received instructions, wherein the instructions can be sent according to an intermittent rule.

[0083] Figure 2 A schematic diagram of a framework for intermittent storage of full and incremental analysis results provided by an embodiment. The order of software updates is: version 1 software, version 2 software, version 3 software, version 4 software, etc. The memory stores the full analysis results of version 1 software, the incremental analysis results of version 2 software, and the incremental analysis results of version 3 software. The analysis results of version 4 software have not yet been stored.

[0084] In this embodiment, the first historical version software H1 may be a historical version with full analysis results selected from multiple historical version softwares, which may be the previous historical version software of the first version software S1, or may not be. When the first historical version software H1 is not the previous historical version software, the code change record determined in step S110 is not the code change record of the first version software S1 relative to the previous historical version software.

[0085] In one implementation, the first historical version software H1 is the previous historical version software, and what is stored in the memory may be the full analysis result of the first historical version software H1 or the incremental analysis result thereof.

[0086] When executing step S120, it can be determined based on the meta information whether the full analysis result or the incremental analysis result of the first historical version software H1 is stored in the memory.

[0087] When the memory stores the full analysis result of the first historical version software H1, the full analysis result of the first historical version software H1 is directly read from the memory.

[0088] When the memory stores the incremental analysis results of the first historical version software H1, the full analysis results of the first historical version software H1 can be determined according to the following steps 1 and 2.

[0089] Step 1, read the full analysis result of the most recent second historical version software H2 and the incremental analysis results corresponding to several historical version software between the second historical version software H2 and the first historical version software H1 from the memory.

[0090] Step 2: Determine the full analysis result of the first historical version software H1 by using several incremental analysis results and the full analysis result of the second historical version software H1.

[0091] In the above step 1, the second historical version software H2 is the historical version software with full analysis results and the closest to the first historical version software H1. There may be one or more historical version software between the second historical version software H2 and the first historical version software H1, or there may be no historical version software, that is, the second historical version software H2 is the previous historical version software of the first historical version software H1. Therefore, the incremental analysis results read in step 1 are one or more.

[0092] When executing the above step 2, the full analysis result of the previous historical version software and the incremental analysis result of the current historical version software can be logically merged in sequence from the second historical version software H2 to the first historical version software H1 to determine the full analysis result of the current historical version software until the full analysis result of the first historical version software H1 is determined. Specifically, assuming that there are version a, version b, and version c software between the second historical version software H2 and the first historical version software H1, version a software can be used as the current historical version software, and the full analysis result of the second historical version software H2 and the incremental analysis result of version a software can be logically merged to obtain the full analysis result of version a software, and version a software can be used as the previous historical version software and version b software can be used as the current historical version software, and the step of using the logical merger of the full analysis result of the previous historical version software and the incremental analysis result of the current historical version software to determine the full analysis result of the current historical version software is repeatedly executed until the full analysis result of the first historical version software H1 is determined, and the loop ends.

[0093] For example, in Figure 2 In the example, assuming that version 4 software is the first version software S1 and version 3 software is the first historical version software H1, the historical version software closest to version 3 software and having the full analysis result is version 1 software, and version 2 software is included between version 1 software and version 3 software, so the full analysis result of version 1 software and the incremental analysis result of version 2 software can be read from the memory. The full analysis result of version 3 software is determined using the incremental analysis result and the full analysis result. Specifically, the incremental analysis result and the full analysis result can be logically merged to obtain the full analysis result of version 3 software.

[0094] When the full analysis result contains different contents, the specific implementation method of logically merging the full analysis result with the incremental analysis result will also be different. For example, the multiple elements contained in the full analysis result may be methods in the software and the calling relationships between the methods.

[0095] The incremental analysis result can contain one or more change execution logics. When the change execution logic contains deletion and addition operations for a certain element (such as the first element) or some elements, in order to ensure the completeness of the execution result, when the full analysis result and the incremental analysis result are logically merged, the first element in the full analysis result can be deleted first and then added. If the addition operation is performed first and then the deletion operation is performed, the addition may be invalid because the added content already exists in the method call graph. If the deletion operation is performed again, the content that should not be deleted will be deleted, resulting in the lack of relevant content in the final result. Performing the deletion operation first and then the addition operation can effectively avoid this problem and improve the completeness of the execution result.

[0096] During the deletion process, it is also possible to detect whether each element is illegal in the current version of the software (ie, the new version of the software). If it is illegal, the deletion operation is performed; if it is not illegal, other judgments can be continued.

[0097] In this embodiment, when executing step S130, it can be first determined whether the analysis result of the first version of the software S1 to be determined is an incremental analysis result or a full analysis result. In one implementation, one of the following methods can be used to determine whether the analysis result of the first version of the software S1 to be determined is an incremental analysis result:

[0098] According to a preset interval rule for full analysis results and incremental analysis results, it is determined whether the analysis result of the first version of the software S1 to be determined is an incremental analysis result;

[0099] Based on the received instruction for instructing to determine the incremental analysis result or the full analysis result of the first version software S1, it is determined whether the analysis result of the first version software S1 to be determined is an incremental analysis result.

[0100] For example, if the interval between full analysis results and incremental analysis results is that a full analysis result is generated after every five incremental analysis results, the number of incremental analysis results k generated after the most recent full analysis result can be determined based on the metadata. If k is less than 5, it is determined that the incremental analysis result needs to be determined next. If k is equal to 5, it is determined that the full analysis result needs to be determined next.

[0101] The execution subject can detect the received instruction. If the instruction indicates that the incremental analysis result is to be determined next, the analysis result of the first version of the software S1 to be determined is the incremental analysis result. If the instruction indicates that the full analysis result is to be determined next, the analysis result of the first version of the software S1 to be determined is the full analysis result. The above instructions can be sent to the execution subject by other devices, or they can be obtained by the execution subject based on the input operation of the R&D personnel.

[0102] When executing step S130, when it is necessary to determine the full analysis result of the first version software S1, the full analysis result of the first historical version software H1 can be modified using the code change record to obtain the full analysis result of the first version software S1. That is, based on the full analysis result of the old version software, the full analysis result is modified based on the code change record, and the modified full analysis result is used as the full analysis result of the new version software.

[0103] When it is necessary to determine the incremental analysis result of the first version software S1, the code change record is used to determine the modifications that need to be made to the full analysis result of the first historical version software H1, and the incremental analysis result of the first version software S1 is determined based on the modifications that need to be made. That is, using the code change record, only the modifications that need to be made to the full analysis result of the old version software are determined, and the full analysis result is not directly modified. After determining which modifications need to be made, the incremental analysis result of the new version software can be determined based on these modifications.

[0104] by Figure 2 As an example, the process of determining the full analysis result or incremental analysis result of the software is described. Assuming that version 1 software is the initial software, a complete software analysis can be performed on version 1 software to obtain the full analysis result of version 1 and store it in the memory. After updating and iterating version 1 software, version 2 software is obtained, and a code change record 1 of version 2 software relative to version 1 software can be obtained. In order to determine the incremental analysis result of the full analysis result of version 2 software relative to the full analysis result of version 1 software, the full analysis result of version 1 software, which is also the most recent full analysis result, can be read from the memory. The code change record 1 and the full analysis result of version 1 software are used for analysis to obtain the incremental analysis result corresponding to version 2 software and store it in the memory. The analysis here includes the process of determining the modifications that need to be made to the full analysis result of version 1 software using the code change record 1, and determining the incremental analysis result of version 2 software based on the modifications that need to be made.

[0105] Next, continue to update the software, that is, obtain version 3 software from version 2 software through update iteration, and obtain code change record 2 of version 3 software relative to version 2 software. In order to determine the incremental analysis result of the full analysis result of version 3 software relative to the full analysis result of version 2 software, the full analysis result of version 1 software and the incremental analysis result of version 2 software can be read from the memory, and the full analysis result of version 1 software and the incremental analysis result of version 2 software are logically merged to obtain the full analysis result of version 2 software. Next, analyze using code change record 2 and the full analysis result of version 2 software to obtain the incremental analysis result corresponding to version 3 software, and store it in the memory.

[0106] Similarly, when determining the incremental analysis results corresponding to version 4 software, it is necessary to logically merge the full analysis results of version 1 software, the incremental analysis results of version 2 software, and the incremental analysis results of version 3 software read from the memory to obtain the full analysis results of version 3 software. Then, the incremental analysis results corresponding to version 4 software are obtained by analyzing using code change record 3 and the full analysis results of version 3 software, and can be stored in the memory.

[0107] The following takes the method call graph included in the full analysis result as an example to illustrate the process of using the code change record to determine the modifications that need to be made to the full analysis result of the old version of the software, and the process of using the modification to determine the incremental analysis result.

[0108] The method call graph includes points representing methods in the software and edges representing the calling relationships between methods in the software. The code change record includes the operation execution logic for one or more methods in the software. For a clearer description, the first method is taken as an example. The operation execution logic may include deleting or adding the first method.

[0109] During execution, the second method that has a calling relationship with the first method can be determined from the method call graph contained in the full analysis result of the first historical version software H1, and the change execution logic for the second method can be determined based on the operation execution logic in the code change record, thereby obtaining the incremental analysis result of the first version software S1.

[0110] For example, when the operation execution logic is to delete the first method, all second methods that have a call relationship with the first method can be determined from the method call graph, and the modifications required include: deleting the edges between all second methods and the first method. When the operation execution logic is to add the first method, all second methods that have a call relationship with the first method can be determined from the method call graph, and the modifications required include: adding edges between all second methods and the first method.

[0111] Figure 3This is a schematic diagram of the structure of a method call graph. The dots represent the methods in the software, and the edges between the dots and the directions of the edges represent the call relationships between the methods in the software. For example, when you need to delete Figure 3 When method 1 is shown in the method call graph, it can be determined that the methods that have a calling relationship with method 1 include method 2, method 3 and method 5, so it can be determined that the modifications that need to be made to the method call graph include: deleting method 1 and deleting the edges between method 1 and method 2, method 3 and method 5 respectively.

[0112] When the required modification includes the change logic that needs to be executed on the method call graph (that is, the full analysis result), the required modification can be directly used as the incremental analysis result. When the required modification does not have the above change execution logic (for example, it does not include operations such as deletion and addition), or is not expressed according to the set change execution logic, the required modification can be changed to obtain an incremental analysis result that meets the requirements. The incremental analysis result includes the elements that need to be deleted and the elements that need to be added, and these deletion or addition operations can be marked on the elements in the form of attributes.

[0113] The code change record can also include the operation execution logic for the call relationship between one or more methods in the software, that is, the operation execution logic for the edges in the method call graph. For example, delete the call relationship between the first method and the second method, or add the call relationship between the first method and the second method. Such operation execution logic can be directly used as the incremental analysis result.

[0114] Still taking the method call graph as an example, when determining the full analysis results, the above method can also be used to determine the required modifications. Simply apply the required modifications to the method call graph to obtain the method call graph of the new version of the software, without the need to generate incremental analysis results separately.

[0115] After obtaining the full analysis results or incremental analysis results of the first version software S1, the full analysis results can be directly applied to software testing and other processing, or the full analysis results or incremental analysis results can be stored in a memory so that they can be read from the memory when software testing and other processing are required.

[0116] In this embodiment, the analysis results of multiple versions of software are stored in full or incremental form, which effectively reduces the waste of memory storage space. Generally, the data volume of incremental analysis results is much smaller than that of full analysis results. Only storing the full analysis results of some versions of software can effectively reduce the amount of data to be stored.

[0117] The above embodiments focus on how to determine the full analysis results and incremental analysis results when analyzing software. In the following embodiments, the focus will be on how to determine the full analysis results of a certain version of software based on the incremental analysis results in the memory, and the same or similar parts as the above embodiments will be briefly described.

[0118] Figure 4 A flowchart of a method for obtaining software analysis results in continuous integration provided in an embodiment. Among them, the memory stores full analysis results or incremental analysis results of several versions of software. Several refers to one or more. The full analysis result is a complete analysis result for the software, and the incremental analysis result contains the change execution logic of the full analysis result of the corresponding version of the software relative to the full analysis result of the historical version of the software. The method can be executed by a computer device, and specifically includes the following steps.

[0119] Step S410, determining the second version software S2 for which the analysis result is to be obtained. The second version software S2 may be any version of software generated in continuous integration, or may be the current latest version software. The analysis result of the second version software S2 has been determined and stored in the memory.

[0120] Step S420, when the memory stores the full analysis result of the second version software S2, the full analysis result can be directly read from the memory. When the memory stores the incremental analysis result of the second version software S2, the full analysis result of the latest third historical version software H3 and the incremental analysis results corresponding to several historical versions of software between the third historical version software H3 and the second version software S2 are read from the memory. The data read from the memory can be stored in the cache or memory.

[0121] The third historical version software H3 is the historical version software with full analysis results and closest to the second version software S2. There may be one or more historical versions of software between the third historical version software H3 and the second version software S2, or there may be no historical version software, that is, the third historical version software H3 is the previous historical version software of the second version software S2. Therefore, the incremental analysis results read in this step are one or more.

[0122] Step S430, using a plurality of incremental analysis results and the full analysis result of the third historical version software H3, determine the full analysis result of the second version software S2.

[0123] When executing step S430, the full analysis result of the previous historical version software and the incremental analysis result of the current version software can be logically merged in order from the third historical version software H3 to the second version software S2 to determine the full analysis result of the current version software until the full analysis result of the second version software S2 is determined. For the specific implementation process, please refer to the description of step 2 in the above content.

[0124] When the change execution logic of the incremental analysis result includes a delete operation and an add operation for a certain element (for example, the first element), the first element in the full analysis result of the previous historical version of the software is first deleted and then added. This ensures the completeness of the execution result.

[0125] In each of the above embodiments, the received input and external output are existing elements in continuous integration, so the method can be deployed in any continuous integration process without affecting the scalability of the continuous integration system. In addition, the analysis system based on the full amount usually already exists, and the steps in the incremental analysis are simple and easy to use, so the existing analysis system can be quickly changed, so as to quickly launch the incremental analysis function. The incremental analysis results saved in the storage stage of this embodiment not only maintain the completeness of the analysis, but also reduce the storage overhead.

[0126] In this specification, the word "first" in terms such as first version software, first historical version software, first element and first method, as well as the word "second" in the text are merely for the convenience of distinction and description and do not have any limiting meaning.

[0127] The foregoing describes certain embodiments of the present specification, and other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims may be performed in an order different from that in the embodiments, and the desired results may still be achieved. In addition, the processes depicted in the accompanying drawings do not necessarily have to be performed in the specific order or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0128] Figure 5 A schematic block diagram of a device for analyzing software in continuous integration provided in an embodiment. Figure 1 The method embodiment shown corresponds to the embodiment shown in the figure. The apparatus 500 is deployed in a computer device, and includes:

[0129] A change determination module 510, configured to determine a code change record of the first version of software to be analyzed relative to the first historical version of software;

[0130] The analysis acquisition module 520 is configured to acquire the full analysis result of the first historical version of the software; wherein the full analysis result is a complete analysis result for the software;

[0131] The result determination module 530 is configured to determine the analysis result for the first version of the software based on the code change record and the full analysis result of the first historical version of the software.

[0132] In one implementation, the result determination module 530 is specifically configured as follows:

[0133] The full analysis result of the first historical version of the software is modified using the code change record to determine the full analysis result for the first version of the software.

[0134] In one embodiment, for any one of multiple versions of software, a full analysis result or an incremental analysis result of the version of software is stored in a memory; the incremental analysis result includes the change execution logic of the full analysis result of the version of software relative to the full analysis result of the historical version of software.

[0135] In one implementation, the analysis and acquisition module 520 is specifically configured as follows:

[0136] When the full analysis result of the first historical version of the software is stored in the memory, the full analysis result of the first historical version of the software is directly read from the memory.

[0137] In one embodiment, the analyzed acquisition module 520 includes:

[0138] a reading submodule (not shown in the figure), configured to read, when the memory stores the incremental analysis result of the first historical version of the software, the full analysis result of the most recent second historical version of the software, and the incremental analysis results corresponding to the plurality of historical versions of the software between the second historical version of the software and the first historical version of the software from the memory;

[0139] A determination submodule (not shown in the figure) is configured to determine the full analysis result of the first historical version software using a number of incremental analysis results and the full analysis result of the second historical version software.

[0140] In one implementation, the determination submodule is specifically configured as follows:

[0141] In order from the second historical version software to the first historical version software, the full analysis result of the previous historical version software and the incremental analysis result of the current historical version software are logically merged to determine the full analysis result of the current historical version software.

[0142] In one implementation, the full analysis result includes multiple elements; the determination submodule is specifically configured as follows:

[0143] When the change execution logic of the incremental analysis result includes a deletion operation and an addition operation for the first element, the deletion operation is first performed on the first element in the full analysis result of the previous historical version of the software, and then the addition operation is performed.

[0144] In one implementation, the first historical version software is the previous historical version software of the first version software.

[0145] In one embodiment, the full analysis results or the incremental analysis results are stored in the memory at intervals.

[0146] In one implementation, the result determination module 530 includes:

[0147] A full quantum module (not shown in the figure), configured to modify the full analysis result of the first historical version of the software using the code change record when the analysis result of the first version of the software to be determined is a full analysis result, to obtain the full analysis result of the first version of the software;

[0148] The incremental sub-module (not shown in the figure) is configured to use the code change record to determine the modifications that need to be made to the full analysis results of the first historical version of the software when the analysis result of the first version of the software that needs to be determined is an incremental analysis result, and determine the incremental analysis result of the first version of the software based on the modifications that need to be made.

[0149] In one implementation, the result determination module 530 further includes a judgment submodule (not shown in the figure); the judgment submodule is configured to use the following operations to determine whether the analysis result of the first version of the software to be determined is an incremental analysis result:

[0150] According to a preset interval rule for full analysis results and incremental analysis results, determining whether the analysis result of the first version of the software to be determined is an incremental analysis result; or,

[0151] Based on the received instruction for instructing to determine the incremental analysis result or the full analysis result of the first version of the software, it is determined whether the analysis result of the first version of the software to be determined is the incremental analysis result.

[0152] In one embodiment, the full analysis result includes a method call graph, which includes points representing methods in the software and edges representing call relationships between methods in the software; the code change record includes operation execution logic for the first method in the software; and the incremental submodule is specifically configured as follows:

[0153] Determine, from a method call graph included in the full analysis result of the first historical version of the software, a second method that has a call relationship with the first method;

[0154] Based on the operation execution logic, a change execution logic for the second method is determined, thereby obtaining an incremental analysis result of the first version of the software.

[0155] Figure 6 A schematic block diagram of a device for obtaining software analysis results in continuous integration provided in an embodiment. The memory stores full analysis results or incremental analysis results of several versions of software; the full analysis result is a complete analysis result for the software, and the incremental analysis result includes the change execution logic of the full analysis result of the corresponding version of the software relative to the full analysis result of the historical version of the software. Figure 4 The method embodiment shown corresponds to the embodiment shown in the figure. The apparatus 600 is deployed in a computer device, and includes:

[0156] The software determination module 610 is configured to determine the second version of the software for which the analysis result is to be obtained;

[0157] The analysis and reading module 620 is configured to read, when the incremental analysis result of the second version of the software is stored in the memory, the full analysis result of the most recent third historical version of the software and the incremental analysis results corresponding to the plurality of historical versions of the software between the third historical version of the software and the second version of the software from the memory;

[0158] The full determination module 630 is configured to determine the full analysis result of the second version of the software by using a plurality of incremental analysis results and the full analysis result of the third historical version of the software.

[0159] In one implementation, the full amount determination module 630 is specifically configured as follows:

[0160] In order from the third historical version software to the second version software, the full analysis result of the previous historical version software and the incremental analysis result of the current version software are logically merged to determine the full analysis result of the current version software.

[0161] In one implementation, the full amount analysis result includes multiple elements; the full amount determination module 630 is specifically configured as follows:

[0162] When the change execution logic of the incremental analysis result includes a deletion operation and an addition operation for the first element, the deletion operation is first performed on the first element in the full analysis result of the previous historical version of the software, and then the addition operation is performed.

[0163] The above-mentioned device embodiments correspond to the method embodiments. For specific descriptions, please refer to the description of the method embodiments, which will not be repeated here. The device embodiments are obtained based on the corresponding method embodiments and have the same technical effects as the corresponding method embodiments. For specific descriptions, please refer to the corresponding method embodiments.

[0164] The present specification also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed in a computer, the computer is caused to execute Figures 1 to 4 Any of the methods described above.

[0165] The embodiment of the present specification also provides a computing device, including a memory and a processor, wherein the memory stores an executable code, and when the processor executes the executable code, Figures 1 to 4 Any of the methods described above.

[0166] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the storage medium and computing device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0167] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present invention may be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions may be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.

[0168] The specific implementation methods described above further describe the purpose, technical solutions and beneficial effects of the embodiments of the present invention in detail. It should be understood that the above description is only a specific implementation method of the embodiments of the present invention and is not intended to limit the scope of protection of the present invention. Any modification, equivalent replacement, improvement, etc. made on the basis of the technical solution of the present invention shall be included in the scope of protection of the present invention.

Claims

1. A method for analyzing software in continuous integration, for any one of multiple versions of software, storing a full analysis result or an incremental analysis result of the version of software in a memory, wherein the full analysis result or the incremental analysis result is stored in the memory at intervals; The full analysis result is a complete analysis result for the software, and the incremental analysis result includes the change execution logic of the full analysis result of the version of the software relative to the full analysis result of the historical version of the software; the method includes: Determine the code change record of the first version of the software to be analyzed relative to the first historical version of the software; When the memory stores the incremental analysis result of the first historical version software, the full analysis result of the most recent second historical version software and the incremental analysis results corresponding to several historical versions of software between the second historical version software and the first historical version software are read from the memory; the full analysis result of the first historical version software is determined by using the several incremental analysis results and the full analysis result of the second historical version software; Based on the code change record and the full analysis result of the first historical version of the software, an analysis result for the first version of the software is determined.

2. According to the method of claim 1, the step of determining the analysis result for the first version of the software comprises: The full analysis result of the first historical version of the software is modified using the code change record to determine the full analysis result for the first version of the software.

3. The method according to claim 1, further comprising: When the full analysis result of the first historical version of the software is stored in the memory, the full analysis result of the first historical version of the software is directly read from the memory.

4. According to the method of claim 1, the step of determining the full analysis result of the first historical version of the software comprises: In order from the second historical version software to the first historical version software, the full analysis result of the previous historical version software and the incremental analysis result of the current historical version software are logically merged to determine the full analysis result of the current historical version software.

5. According to the method of claim 4, the full analysis result includes multiple elements; the step of determining the full analysis result of the current historical version of the software by logically combining the full analysis result of the previous historical version of the software with the incremental analysis result of the current historical version of the software comprises: When the change execution logic of the incremental analysis result includes a deletion operation and an addition operation for the first element, the deletion operation is first performed on the first element in the full analysis result of the previous historical version of the software, and then the addition operation is performed.

6. According to the method of claim 3 or 1, the first historical version software is the previous historical version software of the first version software.

7. The method according to claim 1, wherein the step of determining the analysis result for the first version of the software comprises: When the analysis result of the first version of the software to be determined is a full analysis result, the full analysis result of the first historical version of the software is modified using the code change record to obtain the full analysis result of the first version of the software; When the analysis result of the first version of the software to be determined is an incremental analysis result, the code change record is used to determine the modifications that need to be made to the full analysis result of the first historical version of the software, and the incremental analysis result of the first version of the software is determined based on the modifications that need to be made.

8. The method according to claim 7, wherein the following method is used to determine whether the analysis result of the first version of the software to be determined is an incremental analysis result: According to a preset interval rule for full analysis results and incremental analysis results, determining whether the analysis result of the first version of the software to be determined is an incremental analysis result; or, Based on the received instruction for instructing to determine the incremental analysis result or the full analysis result of the first version of the software, it is determined whether the analysis result of the first version of the software to be determined is the incremental analysis result.

9. The method according to claim 7, wherein the full analysis result includes a method call graph, wherein the method call graph includes points representing methods in the software and edges representing call relationships between methods in the software; The code change record includes operation execution logic for a first method in the software; The step of using the code change record to determine the modifications that need to be made to the full analysis result of the first historical version of the software, and determining the incremental analysis result of the first version of the software based on the modifications that need to be made, includes: Determine, from a method call graph included in the full analysis result of the first historical version of the software, a second method that has a call relationship with the first method; Based on the operation execution logic, a change execution logic for the second method is determined, thereby obtaining an incremental analysis result of the first version of the software.

10. A method for obtaining software analysis results in continuous integration, wherein: The memory stores full analysis results or incremental analysis results of several versions of software, and the full analysis results or incremental analysis results are stored in the memory at intervals; the full analysis result is a complete analysis result for the software, and the incremental analysis result includes the change execution logic of the full analysis result of the corresponding version of the software relative to the full analysis result of the historical version of the software; the method includes: Determine the second version of the software for obtaining the analysis results; When the memory stores the incremental analysis result of the second version of the software, the full analysis result of the latest third historical version of the software and the incremental analysis results corresponding to several historical versions of the software between the third historical version of the software and the second version of the software are read from the memory; The full analysis result of the second version of the software is determined by using several incremental analysis results and the full analysis result of the third historical version of the software.

11. According to the method of claim 10, the step of determining the full analysis result of the second version of the software comprises: In order from the third historical version software to the second version software, the full analysis result of the previous historical version software and the incremental analysis result of the current version software are logically merged to determine the full analysis result of the current version software.

12. According to the method of claim 11, the full analysis result includes multiple elements; the step of determining the full analysis result of the current historical version of the software by logically combining the full analysis result of the previous historical version of the software with the incremental analysis result of the current historical version of the software comprises: When the change execution logic of the incremental analysis result includes a deletion operation and an addition operation for the first element, the deletion operation is first performed on the first element in the full analysis result of the previous historical version of the software, and then the addition operation is performed.

13. A device for analyzing software in continuous integration, storing, for any one of a plurality of versions of software, a full analysis result or an incremental analysis result of the version of software in a memory, wherein the full analysis result or the incremental analysis result is stored in the memory at intervals; The full analysis result is a complete analysis result for the software, and the incremental analysis result includes the change execution logic of the full analysis result of the version of the software relative to the full analysis result of the historical version of the software; the device includes: A change determination module, configured to determine a code change record of a first version of software to be analyzed relative to a first historical version of software; The analysis acquisition module is configured to read the full analysis result of the most recent second historical version software and the incremental analysis results corresponding to several historical versions of software between the second historical version software and the first historical version software from the memory when the incremental analysis result of the first historical version software is stored in the memory; determine the full analysis result of the first historical version software by using the several incremental analysis results and the full analysis result of the second historical version software; The result determination module is configured to determine the analysis result for the first version of the software based on the code change record and the full analysis result of the first historical version of the software.

14. A device for obtaining software analysis results in continuous integration, wherein: The memory stores full analysis results or incremental analysis results of several versions of software, and the full analysis results or incremental analysis results are stored in the memory at intervals; the full analysis result is a complete analysis result for the software, and the incremental analysis result includes the change execution logic of the full analysis result of the corresponding version of the software relative to the full analysis result of the historical version of the software; the device includes: A software determination module, configured to determine a second version of software for which analysis results are to be obtained; an analysis and reading module configured to read, when the memory stores the incremental analysis result of the second version of the software, the full analysis result of the most recent third historical version of the software and the incremental analysis results corresponding to the respective multiple historical versions of the software between the third historical version of the software and the second version of the software from the memory; The full determination module is configured to determine the full analysis result of the second version software by using several incremental analysis results and the full analysis result of the third historical version software.

15. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method according to any one of claims 1 to 12.

16. A computing device, comprising a memory and a processor, wherein the memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 12 is implemented.