CN115840695A - Method and device for analyzing software in continuous integration - Google Patents

Method and device for analyzing software in continuous integration Download PDF

Info

Publication number
CN115840695A
CN115840695A CN202211482609.8A CN202211482609A CN115840695A CN 115840695 A CN115840695 A CN 115840695A CN 202211482609 A CN202211482609 A CN 202211482609A CN 115840695 A CN115840695 A CN 115840695A
Authority
CN
China
Prior art keywords
software
analysis result
full
version
version software
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
Application number
CN202211482609.8A
Other languages
Chinese (zh)
Inventor
赵泽林
徐兆桂
汤震浩
李永超
狄鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alipay Hangzhou Information Technology Co Ltd
Original Assignee
Alipay Hangzhou Information Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Alipay Hangzhou Information Technology Co Ltd filed Critical Alipay Hangzhou Information Technology Co Ltd
Priority to CN202211482609.8A priority Critical patent/CN115840695A/en
Publication of CN115840695A publication Critical patent/CN115840695A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

The embodiment of the specification provides a method and a device for analyzing software in continuous integration. In the method, the memory may store full or incremental analysis results for each version of software. The execution equipment determines a code change record of the new version software to be analyzed relative to the old version software, acquires a full analysis result of the old version software based on an analysis result stored in the memory, and determines an analysis result aiming at the first version software based on the code change record and the full analysis result of the first historical version software. If the first historical version is the incremental analysis result, the full-scale analysis result of the first historical version can be determined by using the incremental analysis result.

Description

Method and device for analyzing software in continuous integration
Technical Field
One or more embodiments of the present disclosure relate to the field of computer technologies, and in particular, to a method and an apparatus for analyzing software in persistent integration.
Background
For a software system, such as enterprise-level software, the development process may include Continuous Integration (CI), continuous Delivery (Continuous Delivery), and Continuous Deployment (Continuous Delivery). Among them, continuous integration is a software development practice, and during the update iteration of software, development members often integrate their works through automated construction in order to find errors in integration as soon as possible. The continuous integration process of the software is a process of continuously updating and iterating a plurality of versions of software. After each new version of software is obtained, the software needs to be analyzed and tested based on the analysis result. And the testing process before the delivery of the new version software plays a crucial role in guaranteeing the software quality. When software systems are bulky and complex, analysis of rapidly updated different versions of software will present new challenges. Moreover, enterprises pay more and more attention to protection of private data of respective software, and software analysis cannot be directly handed to third parties for implementation.
Therefore, it would be desirable to have an improved solution for a voluminous software system that allows for faster analysis of the software.
Disclosure of Invention
One or more embodiments of the present specification describe a method and apparatus for analyzing software in a continuous integration to enable more rapid analysis of software when faced with a large volume of software systems. The specific technical scheme is as follows.
In a first aspect, an embodiment provides a method for analyzing software in persistent integration, the method including:
determining a code change record of a first version of software to be analyzed relative to a first historical version of software;
acquiring a full analysis result of the first historical version software; wherein the full analysis result is a complete analysis result for the software;
determining an analysis result for the first version of software based on the code change record and a full analysis result of the first historical version of software.
In one embodiment, the step of determining the analysis results for the first version of software comprises:
and modifying the full-scale analysis result of the first historical version software by using the code change record, and determining the full-scale analysis result aiming at the first version software.
In one embodiment, for any one of a plurality of versions of software, storing in memory the results of a full or incremental analysis of that version of software; the incremental analysis result comprises change execution logic of the full analysis result of the version software relative to the full analysis result of the historical version software.
In one embodiment, the step of obtaining the result of the full-scale analysis of the first historical version of software includes:
when the full analysis result of the first historical version software is stored in the memory, the full analysis result of the first historical version software is directly read from the memory.
In one embodiment, the step of obtaining the result of the full-scale analysis of the first historical version of software includes:
when the increment analysis result of the first historical version software is stored in the memory, reading the latest full analysis result of the second historical version software from the memory and the increment analysis results corresponding to a plurality of pieces of historical version software from the second historical version software to the first historical version software respectively;
and determining the full analysis result of the first historical version software by using a plurality of incremental analysis results and the full analysis result of the second historical version software.
In one embodiment, the step of determining the result of the full-scale analysis of the first historical version of software comprises:
and sequentially utilizing the logic combination of the full analysis result of the previous historical version software and the incremental analysis result of the current historical version software according to the sequence from the second historical version software to the first historical version software to determine the full analysis result of the current historical version software.
In one embodiment, the result of the full-scale analysis comprises a plurality of elements; the step of determining the full analysis result of the current historical version software by logically combining the full analysis result of the previous historical version software and the incremental analysis result of the current historical version software comprises the following steps:
and when the change execution logic of the incremental analysis result comprises a deleting operation and an adding operation aiming at a first element, firstly deleting the first element and then adding the first element in the full analysis result of the previous historical version software.
In one embodiment, the first historical version of software is a previous historical version of software of the first version of software.
In one embodiment, the full or incremental analysis results are stored in the memory at intervals.
In one embodiment, the step of determining the analysis results for the first version of software comprises:
when the analysis result of the first version software needing to be determined is a full analysis result, modifying the full analysis result of the first historical version software by using the code change record to obtain the full analysis result of the first version software;
when the analysis result of the first version software needing to be determined is an incremental analysis result, determining that the modification to the full-scale analysis result of the first historical version software is needed by using the code change record, and determining the incremental analysis result of the first version software based on the modification needed.
In one embodiment, whether the analysis result of the first version of software to be determined is an incremental analysis result is determined in the following manner:
judging whether the analysis result of the first version software to be determined is an incremental analysis result or not according to a preset interval rule aiming at a full analysis result and an incremental analysis result; alternatively, the first and second electrodes may be,
and judging whether the analysis result of the first version software needing to be determined is an incremental analysis result or not based on the received instruction for indicating to determine the incremental analysis result or the full-scale analysis result of the first version software.
In one embodiment, the full scale analysis results include a method call graph comprising points representing methods in the software and edges characterizing call relationships between the methods in the software; the code change record comprises operation execution logic for a first method in software;
the step of determining that modifications are required to be made to the full-scale analysis result of the first historical version software using the code change record, and determining the incremental analysis result of the first version software based on the modifications required to be made, includes:
determining a second method having a calling relationship with the first method from a method calling graph contained in a full analysis result of the first historical version software;
and determining change execution logic of the second method based on the operation execution logic so as to obtain the increment analysis result of the first version of software.
In a second aspect, an embodiment provides a method for obtaining software analysis results in persistent integration, where a memory stores full analysis results or incremental analysis results of several versions of software; the full analysis result is a complete analysis result aiming at the software, and the incremental analysis result comprises the change execution logic of the full analysis result of the corresponding version software relative to the full analysis result of the historical version software; the method comprises the following steps:
determining second version software of an analysis result to be obtained;
when the incremental analysis result of the second version software is stored in the memory, reading the latest full analysis result of the third history version software and the incremental analysis results corresponding to a plurality of history version software from the third history version software to the second version software from the memory;
and determining the full analysis result of the second version software by using a plurality of incremental analysis results and the full analysis result of the third history version software.
In one embodiment, the step of determining the result of the full-scale analysis of the second version of software comprises:
and sequentially utilizing the logic combination of the full analysis result of the previous historical version software and the incremental analysis result of the current version software according to the sequence from the third historical version software to the second version software to determine the full analysis result of the current version software.
In one embodiment, the result of the full-scale analysis comprises a plurality of elements; the step of determining the full analysis result of the current historical version software by logically combining the full analysis result of the previous historical version software and the incremental analysis result of the current historical version software comprises the following steps:
and when the change execution logic of the incremental analysis result comprises a deleting operation and an adding operation aiming at a first element, firstly deleting the first element and then adding the first element in the full analysis result of the previous historical version software.
In a third aspect, an embodiment provides an apparatus for analyzing software in persistent integration, the apparatus including:
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 acquire a full analysis result of the first historical version software; wherein the full analysis result is a complete analysis result for the software;
a result determination module configured to determine an analysis result for the first version of software based on the code change record and a full analysis result of the first historical version of software.
In a fourth aspect, an embodiment provides an apparatus for obtaining software analysis results in persistent integration, where a 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 comprises a change execution logic of the full analysis result of the corresponding version software relative to the full analysis result of the historical version software; the device comprises:
the software determining module is configured to determine second version software of an analysis result to be obtained;
the analysis reading module is configured to read a recent full analysis result of a third historical version software and incremental analysis results corresponding to a plurality of historical version software from the third historical version software to the second version software respectively from the memory when the incremental analysis result of the second version software is stored in the memory;
and the full amount determination module is configured to determine the full amount analysis result of the second version software by using a plurality of incremental analysis results and the full amount analysis result of the third history version software.
In a fifth aspect, embodiments provide a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the method of any one of the first and second aspects.
In a sixth aspect, an embodiment provides a computing device, which includes a memory and a processor, where the memory stores executable code, and the processor executes the executable code to implement the method of any one of the first aspect and the second aspect.
In the method and the device provided by the embodiment of the specification, the analysis result of the new version software is determined based on the specific content of the code change and the full analysis result of the old version software, the software analysis is only carried out based on the specific content of the code change on the basis of the complete analysis result of the old version software, and the whole new version software is not required to be analyzed again, so that the software analysis efficiency is improved, and particularly when a large-volume software system is faced, the software analysis efficiency can be remarkably improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. It is obvious that the drawings in the following description are only some embodiments of the invention, and that for a person skilled in the art, other drawings can be derived from them without inventive effort.
FIG. 1 is a schematic flowchart of a method for analyzing software in persistent integration according to an embodiment;
FIG. 2 is a block diagram of a framework for interval storage of full and incremental analysis results provided in one embodiment;
FIG. 3 is a schematic diagram of a method call graph;
FIG. 4 is a flowchart illustrating a method for obtaining software analysis results in persistent integration according to an embodiment;
FIG. 5 is a schematic block diagram of an apparatus for analyzing software in persistent integration according to an embodiment;
fig. 6 is a schematic block diagram of an apparatus for obtaining a result of software analysis in persistent integration according to an embodiment.
Detailed Description
The scheme provided by the specification is described below with reference to the accompanying drawings.
Software is a collection of computer data and instructions organized in a specific order, both as non-tangible parts of the computer, as well as computer programs, procedures, rules, and possibly files, documents, and data related to the operation of the computer system. The computer realizes various functions under the mutual cooperation of software and hardware, and achieves certain performance.
In some applications, including but not limited to enterprise level software, the development process can be summarized as CI/CD, where CI is persistent integration and CD includes persistent delivery and persistent deployment. In the CI phase, the same software is continuously updated and iterated by developers, and different versions of software are continuously developed. The new version software needs to be tested, modified and the like to realize delivery. Generally, analyzing the new version software and obtaining the analysis result are processes which need to be relied on when testing the new version software. For large, complex software, frequent and complete software analysis of new versions of software is time consuming and memory consuming.
In order to improve the efficiency of software analysis, the embodiments of the present specification provide a software analysis method. The following describes an embodiment of the present specification with reference to fig. 1.
Fig. 1 is a schematic flowchart of a method for analyzing software in persistent integration according to an embodiment. The method may be performed by a computer device that may be implemented by any apparatus, device, platform, cluster of devices, etc. having computing, processing capabilities. The method comprises the following steps.
Step S110, determining a code change record of the first version software S1 to be analyzed relative to the first historical version software H1.
The first version of software S1 may be any version of software generated in the persistent integration. In the continued integration of software, there are different versions of software produced. Generally, software may be distinguished between different versions by version number, which may be encoded in sequence, e.g., version 1.0 software, version 2.0 software, version 3.0 software, and so on. The first version of software S1 may be the current latest version of software and one or more versions of software that precede the first version of software S1 may all be referred to as historic version of software.
The first historical version software H1 may be any one of several historical versions of software. Typically, software updates are based on the last version of software. Thus, the first historical version software H1 may be the last historical version software of the first version software S1. This makes it easier to determine the code change record. The first history version software H1 may also be other history version software than the last history version software.
The software may be implemented by written code. The code may contain various elements, such as methods and calling relationships between methods. The method may also be referred to as a function. Functions include, but are not limited to, summation functions, ordering functions, and rounding functions, among others.
The code change record represents the difference between the first version software S1 and the first historical version software H1. The code change record may include logic to perform operations on one or more methods in the software, such as deleting or adding a method, deleting or adding call relationships between methods, and so forth.
The code change record may be read directly from a certain storage space. For example, when the first version software S1 is developed or generated, a code change record of the first version software S1 with respect to the previous history version software is generated and stored in the storage space. The code change record may be determined according to a comparison between the first version software S1 and the first historical version software H1 when the step S110 is executed.
Step S120, acquiring a full analysis result of the first historical version software H1. Wherein the full analysis result is a complete analysis result for the software.
The full-scale analysis result may contain contents such as a method call graph and/or a data flow analysis for the software. The method call graph comprises points representing methods in the software and edges representing call relations between the methods in the software. The data flow analysis comprises semantic information of a program in the software and definition and use of variables in the program. Data flow analysis can help to understand programs and discover behavior of software when it is running without actually running the software.
To summarize, the results of the full-scale analysis may contain multiple elements. For example, methods in software and call relationships between methods may be included.
Step S130, based on the code change record and the result of the full-scale analysis of the first historical version software H1, determines the result of the analysis for the first version software S1.
During execution of this step, the full analysis result of the first historical version software H1 may be modified by using the code change record, and the full analysis result for the first version software S1 may be determined. For example, the corresponding element in the full-scale analysis result is modified by the operation execution logic included in the code change record, so that the modified full-scale analysis result is determined as the full-scale analysis result of the first version software S1.
In one embodiment, the code change record may be used to determine that the modification to be performed on the full-scale analysis result is required, and the modification to be performed and the full-scale analysis result of the first historical version software H1 may be used together as the full-scale analysis result of the first version software S1, and the modification to be performed may not be implemented in the full-scale analysis result of the first historical version software H1. Such an embodiment is also possible.
The specific implementation of this step may include various embodiments, and it is possible to implement the analysis of the first version software S1 based on the code change record and the full analysis result of the first historical version software H1.
In this embodiment, on the basis of the full analysis result of the old version software, software analysis is performed based on the specific content of the code change, and it is not necessary to perform complete analysis on the entire new version software again, but only the changed part needs to be analyzed, so that the efficiency of software analysis can be improved, and the consumption of memory in determining the analysis result is also reduced.
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 to determine whether malicious code, hidden program error (bug), content that is not desired to be accessed by the program, and the like exist in the first version software S1. The analysis result may be stored in a nonvolatile memory, and when the first version software S1 needs to be tested, the analysis result may be read from the memory.
In the continuous integration process of the software, the update iteration process of the software can be very frequent, and the content of code update is not much. The full analysis results of a large number of versions of the software are stored in the memory one by one, which occupies a large storage space and causes storage space waste.
In order to reduce the waste of the storage space and improve the efficiency of software analysis, the specification also provides another embodiment. In this embodiment, for any one of a plurality of versions of software, such as a certain version of software a, the full-volume analysis result or the incremental analysis result of the version of software a is stored in the memory. The analysis result comprises a full analysis result or an incremental analysis result, and the incremental analysis result comprises the change execution logic of the full analysis result of the version software a relative to the full analysis result of the historical version software.
In one embodiment, for multiple versions of software, the analysis result may be determined in such a manner that a full analysis result is determined by the multiple versions of software in succession and an incremental analysis result is determined by the multiple versions of software in succession, that is, the analysis result may be stored in such a manner that the full analysis result is stored by the multiple versions of software in succession and the incremental analysis result is stored by the multiple versions of software in succession.
The full or incremental analysis results may be stored in the memory at intervals. In one embodiment, the full-scale analysis results and the incremental analysis results may be determined and stored according to a preset interval rule, for example, n full-scale analysis results and m incremental analysis results alternately appear at intervals. Both n and m are natural numbers, for example n is 1,m is 3, 4 or 5. Or, the execution subject determines and stores the full analysis result or the incremental analysis result of the software according to the received instruction, wherein the instruction can be sent according to the interval rule.
FIG. 2 is a block diagram of the interval storage of full and incremental analysis results according to an embodiment. Wherein, the software updating sequence is as follows: version 1 software, version 2 software, version 3 software, version 4 software, etc. The memory stores the full analysis result of version 1 software, the increment analysis result of version 2 software and the increment analysis result of version 3 software. The analysis results of the version 4 software have not been stored.
In this embodiment, the first historical version software H1 may be a historical version with a full amount of analysis results selected from a plurality of historical version software, which may or may not be the last historical version software of the first version software S1. When the first historical version software H1 is not the last historical version software, the code change record determined in step S110 is also not a code change record of the first version software S1 with respect to the last historical version software.
In one embodiment, the first historical version of software H1 is the last historical version of software, and the memory stores either the full or incremental analysis of the first historical version of software H1.
In performing step S120, it may be determined whether the full-volume analysis result or the incremental analysis result of the first historical version software H1 is stored in the memory based on the meta information.
When the full analysis result of the first historical version software H1 is stored in the memory, the full analysis result of the first historical version software H1 is directly read from the memory.
When the incremental analysis result of the first historical version software H1 is stored in the memory, the full-scale analysis result of the first historical version software H1 can be determined according to the following steps 1 and 2.
Step 1, reading a latest full analysis result of the second historical version software H2 and incremental analysis results corresponding to a plurality of pieces of historical version software between the second historical version software H2 and the first historical version software H1 from a memory.
And 2, determining the full analysis result of the first historical version software H1 by using the plurality of incremental analysis results and the full analysis result of the second historical version software H1.
In step 1 described above, the second history version software H2 is the history version software having the result of the full-scale analysis and being closest to the first history version software H1. There may be one or more historical versions of software between the second historical version of software H2 and the first historical version of software H1, or there may be no historical version of software, i.e., the second historical version of software H2 is the last historical version of software of the first historical version of software H1. Therefore, the incremental analysis result read in step 1 is one or more.
When the step 2 is executed, the total analysis result of the current historical version software may be determined by sequentially using the logical combination of the total analysis result of the previous historical version software and the incremental analysis result of the current historical version software in the order from the second historical version software H2 to the first historical version software H1 until the total analysis result of the first historical version software H1 is determined. Specifically, assuming that version a, version b, and version c software still exist between the second historical version software H2 and the first historical version software H1, the version a software may be used as the current historical version software, the full-scale analysis result of the second historical version software H2 and the incremental analysis result of the version a software are logically combined to obtain the full-scale analysis result of the version a software, the version a software may be used as the previous historical version software, the version b software may be used as the current historical version software, the logical combination of the full-scale analysis result of the previous historical version software and the incremental analysis result of the current historical version software is repeatedly executed, the step of determining the full-scale analysis result of the current historical version software is performed until the full-scale analysis result of the first historical version software H1 is determined, and the cycle is ended.
For example, in fig. 2, assuming that the version 4 software is the first version software S1 and the version 3 software is the first historical version software H1, the historical version software closest to the version 3 software and having the full-scale analysis result is the version 1 software, and the version 2 software is included between the version 1 software and the version 3 software, so that the full-scale analysis result of the version 1 software and the incremental analysis result of the version 2 software can be read from the memory. And determining the full-scale analysis result of the version 3 software by using the increment analysis result and the full-scale analysis result. Specifically, the incremental analysis result and the full analysis result may be logically combined, so as to obtain the full analysis result of the version 3 software.
When the result of the full-scale analysis contains different contents, the specific implementation of the logic combination of the result of the full-scale analysis and the result of the incremental analysis will be different. For example, a plurality of elements included in the result of the full-scale analysis may be methods in software, call relationships between methods, and the like.
When the change execution logic includes a delete operation and an add operation for a certain element (e.g., a first element) or certain elements, in order to ensure completeness of the execution result, when the full analysis result and the increment analysis result are logically merged, the delete operation and then the add operation may be performed for the first element in the full analysis result. If the adding operation is performed first and then the deleting operation is performed, the added content may be added inefficiently because the added content is originally in the method call graph, and the content which should not be deleted is deleted by performing the deleting operation again, so that the related content is lost as a final result. The deletion operation is performed first and then the addition operation is performed, so that the problem can be effectively avoided, and the completeness of an execution result is improved.
In the process of executing the deleting operation, whether each element is illegal in the current version software (namely, the new version software) can be detected, and if the elements are illegal, the deleting operation is executed; if not, other determinations can be continued.
In this embodiment, when step S130 is executed, it may be determined whether the analysis result of the first version software S1 to be determined is an incremental analysis result or a full-scale analysis result. In one embodiment, whether the analysis result of the first version software S1 to be determined is an incremental analysis result may be determined in one of the following manners:
judging whether the analysis result of the first version software S1 required to be determined is an incremental analysis result or not according to a preset interval rule aiming at a full analysis result and an incremental analysis result;
and judging whether the analysis result of the first version software S1 needing to be determined is an incremental analysis result or not based on the received instruction for indicating to determine the incremental analysis result or the full analysis result of the first version software S1.
For example, the interval rule between the full quantity analysis result and the incremental analysis result is that 1 full quantity analysis result is generated after every 5 incremental analysis results, then the number k of the generated incremental analysis results after the current closest 1 full quantity analysis result is determined according to the meta information, and 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.
The executing agent may detect the received instruction, and determine that the analysis result of the first version software S1 that needs to be determined is an incremental analysis result if the instruction indicates that the incremental analysis result is to be determined next. If the instruction indicates that the full-scale analysis result is to be determined next, the analysis result of the first version software S1 that needs to be determined is determined to be the full-scale analysis result. The instruction may be sent to the execution main body by other devices, or may be obtained by the execution main body based on an input operation of a research and development worker.
When the full-scale analysis result of the first version software S1 needs to be determined in the step S130, the full-scale analysis result of the first historical version software H1 may be modified by using the code change record, so as to obtain the full-scale analysis result of the first version software S1. That is, on the basis of 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.
When the incremental analysis result of the first version software S1 needs to be determined, the code change record is used for determining that the modification needs to be carried out on the full-scale 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 modification needing to be carried out. That is, the code change record is used to determine which modifications need to be made to the full-scale analysis result of the old version software, and the full-scale analysis result is not directly modified. After determining which modifications need to be made, the results of the incremental analysis of the new version of software can be determined based on the modifications.
Taking fig. 2 as an example, a process of determining the result of the full-scale analysis or the result of the incremental analysis of the software is described. Assuming that the version 1 software is the initial software, the complete software analysis can be performed on the version 1 software at this time, so as to obtain the full analysis result of the version 1, and store the full analysis result into the memory. And updating and iterating the version 1 software to obtain version 2 software, and obtaining the code change record 1 of the version 2 software relative to the version 1 software. To determine the incremental analysis results of the full analysis results of the version 2 software relative to the full analysis results of the version 1 software, which are also the most recent full analysis results, may be read from memory. And analyzing by using the code change record 1 and the full analysis result of the version 1 software to obtain an incremental analysis result corresponding to the version 2 software, and storing the incremental analysis result in a memory. The analysis here includes a process of determining, using the code change record 1, that a modification needs to be made to the results of the full-scale analysis of the version 1 software, and determining, based on the modification that needs to be made, the results of the incremental analysis of the version 2 software.
Next, the software is updated continuously, that is, version 3 software is obtained from version 2 software through update iteration, and a code change record 2 of version 3 software relative to version 2 software is obtained. In order to determine the incremental analysis result of the full analysis result of the version 3 software relative to the full analysis result of the version 2 software, the full analysis result of the version 1 software and the incremental analysis result of the version 2 software may be read from the memory, and the full analysis result of the version 1 software and the incremental analysis result of the version 2 software are logically combined to obtain the full analysis result of the version 2 software. And then, analyzing by using the code change record 2 and the full analysis result of the version 2 software to obtain an incremental analysis result corresponding to the version 3 software, and storing the incremental analysis result in a memory.
Similarly, when determining the incremental analysis result corresponding to the version 4 software, the full-scale analysis result of the version 1 software, the incremental analysis result of the version 2 software, and the incremental analysis result of the version 3 software, which are read from the memory, need to be logically combined to obtain the full-scale analysis result of the version 3 software. Then, the full analysis results of the code change record 3 and the version 3 software are used for analysis, so that an incremental analysis result corresponding to the version 4 software is obtained and can be stored in a memory.
The following describes a process of determining a modification that needs to be made to the full-scale analysis result of the old version software using the code change record, and a process of determining an incremental analysis result using the modification, by taking a method call graph included in the full-scale analysis result as an example.
The method call graph includes points representing methods in the software and edges characterizing call relationships between the methods in the software, and the code change record includes logic for performing operations on one or more methods in the software. For clarity, the first method is taken as an example. Operating the execution logic may include deleting or adding the first method.
During execution, a second method having a calling relationship with the first method can be determined from a method call graph included in the full-scale analysis result of the first historical version software H1, and change execution logic for the second method can be determined based on operation execution logic in the code change record, so as to obtain an incremental analysis result of the first version software S1.
For example, when the operation execution logic is to delete a first method, all second methods that have a calling relationship with the first method may be determined from the method call graph, so that the modifications that need to be made include: all edges between the second method and the first method are deleted. When the operation execution logic is to add a first method, determining all second methods having a calling relationship with the first method from the method call graph, so that the modification to be made comprises: edges are added between all second methods and the first method.
FIG. 3 is a schematic diagram of a method call graph. The dots represent methods in the software, and the edges between the dots and the direction of the edges represent calling relations between the methods in the software. For example, when method 1 in the method call graph shown in fig. 3 needs to be deleted, it may be determined that methods having a call relationship with method 1 include method 2, method 3, and method 5, and thus it may be determined that modifications to the method call graph need to be made include: delete method 1 and delete edges between method 1 and method 2, method 3 and method 5, respectively.
When the modification to be performed includes change logic to be performed on the method call graph (i.e., the full-scale analysis result), the modification to be performed may be directly used as the incremental analysis result. When the modification to be performed does not have the above change execution logic (for example, the modification includes no operation such as deletion or addition), or is not expressed according to the set change execution logic, the modification to be performed may be modified, so as to obtain the increment analysis result meeting the requirement. The incremental analysis result contains elements needing to be deleted and elements needing to be added, and the operations of deleting or adding can be marked on the elements in the form of attributes.
The code change record may also contain operation execution logic for call relationships between one or more methods in the software, i.e., contain operation execution logic for edges in the method call graph. For example, a call relationship between a first method and a second method is deleted, or a call relationship between a first method and a second method is added. Such operation execution logic may be used directly as a result of the incremental analysis.
Still taking the method call graph as an example, when determining the full-quantity analysis result, the modification required to be performed can also be determined by adopting the above method, and the method call graph of the new version software can be obtained only by directly applying the modification required to be performed to the method call graph without independently generating an incremental analysis result.
After obtaining the full-scale analysis result or the incremental analysis result of the first version of software S1, the full-scale analysis result may be directly applied to a process such as a software test, or the full-scale analysis result or the incremental analysis result may be stored in a memory so as to be read from the memory when the process such as the software test is required.
In the embodiment, the analysis results of a plurality of versions of software are stored in a full or incremental manner, so that the waste of memory storage space is effectively reduced. Generally, the data volume of the incremental analysis result is much smaller than that of the full analysis result, and only the full analysis result of the partial version software is stored, so that the data volume to be stored can be effectively reduced.
The above embodiments focus on how to determine the full and incremental analysis results when analyzing the software. In the following embodiments, the emphasis will be given on how to determine the full-scale analysis result of a certain version of software based on the incremental analysis result in the memory, wherein the same or similar parts as those of the above embodiments will be briefly described.
Fig. 4 is a flowchart illustrating a method for obtaining a software analysis result in persistent integration according to an embodiment. Wherein, the memory stores the full analysis results or the incremental analysis results of a plurality of versions of software. Several refers to one or more. The full analysis result is a complete analysis result aiming at the software, and the incremental analysis result comprises the change execution logic of the full analysis result of the corresponding version software relative to the full analysis result of the historical version software. The method can be executed by computer equipment and specifically comprises the following steps.
Step S410, determining a second version of software S2 for which an analysis result is to be obtained. The second version of software S2 may be any version of software generated in the persistent integration or may be the current latest version of software. The results of the analysis of the second version of software S2 have been determined and have been stored in memory.
In step S420, when the full-scale analysis result of the second version software S2 is stored in the memory, the full-scale analysis result can be directly read from the memory. When the incremental analysis result of the second version software S2 is stored in the memory, the latest full analysis result of the third history version software H3 and the incremental analysis results corresponding to a plurality of pieces of history version software between the third history version software H3 and the second version software S2 are read from the memory. Data read from the memory may be stored in a cache or in memory.
The third historical version software H3 is the most recent historical version software with the full-scale analysis results from the second version software S2. There may be one or more historical versions of software between the third historical version of software H3 and the second version of software S2, or there may be no historical version of software, i.e., the third historical version of software H3 is the last historical version of software of the second version of software S2. Therefore, the incremental analysis result read in this step is one or more.
And step S430, determining the full-scale analysis result of the second version software S2 by using the plurality of incremental analysis results and the full-scale analysis result of the third history version software H3.
In the step S430, the full-scale analysis result of the current version software may be determined by sequentially using the logical combination of the full-scale analysis result of the previous historical version software and the incremental analysis result of the current version software in the order from the third historical version software H3 to the second version software S2 until the full-scale analysis result of the second version software S2 is determined. The specific implementation process can be seen in the description of step 2 in the above.
When the change execution logic of the incremental analysis result includes a delete operation and an add operation for a certain element (for example, a first element), the delete operation is performed first, and then the add operation is performed for the first element in the full analysis result of the previous historical version software. This ensures the completeness of the execution result.
In the above embodiments, the received input and the external output are existing elements in persistent integration, so the method can be deployed in any persistent integration flow, and the extensibility of the persistent integration system is not affected. In addition, the analysis system based on the full quantity usually exists, and the steps in the incremental analysis have simplicity and usability, so that the existing analysis system can be quickly changed, and the function of the incremental analysis can be quickly online. The incremental analysis result stored in the storage stage of the embodiment can not lose the completeness of analysis, but also reduce the storage overhead,
in this specification, the words "first" in the words first version software, first historical version software, first element and first method, and the words "second" in the words "second" and the like are used for convenience of description and differentiation, and are not to be construed in any limiting sense.
The foregoing describes certain embodiments of the present specification, and other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily have to be in the particular order shown or in sequential order to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
Fig. 5 is a schematic block diagram of an apparatus for analyzing software in persistent integration according to an embodiment. This embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 1. The apparatus 500 is deployed in a computer device, and comprises:
a change determination module 510 configured to determine a code change record of a first version of software to be analyzed relative to a first historical version of software;
an analysis obtaining module 520 configured to obtain a full analysis result of the first historical version software; wherein the full analysis result is a complete analysis result for the software;
a result determination module 530 configured to determine an analysis result for the first version of software based on the code change record and a full analysis result of the first historical version of software.
In one embodiment, the result determining module 530 is specifically configured to:
and modifying the full-scale analysis result of the first historical version software by using the code change record, and determining the full-scale analysis result aiming at the first version software.
In one embodiment, for any one of a plurality of versions of software, storing in memory the results of a full or incremental analysis of that version of software; the incremental analysis result comprises change execution logic of the full analysis result of the version software relative to the full analysis result of the historical version software.
In one embodiment, the analysis obtaining module 520 is specifically configured to:
when the full analysis result of the first historical version software is stored in the memory, the full analysis result of the first historical version software is directly read from the memory.
In one embodiment, the analyzed acquisition module 520 includes:
a reading sub-module (not shown in the figure) configured to, when the incremental analysis result of the first historical version software is stored in the memory, read the latest full-scale analysis result of the second historical version software and the incremental analysis results corresponding to a plurality of pieces of historical version software from the second historical version software to the first historical version software from the memory;
a determining sub-module (not shown in the figure) configured to determine a full-scale analysis result of the first historical version software by using a plurality of incremental analysis results and a full-scale analysis result of the second historical version software.
In one embodiment, the determining submodule is specifically configured to:
and sequentially utilizing the logic combination of the full analysis result of the previous historical version software and the incremental analysis result of the current historical version software according to the sequence from the second historical version software to the first historical version software to determine the full analysis result of the current historical version software.
In one embodiment, the results of the full-scale analysis comprise a plurality of elements; the determination submodule is specifically configured to:
and when the change execution logic of the incremental analysis result comprises a deleting operation and an adding operation aiming at a first element, firstly deleting the first element and then adding the first element in the full analysis result of the previous historical version software.
In one embodiment, the first historical version of software is a previous historical version of software of the first version of software.
In one embodiment, the full or incremental analysis results are stored in the memory at intervals.
In one embodiment, the result determination module 530 includes:
a full-scale sub-module (not shown in the figure) configured to modify the full-scale analysis result of the first historical version software by using the code change record to obtain the full-scale analysis result of the first version software when the analysis result of the first version software to be determined is the full-scale analysis result;
and an increment sub-module (not shown in the figure) configured to determine that a modification needs to be performed on the full-scale analysis result of the first historical version software by using the code change record when the analysis result of the first version software which needs to be determined is an increment analysis result, and determine the increment analysis result of the first version software based on the modification which needs to be performed.
In one embodiment, the result determination module 530 further comprises a judgment sub-module (not shown in the figure); the judgment sub-module is configured to judge whether the analysis result of the first version software to be determined is an incremental analysis result by adopting the following operations:
judging whether the analysis result of the first version software to be determined is an incremental analysis result or not according to a preset interval rule aiming at a full-quantity analysis result and an incremental analysis result; alternatively, the first and second electrodes may be,
and judging whether the analysis result of the first version software needing to be determined is an incremental analysis result or not based on the received instruction for indicating to determine the incremental analysis result or the full-scale analysis result of the first version software.
In one embodiment, the results of the full-scale analysis include a method call graph that includes points representing methods in the software and edges characterizing call relationships between the methods in the software; the code change record comprises operation execution logic for a first method in software; the increment sub-module is specifically configured to:
determining a second method having a calling relationship with the first method from a method calling graph contained in a full analysis result of the first historical version software;
and determining change execution logic of the second method based on the operation execution logic so as to obtain the incremental analysis result of the first version software.
Fig. 6 is a schematic block diagram of an apparatus for obtaining software analysis results in persistent integration according to an embodiment. Wherein, the memory stores the full analysis results or the incremental analysis results of a plurality of versions of software; the full analysis result is a complete analysis result aiming at the software, and the incremental analysis result comprises the change execution logic of the full analysis result of the corresponding version software relative to the full analysis result of the historical version software. This embodiment of the device corresponds to the embodiment of the method shown in fig. 4. The apparatus 600 is deployed in a computer device, and comprises:
a software determination module 610 configured to determine a second version of software for which an analysis result is to be obtained;
an analysis reading module 620, configured to, when the incremental analysis result of the second version software is stored in the memory, read a latest full analysis result of the third historical version software and incremental analysis results corresponding to a plurality of historical version software between the third historical version software and the second version software from the memory;
a full determination module 630 configured to determine a full analysis result of the second version of software using the plurality of incremental analysis results and the full analysis result of the third history version of software.
In one embodiment, the total amount determining module 630 is specifically configured to:
and sequentially utilizing the logic combination of the full analysis result of the previous historical version software and the incremental analysis result of the current version software according to the sequence from the third historical version software to the second version software to determine the full analysis result of the current version software.
In one embodiment, the results of the full-scale analysis comprise a plurality of elements; the total amount determination module 630 is specifically configured to:
and when the change execution logic of the incremental analysis result comprises a deleting operation and an adding operation aiming at a first element, firstly deleting the first element and then adding the first element in the full analysis result of the previous historical version software.
The above device embodiments correspond to the method embodiments, and for specific description, reference may be made to the description of the method embodiments, which is not described herein again. The device embodiment is obtained based on the corresponding method embodiment, has the same technical effect as the corresponding method embodiment, and for the specific description, reference may be made to the corresponding method embodiment.
Embodiments of the present specification also provide a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the method of any one of fig. 1 to 4.
The present specification also provides a computing device, including a memory and a processor, where the memory stores executable code, and the processor executes the executable code to implement the method described in any one of fig. 1 to 4.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the storage medium and the computing device embodiments, since they are substantially similar to the method embodiments, they are described relatively simply, and reference may be made to some descriptions of the method embodiments for relevant points.
Those skilled in the art will recognize that, in one or more of the examples described above, the functions described in connection with the embodiments of the invention may be implemented in hardware, software, firmware, or any combination thereof. When implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium.
The above-mentioned embodiments further describe the objects, technical solutions and advantages of the embodiments of the present invention in detail. It should be understood that the above description is only exemplary of the embodiments of the present invention, and is not intended to limit the scope of the present invention, and any modification, equivalent replacement, or improvement made on the basis of the technical solutions of the present invention should be included in the scope of the present invention.

Claims (19)

1. A method of analyzing software in a continuous integration, the method comprising:
determining a code change record of a first version of software to be analyzed relative to a first historical version of software;
acquiring a full analysis result of the first historical version software; wherein the full analysis result is a complete analysis result for the software;
determining an analysis result for the first version of software based on the code change record and a full analysis result of the first historical version of software.
2. The method of claim 1, the step of determining an analysis result for the first version of software, comprising:
and modifying the full-scale analysis result of the first historical version software by using the code change record, and determining the full-scale analysis result aiming at the first version software.
3. The method of claim 1, storing in memory, for any one of a plurality of versions of software, a full or incremental analysis of that version of software; the incremental analysis result includes 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.
4. The method of claim 3, the step of obtaining results of a full analysis of the first historical version of software comprising:
when the full analysis result of the first historical version software is stored in the memory, the full analysis result of the first historical version software is directly read from the memory.
5. The method of claim 3, the step of obtaining results of a full analysis of the first historical version of software comprising:
when the increment analysis result of the first historical version software is stored in the memory, reading the latest full analysis result of the second historical version software and the increment analysis results corresponding to a plurality of pieces of historical version software from the second historical version software to the first historical version software from the memory;
and determining the full analysis result of the first historical version software by using a plurality of incremental analysis results and the full analysis result of the second historical version software.
6. The method of claim 5, the step of determining the results of the full-scale analysis of the first historical version of software, comprising:
and sequentially utilizing the logic combination of the full analysis result of the previous historical version software and the incremental analysis result of the current historical version software according to the sequence from the second historical version software to the first historical version software to determine the full analysis result of the current historical version software.
7. The method of claim 6, wherein the result of the full-scale analysis comprises a plurality of elements; the step of determining the full analysis result of the current historical version software by using the logical combination of the full analysis result of the previous historical version software and the incremental analysis result of the current historical version software comprises the following steps:
and when the change execution logic of the incremental analysis result comprises a deleting operation and an adding operation aiming at a first element, firstly deleting the first element and then adding the first element in the full analysis result of the previous historical version software.
8. The method of claim 4 or 5, the first historical version of software being a last historical version of software of the first version of software.
9. The method of claim 3, wherein full or incremental analysis results are stored in the memory at intervals.
10. The method of claim 3, the step of determining an analysis result for the first version of software comprising:
when the analysis result of the first version software which needs to be determined is a full analysis result, modifying the full analysis result of the first historical version software by using the code change record to obtain the full analysis result of the first version software;
when the analysis result of the first version software needing to be determined is an incremental analysis result, determining that the modification to the full-scale analysis result of the first historical version software is needed by using the code change record, and determining the incremental analysis result of the first version software based on the modification needed.
11. The method of claim 10, determining whether the analysis result of the first version of software to be determined is an incremental analysis result by:
judging whether the analysis result of the first version software to be determined is an incremental analysis result or not according to a preset interval rule aiming at a full analysis result and an incremental analysis result; alternatively, the first and second electrodes may be,
and judging whether the analysis result of the first version software needing to be determined is an incremental analysis result or not based on the received instruction for indicating to determine the incremental analysis result or the full analysis result of the first version software.
12. The method of claim 10, the results of the full scale analysis comprising a method call graph containing points representing methods in software and edges characterizing call relationships between methods in software; the code change record comprises operation execution logic for a first method in software;
the step of determining that modifications are required to be made to the full-scale analysis result of the first historical version software using the code change record, and determining the incremental analysis result of the first version software based on the modifications required to be made, includes:
determining a second method having a calling relationship with the first method from a method calling graph contained in a full analysis result of the first historical version software;
and determining change execution logic of the second method based on the operation execution logic so as to obtain the incremental analysis result of the first version software.
13. A method for obtaining software analysis results in continuous integration is disclosed, wherein, a memory stores full analysis results or incremental analysis results of a plurality of versions of software; the full analysis result is a complete analysis result aiming at the software, and the incremental analysis result comprises the change execution logic of the full analysis result of the corresponding version software relative to the full analysis result of the historical version software; the method comprises the following steps:
determining second version software of an analysis result to be obtained;
when the incremental analysis result of the second version software is stored in the memory, reading the latest full analysis result of the third history version software and the incremental analysis results corresponding to a plurality of history version software from the third history version software to the second version software from the memory;
and determining the full analysis result of the second version software by using a plurality of incremental analysis results and the full analysis result of the third history version software.
14. The method of claim 13, the step of determining the results of the full-scale analysis of the second version of software, comprising:
and sequentially utilizing the logic combination of the total analysis result of the previous historical version software and the incremental analysis result of the current version software according to the sequence from the third historical version software to the second version software to determine the total analysis result of the current version software.
15. The method of claim 14, wherein the result of the full-scale analysis comprises a plurality of elements; the step of determining the full analysis result of the current historical version software by logically combining the full analysis result of the previous historical version software and the incremental analysis result of the current historical version software comprises the following steps:
and when the change execution logic of the incremental analysis result comprises a deleting operation and an adding operation aiming at a first element, firstly deleting the first element and then adding the first element in the full analysis result of the previous historical version software.
16. An apparatus for analyzing software in a continuous integration, the apparatus comprising:
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 acquire a full analysis result of the first historical version software; wherein the full analysis result is a complete analysis result for the software;
a result determination module configured to determine an analysis result for the first version of software based on the code change record and a full analysis result of the first historical version of software.
17. A device for obtaining software analysis results in continuous integration is disclosed, wherein, a memory stores full analysis results or incremental analysis results of a plurality of versions of software; the full analysis result is a complete analysis result aiming at the software, and the incremental analysis result comprises the change execution logic of the full analysis result of the corresponding version software relative to the full analysis result of the historical version software; the device comprises:
the software determining module is configured to determine second version software of the analysis result to be obtained;
the analysis reading module is configured to read a recent full analysis result of a third historical version software and incremental analysis results corresponding to a plurality of historical version software from the third historical version software to the second version software respectively from the memory when the incremental analysis result of the second version software is stored in the memory;
and the full amount determination module is configured to determine the full amount analysis result of the second version software by using a plurality of incremental analysis results and the full amount analysis result of the third history version software.
18. A computer-readable storage medium, on which a computer program is stored which, when executed in a computer, causes the computer to carry out the method of any one of claims 1-15.
19. A computing device comprising a memory having executable code stored therein and a processor that, when executing the executable code, implements the method of any of claims 1-15.
CN202211482609.8A 2022-11-24 2022-11-24 Method and device for analyzing software in continuous integration Pending CN115840695A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211482609.8A CN115840695A (en) 2022-11-24 2022-11-24 Method and device for analyzing software in continuous integration

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211482609.8A CN115840695A (en) 2022-11-24 2022-11-24 Method and device for analyzing software in continuous integration

Publications (1)

Publication Number Publication Date
CN115840695A true CN115840695A (en) 2023-03-24

Family

ID=85575985

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211482609.8A Pending CN115840695A (en) 2022-11-24 2022-11-24 Method and device for analyzing software in continuous integration

Country Status (1)

Country Link
CN (1) CN115840695A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080148232A1 (en) * 2006-12-13 2008-06-19 International Business Machines Corporation Method and Apparatus for Managing Selective and Subtractive Merges in a Software Configuration
CN114090013A (en) * 2021-11-24 2022-02-25 中国银行股份有限公司 Method and device for determining change set of executable code file
CN115269444A (en) * 2022-09-30 2022-11-01 平安银行股份有限公司 Code static detection method and device and server

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080148232A1 (en) * 2006-12-13 2008-06-19 International Business Machines Corporation Method and Apparatus for Managing Selective and Subtractive Merges in a Software Configuration
CN114090013A (en) * 2021-11-24 2022-02-25 中国银行股份有限公司 Method and device for determining change set of executable code file
CN115269444A (en) * 2022-09-30 2022-11-01 平安银行股份有限公司 Code static detection method and device and server

Similar Documents

Publication Publication Date Title
US9575752B2 (en) Inferring a defect's cause in updated source code
US20230094191A1 (en) Scalable execution tracing for large program codebases
US7321988B2 (en) Identifying a code library from the subset of base pointers that caused a failure generating instruction to be executed
US8261244B2 (en) Arbitrary runtime function call tracing
US8997065B2 (en) Automatic modularization of source code
US20110307875A1 (en) Tracking variable information in optimized code
CN108762825B (en) Method and system for realizing heavy load of dynamic library
CN111400164B (en) Software testing method and device
JP4939973B2 (en) Test control apparatus, test control method, and test control program
CN113760476A (en) Task dependency processing method and related device
CN112860312A (en) Method and device for detecting item dependency relationship change
CN108694049B (en) Method and equipment for updating software
US20070011216A1 (en) Heap dump acquiring method
CN112789602A (en) Reverse debugging of software failures
US10872027B2 (en) Run-time or compile-time error solutions for locating missing program elements in a programming environment
US7523445B1 (en) Method for generating an explanation of a CSP solution
CN115840695A (en) Method and device for analyzing software in continuous integration
CN111240987A (en) Migration program detection method and device, electronic equipment and computer readable storage medium
US20160004982A1 (en) Method and system for estimating the progress and completion of a project based on a bayesian network
CN111352852B (en) Regression test case selection method and device
CN111143229A (en) Software testing method and device, computer equipment and computer readable storage medium
CN114791865A (en) Method, system and medium for detecting self-consistency of configuration items based on relational graph
CN113495728B (en) Dependency relationship determination method, dependency relationship determination device, electronic equipment and medium
US8290917B2 (en) Reordering of data elements in a data parallel system
CN114924762A (en) Component upgrade adaptation detection method and device

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