Program dependency graph feature-based metamorphic relation identification method and device

By constructing control flow graphs and program dependency graphs, and combining them with predictive models, the problem of insufficient accuracy in obtaining metamorphic relationships was solved, thereby improving the efficiency and quality of software development.

CN121880911APending Publication Date: 2026-04-17HUANENG NUCLEAR ENERGY TECH RES INST CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HUANENG NUCLEAR ENERGY TECH RES INST CO LTD
Filing Date
2025-11-12
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

In existing technologies, the accuracy of obtaining metamorphic relationships in metamorphic testing is insufficient, leading to problems with the accuracy and efficiency of software testing.

Method used

By obtaining the control flow graph and forward dominance tree of the target program, a control dependency graph and a program dependency graph are constructed. Combined with the program analysis requirement slicing criterion, a support vector machine, decision tree, or neural network model is used to predict the transformation relationship.

Benefits of technology

It improves the accuracy of obtaining metamorphic relationships, reduces the number of cases where they cannot be obtained, and enhances the convenience and quality of software development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121880911A_ABST
    Figure CN121880911A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, in particular to a metamorphic relation identification method based on program dependency graph features. The method comprises the following steps: obtaining a control flow graph (CFG) of a target program, and obtaining a control dependency graph according to the control flow graph and a forward dominating tree; obtaining a program dependency graph according to the control dependency graph and the data dependency relationship; according to a program analysis requirement slicing criterion C = (N, V) of a target program, graph traversal is conducted on the program dependency graph, program slicing features are obtained, N represents instructions in the target program, and V represents a variable set; and inputting the program slice features into a target prediction model for identification, and obtaining a prediction result corresponding to the metamorphic relationship of the target program. By the adoption of the method and device, the metamorphic relation obtaining accuracy can be improved, the situation that the metamorphic relation cannot be obtained is reduced, program testing convenience can be improved, and software quality is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a method for identifying metamorphic relationships based on program dependency graph features. Background Technology

[0002] With the development of science and technology, software testing has become an indispensable part of the software development process. The accuracy of software testing directly impacts the quality of software development. One common problem in software testing is the inability to obtain the program's output, known as the "Oracle problem." Metamorphic testing is one method to mitigate the "Oracle problem." It determines whether a test case passes or fails by constructing multiple sets of relationships (i.e., metamorphic relationships) between inputs and outputs. Therefore, improving the accuracy of obtaining metamorphic relationships has become a key focus. Summary of the Invention

[0003] This disclosure provides a method for identifying metamorphic relationships based on program dependency graph features. This method improves the accuracy of metamorphic relationship acquisition, reduces the number of cases where metamorphic relationships cannot be obtained, and enhances the convenience and quality of program development. The technical solution of this disclosure is as follows: According to a first aspect of the present disclosure, a method for identifying metamorphic relationships based on program dependency graph features is provided, comprising: Obtain the control flow graph (CFG) of the target program, and obtain the control dependency graph based on the control flow graph and the forward dominance tree; The program dependency graph is obtained based on the control dependency graph and data dependencies; Based on the program analysis requirement slicing criterion C=(N,V) of the target program, the program dependency graph is traversed to obtain program slice features, where N represents the instructions in the target program and V represents the variable set; The program slice features are input into the target prediction model for identification, and the prediction results corresponding to the metamorphosis relationship of the target program are obtained.

[0004] According to some embodiments, obtaining the control dependency graph based on the control flow graph and the forward dominance tree includes: Use program analysis tools to obtain the control flow graph of the target program; Based on the control flow graph and the execution order information corresponding to the control flow graph, the control flow graph is flipped to obtain the forward dominance tree; The control dependency graph is obtained based on the control flow graph and the forward dominance tree.

[0005] According to some embodiments, obtaining the program dependency graph based on the control dependency graph and data dependencies includes: Based on the execution result of the first node in the control dependency graph, obtain the data dependency relationship and control dependency relationship between the second node and the first node; Based on the data dependency relationship between the second node and the first node, and the control dependency relationship, obtain the program dependency graph.

[0006] According to some embodiments, the step of performing graph traversal on the program dependency graph based on the program analysis requirement slicing criterion C=(N,V) of the target program to obtain program slicing features includes at least one of the following: When the slice acquisition direction corresponding to the target program is a forward slice, trace back from the starting point of the target program, and collect all statements and variables that affect any node in the target program according to the program analysis requirement slicing criterion C=(N,V) to obtain program slice characteristics. When the slice acquisition direction corresponding to the target program is backward slicing, trace back from the end point of the target program, collect all statements and variables that affect any node in the target program according to the program analysis requirement slicing criterion C=(N,V), and obtain the program slice characteristics.

[0007] According to some embodiments, the method further includes: Obtain the target prediction model corresponding to the target program from the prediction model set, wherein the model type corresponding to the prediction model set includes at least one of support vector machine, decision tree and neural network model.

[0008] According to some embodiments, the method further includes: Obtain the historical program set of the initial prediction model; Obtain the historical program dependency graph corresponding to each historical program in the historical program set; Obtain the historical slice features corresponding to the historical program dependency graph; The initial prediction model is trained using the historical slice features to obtain the target prediction model.

[0009] According to some embodiments, the method further includes: Obtain a first number of samples whose initial prediction model is positive and a second number of samples whose initial prediction model is negative; Based on the first quantity and the second quantity, obtain the accuracy corresponding to the initial prediction model; Obtain the area under the receiver operating characteristic curve (ROC curve) corresponding to the initial prediction model; The target prediction model is obtained when the accuracy meets the accuracy requirement and the area under the ROC curve meets the area requirement.

[0010] According to a second aspect of the present disclosure, a device for identifying metamorphic relationships based on program dependency graph features is provided, comprising: The dependency graph acquisition unit is used to acquire the control flow graph (CFG) of the target program and obtain the control dependency graph based on the control flow graph and the forward dominance tree. The dependency graph acquisition unit is further configured to obtain a program dependency graph based on the control dependency graph and data dependency relationship; The feature acquisition unit is used to perform graph traversal on the program dependency graph according to the program analysis requirement slicing criterion C=(N,V) of the target program to obtain program slice features, where N represents the instructions in the target program and V represents the variable set; The result acquisition unit is used to input the program slice features into the target prediction model for identification and to obtain the prediction results corresponding to the metamorphosis relationship of the target program.

[0011] According to a third aspect of the present disclosure, an electronic device is provided, comprising: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the metamorphic relationship identification method based on program dependency graph features as described in any of the preceding aspects.

[0012] According to a fourth aspect of the present disclosure, a storage medium is provided such that, when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is able to perform the metamorphic relationship identification method based on program dependency graph features as described in any of the preceding aspects.

[0013] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the method described in any one of the preceding aspects.

[0014] The technical solutions provided by the embodiments of this disclosure have at least the following beneficial effects: In some or related embodiments, a control flow graph (CFG) of the target program is obtained, and a control dependency graph is derived based on the CFG and the forward dominance tree. A program dependency graph is then obtained based on the control dependency graph and data dependencies. The program dependency graph is traversed according to the program analysis requirement slicing criterion C=(N, V) of the target program to obtain program slice features, where N represents the instructions in program P and V represents the variable set. These program slice features are then input into a target prediction model for identification, obtaining the prediction results corresponding to the transformation relationships of the target program. Therefore, transformation relationships can be obtained through the control dependency graph and program dependency graph, and can be obtained through a prediction model. This improves the accuracy of transformation relationship acquisition, reduces the number of cases where transformation relationships cannot be obtained, enhances the convenience of program development, and improves software development quality.

[0015] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.

[0017] Figure 1 This is a flowchart of the first method for identifying metamorphic relationships based on program control flow graph features provided in this disclosure embodiment; Figure 2 This is a flowchart of the second method for identifying metamorphic relationships based on program control flow graph features provided in this disclosure embodiment; Figure 3A It is a code segment m of program p provided in this embodiment of the disclosure; Figure 3B This is the control flow graph (CFG) of code snippet m provided in the embodiments of this disclosure; Figure 3C This is the forward dominance tree (FDT) of code snippet m provided in the embodiments of this disclosure; Figure 3D This is the control dependency graph (CDG) of code snippet m provided in the embodiments of this disclosure; Figure 3E This is the program dependency graph (PDG) of code snippet m provided in the embodiments of this disclosure; Figure 3F This is a program dependency result diagram of the slice feature C provided in this embodiment of the disclosure; Figure 4 This is a flowchart of a metamorphic relationship test provided in an embodiment of this disclosure; Figure 5(a) is an example schematic diagram of a control flow graph generated using the Soot tool according to an embodiment of this disclosure; Figure 5(b) is an example schematic diagram of a converted labeled control flow graph provided by an embodiment of this disclosure; Figure 5(c) is an example schematic diagram illustrating a metamorphic relationship identification method based on program control flow graph features according to an exemplary embodiment; Figure 6 This is a block diagram illustrating a metamorphic relationship identification device based on program control flow graph features, according to an exemplary embodiment. Figure 7 This is an example schematic diagram of an electronic device according to an exemplary embodiment. Detailed Implementation

[0018] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.

[0019] This disclosure provides a method, apparatus, electronic device, and storage medium for identifying metamorphic relationships based on program control flow graph features. In some embodiments, the terms "method for identifying metamorphic relationships based on program control flow graph features" and "information processing method," "communication method," etc., can be used interchangeably; the terms "apparatus for identifying metamorphic relationships based on program control flow graph features" and "information processing apparatus," "communication apparatus," etc., can be used interchangeably; and the terms "information processing system," "communication system," etc., can be used interchangeably.

[0020] This disclosure is not exhaustive, but merely illustrative of some embodiments, and is not intended to limit the scope of protection of this disclosure. Unless otherwise specified, each step in a particular embodiment can be implemented as an independent embodiment, and the steps can be arbitrarily combined. For example, a solution after removing some steps in a particular embodiment can also be implemented as an independent embodiment, and the order of the steps in a particular embodiment can be arbitrarily interchanged. Furthermore, the optional implementation methods in a particular embodiment can be arbitrarily combined; moreover, the embodiments can be arbitrarily combined, for example, some or all steps of different embodiments can be arbitrarily combined, and a particular embodiment can be arbitrarily combined with the optional implementation methods of other embodiments.

[0021] In each of the disclosed embodiments, unless otherwise specified or in case of logical conflict, the terminology and / or descriptions of the embodiments are consistent and can be referenced by each other. Technical features in different embodiments can be combined to form new embodiments based on their inherent logical relationships.

[0022] The terminology used in the embodiments of this disclosure is for the purpose of describing particular embodiments only and is not intended to limit the scope of this disclosure.

[0023] In this disclosure, unless otherwise stated, elements expressed in the singular form, such as "a," "an," "the," "the," "the," "the," "the," "the," "this," etc., can mean "one and only one," or "one or more," "at least one," etc. For example, when using articles such as "a," "an," "the," etc. in translation, the noun following the article can be understood as either a singular or a plural expression.

[0024] In the embodiments disclosed herein, "multiple" refers to two or more.

[0025] In some embodiments, the terms “at least one of,” “one or more,” “a plurality of,” and “multiple” may be used interchangeably.

[0026] The prefixes "first," "second," etc., used in the embodiments of this disclosure are merely for distinguishing different descriptive objects and do not impose restrictions on the position, order, priority, quantity, or content of the descriptive objects. The description of the descriptive objects is found in the claims or the context of the embodiments, and the use of prefixes should not constitute unnecessary restrictions. For example, if the descriptive object is a "field," the ordinal numbers preceding "field" in "first field" and "second field" do not restrict the position or order of the "fields." "First" and "second" do not restrict whether the "fields" they modify are in the same message, nor do they restrict the order of "first field" and "second field." Similarly, if the descriptive object is a "level," the ordinal numbers preceding "level" in "first level" and "second level" do not restrict the priority between "levels." Furthermore, the number of descriptive objects is not limited by ordinal numbers and can be one or more. For example, in "first device," the number of "devices" can be one or more. Furthermore, the objects modified by different prefixes can be the same or different. For example, if the object being described is "device", then "first device" and "second device" can be the same device or different devices, and their types can be the same or different. Similarly, if the object being described is "information", then "first information" and "second information" can be the same information or different information, and their content can be the same or different.

[0027] In some embodiments, "terminal" or "terminal device" may be referred to as "user equipment (UE)," "user terminal," "mobile station (MS)," "mobile terminal (MT)," "subscriber station," "mobile unit," "subscriber unit," "wireless unit," "remote unit," "mobile device," "wireless device," "wireless communication device," "remote device," "mobile subscriber station," "access terminal," "mobile terminal," "wireless terminal," "remote terminal," "handset," "user agent," "mobile client," "client," etc.

[0028] In some embodiments, data, information, etc., may be obtained with the user's consent.

[0029] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0030] Figure 1 This is a flowchart of the first method for identifying metamorphic relationships based on program control flow graph features provided in this disclosure, as shown in the following embodiments. Figure 1 As shown, this method for identifying metamorphic relationships based on program control flow graph features can be used in software testing scenarios, and includes the following steps: In step S11, the control flow graph (CFG) of the target program is obtained, and the control dependency graph is obtained based on the control flow graph and the forward dominance tree. In some embodiments, the implementing entity of this disclosure may be, for example, an electronic device. This electronic device does not specifically refer to a particular fixed electronic device. For example, when the device identifier changes, the electronic device may also change accordingly. For example, when the structure of the electronic device changes, the electronic device may also change accordingly.

[0031] In some embodiments, the target program may be, for example, the program to be tested. The target program is not specifically defined as a fixed program. For example, the target program may change if the executable statements it includes change. Similarly, the target program may change if the time point at which it is acquired changes. The method of acquiring the target program is not limited. The name of the target program is not limited. For example, the target program may be called the program to be tested, a test case, etc.

[0032] According to some embodiments, a control flow graph can be, for example, an abstract data structure representing the control flow of a target program during execution. Different target programs may correspond to different control flow graphs. The control flow graph in this disclosure is not specifically a fixed control flow graph. For example, when the target program changes, the control flow graph may also change accordingly.

[0033] In some embodiments, control statements can be, for example, syntactic structures in a control flow graph used to control the program execution flow, determining the execution order, branch selection, or loop repetition of code. Different control flow graphs can correspond to different control statements. The control statements corresponding to a control flow graph can be, for example, a set of control statements. This set of control statements can be, for example, a collection of at least one control statement. This set of control statements does not specifically refer to a fixed set. For example, when a control statement in the set changes, the set of control statements can also change accordingly. For example, when the number of control statements included in the set changes, the set of control statements can also change accordingly.

[0034] According to some embodiments, a node can be, for example, a node derived from a control statement. This node can be, for example, a tagged node. Specifically, the node can include tag information. Different nodes can correspond to different tag information.

[0035] In some embodiments, the node set may be, for example, a collection of at least one node corresponding to a control flow graph. This node set is not specifically a fixed set. For example, the node set may change when the number of nodes changes. Similarly, the node set may change when a node in the node set changes. The control flow graph corresponding to the target program can be obtained, and each control statement in the control flow graph can be converted into a node to obtain the node set corresponding to the control flow graph.

[0036] According to some embodiments, a control dependency graph is obtained from the control flow graph and the forward dominator tree. The forward dominator tree (FDT) is a hierarchical representation of dominance relationships in the control flow graph (CFG) from a forward perspective. It compresses the forward dominance relationship—"which nodes must be traversed from the entry point to reach a given node"—into a tree, serving as the infrastructure for compiler optimizations such as dominance boundary calculation, SSA construction, dead code removal, and loop detection. For example, the execution of a node may depend on the execution result of another node.

[0037] In step S12, a program dependency graph is obtained based on the control dependency graph and data dependency relationships; In some embodiments, data dependencies may be, for example, dependencies between nodes of a target program.

[0038] According to some embodiments, the program dependency graph may be, for example, a dependency graph corresponding to the target program, and this program dependency graph does not specifically refer to a fixed dependency graph. For example, when the target program changes, the program dependency graph may also change accordingly. For example, when the method of obtaining the program dependency graph changes, the program dependency graph may also change accordingly.

[0039] In some embodiments, a program dependency graph can be obtained based on the control dependency graph and data dependencies. In step S13, the program dependency graph is traversed according to the program analysis requirement slicing criterion C=(N,V) of the target program to obtain program slice features, where N represents the instructions in the target program and V represents the variable set; According to some embodiments, the program analysis requirement slicing criterion can be, for example, a slicing criterion corresponding to the target program. This slicing criterion can be used to obtain the slicing features of the target program. A program slice can be, for example, a small program related to the value of a certain variable at a certain point, which constitutes a slice. This program analysis requirement slicing criterion does not specifically refer to a fixed criterion. Different programs can correspond to different program analysis requirement slicing criteria.

[0040] In some embodiments, program slice features may be features obtained by traversing and slicing the program dependency graph. These program slice features are not specifically defined by any single fixed feature. For example, the program slice features may change accordingly when the method of obtaining them changes.

[0041] According to some embodiments, the program dependency graph can be traversed according to the program analysis requirement slicing criterion C=(N,V) of the target program to obtain program slice features, where N represents the instructions in the target program and V represents the variable set.

[0042] In step S14, the program slice features are input into the target prediction model for identification, and the prediction results corresponding to the metamorphosis relationship of the target program are obtained.

[0043] According to some embodiments, the target prediction model may be, for example, a model that has already been trained for predicting metamorphic relationships. This target prediction model is not specifically defined by a fixed model. For example, the target prediction model may change accordingly when the model type changes. Similarly, the target prediction model may change accordingly when the model parameters change.

[0044] In some embodiments, metamorphic relationships can be used to indicate multiple sets of relationships between the input and output of a target program. These metamorphic relationships are not specifically defined by a single fixed relationship. For example, the metamorphic relationship can change accordingly when the execution statements corresponding to the target program change.

[0045] According to some embodiments, the prediction result may be, for example, the result obtained by predicting the metamorphic relationship. This prediction result is not specifically a fixed outcome. For example, the prediction result may also change when the target prediction model changes. Similarly, the prediction result may change when the target program changes.

[0046] This disclosure may also include, for example, obtaining node features and path features of the target program, inputting the node features and path features into the target prediction model for identification, and obtaining the prediction results corresponding to the transformation relationship of the target program.

[0047] According to some embodiments, the program slice features can be input into the target prediction model for identification to obtain the prediction results corresponding to the metamorphosis relationship of the target program.

[0048] In some or related embodiments, a control flow graph (CFG) of the target program is obtained, and a control dependency graph is derived based on the CFG and the forward dominance tree. A program dependency graph is then obtained based on the control dependency graph and data dependencies. The program dependency graph is traversed according to the program analysis requirement slicing criterion C=(N, V) of the target program to obtain program slice features, where N represents the instructions in program P and V represents the variable set. These program slice features are then input into a target prediction model for identification, obtaining the prediction results corresponding to the transformation relationships of the target program. Therefore, transformation relationships can be obtained through the control dependency graph and program dependency graph, and can be obtained through a prediction model. This improves the accuracy of transformation relationship acquisition, reduces the number of cases where transformation relationships cannot be obtained, enhances the convenience of program development, and improves software development quality.

[0049] Figure 2 This is a flowchart of the second method for identifying metamorphic relationships based on program control flow graph features provided in this disclosure, as shown in the embodiment. Figure 2 As shown, this method for identifying metamorphic relationships based on program control flow graph features can be used in scenarios involving prediction of program metamorphic relationships, and includes the following steps: In step S21, the control flow graph (CFG) of the target program is obtained; The relevant processes can be as described above, and will not be repeated here.

[0050] In step S22, a program analysis tool is used to obtain the control flow graph of the target program; The relevant processes can be as described above, and will not be repeated here.

[0051] According to some embodiments, a program analysis tool can be used to perform static analysis on the target program to obtain a control flow graph. The program analysis tool may be, for example, Soot. This disclosure does not limit this approach.

[0052] In some embodiments, the control statements may include, for example, control statements for loop branches, or control statements for conditional branches.

[0053] In some embodiments, converting control statements in a control flow graph into nodes, for example, converting control statements in a control flow graph into labeled nodes, can improve the convenience of node feature extraction.

[0054] In step S23, the control flow graph is flipped to obtain the forward dominance tree based on the control flow graph and the execution order information corresponding to the control flow graph; According to some embodiments, execution order information can be used, for example, to indicate execution constraint information in the control flow graph. This execution order information may include, for example, information about when each statement is executed and at which node. This execution order information is not specifically fixed. For example, when the target program changes, this execution order information may also change accordingly. For example, when the control flow graph changes, this execution order information may also change accordingly.

[0055] In step S24, the control dependency graph is obtained based on the control flow graph and the forward dominance tree; The relevant processes can be as described above, and will not be repeated here.

[0056] In step S25, a program dependency graph is obtained based on the control dependency graph and data dependency relationship; The relevant processes can be as described above, and will not be repeated here.

[0057] According to some embodiments, obtaining the program dependency graph based on the control dependency graph and data dependencies includes: Based on the execution result of the first node in the control dependency graph, obtain the data dependency relationship and control dependency relationship between the second node and the first node; Based on the data dependency relationship between the second node and the first node, and the control dependency relationship, obtain the program dependency graph.

[0058] In some embodiments, the first node and the second node may be nodes executed adjacently. The "first" in the first node is used to distinguish it from the other nodes and does not specifically refer to a fixed set.

[0059] According to some embodiments, the control dependency relationship between nodes is found based on the control dependency graph. For example, if a and b are two nodes of a program CFG, and whether b can be executed depends on the execution result of a, then b is said to be control-dependent on a. Data dependency represents the dependence of a basic block (or statement) that references a variable in a program on the basic block that defines that variable, i.e., a "definition-reference" relationship. Let a and b be two nodes of a program CFG, and v be a variable in the program. If the following conditions are met, then b is said to be directly data dependent on a with respect to the variable v.

[0060] 1. If a defines variable v, i.e. v∈Def(a); In 2.b, the variable v is referenced, i.e., v∈Use(b); 3. There is an executable path from a to b, and there is no statement defining v on this path.

[0061] In step S26, the program dependency graph is traversed according to the program analysis requirement slicing criterion C=(N,V) of the target program to obtain program slice features, where N represents the instructions in program P and V represents the variable set. The relevant processes can be as described above, and will not be repeated here.

[0062] According to some embodiments, the process of performing graph traversal on the program dependency graph based on the program analysis requirement slicing criterion C=(N,V) of the target program to obtain program slice features includes at least one of the following: When the slice acquisition direction corresponding to the target program is a forward slice, trace back from the starting point of the target program, and collect all statements and variables that affect any node in the target program according to the program analysis requirement slicing criterion C=(N,V) to obtain program slice characteristics. When the slice acquisition direction corresponding to the target program is backward slicing, trace back from the end point of the target program, and collect all statements and variables that affect any node in the target program according to the program analysis requirement slicing criterion C=(N,V) to obtain program slice characteristics.

[0063] In step S27, the program slice features are input into the target prediction model for identification, and the prediction results corresponding to the metamorphosis relationship of the target program are obtained.

[0064] The relevant processes can be as described above, and will not be repeated here.

[0065] According to some embodiments, Figure 3A It is a code segment m of program p provided in this embodiment of the disclosure; Figure 3B This is the control flow graph (CFG) of code snippet m provided in the embodiments of this disclosure; Figure 3C This is the forward dominance tree (FDT) of code snippet m provided in the embodiments of this disclosure; Figure 3D This is the control dependency graph (CDG) of code snippet m provided in the embodiments of this disclosure; Figure 3E This is the program dependency graph (PDG) of code snippet m provided in the embodiments of this disclosure; Figure 3F This is a program dependency result diagram of the slice feature C provided in the embodiments of this disclosure.

[0066] According to some embodiments, a code segment m of program p and its metamorphic relation MR1' are used as follows: Figure 3A Described as an example.

[0067] Step 1: Based on the known program p code fragment m, obtain the control flow graph (CFG) of code fragment m, such as... Figure 3B .

[0068] Step 2: Add entries to the control flow graph (CFG) of m and flip the control flow graph to obtain the forward dominance tree (FDT), as shown below. Figure 3C The control dependency graph CDG can be obtained through CFG and FDT, such as Figure 3D .

[0069] Step 3: Based on the control dependency graph (CDG), the data dependencies can be plotted to obtain the program dependency graph (PDG), such as... Figure 3E .

[0070] Step 4: Based on the program dependency graph PDG and the slicing criterion C(12, z), perform a graph traversal starting from node print(“%d\n”, z);. Nodes filled in gray are the nodes obtained during the traversal. The numbers inside the circles next to the nodes indicate the order of the depth-first traversal. Figure 3F Finally, the slice features were obtained as {3, 4, 6, 7, 10, 12}.

[0071] Step 5: Use logistic regression to build a prediction model. Obtain the target prediction model corresponding to the target program from the prediction model set. The model type corresponding to the prediction model set includes at least one of support vector machine, decision tree and neural network model.

[0072] According to some embodiments, the method further includes: Obtain the historical program set of the initial prediction model; Obtain the historical control flow graph corresponding to each historical program in the historical program set; Obtain the historical node features and historical path features corresponding to the historical control flow graph; By employing historical node features and historical path features, the initial prediction model is trained to obtain the target prediction model. Therefore, training the model based on a historical program set can improve the accuracy of obtaining the target prediction model.

[0073] In some embodiments, an initial prediction model can be pre-selected, which may correspond to the program to be predicted, i.e., the initial prediction model can be obtained according to the application scenario. This prediction model includes, but is not limited to, vector machines, decision trees, or neural network models.

[0074] In some embodiments, for example, the initial prediction model can be trained based on the feature vectors corresponding to historical node features and the feature vectors corresponding to historical path features to improve the accuracy of obtaining metamorphic relationships.

[0075] According to some embodiments, the method further includes: Obtain the first number of samples whose initial prediction model is positive and the second number of samples whose initial prediction model is negative; Based on the first and second quantities, obtain the accuracy corresponding to the initial prediction model; Obtain the area under the ROC curve corresponding to the initial prediction model; The target prediction model is obtained when both the accuracy and the area under the ROC curve meet the accuracy requirements. Therefore, the accuracy and area under the ROC curve can be used to determine whether the trained model meets the requirements, which can improve the accuracy of the target prediction model and the accuracy of metamorphic relationship prediction.

[0076] In some implementations, accuracy and AUC can be used as metrics to evaluate the performance of a predictive model. Accuracy is the percentage of correctly classified predictions made by the model, calculated as the number of correctly classified samples divided by the total number of samples. Generally, a higher accuracy indicates a better classification model. AUC is defined as the area under the ROC curve and is used to evaluate the performance of a machine learning model. Since the ROC curve is generally located under the ROC curve... Above this line, the value of AUC ranges between 0.5 and 1. The closer the AUC is to 1, the stronger the predictive ability of the model. A classifier with AUC=0.5 is considered to be a classifier that makes random predictions, and a classifier with AUC>0.9 is considered to be an efficient classifier in the field of machine learning.

[0077] (1) in, e represents the number of correctly predicted samples in the positive sample; e represents the number of correctly predicted samples among the negative samples; e+ e represents the total number of samples.

[0078] According to some embodiments, the method further includes: Obtain the target prediction model corresponding to the target program from the prediction model set, wherein the model type corresponding to the prediction model set includes at least one of support vector machine, decision tree and neural network model.

[0079] According to some embodiments, for example, when the result output by the target prediction model is 1, the target program has a metamorphic relationship; for example, when the result output by the target prediction model is 0, the target program does not have a metamorphic relationship.

[0080] In one or related embodiments, a program analysis tool is used to obtain the control flow graph of the target program; based on the control flow graph and the execution order information corresponding to the control flow graph, the control flow graph is flipped to obtain a forward dominance tree; the control dependency graph is obtained based on the control flow graph and the forward dominance tree, which can improve the accuracy of node feature and path feature acquisition and improve software development quality.

[0081] According to some embodiments, the method may further include, for example: Obtain the control flow graph corresponding to the target program, and convert each control statement in the control flow graph into a node, thereby obtaining the node set corresponding to the control flow graph; Based on the set of nodes, obtain the node features and path features corresponding to the control flow graph; The node features and path features are input into the target prediction model for identification, and the prediction results corresponding to the metamorphosis relationship of the target program are obtained.

[0082] In some embodiments, Figure 4 This is a flowchart of a metamorphic relationship test according to an embodiment of the present disclosure, such as... Figure 4 As shown, it includes: Obtaining metamorphic relationships: Metamorphic relationships of the program under test are usually derived from the physical or mathematical model of the program.

[0083] Initial test case creation and execution: Test case generation techniques such as randomization, structure coverage, and fault-based testing can be used. The generated test inputs are then executed on the program under test to obtain the test output.

[0084] Derivative test case creation: Transform initial test cases using defined metamorphic relationships to obtain derived test cases.

[0085] Subsequent test case execution: Execute subsequent test cases and compare the outputs of the initial test cases and subsequent test cases, i.e., O=P(T) and O'=P(T'), to verify whether the corresponding metamorphic relation is satisfied. If the corresponding metamorphic relation is violated, it indicates that the program under test has an error. This is based on whether (O, O') belongs to R... f Determine whether a metamorphic relationship exists.

[0086] Table 1 illustrates the preset metamorphic relationships in embodiments of this disclosure. For example, the metamorphic relationships can be divided into input modes and output modes. A permutation relationship indicates that arbitrarily swapping the positions of two elements in the input data does not affect the output value. Add_all means adding a constant to each element of the input data, which will cause the output value to increase; Sub_all is the opposite of Add_all; it means that subtracting a constant from each element of the input data will result in a decrease in the output value. Add_one means that adding a constant to an element in the input data will cause the output value to increase; Sub_one means that subtracting a constant from one element in the input data will result in a decrease in the output value; Mul_all means that multiplying each element in the input data by a constant will cause the output value to increase; Mul_one indicates that multiplying an element of the input data by a constant will cause the output value to increase; Inclusive means that adding an element greater than or equal to 0 to the input data will cause the output value to increase; Exclusive means that subtracting one element from the input data will result in a smaller output value.

[0087] Table 1. Preset Transformation Relationships

[0088] According to some embodiments, Figure 5(a) is a control flow graph generated using the Soot tool, which can be, for example, a graphical representation of a Jimpple file. As can be seen from the figure, loop operations such as while and for in Java are replaced by goto operations and corresponding labels in Jimpple. Since the control flow graph in Figure 5(a) is not conducive to feature extraction, various control statements in the control flow graph can be labeled. Control flow graph labels can be, for example, as shown in Table 2. Figure 5(b) shows the transformed labeled control flow graph.

[0089] Table 2

[0090] According to some embodiments, node features may be features used to characterize the node. These node features do not specifically refer to a single fixed feature. Node features may include, for example, node type, number of nodes, node out-degree, and in-degree. These node features do not specifically refer to a single fixed feature. For example, when the number of features included in a node feature changes, the node feature may also change accordingly. For example, when the specific feature corresponding to a node feature changes, the node feature may also change accordingly.

[0091] In some embodiments, path features can be used to indicate corresponding execution paths in the control flow graph. These path features are not specific to any particular fixed feature. For example, the path feature may change when the control flow graph changes. Similarly, the path feature may change when control statements change.

[0092] In some embodiments, node features and path features corresponding to the control flow graph can be obtained based on the set of nodes.

[0093] Specifically, based on the set of nodes, the node features corresponding to the control flow graph are obtained, including at least one of the following: Based on the node type corresponding to each node in the node set, obtain the node type set corresponding to the control flow graph; Get the count for each node type in the set of node types in the control flow graph; Obtain the in-degree and out-degree of each node in the node set of the control flow graph.

[0094] In some embodiments, node types may include, for example, assignment operations, conditional operations, jump operations, and return operations. The node type of a given node is not limited; it can be determined based on the operation corresponding to the current node.

[0095] According to some embodiments, the number of occurrences can be used, for example, to represent the number of times various node types appear in the control flow graph. This number is not specifically a fixed number. For example, the number can change when the node type changes. Similarly, the number can change when the control flow graph changes.

[0096] In some implementations, the in-degree of a node is used to indicate the number of incoming edges for each node. The out-degree of a node... Spend This is used to indicate the number of outgoing edges for each node. For example, different nodes can correspond to different in-degrees and outgoing degrees.

[0097] In some embodiments, a node can refer to all labeled nodes in the control flow graph. For example, a combination of node name, in-degree, and out-degree can be used as a node of different types. The specific representation of the number of node types can be (operation-in-out: n). Here, operation-in-out represents the node type, where operation represents a labeled node in the control flow graph, in represents the in-degree of the node in the control flow graph, and out represents the out-degree of the node in the control flow graph; n is the number of nodes, representing the number of times this type of feature appears in the control flow graph.

[0098] According to some embodiments, an independent execution path can refer, for example, to multiple executions from the entry point to the exit point of a target program, in which at least one statement is not executed each time. An independent execution path in a control flow graph is represented as one that traverses at least one previously unvisited node each time.

[0099] In the embodiments of this disclosure, the independent path feature is defined as IdPath_Feature = (IdPath_Name, IdPath_Value), where IdPath_Name represents the independent path name, which is composed of nodes in the control flow graph, and nodes are connected by '-'. IdPath_Value represents the independent path value. Since each independent path appears only once in the control flow graph, this value is 1 by default.

[0100] According to some embodiments, this independent execution path can be used, for example, as a path that can be executed from the start node to the end node of the control flow graph. This independent path may, for example, include at least one unexecuted statement.

[0101] In some embodiments, all possible paths in the control flow graph can be determined first, including, for example, all possible execution paths in loops and conditional branches. For each path, it is determined whether it is an independent path, i.e., the path contains at least one unexecuted statement. That is, there is at least one different node between any two execution paths.

[0102] In some embodiments, the label information may be, for example, information used to identify the node. This label information does not refer to any specific, fixed information. For example, the label information may change accordingly when the node changes.

[0103] According to some embodiments, the set of independent execution paths can be, for example, a collection of at least one independent path. This set of independent execution paths does not specifically refer to a fixed set. For example, when one of the independent execution paths in the set changes, that independent execution path can also change accordingly.

[0104] According to some embodiments, the set of all independent execution paths in control is obtained, including: Select a target node from the set of nodes corresponding to the control flow graph. The target node is a non-starting node and a non-ending node, and the label information is the first label information. Based on the shortest path algorithm, obtain the first sub-execution path from the starting node to the target node; Based on the shortest path algorithm, obtain the second sub-execution path from the target node to the termination node; The first sub-execution path and the second sub-execution path are concatenated to obtain the concatenated independent execution path, and the label information of each node on the concatenated independent execution path is set as the second label information. Add the concatenated independent execution paths to the set of independent execution paths; Traverse the control flow graph to obtain the set of all independent execution paths in the control. Therefore, traversing the control flow graph and obtaining the set of independent paths based on label information can improve the accuracy of obtaining the set of independent paths and thus improve the accuracy of predicting transformation relationships.

[0105] In some embodiments, the first tag information may be used to indicate that the node is a node that has not been executed, that is, a node that has not been traversed by an independent execution path. This first tag information does not specifically refer to any particular fixed tag information. The "first" in the first tag information is used to distinguish it from other tag information. For example, when the components of the first tag information change, the first tag information may also change accordingly.

[0106] According to some embodiments, the target node may be a node that is neither a starting node nor a ending node, and whose label information is the first label information. The target node may be a node that has not been traversed between the starting node and the ending node. The name of the target node is not limited. The target node does not specifically refer to a fixed node. For example, the target node may change accordingly when the number of traversals changes.

[0107] In some embodiments, the first sub-execution path may be, for example, a path from the starting node to the target node. The "first" in this first sub-execution path is used to distinguish it from the other sub-execution paths and does not specifically refer to a fixed path. For example, when the target node corresponding to the first sub-execution path changes, the first sub-execution path may also change accordingly. For example, when the maximum path algorithm changes, the first sub-execution path may also change accordingly.

[0108] According to some embodiments, the second tag information may be, for example, the tag information of nodes already traversed by the execution path. This second tag information does not specifically refer to any fixed tag information. For example, when the composition of the second tag information changes, the second tag information may also change accordingly.

[0109] In some embodiments, the first sub-execution path and the second sub-execution path can be concatenated to obtain an independent execution path from the starting node to the ending node.

[0110] In some embodiments, the shortest path algorithm may be an algorithm that has already been trained and can be used to obtain sub-execution paths. This shortest path algorithm is not specifically defined by a single fixed algorithm. For example, when the type of algorithm corresponding to the shortest path algorithm changes, the shortest path algorithm may also change accordingly.

[0111] Specifically, for example, a container `IdPath` can be initialized, which is a tuple containing `name` and `value`. When there are nodes that have not been traversed, a node that is neither a start nor an end point and is not marked as 1 can be selected from the Control Flow Graph (CFG). The shortest path algorithm can be used to obtain the path from the start node to this node, and the markers of the traversed nodes are set to 1. Then, the shortest path algorithm is used again to obtain the path from the selected node to the end node, and the markers of the traversed nodes are set to 1. These two path segments can be concatenated to form the name of an independent path, which is then added to the container. This process is repeated until no node that is neither a start nor an end point and is not marked as 1 is selected from the control flow graph.

[0112] According to some embodiments, Figure 5(c) is an example schematic diagram illustrating a method for identifying metamorphic relationships based on program control flow graph features according to an exemplary embodiment. Referring to Figure 5(c), the method includes: obtaining function source code; obtaining the control flow graph using the Soot tool; obtaining node features using Algorithm 1; obtaining independent path features using Algorithm 2; obtaining preset metamorphic relationships through static analysis of the function source code; obtaining a training set; training a Python language model (PYML) to obtain a prediction model; testing the function under test; and predicting metamorphic relationships. The function under test can be, for example, a target program.

[0113] According to some embodiments, the codebase constructed in this disclosure may be as shown in Table 3, for example. Table 3 Functions in the codebase

[0114] In some embodiments, the obtained node features and independent path features may be as shown in Table 4 and Table 5, respectively.

[0115] Table 4

[0116] Table 5

[0117] According to some embodiments, for example, the model is trained using SVM in the PyML tool, and a linear kernel and the default PyML parameters (C=10) are used as the parameters for training the model. When evaluating the prediction model, the same data as the training set is selected as the data for evaluating the model.

[0118] According to some embodiments, two programs can be selected: GetModifyCRHeight and Summary_d. The GetModifyCRHeight program retrieves the corresponding control rod group height from the database using the given control rod group name. This function accepts an object storing control rod group information and the control rod group name, and returns a double-precision value representing the control rod group height. The Summary_d program sums the stored axial active heights. This function accepts an array storing the heights of the axial active regions and returns a double-precision value representing the sum of the heights.

[0119] After converting the selected test program into a control flow graph, the features of the test functions are extracted using the method described above, and a test dataset is constructed. This test dataset is then provided to the prediction model. For each metamorphic relationship, the model trained on it performs a prediction. A result of 1 indicates that the prediction model believes the program has a corresponding metamorphic relationship, while a result of 0 indicates that the prediction model believes the program does not have a corresponding metamorphic relationship. Prediction results can be, for example, as shown in Table 6.

[0120] Table 6

[0121] A block diagram illustrating a metamorphic relationship identification device based on program control flow graph features, according to an exemplary embodiment. (Refer to...) Figure 6 The device 600 includes: The dependency graph acquisition unit 601 is used to acquire the control flow graph (CFG) of the target program and obtain the control dependency graph based on the control flow graph and the forward dominance tree. The dependency graph acquisition unit 601 is further configured to obtain a program dependency graph based on the control dependency graph and data dependency relationship; The feature acquisition unit 602 is used to perform graph traversal on the program dependency graph according to the program analysis requirement slicing criterion C=(N,V) of the target program to obtain program slice features, where N represents the instructions in the target program and V represents the variable set; The result acquisition unit 603 is used to input the program slice features into the target prediction model for identification and obtain the prediction results corresponding to the metamorphosis relationship of the target program.

[0122] According to some embodiments, the dependency graph acquisition unit 601, when obtaining the control dependency graph based on the control flow graph and the forward dominance tree, is specifically used for: Use program analysis tools to obtain the control flow graph of the target program; Based on the control flow graph and the execution order information corresponding to the control flow graph, the control flow graph is flipped to obtain the forward dominance tree; The control dependency graph is obtained based on the control flow graph and the forward dominance tree.

[0123] According to some embodiments, the dependency graph acquisition unit 601, when obtaining the program dependency graph based on the control dependency graph and data dependencies, is specifically used for: Based on the execution result of the first node in the control dependency graph, obtain the data dependency relationship and control dependency relationship between the second node and the first node; Based on the data dependency relationship between the second node and the first node, and the control dependency relationship, obtain the program dependency graph.

[0124] According to some embodiments, the feature acquisition unit 602 is used to perform graph traversal on the program dependency graph according to the program analysis requirement slicing criterion C=(N,V) of the target program to acquire program slice features, specifically for at least one of the following: When the slice acquisition direction corresponding to the target program is a forward slice, trace back from the starting point of the target program, and collect all statements and variables that affect any node in the target program according to the program analysis requirement slicing criterion C=(N,V) to obtain program slice characteristics. When the slice acquisition direction corresponding to the target program is backward slicing, trace back from the end point of the target program, collect all statements and variables that affect any node in the target program according to the program analysis requirement slicing criterion C=(N,V), and obtain the program slice characteristics.

[0125] According to some embodiments, the result acquisition unit 603 is further specifically used for: Obtain the target prediction model corresponding to the target program from the prediction model set, wherein the model type corresponding to the prediction model set includes at least one of support vector machine, decision tree and neural network model.

[0126] According to some embodiments, the result acquisition unit 603 is further specifically used for: Obtain the historical program set of the initial prediction model; Obtain the historical control flow graph corresponding to each historical program in the historical program set; Obtain the historical node features and historical path features corresponding to the historical control flow graph; The initial prediction model is trained using historical node features and historical path features to obtain the target prediction model.

[0127] According to some embodiments, the result acquisition unit 603 is further specifically used for: Obtain the first number of samples whose initial prediction model is positive and the second number of samples whose initial prediction model is negative; Based on the first and second quantities, obtain the accuracy corresponding to the initial prediction model; Obtain the area under the ROC curve corresponding to the initial prediction model; The target prediction model is obtained when the accuracy meets the accuracy requirement and the area under the ROC curve meets the area requirement.

[0128] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0129] In some or related embodiments, a dependency graph acquisition unit is used to acquire the control flow graph (CFG) of the target program and obtain a control dependency graph based on the control flow graph and the forward dominance tree. The dependency graph acquisition unit is also used to obtain a program dependency graph based on the control dependency graph and data dependencies. A feature acquisition unit is used to perform graph traversal on the program dependency graph according to the program analysis requirement slicing criterion C=(N, V) of the target program to obtain program slice features, where N represents the instructions in the target program and V represents the variable set. A result acquisition unit is used to input the program slice features into a target prediction model for identification and obtain the prediction results corresponding to the transformation relationships of the target program. Therefore, transformation relationships can be obtained through the control dependency graph and program dependency graph, and transformation relationships can be obtained through a prediction model. This improves the accuracy of transformation relationship acquisition, reduces the number of cases where transformation relationships cannot be obtained, improves the convenience of program development, and enhances the quality of software development.

[0130] Figure 7 A schematic block diagram of an example electronic device 700 that can be used to implement embodiments of the present disclosure is shown. The electronic device 700 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0131] like Figure 7As shown, the electronic device 700 includes a computing unit 701, which can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. The RAM 703 may also store various programs and data required for the operation of the electronic device 700. The computing unit 701, ROM 702, and RAM 703 are interconnected via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0132] Multiple components in electronic device 700 are connected to I / O interface 705, including: input unit 706, such as keyboard, mouse, etc.; output unit 707, such as various types of displays, speakers, etc.; storage unit 708, such as disk, optical disk, etc.; and communication unit 709, such as network card, modem, wireless transceiver, etc. Communication unit 709 allows electronic device 700 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0133] The computing unit 701 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 701 performs the various methods and processes described above. For example, in some embodiments, the above methods can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 708. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 700 via ROM 702 and / or communication unit 709. When the computer program is loaded into RAM 703 and executed by the computing unit 701, one or more steps of the methods described above can be performed. Alternatively, in other embodiments, the computing unit 701 can be configured to perform the above methods by any other suitable means (e.g., by means of firmware).

[0134] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0135] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0136] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0137] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0138] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), the Internet, and blockchain networks.

[0139] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is established by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service system that addresses the shortcomings of traditional physical hosts and VPS (Virtual Private Server, or simply "VPS") services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers incorporating blockchain technology.

[0140] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0141] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A method for identifying metamorphic relationships based on program dependence graph features, comprising: include: ​ Obtain the control flow graph (CFG) of the target program, and obtain the control dependency graph based on the control flow graph and the forward dominance tree; The program dependency graph is obtained based on the control dependency graph and data dependencies; Based on the program analysis requirement slicing criterion C=(N,V) of the target program, the program dependency graph is traversed to obtain program slice features, where N represents the instructions in the target program and V represents the variable set; The program slice features are input into the target prediction model for identification, and the prediction results corresponding to the metamorphosis relationship of the target program are obtained.

2. The method of claim 1, wherein, The process of obtaining the control dependency graph based on the control flow graph and the forward dominance tree includes: Use program analysis tools to obtain the control flow graph of the target program; Based on the control flow graph and the execution order information corresponding to the control flow graph, the control flow graph is flipped to obtain the forward dominance tree; The control dependency graph is obtained based on the control flow graph and the forward dominance tree.

3. The method of claim 1, wherein, The step of obtaining the program dependency graph based on the control dependency graph and data dependencies includes: Based on the execution result of the first node in the control dependency graph, obtain the data dependency relationship and control dependency relationship between the second node and the first node; Based on the data dependency relationship between the second node and the first node, and the control dependency relationship, obtain the program dependency graph.

4. The method of claim 1, wherein, The step of performing a graph traversal on the program dependency graph based on the program analysis requirement slicing criterion C=(N,V) of the target program to obtain program slice features includes at least one of the following: When the slice acquisition direction corresponding to the target program is a forward slice, trace back from the starting point of the target program, and collect all statements and variables that affect any node in the target program according to the program analysis requirement slicing criterion C=(N,V) to obtain program slice characteristics. When the slice acquisition direction corresponding to the target program is backward slicing, trace back from the end point of the target program, collect all statements and variables that affect any node in the target program according to the program analysis requirement slicing criterion C=(N,V), and obtain the program slice characteristics.

5. The method of claim 1, wherein, The method further includes: Obtain the target prediction model corresponding to the target program from the prediction model set, wherein the model type corresponding to the prediction model set includes at least one of support vector machine, decision tree and neural network model.

6. The method of claim 1, wherein, The method further includes: Obtain the historical program set of the initial prediction model; Obtain the historical program dependency graph corresponding to each historical program in the historical program set; Obtain the historical slice features corresponding to the historical program dependency graph; The initial prediction model is trained using the historical slice features to obtain the target prediction model.

7. The method of claim 6, wherein, The method further includes: Obtain a first number of samples whose initial prediction model is positive and a second number of samples whose initial prediction model is negative; Based on the first quantity and the second quantity, obtain the accuracy corresponding to the initial prediction model; Obtain the area under the ROC curve corresponding to the initial prediction model; The target prediction model is obtained when the accuracy meets the accuracy requirement and the area under the ROC curve meets the area requirement.

8. A device for identifying metamorphic relationships based on program dependency graph features, characterized in that, include: The dependency graph acquisition unit is used to acquire the control flow graph (CFG) of the target program and obtain the control dependency graph based on the control flow graph and the forward dominance tree. The dependency graph acquisition unit is further configured to obtain a program dependency graph based on the control dependency graph and data dependency relationship; The feature acquisition unit is used to perform graph traversal on the program dependency graph according to the program analysis requirement slicing criterion C=(N,V) of the target program to obtain program slice features, where N represents the instructions in the target program and V represents the variable set; The result acquisition unit is used to input the program slice features into the target prediction model for identification and to obtain the prediction results corresponding to the metamorphosis relationship of the target program.

9. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the metamorphic relationship identification method based on program dependency graph features as described in any one of claims 1 to 7.

10. A storage medium, the storage medium storing instructions, wherein, When the instructions are executed on an electronic device, the electronic device performs the metamorphic relationship identification method based on program dependency graph features as described in any one of claims 1 to 7.