Compatibility detection method and device, electronic equipment, storage medium and program product

By statically analyzing the software source code, identifying the change function and its call chain, the problem of the inability to detect the compatibility risks brought about by changes in non-entry codes in the existing technology is solved, the compatibility detection between software components is improved, and the software stability is enhanced sex.

CN118939563AInactive Publication Date: 2024-11-12PINGCAP XINGCHEN (BEIJING) TECH CO LTD

Patent Information

Application Number
CN202411418998.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-11
Publication Date
2024-11-12
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The prior art cannot effectively detect compatibility risks caused by changes in non-entry codes, resulting in insufficient compatibility detection between software components.

Method used

By obtaining the version change data of the software to be tested, determining the change function, and statically analyzing the source code, building call chain data, identifying the target components associated with the change function, thereby detecting components with compatibility risks.

Benefits of technology

No need to run code, effectively detects the compatibility risks brought about by changes in entry code and non-entry code, improves the effectiveness of compatibility detection between software components, and enhances software stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118939563A_ABST
    Figure CN118939563A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a compatibility detection method and device, electronic equipment, a storage medium and a program product, and relates to the technical field of computers, for example, distributed databases capable of being applied to the field of databases. The method comprises the steps of obtaining version change data of to-be-tested software, and determining at least one change function based on the version change data; performing static analysis on the current source code of the to-be-tested software to obtain corresponding calling relation data; constructing call chain data corresponding to each change function based on the call relation data; and determining at least one target component associated with the call chain data corresponding to each change function from a plurality of components in the to-be-tested software. According to the embodiment of the invention, codes do not need to run, so that the codes of the to-be-tested software are non-invasive; compatibility risks caused by changes of entry codes and non-entry codes can be effectively detected, and the effectiveness of compatibility detection is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a compatibility detection method, device, electronic device, storage medium and program product. Background Art

[0002] In the software development process, in order to facilitate collaborative development, large software products need to decouple components (or modules). Since there are dependencies between components in the software, when a component changes, it may affect other components related to it, which creates compatibility risks.

[0003] In the prior art, the mapping relationship between software functions and entry codes recorded by the configuration center is usually used to find the components corresponding to the affected functions through the entry codes. When non-entry codes (i.e., codes related to functions that will not be exposed to users) change, the affected components cannot be detected due to the lack of corresponding mapping relationships. Existing compatibility detection methods cannot effectively detect compatibility risks caused by changes in non-entry codes. Summary of the invention

[0004] The embodiments of the present disclosure provide a compatibility detection method, device, electronic device, storage medium and program product, which can solve the problem that the compatibility risk caused by the change of non-entry code in the prior art cannot be effectively detected. The technical solution provided by the present disclosure is as follows: According to one aspect of an embodiment of the present disclosure, a compatibility detection method is provided, the method comprising: Obtaining version change data of the software to be tested, and determining at least one change function based on the version change data; Performing static analysis on the current source code of the software to be tested to obtain corresponding call relationship data, wherein the call relationship data includes the call relationship between various functions in the source code; Based on the call relationship data, construct call chain data corresponding to each changed function; At least one target component associated with the call chain data corresponding to each changed function is determined from multiple components in the software to be tested; the component includes multiple functions; and the target component is a component in the software to be tested that has a compatibility risk.

[0005] Optionally, the call relationship data includes a call relationship corresponding to each function in the software to be tested, and the call relationship corresponding to each function includes a target node corresponding to the function, and at least one parent node and at least one child node associated with the target node, the child node is used to represent a function directly called by the function, and the parent node is used to represent a function that directly calls the function; The step of constructing call chain data corresponding to each changed function based on the call relationship data includes: For each changed function, the changed function is taken as a target node, and at least one first node associated with the target node is determined from the call relationship data; the first node is used to represent a node that directly or indirectly calls the changed function with the corresponding function; Based on the at least one first node, call chain data corresponding to the changed function is constructed.

[0006] Optionally, determining at least one first node associated with the target node from the call relationship data includes: Perform at least one query operation on the call relationship data to obtain the call nodes corresponding to each query operation, until all the obtained call nodes are root nodes; Using the calling nodes obtained from each query operation as the at least one first node; The query operation includes: Determine the query starting point corresponding to the current query operation; the query starting point corresponding to the first query operation includes the node corresponding to the change function; At least one parent node of the query starting point is determined from the call relationship data, the at least one parent node is used as at least one call node corresponding to the current query operation, and the query starting point corresponding to the next query operation is determined based on the at least one call node.

[0007] Optionally, determining at least one target component associated with the call chain data corresponding to each changed function from the plurality of components in the software to be tested includes: For each changed function, determining at least one first component associated with the changed function in the software to be tested based on the call chain data corresponding to the changed function; At least one target component is determined from at least one first component corresponding to each change function.

[0008] Optionally, the node includes node information, and the node includes function information and component information of a component to which the function belongs; The determining, based on the call chain data corresponding to the changed function, at least one first component associated with the changed function in the software to be tested comprises: The call chain data containing node corresponding to the changed function is used as the second node; For each second node, determining a component corresponding to the second node based on component information in the node information of the second node; Based on the components corresponding to the respective second nodes, the at least one first component is obtained.

[0009] Optionally, determining at least one target component from at least one first component corresponding to each change function includes: Clustering at least one first component corresponding to each change function based on the component information to obtain at least one corresponding clustering result; The components corresponding to each clustering result are taken as at least one target component.

[0010] Optionally, determining a query starting point corresponding to a next query operation based on at least one calling node includes: For each calling node, if the calling node is not a root node, the calling node is used as a query starting point corresponding to the next query operation.

[0011] According to another aspect of an embodiment of the present disclosure, a compatibility detection device is provided, the device comprising: A change function determination module, used to obtain version change data of the software to be tested, and determine at least one change function based on the version change data; A calling relationship data determination module, used to perform static analysis on the current source code of the software to be tested to obtain corresponding calling relationship data, wherein the calling relationship data includes the calling relationship between various functions in the source code; A call chain data determination module, used to construct call chain data corresponding to each changed function based on the call relationship data; A compatibility detection module is used to determine at least one target component associated with the call chain data corresponding to each changed function from multiple components in the software under test; the component includes multiple functions; the target component is a component in the software under test that has a compatibility risk.

[0012] According to another aspect of an embodiment of the present disclosure, an electronic device is provided, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of any one of the above-mentioned compatibility detection methods when executing the program.

[0013] According to another aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned compatibility detection methods are implemented.

[0014] According to one aspect of an embodiment of the present disclosure, a computer program product is provided, which includes a computer program. When the computer program is executed by a processor, the steps of any of the above-mentioned compatibility detection methods are implemented.

[0015] The technical solution provided by the embodiments of the present disclosure has the following beneficial effects: By determining at least one changed function from the version change data of the software to be tested, and by performing static analysis on the current source code of the software to be tested, the call relationship data is obtained, and the code of the software to be tested is non-intrusive without running the code. Based on the call relationship data and at least one changed function, the call chain data corresponding to each changed function is obtained, and by analyzing the call chain data corresponding to each changed function, at least one target component with compatibility risk is obtained. It does not rely on the mapping relationship between the entry code and the software function, and can effectively detect the compatibility risks brought by the changes of the entry code and non-entry code, which improves the effectiveness of compatibility detection between components in the software and is conducive to improving the stability of the software. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings required for describing the embodiments of the present disclosure are briefly introduced below.

[0017] Figure 1 A flow chart of a compatibility detection method provided in an embodiment of the present disclosure; Figure 2 A schematic diagram of an SVG file corresponding to a source code provided in an embodiment of the present disclosure; Figure 3 A schematic diagram of a calling relationship provided in an embodiment of the present disclosure; Figure 4 A schematic diagram of call chain data provided by an embodiment of the present disclosure; Figure 5 A schematic diagram of the structure of a compatibility detection device provided in an embodiment of the present disclosure; Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0018] The embodiments of the present disclosure are described below in conjunction with the drawings in the present disclosure. It should be understood that the implementation methods described below in conjunction with the drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present disclosure and do not constitute a limitation on the technical solutions of the embodiments of the present disclosure.

[0019] It will be understood by those skilled in the art that, unless specifically stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the terms "including" and "comprising" used in the embodiments of the present disclosure refer to that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and / or components, but do not exclude the implementation as other features, information, data, steps, operations, elements, components and / or combinations thereof supported by the technical field. It should be understood that when we say that an element is "connected" or "coupled" to another element, the one element may be directly connected or coupled to the other element, or it may refer to that the one element and the other element establish a connection relationship through an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein indicates at least one of the items defined by the term, for example, "A and / or B" or "A, B" indicates that it is implemented as "A", or implemented as "B", or implemented as "A and B".

[0020] The following describes several exemplary embodiments to illustrate the technical solutions of the embodiments of the present disclosure and the technical effects produced by the technical solutions of the present disclosure. It should be noted that the following embodiments can refer to, draw on or combine with each other, and the same terms, similar features and similar implementation steps in different embodiments will not be described repeatedly.

[0021] Figure 1 A flow chart of a compatibility detection method provided by an embodiment of the present disclosure is shown as follows: Figure 1 As shown, the method includes: Step S110: obtaining version change data of the software to be tested, and determining at least one change function based on the version change data.

[0022] Specifically, during the software development process, when developers need to change the software code, compatibility risks between components in the software may arise. Therefore, after the software code is changed, the changed software needs to be tested for compatibility.

[0023] The software to be tested may be software that needs to be tested for compatibility, and the type of the software to be tested may be specifically set according to different application scenarios. For example, in the application scenario of database testing, the software to be tested may be a database system that needs to be tested.

[0024] When the software under test is changed, the corresponding version change data can be obtained through the version control system, and at least one change function can be obtained by parsing the version change data. The version change data may include data that has changed between different versions, and the change function may be a function that has changed.

[0025] Optionally, the version control system may include SVN (a centralized version control system) or Git (a distributed version control system).

[0026] For example, the diff data of a specific PR (Pull Request) or Commit may be obtained as version change data based on git diff, where git diff is a command for displaying the differences between different versions of a file.

[0027] Step S120 , statically analyzing the current source code of the software to be tested to obtain corresponding calling relationship data, where the calling relationship data includes the calling relationship between various functions in the source code.

[0028] Specifically, when the software under test is changed, the current source code of the software under test (ie, the changed source code) can be statically analyzed without running the source code to obtain the calling relationship between each function in the source code as the calling relationship data.

[0029] Optionally, a static analysis tool, such as go-callvis (a code visualization tool), may be used to obtain an SVG (Scalable Vector Graphics) file corresponding to the source code, and the call relationship data may be obtained by parsing the SVG file.

[0030] Among them, SVG is a standard graphic file type used to render two-dimensional images on the Internet. Unlike other popular image file formats, SVG files store images as vectors, which are graphics composed of points, lines, curves, and shapes based on mathematical formulas.

[0031] Figure 2 A schematic diagram of an SVG file corresponding to a source code provided in an embodiment of the present disclosure, such as Figure 2 As shown, an SVG file may include multiple points and multiple edges connecting two points, wherein a point (Node) may be used to represent a function, and an edge (Edge) may be used to represent a calling relationship between functions.

[0032] It should be noted that Figure 2 This is only an example of the SVG file provided in the embodiment of the present disclosure and does not constitute a limitation on the SVG file in the embodiment of the present disclosure.

[0033] After obtaining the SVG file corresponding to the source code through the code visualization tool, the call relationship data can be obtained by parsing the points and edges in the SVG file.

[0034] It should be noted that step S110 and step S120 in the embodiment of the present disclosure may be executed simultaneously or sequentially. When these two steps are executed sequentially, step S110 may be executed first and then step S120; or step S120 may be executed first and then step S110. The embodiment of the present disclosure does not limit the execution order of these two steps.

[0035] Step S130: constructing call chain data corresponding to each changed function based on the call relationship data.

[0036] Specifically, after obtaining at least one changed function and the call relationship data corresponding to the current source code, at least one function that has a call relationship with each changed function can be queried from the call relationship data. For each changed function, based on at least one function that has a call relationship with the changed function, call chain data corresponding to the changed function can be constructed, wherein the call chain data may include at least one function that has a call relationship with the changed function.

[0037] Step S140, determining at least one target component associated with the call chain data corresponding to each changed function from multiple components in the software under test; the component includes multiple functions; the target component is a component in the software under test that has a compatibility risk.

[0038] Specifically, the software to be tested may be composed of multiple components, each of which may include multiple functions. After obtaining the call chain data corresponding to each change function, the call chain data corresponding to each change function may be analyzed to select multiple components associated with the change function from the multiple components of the software to be tested. Since these multiple components are associated with the change function, when the code of the change function changes, these components may be affected, i.e., compatibility risks may be generated. Therefore, these multiple components may be used as at least one target component with compatibility risks.

[0039] Optionally, after obtaining at least one target component, the developer may perform further compatibility risk analysis by locating the specific target component.

[0040] In the disclosed embodiment, by determining at least one changed function from the version change data of the software to be tested, and by performing static analysis on the current source code of the software to be tested, the call relationship data is obtained, and the code of the software to be tested is non-intrusive without running the code. Based on the call relationship data and at least one changed function, the call chain data corresponding to each changed function is obtained, and by analyzing the call chain data corresponding to each changed function, at least one target component with compatibility risk is obtained, which does not rely on the mapping relationship between the entry code and the software function, and can effectively detect the compatibility risks brought by the changes of the entry code and the non-entry code, thereby improving the effectiveness of the compatibility detection between the components in the software, which is conducive to improving the stability of the software.

[0041] As an optional embodiment, the call relationship data includes a call relationship corresponding to each function in the software to be tested, and the call relationship corresponding to each function includes a target node corresponding to the function, and at least one parent node and at least one child node associated with the target node, the child node is used to represent a function directly called by the function, and the parent node is used to represent a function that directly calls the function; Based on the call relationship data, the call chain data corresponding to each changed function is constructed, including: For each changed function, the changed function is used as a target node, and at least one first node associated with the target node is determined from the call relationship data; the first node is used to represent a node that directly or indirectly calls the changed function by the corresponding function; Based on at least one first node, call chain data corresponding to the changed function is constructed.

[0042] Specifically, the call relationship data may include the call relationship corresponding to each function in the software to be tested. For each function, the call relationship corresponding to the function may include three levels of nodes, namely, a target node corresponding to the function, and at least one child node and at least one parent node connected to the target node. The child node may be used to represent a function directly called by the function, and the parent node may be used to represent a function that directly calls the function. Figure 3 A schematic diagram of a calling relationship provided by an embodiment of the present disclosure, such as Figure 3 As shown, node A represents the target node, and node A corresponds to two parent nodes (i.e., nodes B1 and B2), and two child nodes (i.e., nodes S1 and S2), wherein the arrow points to the node corresponding to the calling function.

[0043] It should be noted that Figure 3 It is only an example of the calling relationship provided in the embodiment of the present disclosure and does not constitute a limitation on the calling relationship in the embodiment of the present disclosure.

[0044] Optionally, the call relationship corresponding to each function can be expressed in the following form: child node->target node->parent node, Figure 3 The calling relationship in can be expressed as (S1, S2)->A->(B1, B2) On this basis, for each changed function, the changed function may be used as a target node, and based on the call relationship data, at least one first node corresponding to a function that directly or indirectly calls the changed function may be determined.

[0045] After obtaining at least one first node, the first nodes may be connected according to the calling relationship between the first nodes to obtain the call chain data corresponding to the changed function.

[0046] Figure 4 A schematic diagram of a call chain data provided by an embodiment of the present disclosure, such as Figure 4 As shown, in Figure 3 On the basis of, at least one first node associated with the change function (i.e., node A) includes B1, B2, C1, C2, C3, D1, and D2. Among them, B1 and B2 are function nodes that directly call the change function (i.e., connected by one edge); C1, C2, C3, D1, and D2 are function nodes that indirectly call the change function (i.e., connected by at least two edges).

[0047] It should be noted that Figure 4 This is only an example of the call chain data provided in the embodiment of the present disclosure and does not constitute a limitation on the call chain data in the embodiment of the present disclosure.

[0048] In the disclosed embodiment, by setting the calling relationship corresponding to each function and constructing the calling relationship corresponding to each function in the form of a target node and its corresponding parent node and child node, the complex calling relationship between the functions in the source code is stored through multiple data records with simple structures, thereby reducing the complexity of data storage and facilitating the management and maintenance of the calling relationship data.

[0049] As an optional embodiment, determining at least one first node associated with the target node from the call relationship data includes: Perform at least one query operation on the call relationship data to obtain the call nodes corresponding to each query operation, until all the obtained call nodes are root nodes; Using the calling nodes obtained from each query operation as at least one first node; The query operations include: Determine the query starting point corresponding to the current query operation; the query starting point corresponding to the first query operation includes the node corresponding to the change function; At least one parent node of the query starting point is determined from the call relationship data, the at least one parent node is used as at least one call node corresponding to the current query operation, and the query starting point corresponding to the next query operation is determined based on the at least one call node.

[0050] Specifically, at least one first node associated with the target node corresponding to the changed function may be obtained by performing multiple query operations on the call relationship data.

[0051] The node corresponding to the change function can be used as the query starting point corresponding to the first query operation, and the call relationship with the query starting point as the target node can be determined from the call relationship data, and at least one parent node of the query starting point can be determined based on the call relationship corresponding to the query starting point, and the obtained at least one parent node can be used as the at least one call node obtained by the current query operation. The query starting point corresponding to the next query operation is determined based on the at least one call node, and the next query operation is entered, and the above query operation is repeatedly performed until all the obtained call nodes are root nodes.

[0052] Optionally, determining a query starting point corresponding to a next query operation based on at least one calling node includes: For each calling node, if the calling node is not a root node, the calling node is used as the query starting point corresponding to the next query operation.

[0053] Specifically, for each calling node, if the calling node is not a root node (that is, there is at least one parent node), the calling node is used as the query starting point for the next query operation; if the calling node is a root node, other calling nodes are judged. After the judgment of each calling node corresponding to the current query operation is completed, if there is at least one calling node that is not a root node among the calling nodes, the next query operation is entered, otherwise, the query operation is stopped.

[0054] At least one call node obtained by the first query operation represents a function that directly calls the changed function, and at least one call node obtained by the query operation after the first query operation represents a function that indirectly calls the changed function. At least one first node associated with the changed function can be generated based on the call nodes corresponding to each query operation.

[0055] In the disclosed embodiment, by performing multiple recursive query operations on the call relationship data, the first node corresponding to the function that directly or indirectly calls the changed function is obtained, so as to subsequently construct the call chain data corresponding to the changed function based on the first node.

[0056] As an optional embodiment, determining at least one target component associated with the call chain data corresponding to each changed function from multiple components in the software to be tested includes: For each changed function, based on the call chain data corresponding to the changed function, determining at least one first component associated with the changed function in the software to be tested; At least one target component is determined from at least one first component corresponding to each change function.

[0057] Specifically, for each changed function, after obtaining the call chain data corresponding to the changed function, the node corresponding to at least one function that directly or indirectly calls the changed function can be determined from the call chain data, and the function corresponding to each node has a corresponding component. Based on the components associated with each node in the call chain data, at least one first component associated with the changed function can be determined. The first component can be understood as a component that will be affected by the change function.

[0058] After obtaining at least one first component corresponding to each change function, the first components can be deduplicated and the deduplicated first components can be used as at least one target component.

[0059] As an optional embodiment, the node includes function information and component information of the component to which the function belongs; Determining at least one first component associated with the changed function in the software to be tested based on the call chain data corresponding to the changed function includes: The call chain data containing node corresponding to the changed function is used as the second node; For each second node, determining a component corresponding to the second node based on component information in the node information of the second node; At least one first component is obtained based on the components corresponding to each second node.

[0060] Specifically, each node in the call relationship may include corresponding node information, and the node information may include function information of the corresponding function and component information of the component to which the function belongs.

[0061] After obtaining the call chain data corresponding to the changed function, each node in the call chain data corresponding to the changed function can be used as a second node, and for each second node, based on the component information in the node information of the second node, the component corresponding to the second node is obtained. At least one first component is determined from the components corresponding to each second node in the call chain data.

[0062] Optionally, the component corresponding to each second node can be used as the first component; or the multiple components corresponding to each second node can be deduplicated first, and the multiple components after deduplication can be used as at least one first component. This embodiment of the present disclosure is not limited to this.

[0063] As an optional embodiment, determining at least one target component from at least one first component corresponding to each change function includes: Clustering at least one first component corresponding to each change function based on the component information to obtain at least one corresponding clustering result; The components corresponding to each clustering result are taken as at least one target component.

[0064] Specifically, after obtaining at least one first component corresponding to each change function, each first component can be clustered based on the component information corresponding to each first component, and at least one first component corresponding to the same component information is taken as one class, thereby obtaining at least one clustering result, and each clustering result can include multiple first components corresponding to the same component information. The component information can be used to identify the corresponding component, and the component information can include a component name, a component number, etc.

[0065] After obtaining multiple clustering results, each clustering result corresponds to a component, and the components corresponding to each clustering result can be used as at least one target component.

[0066] In the disclosed embodiment, by clustering the multiple first components corresponding to each change function and determining the target component based on the clustering results, it is possible to effectively screen out the target components with compatibility risks and avoid wasting storage space due to duplicate data and interfering with data analysis, which is beneficial to improving data processing efficiency.

[0067] Figure 5 A schematic diagram of a compatibility detection device provided by an embodiment of the present disclosure is shown in FIG. Figure 5 As shown, the device of this embodiment may include: A change function determination module 210 is used to obtain version change data of the software to be tested, and determine at least one change function based on the version change data; The calling relationship data determination module 220 is used to perform static analysis on the current source code of the software to be tested to obtain corresponding calling relationship data, wherein the calling relationship data includes the calling relationship between various functions in the source code; A call chain data determination module 230, configured to construct call chain data corresponding to each changed function based on the call relationship data; The compatibility detection module 240 is used to determine at least one target component associated with the call chain data corresponding to each changed function from multiple components in the software under test; the component includes multiple functions; the target component is a component in the software under test that has a compatibility risk.

[0068] As an optional embodiment, the call relationship data includes a call relationship corresponding to each function in the software to be tested, and the call relationship corresponding to each function includes a target node corresponding to the function, and at least one parent node and at least one child node associated with the target node, the child node is used to represent a function directly called by the function, and the parent node is used to represent a function that directly calls the function; The call chain data determination module is specifically used for: For each changed function, the changed function is taken as a target node, and at least one first node associated with the target node is determined from the call relationship data; the first node is used to represent a node that directly or indirectly calls the changed function with the corresponding function; Based on the at least one first node, call chain data corresponding to the changed function is constructed.

[0069] As an optional embodiment, when the call chain data determination module determines at least one first node associated with the target node from the call relationship data, it is specifically configured to: Perform at least one query operation on the call relationship data to obtain the call nodes corresponding to each query operation, until all the obtained call nodes are root nodes; Using the calling nodes obtained from each query operation as the at least one first node; The query operation includes: Determine the query starting point corresponding to the current query operation; the query starting point corresponding to the first query operation includes the node corresponding to the change function; At least one parent node of the query starting point is determined from the call relationship data, the at least one parent node is used as at least one call node corresponding to the current query operation, and the query starting point corresponding to the next query operation is determined based on the at least one call node.

[0070] As an optional embodiment, the compatibility detection module is specifically used for: For each changed function, determining at least one first component associated with the changed function in the software to be tested based on the call chain data corresponding to the changed function; At least one target component is determined from at least one first component corresponding to each change function.

[0071] As an optional embodiment, the node includes node information, and the node includes function information and component information of a component to which the function belongs; When the compatibility detection module determines at least one first component associated with the changed function in the software to be tested based on the call chain data corresponding to the changed function, it is specifically used to: The call chain data containing node corresponding to the changed function is used as the second node; For each second node, determining a component corresponding to the second node based on component information in the node information of the second node; Based on the components corresponding to the respective second nodes, the at least one first component is obtained.

[0072] As an optional embodiment, when the compatibility detection module determines at least one target component from at least one first component corresponding to each change function, the compatibility detection module is specifically configured to: Clustering at least one first component corresponding to each change function based on the component information to obtain at least one corresponding clustering result; The components corresponding to each clustering result are taken as at least one target component.

[0073] As an optional embodiment, when the call chain data determination module determines the query starting point corresponding to the next query operation based on at least one call node, it is specifically used to: For each calling node, if the calling node is not a root node, the calling node is used as a query starting point corresponding to the next query operation.

[0074] The device of the embodiment of the present disclosure can execute the method provided by the embodiment of the present disclosure, and its implementation principle is similar and has corresponding technical effects. The actions performed by each module in the device of each embodiment of the present disclosure correspond to the steps in the method of each embodiment of the present disclosure. For the detailed functional description of each module of the device, please refer to the description in the corresponding method shown in the previous text, which will not be repeated here.

[0075] In the embodiments of the present disclosure, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories), or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0076] In an embodiment of the present disclosure, an electronic device is provided, including a memory, a processor and a computer program stored in the memory, and the processor executes the above-mentioned computer program to implement the steps of the method provided by any optional embodiment of the present disclosure. Compared with the prior art, it can be achieved that: by determining at least one change function from the version change data of the software to be tested, and by statically analyzing the current source code of the software to be tested, the call relationship data is obtained, and there is no need to run the code, so that the code of the software to be tested is non-intrusive. Based on the call relationship data and at least one change function, the call chain data corresponding to each change function is obtained, and by analyzing the call chain data corresponding to each change function, at least one target component with compatibility risks is obtained, which does not rely on the mapping relationship between the entry code and the software function, and the compatibility risks brought by the changes of the entry code and the non-entry code can be effectively detected, which improves the effectiveness of the compatibility detection between the components in the software, and is conducive to improving the stability of the software.

[0077] In an alternative embodiment, an electronic device is provided, such as Figure 6 As shown, Figure 6 The electronic device 4000 shown includes: a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, such as through a bus 4002. Optionally, the electronic device 4000 may also include a transceiver 4004, which may be used for data interaction between the electronic device and other electronic devices, such as data transmission and / or data reception. It should be noted that in actual applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present disclosure.

[0078] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of the present invention. Processor 4001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0079] The bus 4002 may include a path to transmit information between the above components. The bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 4002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0080] The memory 4003 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium that can be used to carry or store computer programs and can be read by a computer, without limitation herein.

[0081] The memory 4003 is used to store the computer program for executing the embodiment of the present disclosure, and the execution is controlled by the processor 4001. The processor 4001 is used to execute the computer program stored in the memory 4003 to implement the steps shown in the above method embodiment.

[0082] Among them, electronic devices include but are not limited to: mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), wearable devices, etc., and fixed terminals such as digital TVs, desktop computers, etc.

[0083] An embodiment of the present disclosure provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps and corresponding contents of the aforementioned method embodiment can be implemented.

[0084] The embodiments of the present disclosure also provide a computer program product, including a computer program, which can implement the steps and corresponding contents of the aforementioned method embodiments when executed by a processor.

[0085] It should be understood that, although the flowchart of the embodiment of the present disclosure indicates each operation step by arrows, the implementation order of these steps is not limited to the order indicated by the arrows. Unless clearly stated herein, in some implementation scenarios of the embodiment of the present disclosure, the implementation steps in each flowchart can be executed in other orders according to demand. In addition, some or all of the steps in each flowchart may include multiple sub-steps or multiple stages based on the actual implementation scenario. Some or all of these sub-steps or stages can be executed at the same time, and each sub-step or stage in these sub-steps or stages can also be executed at different times. In scenarios with different execution times, the execution order of these sub-steps or stages can be flexibly configured according to demand, and the embodiment of the present disclosure does not limit this.

[0086] The above is only an optional implementation method for some implementation scenarios of the present disclosure. It should be pointed out that for ordinary technicians in this technical field, without departing from the technical concept of the scheme of the present disclosure, other similar implementation methods based on the technical ideas of the present disclosure are also within the protection scope of the embodiments of the present disclosure.

Claims

1. A compatibility detection method, characterized in that: include: Obtaining version change data of the software to be tested, and determining at least one change function based on the version change data; Performing static analysis on the current source code of the software to be tested to obtain corresponding call relationship data, wherein the call relationship data includes the call relationship between various functions in the source code; Based on the call relationship data, construct call chain data corresponding to each changed function; At least one target component associated with the call chain data corresponding to each changed function is determined from multiple components in the software to be tested; the component includes multiple functions; and the target component is a component in the software to be tested that has a compatibility risk.

2. The method according to claim 1, characterized in that The call relationship data includes the call relationship corresponding to each function in the software to be tested, and the call relationship corresponding to each function includes a target node corresponding to the function, and at least one parent node and at least one child node associated with the target node, the child node is used to represent a function directly called by the function, and the parent node is used to represent a function that directly calls the function; The step of constructing call chain data corresponding to each changed function based on the call relationship data includes: For each changed function, the changed function is taken as a target node, and at least one first node associated with the target node is determined from the call relationship data; the first node is used to represent a node that directly or indirectly calls the changed function with the corresponding function; Based on the at least one first node, call chain data corresponding to the changed function is constructed.

3. The method according to claim 2, characterized in that The determining at least one first node associated with the target node from the call relationship data comprises: Perform at least one query operation on the call relationship data to obtain the call nodes corresponding to each query operation, until all the obtained call nodes are root nodes; Using the calling nodes obtained from each query operation as the at least one first node; The query operation includes: Determine the query starting point corresponding to the current query operation; the query starting point corresponding to the first query operation includes the node corresponding to the change function; At least one parent node of the query starting point is determined from the call relationship data, the at least one parent node is used as at least one call node corresponding to the current query operation, and the query starting point corresponding to the next query operation is determined based on the at least one call node.

4. The method according to claim 1, characterized in that: The step of determining at least one target component associated with the call chain data corresponding to each changed function from the plurality of components in the software to be tested comprises: For each changed function, determining at least one first component associated with the changed function in the software to be tested based on the call chain data corresponding to the changed function; At least one target component is determined from at least one first component corresponding to each change function.

5. The method according to claim 4, characterized in that The node includes node information, wherein the node includes function information and component information of the component to which the function belongs; The determining, based on the call chain data corresponding to the changed function, at least one first component associated with the changed function in the software to be tested comprises: The call chain data containing node corresponding to the changed function is used as the second node; For each second node, determining a component corresponding to the second node based on component information in the node information of the second node; Based on the components corresponding to the respective second nodes, the at least one first component is obtained.

6. The method according to claim 4, characterized in that The step of determining at least one target component from at least one first component corresponding to each change function includes: Clustering at least one first component corresponding to each change function based on the component information to obtain at least one corresponding clustering result; The components corresponding to each clustering result are taken as at least one target component.

7. The method according to claim 3, characterized in that The determining a query starting point corresponding to the next query operation based on at least one calling node includes: For each calling node, if the calling node is not a root node, the calling node is used as a query starting point corresponding to the next query operation.

8. A compatibility detection device, characterized in that: include: A change function determination module, used to obtain version change data of the software to be tested, and determine at least one change function based on the version change data; A calling relationship data determination module, used to perform static analysis on the current source code of the software to be tested to obtain corresponding calling relationship data, wherein the calling relationship data includes the calling relationship between various functions in the source code; A call chain data determination module, used to construct call chain data corresponding to each changed function based on the call relationship data; A compatibility detection module is used to determine at least one target component associated with the call chain data corresponding to each changed function from multiple components in the software under test; the component includes multiple functions; the target component is a component in the software under test that has a compatibility risk.

9. An electronic device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Automatic test case determination method and device, equipment and storage medium

    CN111382073A

  • Micro-service architecture change detection method and device, server and storage medium

    CN112199276A

  • Interface update crash risk detection method and device, electronic equipment and storage medium

    CN112882943A

  • System code testing method and device, electronic equipment and storage medium

    CN114328254A

  • Data processing method, related equipment and storage medium

    CN114816971A

Cited By

  • Open source component analysis method based on static program

    CN120950367A

  • Static program open source component analysis method

    CN120950367B