CN116991701A - Data processing method, device, electronic equipment, storage medium and program product - Google Patents

Data processing method, device, electronic equipment, storage medium and program product Download PDF

Info

Publication number
CN116991701A
CN116991701A CN202211163933.3A CN202211163933A CN116991701A CN 116991701 A CN116991701 A CN 116991701A CN 202211163933 A CN202211163933 A CN 202211163933A CN 116991701 A CN116991701 A CN 116991701A
Authority
CN
China
Prior art keywords
program
node
target
information
basic block
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211163933.3A
Other languages
Chinese (zh)
Inventor
高文冠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202211163933.3A priority Critical patent/CN116991701A/en
Publication of CN116991701A publication Critical patent/CN116991701A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3676Test management for coverage analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Software Systems (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the invention discloses a data processing method, a device, electronic equipment, a storage medium and a program product, wherein the data processing method obtains a program control flow diagram through grammar analysis of a target program, and as the nodes of the program control flow diagram correspond to program branch nodes of the target program, basic blocks corresponding to the program branch nodes can be generated according to the program control flow diagram; next, determining injection information of the basic block, wherein the injection information comprises node labels for identifying program branch nodes by entry position information of the basic block; then, the node tag and a preset target function are written in the target program according to the entry position information, so that when the basic block is called, the target function is triggered to automatically write the node tag into the call record table. Therefore, the data processing method provided by the embodiment of the invention can automatically report the node label when the basic block is called, realize the perspective of the program branch node and provide a basis for improving the efficiency of flow test and analysis.

Description

Data processing method, device, electronic equipment, storage medium and program product
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a data processing method, apparatus, electronic device, storage medium, and program product.
Background
With the continuous development of internet technology, the provision of business services through programs has become a mainstream trend. In order to test and analyze the target program of the business service, when the target program runs the use case, the called program branch node in the target program needs to be determined.
In the related art, it is determined that a code mapping relation between a use case and a target program needs to be preset for a called program branch node, after the flow of the use case is sent to the target program, the called program branch node is determined by backtracking a code covered by the flow. By the method, the called program branch nodes are determined, forward tracing and coverage rate analysis consume more time, and under the condition of more flow, the testing and analysis efficiency is required to be improved.
Disclosure of Invention
The following is a summary of the subject matter described in detail herein. This summary is not intended to limit the scope of the claims.
The embodiment of the invention provides a data processing method, a device, electronic equipment, a storage medium and a program product, which can automatically report node labels when program branch nodes are called, realize perspective of the program branch nodes and provide a basis for improving the efficiency of flow test and analysis.
In one aspect, an embodiment of the present invention provides a data processing method, including:
carrying out grammar analysis on a target program to obtain a program control flow graph of the target program;
generating a basic block corresponding to a program branch node of the target program according to the program control flow diagram;
determining injection information of the basic block, wherein the injection information comprises entry position information of the basic block and a node label for identifying a corresponding program branch node;
and writing the node tag and a preset target function in the target program according to the entry position information, wherein the target function is used for acquiring the node tag when the basic block is called and writing the node tag into a call record table.
On the other hand, the embodiment of the invention also provides a data processing device, which comprises:
the grammar analysis module is used for carrying out grammar analysis on the target program to obtain a program control flow diagram of the target program;
the basic block generation module is used for generating basic blocks corresponding to program branch nodes of the target program according to the program control flow diagram;
the injection information generation module is used for determining injection information of the basic block, wherein the injection information comprises entry position information of the basic block and a node label used for identifying a corresponding program branch node;
And the function injection module is used for writing the node tag and a preset target function in the target program according to the entry position information, wherein the target function is used for acquiring the node tag and writing the node tag into a call record table when the basic block is called.
Further, the above grammar parsing module is specifically configured to:
carrying out grammar analysis on the target program to obtain node information and boundary information of the program branch nodes;
and generating the program control flow graph according to the node information and the boundary information.
Further, the above grammar parsing module is specifically configured to:
analyzing the target program to obtain a node information pool, wherein the node information pool comprises a plurality of identifiable characters and a plurality of node intervals;
identifying an entry statement for the basic block based on a grammatical parsing of a continuous plurality of the recognizable characters;
and extracting the node information and the boundary information from the content recorded in the node section where the entry sentence is located based on a preset protocol.
Further, the object program includes a plurality of the basic blocks, the node information includes start point position information and end point position information, and the basic block generation module is specifically configured to:
Analyzing the program control flow graph to determine sub-node information of each program branch node, wherein the sub-node information is used for identifying program sub-branch nodes of the program branch nodes;
determining scope information of the program branch node based on the starting point position information, the end point position information and the child node information corresponding to the program branch node;
generating the basic block according to the scope information
Further, when the program branch node is a program parent branch node and includes the program child branch node, the basic block generating module is further specifically configured to:
determining a first scope interval based on the starting point position information of the branch parent node and the starting point position information of the program child branch node;
determining a second scope section based on the start point position information of the program sub-branch node and the end point position information of the program sub-branch node, wherein the first scope section and the second scope section are mutually disjoint;
generating a first information set according to the first scope interval and the child node information of the program parent branch node, and generating a second information set according to the second scope interval and the child node information of the program child branch node;
Determining the first information set as the scope information of the program parent branch node;
and when the sub-node information of the program sub-branch node is empty, determining the second information set as the scope information of the program sub-branch node.
Further, the data processing device further comprises a file identification module, specifically configured to:
determining a target service module, wherein the target service module comprises a plurality of module files;
determining the module file recorded with the business logic as a target file;
and determining the program recorded in the target file as the target program.
Further, the object program includes a plurality of the basic blocks, and the basic block generation module is specifically further configured to:
generating target injection information of the basic block based on a file identification of the target file and the injection information of the corresponding basic block;
and generating an injection information list of the target file according to all the target injection information.
Further, the data processing device further comprises a flow processing module, and the flow processing module is specifically configured to:
recording test flow, when the test flow calls a target basic block, acquiring a corresponding node label based on the target function corresponding to the target basic block, and writing the node label into the call record table;
When the test flow is recorded, acquiring the node label triggered and written by the test flow from the call record list;
and determining the flow path information of the test flow based on the node label which is written in by triggering the test flow.
Further, the number of the test flows is plural, and the flow processing module is specifically configured to:
screening at least one target test flow from a plurality of test flows according to a preset flow screening rule to obtain a target flow set consisting of at least one target test flow;
and determining node coverage rate of the target flow set to the target program according to the flow path information of each target test flow.
Further, the flow processing module is specifically configured to:
summarizing a set of target basic blocks corresponding to the target flow set according to the flow path information of each target test flow;
and determining the node coverage rate according to the set of the target basic blocks.
Further, the flow processing module is specifically configured to:
generating a target label list based on the recorded union of the node labels triggered and written by the test flow;
Converting the target tag list into a target feature vector, wherein vector elements of the target feature vector are the node tags of the target tag list;
performing OR operation according to the newly recorded flow path information of the test flow and the target feature vector;
and when the target feature vector is added with a new vector element through the OR operation, determining the newly recorded test flow as the target test flow.
On the other hand, the embodiment of the invention also provides electronic equipment, which comprises a memory and a processor, wherein the memory stores a computer program, and the processor realizes the data processing method when executing the computer program.
In another aspect, an embodiment of the present invention further provides a computer readable storage medium, where a program is stored, where the program is executed by a processor to implement the above-mentioned data processing method.
In another aspect, a computer program product or computer program is provided, the computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions so that the computer device performs the data processing method described above.
The embodiment of the invention at least comprises the following beneficial effects: according to the embodiment of the invention, the program control flow diagram is obtained by carrying out grammar analysis on the target program, and as the nodes of the program control flow diagram correspond to the program branch nodes of the target program, the basic blocks corresponding to the program branch nodes can be generated according to the program control flow diagram; next, determining injection information of the basic block, wherein the injection information comprises node labels for identifying program branch nodes by entry position information of the basic block; then, the node label and the preset target function are written in the target program according to the entry position information, so that when the basic block is called, the target function is triggered to automatically write the node label into the call record table, and the called program branch node is automatically determined according to the call record table. Therefore, the data processing method provided by the embodiment of the invention can automatically report the node label when the basic block is called, realize the perspective of the program branch node and provide a basis for improving the efficiency of flow test and analysis.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
The accompanying drawings are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate and do not limit the invention.
FIG. 1 is a schematic diagram of an implementation environment provided by an embodiment of the present invention;
FIG. 2 is a block diagram of a data processing system according to an embodiment of the present invention;
FIG. 3 is a flowchart of a data processing method according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a process for parsing a target program according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of an example of a program control flow diagram according to an embodiment of the present invention;
FIG. 6 is a schematic diagram illustrating an example of scope information of a program branch node according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of an example of an injection information list according to an embodiment of the present invention;
FIG. 8 is a schematic diagram illustrating a process for recording test flow according to an embodiment of the present invention;
fig. 9 is a schematic diagram of a processing procedure of a flow screening rule according to an embodiment of the present invention;
FIG. 10 is a flowchart illustrating a data processing method according to an embodiment of the present invention;
FIG. 11 is a schematic diagram of a data processing apparatus according to an embodiment of the present invention;
Fig. 12 is a block diagram of a portion of a terminal according to an embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
In the embodiments of the present application, when related processing is performed according to data related to characteristics of a target object, such as attribute information or attribute information set of the target object, permission or consent of the target object is obtained first, and the collection, use and processing of the data comply with relevant laws and regulations and standards of relevant countries and regions. Wherein the target object may be a user. In addition, when the embodiment of the application needs to acquire the attribute information of the target object, the independent permission or independent consent of the target object is acquired through a popup window or a jump to a confirmation page or the like, and after the independent permission or independent consent of the target object is explicitly acquired, the necessary target object related data for enabling the embodiment of the application to normally operate is acquired.
Before describing embodiments of the present invention in further detail, the terms and terminology involved in the embodiments of the present invention will be described, and the terms and terminology involved in the embodiments of the present invention are suitable for the following explanation:
basic block: a basic block is a sequence of statements that are executed in the program in maximum order, with only one entry being its first statement and one exit being its last statement. The entry statement of the basic block may be the first statement of the program, the target statement of the jump, or the next statement of the conditional jump; the exit statement of the basic block may be a stop statement, a skip statement, or a statement (lexical order) preceding the skip target statement. Each basic block satisfies the following condition: control flow can only enter from the first instruction of the basic block and, except for the last instruction of the basic block, control flow does not stall or jump before leaving the basic block. Therefore, a typical feature of the basic block is: all execution within the basic block will be performed in sequence only once, as long as the first instruction in the basic block is executed.
Program control flow graph: the result of the control flow analysis is a directed graph in which nodes represent basic blocks, directed edges between nodes represent control flow paths, and reverse edges represent loops that may exist.
Cppcheck: the static checking tool for the C/C++ code defects is different from a C/C++ compiler and other analysis tools, and Cppcheck only checks bug which cannot be checked by the compiler and does not check grammar errors.
DUMP: i.e., DUMP (also called DUMP), DUMP to file means dumping the data in memory into a static (file) format. DUMP files, representing the dumped files.
Scope (Scope): the data structure representing a code scope is not always valid/available for a name used in a piece of program code, and the scope of code defining the availability of this name is the scope of this name.
Daily construction (Dailybuild), a timing triggered flow recording method.
In the related art, it is determined that a code mapping relation between a use case and a target program needs to be preset for a called program branch node, after the flow of the use case is sent to the target program, the called program branch node is determined by backtracking a code covered by the flow. According to the method, the called program branch node is determined to record the flow, so that the flow can be sent only in a serial mode in order to avoid interference among different flows, and under the condition of more flows, the testing and analyzing efficiency is required to be improved.
Based on the above, the embodiment of the invention provides a data processing method, a device, electronic equipment, a storage medium and a program product, which can automatically report a node label when a program branch node is called, realize perspective of the program branch node and provide a basis for improving efficiency of flow test and analysis.
The data processing method provided by the embodiment of the invention can be applied to testing scenes of programs such as cloud technology, artificial intelligence, intelligent traffic, auxiliary driving and the like, and the specific principle of the data processing method provided by the embodiment of the invention is described in detail below with reference to the accompanying drawings.
Referring to fig. 1, fig. 1 is a schematic diagram of an implementation environment provided by an embodiment of the present invention, where the implementation environment includes a server 101 and a terminal 102, where the terminal 102 and the server 101 are connected through a communication network 103.
The server 101 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs (Content Delivery Network, content delivery networks), basic cloud computing services such as big data and artificial intelligent platforms, and the like.
In addition, server 101 may also be a node server in a blockchain network.
The terminal 102 may be, but is not limited to, a smart phone, tablet, notebook, desktop, smart box, smart watch, car terminal, etc. The terminal 102 and the server 101 may be directly or indirectly connected through wired or wireless communication, which is not limited in this embodiment of the present invention.
The terminal 102 shown in fig. 1 may be a terminal for performing flow test or analysis, where the terminal 102 may be configured with a target program, and after the target program is configured, analyze the target program to obtain a program control flow diagram, and generate a basic block corresponding to each program branch node according to the program control flow diagram; next, determining injection information of the basic block, wherein the injection information comprises node labels for identifying program branch nodes by entry position information of the basic block; then, writing a node tag and a preset target function in a target program according to the entry position information, so that when the basic block is called, triggering the target function to automatically write the node tag into a call record table; in the test environment, when the terminal 102 obtains the test flow sent by the server 101, and when the basic block of the target program is called, the node label of the branch node of the target function obtaining program is triggered, and the obtained node label is written into the call record table in the terminal 102, so as to realize automatic obtaining of the flow running path of the test flow.
It may be appreciated that, after the target program writes the node tag and the target function, the terminal 102 may also run a unit test or compile analysis of the target program in the test environment, and trigger the target function to report the node tag when the corresponding basic block is called, so as to determine that the unit test achieves full coverage of the unit under test, or quickly locate through the node tag when an abnormal node is detected.
It will be appreciated that the terminal 102 may also operate the target program in a formal environment, where the flow entering the target program triggers the target function, and writes the corresponding node tag into the call record table.
In addition, the target program may be directly run in the server 101, and at this time, the node tag and the target function may be injected into only each target program of the server 101, and when the server 101 performs analysis or test on the target program, the node tag of the basic block called may be automatically reported when the target program is executed, so as to complete the analysis or test on the server 101.
With reference to fig. 2, fig. 2 is a schematic diagram of a data processing system according to an embodiment of the present invention, where the data processing system may be deployed on the server 101 or the terminal 102 shown in fig. 1, and is hereinafter illustrated as being deployed on the terminal 102. The architecture of the data processing system provided by the embodiment of the invention comprises a code grammar analysis module, a basic block generation module, a code injection module, a flow data reporting module and a flow screening service, wherein the code grammar analysis module is used for analyzing the flow data. At the compiling period of the target program, the code grammar analysis module is used for carrying out grammar analysis on the target program to obtain a program control flow diagram of the target program, the basic block generation module is used for generating basic blocks corresponding to program branch nodes of the target program according to the program control flow diagram, the code injection module is used for determining injection information of the basic blocks, the injection information comprises inlet position information of the basic blocks and node labels used for identifying the corresponding program branch nodes, and the node labels and preset target functions are written in the target program according to the inlet position information. In addition, in the running period of the target program, after the flow is input into the target program, the target function of the called basic block acquires the corresponding node label, and the flow data reporting module writes the node labels acquired by the target functions into the calling record table. Then, taking a flow screening application scenario as an example based on the flow data acquired in the operation period, in the offline calculation period, the flow screening service can trigger the written node labels according to each flow written in the call record table, and perform flow extraction by combining with a preset flow screening rule to obtain a target flow set.
Based on the implementation environment shown in fig. 1 and the test system architecture shown in fig. 2, the principle of the data processing method provided by the embodiment of the present invention is described in detail below. Referring to fig. 3, fig. 3 is a flowchart of a data processing method according to an embodiment of the present invention, which may be executed by the server 101 of fig. 1, or may be executed by the terminal 102 of fig. 1, or may be executed by both the server 101 and the terminal 102 of fig. 1, and the data processing method is described below by taking the execution of the data processing method by the terminal 102 as an example, and the data processing method includes, but is not limited to, the following steps 301 to 304.
Step 301: and carrying out grammar analysis on the target program to obtain a program control flow graph of the target program.
The step may be performed by a code syntax parsing module shown in fig. 2, where the program control flow graph is used for automatically generating basic blocks later, and each program branch node of the target program is determined through syntax parsing at the compiling period of the target program, so as to form the program control flow graph, where the program branch nodes are graphic nodes of the program control flow graph, each graphic node corresponds to a basic block, and the basic block corresponding to the graphic node includes a statement sequence capable of being executed in a maximum order, for example, a conditional branch of a judgment statement, a jump statement meeting a condition, an assignment statement, and the like.
In one possible implementation manner, before the grammar parsing of the target program, the target service module can be determined, where the target service module includes a plurality of module files, and the module file recorded with the service logic is determined as the target file; the program described in the target file is determined as the target program. Specifically, the target service module may be executed in the terminal to implement one or more service functions, such as popularization information display, information transmission, quick payment, game operation, and the like. In addition, the module files in the target business module can record different contents, such as system configuration, business logic or remark information, and flow screening, unit testing or compiling analysis according to test flow are usually performed on the business logic, so that the module files recorded with the business logic can be determined as target files, and programs recorded in the target files are determined as target programs, unnecessary program analysis is reduced, and the node label injection efficiency is improved.
The target program may be all programs described in the target file, or may be defined by a program identifier or a program type, and a partial fragment may be determined as the target program from the programs described in the target file.
It can be understood that, when the target service module includes a plurality of target files, the program of each target file may be determined as a target program, and the data processing method of the present embodiment is independently executed for each target program; the program union of the plurality of target files may be used as a target program, for example, the target files related to the plurality of functions may be combined, or the target files of the same type of functions may be combined.
After the target file is acquired, the target file needs to be input into a static code checking tool to acquire a dump file generated by the static code checking tool, and because the dump file is recorded with information such as each variable, array boundary, function and the like through traversal when the static code checking tool performs logic checking, a program control flow diagram can be obtained by carrying out grammar analysis on the dump file. Illustratively, the static code checking tool may be Cppcheck, which is not limited in this embodiment.
The following generally describes the operation of generating a program control flow graph in an embodiment of the present invention with reference to the accompanying drawings. Referring to fig. 4, fig. 4 is a schematic diagram of a process of parsing a target program according to an embodiment of the present invention, where the target program is a program recorded in one target file, during a compilation period, a terminal determines that one or more module files related to service logic in a target service module are determined as target files, inputs the target files into a Cppcheck tool to generate corresponding dump files, includes all symbol sets and various section information in the target program of the target files, inputs the dump files into a code syntax parsing module, and parses the dump files to obtain a program control flow diagram.
In one possible implementation manner, the target program is subjected to grammar analysis to obtain a program control flow diagram of the target program, and specifically, node information and boundary information of a program branch node can be obtained by grammar analysis of the target program; and generating a program control flow graph according to the node information and the boundary information.
The program control flow diagrams in the embodiments of the present invention are described in detail below with reference to the accompanying drawings. Referring to fig. 5, fig. 5 is an exemplary schematic diagram of a program control flow diagram according to an embodiment of the present invention, where the program control flow diagram includes node information, boundary information, and control flow scope information.
The node information belongs to the program branch node and can comprise information such as node identification, node entry statement, constraint information, node type, starting point position information, end point position information, node scope identification and the like, wherein the node identification is used for identifying the program branch node; the node entry statement is an entry statement of a program branch node, namely an entry statement of a basic block, such as a judgment condition statement, a jump statement and the like; constraint information is used for indicating the jump operation of the program branch node, and can be keywords such as "return", "break" or "continuous" and the like; the node type can be a keyword and a Boolean value thereof, wherein the keyword is used for representing the type of the program branch node, such as function, if, normal and the like; the start position information may be a position of an entry sentence of the program branch node in the target program, the terminal position information may be a position of an exit sentence of the program branch node in the target program, for example, the start position information is "first line", and the terminal position information is "sixth line"; the node scope identifier is an identifier of a scope to which the program branch node belongs.
The boundary information may include a plurality of boundary sections, each of which is used to characterize the control flow, for example, the target program includes three program branch nodes, the node identifier of the program branch node 1 is ID1, the node identifier of the program branch node 2 is ID2, the node identifier of the program branch node 3 is ID3, the program branch node 2 is a child node of the program branch node 1, the program branch node 3 is a child node of the program branch node 2, the boundary information is recorded by the node identifier of the program branch node, the boundary section 1 is [ ID1, ID2], the boundary section 2 is [ ID2, ID3], and the boundary section 3 is [ ID3, -1], where, -1 represents the end node.
Illustratively, the control flow scope information is used to characterize the scope of action of the program branch node in the target program, and may specifically include a control flow scope identifier, a control flow type, control flow start point information, control flow end point information, and sub-control flow information. The control flow scope identifier is used for identifying a scope of the program control flow graph, the control flow type can be keywords of the type of the control flow such as functions, if, normal and the like and the boolean value of the keywords, the control flow start point information is a first node scope identifier corresponding to the program control flow graph, the control flow end point information is a last node scope identifier corresponding to the program control flow graph, and the sub-control flow information is identification information of a sub-control flow graph of the program control flow graph.
In one possible implementation manner, the method includes that the target program is parsed to obtain node information and boundary information of program branch nodes, specifically includes that the target program is parsed to obtain a node information pool, and the node information pool comprises a plurality of identifiable characters and a plurality of node sections; identifying an entry statement for the basic block based on a grammatical parsing of the continuous plurality of recognizable characters; based on a preset protocol, node information and boundary information are extracted from contents recorded in a node section where an entry sentence is located.
The node information pool may be a Dump file obtained by inputting the code static analysis tool into the target file, and the Dump file records a character set and interval information obtained by traversing the code static analysis tool, wherein the character set includes a plurality of recognizable characters, and the recognizable characters may be characters defining keywords, variables, assignment operators and the like, for example, for a sentence "a > b" in the target program, the recognizable characters recorded in the Dump file are "a", "b". In addition, the node section may be section information analyzed from the Dump file, and may be determined by identifying pairs of brackets in the Dump file, and in the process of analyzing the Dump file, positions corresponding to each pair of brackets are identified, so as to form a plurality of node sections, and each node section is recorded with one or more identifiable characters for forming a series of variables and operation sentences.
It will be appreciated that each graphic node of the program control flow graph is a basic block of the target program, the entry statement of the basic block is typically the first statement of the program, the target statement of the jump, or the next statement of the conditional jump, etc., while the recognizable characters in the Dump file are written in the sequence of traversal, so that grammar recognition can be performed according to a plurality of consecutive recognizable characters, and when a statement composed of a plurality of consecutive recognizable characters together satisfies the type of the entry statement, the statement can be determined as the entry statement of one basic block. For example, three consecutive recognizable characters are "a", "a" and "b", respectively, and the first two recognizable characters are recognized and cannot constitute a complete operation sentence, then the three recognizable characters are parsed to obtain "a > b", which belongs to a complete condition judgment sentence, and then are determined as an entry sentence.
In addition, after the entry and exit sentence is identified, the node section where the entry sentence is located may be taken as the node section of the program branch node, and the identifiable character located in the node section constitutes the content of the program branch node, so that the node information and the boundary information may be extracted from the content recorded in the node section, for example, the node section is from the 1 st line to the 6 th line, the 1 st line may be determined as the start point position information of the program branch node, the 6 th line may be determined as the end point position information of the program branch node, and the identifiable characters recorded in the 1 st line to the 6 th line may be parsed to obtain each node information, for example, when the identifiable character is a constraint keyword, the identifiable character located in the subsequent position of the constraint keyword may be obtained as the boolean value thereof. For another example, the recognizable character is a keyword that characterizes the scope, and the recognizable character that follows the keyword of the scope is identified as the node scope. In addition, when another entry sentence is identified in the 2 nd line, it may be determined that the program branch node has a program sub-branch node, and when it is determined that the node section corresponding to the program sub-branch node is the 2 nd line to the 4 th line in the same manner as described above, the node information of the program sub-branch node is extracted in the 2 nd line to the 4 th line, the node information of the program sub-branch node is not included in the node information of the program parent branch node, for example, the constraint keyword extracted from the 2 nd line to the 4 th line is used as the node information of the program sub-branch node, and is not used as the node information of the program parent branch node.
In order to normalize the extracted node information and boundary information, a preset protocol of the program control flow graph needs to be preset, and the preset protocol may be used to indicate a data frame of the program control flow graph, for example, the program control flow graph shown in fig. 5, and the program control flow graph is specified to include node information, boundary information and control flow scope information through the preset protocol, and specific content included in each item of information, for example, the node information includes a node identifier, a node entry statement, constraint information, a node type, start position information, end position information and a node scope identifier of each program branch node. And information outside the preset protocol is not extracted, so that the data extraction efficiency is effectively improved.
Step 302: and generating a basic block corresponding to the program branch node of the target program according to the program control flow diagram.
This step may be performed by the basic block generating module shown in fig. 2, where the entry position of the basic block corresponds to the start position of the program branch node, and may be used to determine injection information in the subsequent step, so that after the target program completes the injection of the node tag and the target function, after the basic block generating module obtains the program control flow diagram, the scope of each basic block may be determined according to the boundary information recorded in the program control flow diagram and the node information of the program branch node, so as to generate the corresponding basic block.
The program control flow graph includes node information and boundary information of each program branch node, where the node information may include node identification, constraint information, and the like, and the boundary information is used to characterize the control flow, for example, boundary interval 1 is [ ID1, ID2], boundary interval 2 is [ ID2, ID3], boundary interval 3 is [ ID3, -1], and after the flow enters the target program, the flow enters the program branch node 1, jumps to the program branch node 2, and jumps to the program branch node 3.
In one possible implementation manner, the target program includes a plurality of basic blocks, the node information includes start position information and end position information, the basic blocks corresponding to program branch nodes of the target program are generated according to the program control flow diagram, the sub-node information of each program branch node can be determined by analyzing the program control flow diagram, the sub-node information is used for identifying the program sub-branch nodes of the program branch nodes, the scope information of the program branch nodes is determined based on the start position information, the end position information and the sub-node information corresponding to the program branch nodes, and the basic blocks are generated according to the scope information.
For example, the scope information may include section start point information, section end point information, section identification, file identification, and child node information, where the section start point information and the section end point information may be respectively determined according to start point position information and end point position information of the program branch node, the section identification is used to identify the scope information, the file identification is used to identify a target file to which the target program belongs, and the child node information is used to identify a child node of the program branch node.
The child node of each program branch node may be determined according to the start position information and the end position information of each program branch node, for example, the start position information and the end position information of the program branch node 2 are located between the start position information and the end position information of the program branch node 1, and then the program branch node 2 may be determined to be the child node of the program branch node 1. In addition, the sub-nodes of each program branch node may be determined by the node information and the boundary information of the program control flow graph, taking the program control flow graph shown in fig. 5 as an example, the program control flow graph includes 3 program branch nodes, namely, program branch node 1, program branch node 2 and program branch node 3, and the boundary information of the program control flow graph includes 3 boundary sections, wherein the boundary section 1 is [ ID1, ID2], the boundary section 2 is [ ID2, ID3] and the boundary section 3 is [ ID3, -1], and since the boundary section 1 and the boundary section 2 have an intersection, the boundary section 2 and the boundary section 3 have an intersection, it may be determined that the program branch node 1 is the program branch executed first, then goes to the program branch node 2, and finally goes to the program branch node 3, it may be determined that the program branch node 2 is a sub-node of the program branch node 1, and the program branch node 3 is a sub-node of the program branch node 2.
Then, after determining the program sub-branch node, the node scope identifier corresponding to the program sub-branch node may be determined as the sub-node information in the scope information of the program parent branch node, for example, the program branch node 2 is a sub-node of the program branch node 1, the node scope identifier of the program branch node 1 is "section identifier 1", the node scope identifier of the program branch node 2 is "section identifier 2", and the sub-node information corresponding to the program branch node 1 is "section identifier 2".
The scope information is determined according to the node information, specifically, the section start point information and the section end point information in the scope information can be extracted from the node information, specifically, the start point position information is determined as the section start point information, the end point position information is determined as the section end point information, the node scope identifier is determined as the section identifier, and the corresponding sub-node information is determined, if the sub-node is not provided, the sub-node information needs to be set to be empty.
Then, a basic block may be generated from the section start point information and the section end point information described in the scope information, for example, the section start point information is exemplified by the number of code lines in the target program, the section start point information of the scope information of the program branching node 1 is 1, the section end point information is 33, namely, the scope of the program branch node 1 is the 1 st line to the 33 rd line of the target program, and similarly, the section start point information of the scope information of the program branch node 2 is 34, the interval end point information is 35, the interval of the basic block 1 corresponding to the program branch node 1 is {1,2, ···33} the interval of basic block 2 corresponding to program branch node 2 is {34,35}.
In one possible implementation manner, the scope information of the program branch node is determined based on the start point position information, the end point position information and the child node information corresponding to the program branch node, and specifically, the first scope interval may be determined based on the start point position information of the program parent branch node and the start point position information of the program child branch node; determining a second action scope interval based on the starting point position information of the program sub-branch node and the ending point position information of the program sub-branch node, wherein the first action scope interval and the second action scope interval are mutually disjoint; generating a first information set according to the first scope interval and the child node information of the program parent branch node, and generating a second information set according to the second scope interval and the child node information of the program child branch node; determining a first information set as scope information of a program parent branch node; and when the sub-node information of the program sub-branch node is empty, determining the second information set as the scope information of the program sub-branch node.
For a program sub-branch node, the scope information of the program sub-branch node includes two information sets, the first information set is obtained according to node information of a program parent branch node, the second information set is obtained according to node information of the program sub-branch node, therefore, the scope information of the program sub-branch node actually includes the scope information of the program parent branch node, the program sub-branch node is one conditional branch of the program parent branch node, taking a flow test as an example, if the test flow reaches the program sub-branch node, the program parent branch node is first entered, therefore, the scope information of the program sub-branch node can be reduced, only the information set with the empty information of the sub-node is reserved, so as to reduce redundancy of the scope information, for example, the first information set is the scope information of the program parent branch node, the sub-node information of the first information set is used for identifying the program sub-branch node, namely is not empty, the redundancy interval is removed, and the second information set is obtained according to the node information of the program sub-node, and the second information set is determined as the scope information of the sub-branch node.
It may be understood that, because intervals between the plurality of basic blocks do not overlap with each other, the interval end information of the program parent branch node needs to be determined according to the start position information of the program child branch node, for example, it may be the previous row corresponding to the start position information of the program child branch node, for example, it may also be determined according to the start position information and the end position information of the program child branch node, and for example, a second scope interval may be determined according to the start position information and the end position information of the program child branch node, a remainder set of the second scope interval is taken from the scope intervals formed by the start position information and the end position information of the program parent branch node, where the remainder set is the first scope interval, for example, the number of lines of the target program is 1, the end point is 35, the start position information of the program child branch node is 34, and the end position information is 35, where the first scope interval of the program parent branch node is [1,33], and the second scope interval of the program child branch node is [34,35].
Scope information in an embodiment of the present invention is described in its entirety with reference to the accompanying drawings. Referring to fig. 6, fig. 6 is a schematic diagram of an example of scope information provided in an embodiment of the present invention, by analyzing node information in a program control flow graph, it is determined that starting point position information of a program branch node 1 is 1, end point position information is 33, a node scope is identified as "section identification 1", starting point position information of a program branch node 2 is 34, end point position information is 35, and a node scope is identified as "section identification 2", the program branch node 1 and the program branch node 2 belong to the same target file, and file identification of the target file is "file identification 1", and the obtained scope information is specifically divided into two cases.
When the program branch node 1 is the root node of the program control flow chart and has no child node, the section start point information of the scope information corresponding to the program branch node 1 is 1, the section end point information is 33, the section identifier is "section identifier 1", the child node information is null and the file identifier is "file identifier 1".
When the program branch node 2 is a child node of the program branch node 1, determining a previous line of the start position information of the program branch node 2 as the interval end information of the program branch node 1, obtaining a first scope interval [1,33], obtaining a second scope interval [34,35] according to the start position information and the end position information of the program branch node 2, analyzing the program control flow graph to obtain a first information set and a second information set, wherein the first information set comprises interval start point information 1, interval end point information 33, interval identification 1, child node information null and file identification 1, the second information set comprises interval start point information 34, interval end point information 35, interval identification 2, child node information null and file identification 1. Therefore, the scope information of the program branch node 1 is a first information set, the scope information of the program branch node 2 is a union of the first information set and a second information set, and since the child node information of the first information set is not null, the child node information of the second information set is null, the first information set is taken out from the scope information of the program branch node 2, and the second information set is reserved as final scope information. Then, the basic block 1 generated from the scope information of the program branch node 1 is {1,2, and 33, respectively, the basic block 2 generated from the scope information of the program branch node 2 is 34,35, when the test traffic enters the basic block 2, it can be determined that the test traffic has passed through basic block 1, so that the node tag is injected according to the 2 basic blocks generated above, so that it can be ensured that each called basic block can trigger the objective function to write the node tag into the call record table.
Step 303: injection information of the basic block is determined, wherein the injection information comprises entry position information of the basic block and node labels for identifying corresponding program branch nodes.
The step can be executed by a basic block generating module shown in fig. 2, wherein after the basic block generating module generates a basic block according to a program control flow diagram, in order to be able to write an objective function and a node tag subsequently, the basic block generating module needs to determine entry position information, namely, a head line address of a program branch node; and meanwhile, determining a node label for identifying the corresponding program branch node, and realizing perspective of the program branch node by utilizing the corresponding relation between the node label and the basic block.
The target function is triggered when being executed, and the program branch node corresponding to the basic block can only have one line of statement, so that after the entry position of the basic block is used as a writing position, the target function can be written into the position corresponding to each basic block of the target program, the target function can be ensured to be executed when each basic block is called, and the target function can acquire the corresponding node label. For example, if the interval corresponding to the basic block is {1,2, ··33}, the entry location information is the first row of the target program, and the specific form of the entry location information may be determined according to the variable definition in the injection information, for example, the variable corresponding to the entry location information in the injection information is "number of code rows", the value of the entry location information is "1", and for example, the variable corresponding to the entry location information in the injection information is "location", the value of the entry location information is "first row", or similar description manner.
In addition, the node tag may be identification information allocated to each basic block after generating a plurality of basic blocks according to the program control flow graph, and when the basic blocks are reported through the objective function, the called basic block can be determined through the mapping relationship between the identification information and the basic blocks. For example, after basic block 1 and basic block 2 are generated according to the control flow chart, the node label allocated to basic block 1 in order is "node label 1", and the node label allocated to basic block 2 is "node label 2"; for another example, since the rows of each basic block do not overlap, the description information of the first address of the basic block may also be used as the node label, for example, the entry position information of the basic block 1 is 1, the entry position information of the basic block 2 is 34, and the node label of the basic block 1 may be "program first row", and the node label of the basic block 2 may be "program 34 th row".
It should be noted that, the target service module may include a plurality of target files, that is, a plurality of target programs are deployed in the terminal, so that in order to improve the accuracy of program branch node perspective, it is required to ensure that the node labels uniquely identify the basic blocks in the target service module, that is, the node labels written in different target programs are not repeated.
In one possible implementation manner, before writing the node tag and the preset objective function in the objective program according to the entry position information, specifically, the objective injection information of the basic block may be generated based on the file identifier of the objective file and the injection information of the corresponding basic block; and generating an injection information list of the target file according to all the target injection information.
After the terminal generates a basic block and determines injection information in the compiling period, an objective function and a node tag need to be written in an objective program, and the objective service module can comprise a plurality of objective files, and the objective injection information is obtained by adding file identifiers of the objective files in the injection information, so that the terminal is ensured to write corresponding contents into correct objective files according to the objective injection information.
For example, the file identifier of the target file 1 is "file identifier 1", the file identifier of the target file 2 is "file identifier 2", the basic block 1 and the basic block 2 are obtained according to the target file 1, the basic block 3 and the basic block 4 are obtained according to the target file 2, the entry position information of the basic block is exemplified by the number of code lines, the injection information of the basic block 1 is {1, the node tag 1}, the injection information of the basic block 2 is {34, the node tag 2}, the injection information of the basic block 3 is {1, the node tag 3}, the injection information of the basic block 4 is {2, the node tag 4}, the target injection information of the basic block 1 is {1, the node tag 1, the file tag 1}, the target injection information of the basic block 2 is {34, the node tag 2, the file tag 1} the target injection information of the basic block 3 is {1, the node tag 3, the file tag 2}, the target injection information of the basic block 4 is {2, the node tag 4 }. When writing according to the target injection information of the basic block 1 and the basic block 2, identifying the file to be written as a target file 1 according to the file identification information, writing the target function and the node tag 1 in the 1 st row of the target file 1, and writing the target function and the node tag 2 in the 34 th row; when writing is performed according to the target injection information of the basic block 3 and the basic block 4, the file to be written is identified as the target file 2 according to the file identification information, the target function and the node tag 3 are written in the 1 st row of the target file 2, and the target function and the node tag 4 are written in the 2 nd row.
In addition, the target program includes a plurality of basic blocks, the terminal usually analyzes the target program completely in the compiling process, that is, analyzes all basic blocks corresponding to the target program, if writing is performed once according to the target injection information of each basic block, a plurality of instructions need to be generated and executed, in order to improve efficiency, an injection information list needs to be generated according to the target injection information of all basic blocks, the instructions are executed once based on the injection information list, and the entry position information of each basic block is written into the target function and the corresponding node label in sequence.
The following describes the injection information list in the embodiment of the present invention in its entirety with reference to the accompanying drawings. Referring to fig. 7, fig. 7 is a schematic diagram illustrating an example of an injection information list according to an embodiment of the present invention. Illustratively, the file identifier of the target file 1 is "file identifier 1", the file identifier of the target file 2 is "file identifier 2", the basic block 1 and the basic block 2 are obtained according to the target file 1, the basic block 3 and the basic block 4 are obtained according to the target file 2, and the entry position information of the basic block is exemplified by the number of code lines.
First, the injection information of the basic block 1 is {1, node tag 1}, the injection information of the basic block 2 is {34, node tag 2}, the injection information of the basic block 3 is {1, node tag 3}, the injection information of the basic block 4 is {2, node tag 4}, the target injection information of the basic block 1 is {1, node tag 1, file tag 1}, the target injection information of the basic block 2 is {34, node tag 2, file tag 1}, the target injection information of the basic block 3 is {1, node tag 3, file tag 2}, the target injection information of the basic block 4 is {2, node tag 4, file tag 2}, and the target injection information of the basic block 1 is {1, node tag 1, file tag 1 }.
Then, generating an injection information list of the target file 1 according to the basic block 1 and the basic block 2, wherein the obtained injection information 1 is target injection information of the basic block 1, and the injection information 2 is target injection information of the basic block 2, namely, the injection information list of the target file 1 is { {1, node tag 1, file identifier 1}, {34, node tag 2, file identifier 1 };
then, generating an injection information list of a target file 2 according to the basic block 3 and the basic block 4, wherein the obtained injection information 1 is target injection information of the basic block 3, and the injection information 2 is target injection information of the basic block 4, namely, the injection information list of the target file 2 is { {1, node tag 3, file identifier 2}, {2, node tag 4, file identifier 2 };
then, the injection information list of the target file 1 and the injection information list of the target file 2 are used as the output of the basic block generation module for the subsequent code injection module to write in the target function and the node tag. When writing according to the injection information list of the target file 1, identifying the file to be written as the target file 1 according to the file identification information, writing the target function and the node tag 1 in the 1 st row of the target file 1, and writing the target function and the node tag 2 in the 34 th row; when writing according to the injection information list of the target file 2, the file to be written is identified as the target file 2 according to the file identification information, the target function and the node tag 3 are written in the 1 st row of the target file 2, and the target function and the node tag 4 are written in the 2 nd row.
Step 304: and writing the node label and a preset objective function into the objective program according to the entry position information.
The objective function is used for acquiring the node tag when the basic block is called and writing the node tag into the call record table.
The step may be executed by the code injection module shown in fig. 2, after the injection information list output by the basic block generation module is obtained, writing an objective function and a corresponding node tag according to each entry position information, that is, the objective function written in each entry position information is the same, taking the node tag as a parameter of the objective function, so that when the objective function is triggered, the node tag is obtained from a node interval corresponding to the basic block, and the node tag is written in the call record table, thereby realizing automatic reporting of the node tag.
The objective function may be a common library function, so that each objective file of the objective service module can be called and has a unified function, for example, a function mmad_insert_path (INDEX) in the common library, where the incoming INDEX is a node tag, and a remote procedure call (Remote Procedure Call, RPC) is implemented at the terminal, i.e. each objective program can run the common library function. The node tag is a node tag, and the function of the objective function is to write the execution information of the objective program into the call record table, and the execution information may include information such as the node tag, trigger time information, trigger sequence and the like.
Illustratively, basic block 1 and basic block 2 are obtained by parsing the program control flow diagram of the target file, wherein the injection information of basic block 1 is {1, node tag 1}, the injection information of basic block 2 is {34, node tag 2}, then "node tag 1" and mmad_insert_path (INDEX) are written in the target program line 1, and "node tag 2" and mmad_insert_path (INDEX) are written in the target program line 34.
In addition, since the basic blocks through which different test flows pass are different, a tag set may be set for each test flow in the call record table, and the node tag for triggering writing of the corresponding test flow may be recorded, for example, in the case of two test flows, the node tag for triggering writing of the test flow 1 is recorded in the tag set 1 of the call record table, the node tag for triggering writing of the test flow 2 is recorded in the tag set 2 of the call record table, the flow paths of the test flow 1 and the test flow 2 may be determined according to the respective corresponding tag sets, that is, the flow path information of the test flow 1 is determined according to the node tag recorded in the tag set 1, and the flow path information of the test flow 2 is determined according to the node tag recorded in the tag set 2.
After each target file of the target service module completes writing of the target function and the node label, the target service module can be compiled and packaged into a pile-inserted version by combining a compiling tool, and the terminal can be directly used for scenes such as flow test after pile insertion. After the objective function executes the service logic, each test flow can trigger the node tag set written in the call record table to generate flow path information according to each test flow, and the flow path information is reported to the server for subsequent processing.
In the related art, to determine the coverage rate of test traffic to a target program, a mapping relation between the test case and the code of the target program needs to be established, the coverage rate generated by statistics and calling is associated, after the test traffic of the test case is input, reverse backtracking is performed according to the increment code difference record triggered and submitted by the test traffic, and the program branch node and the upper layer service corresponding to the increment code are determined according to the established mapping relation, so that the traffic path of the test traffic is determined. However, the forward tracing and coverage rate analysis stages take longer time, and in order to avoid overlapping of incremental codes triggered and submitted by a plurality of test flows, the plurality of test flows need to be sent in a serial mode, and the overall efficiency is very low when the test flows are more; in addition, in the process of screening or analyzing the test flow, the terminal has unexpected situations such as service restarting, coredump and the like, the whole screening or analyzing process needs to be re-executed, and secondly, the code mapping relation between the test case and the target program needs to be maintained, if the service code is changed, the screening or analyzing process needs to be re-executed, and the maintenance cost is very high.
In the embodiment of the invention, the terminal writes the objective function and the node tag in the position corresponding to each basic block of the target program in the compiling period, so that the mapping relation between the test case and the target program is not required to be established and maintained, after the test flow enters the target program, the objective function is triggered to report the node tag to the call record table after passing through one basic block, the perspective of the program branch is realized through the node tag, and each triggered objective function is reported in real time, thereby effectively reducing the interference of unexpected situations such as restarting of the terminal; meanwhile, the node labels written in by triggering of each test flow can be recorded by calling the record table, the test flows are not interfered with each other, parallel input of the test flows can be realized, and the efficiency of flow screening and analysis is effectively improved.
The steps 301 to 304 are performed with syntax analysis on the target program to obtain a program control flow diagram, and since the node of the program control flow diagram corresponds to the program branch node of the target program, the basic block corresponding to each program branch node can be generated according to the program control flow diagram; next, determining injection information of the basic block, wherein the injection information comprises node labels for identifying program branch nodes by entry position information of the basic block; then, the node label and the preset target function are written in the target program according to the entry position information, so that when the basic block is called, the target function is triggered to automatically write the node label into the call record table, and the called program branch node is automatically determined according to the call record table. Therefore, the data processing method provided by the embodiment of the invention can automatically report the node label when the basic block is called, realize the perspective of the program branch node and provide a basis for improving the efficiency of flow test and analysis.
In some possible implementations, after the step 304 is executed, the test flow may be recorded, and when the test flow calls the target basic block, based on the objective function corresponding to the target basic block, the corresponding node tag is obtained and written into the call record table; when the test flow is recorded, acquiring a node tag triggered and written by the test flow from a calling record list; and triggering the written node label based on the test traffic, and determining traffic path information of the test traffic. The method comprises the steps that each called target basic block can be triggered to report a node label in the recording process of the test flow, the flow path information of the test flow is determined according to the node label, the path and coverage data of the test flow in a program are used as metadata of flow recording data, and the metadata can be used for subsequent screening or analysis processing after recording is completed; then, when abnormal conditions such as coredump and restarting occur at the terminal, the basic block is not called, so that abnormal data is not recorded; then, because the objective function is written, the method is equivalent to generating an RPC call in the objective program in the compiling period, after each time of recording the flow, the flow path information directly exists as downstream data in a call record table, and compared with the related art, the method has the advantages that the mapping relation between the number of lines of codes and the coverage rate is not required to be maintained, and the maintenance cost is low.
The number of test flows may be arbitrary, and in this embodiment, the number of test flows is not limited to this, and under the condition of multiple test flows, multiple test flows may be input into the terminal 102 in a parallel manner, and the test flows are run through a corresponding target program in the terminal 102, so as to obtain flow path information of each test flow.
In addition, the call record table can generate a node label set for each test flow, so that each test flow input in parallel can independently run, and call the target basic block for each call to trigger writing of the node label, and the test efficiency is improved.
In addition, the node label of the target basic block is written in the process of flow recording and is written in along with the end of flow recording, so that the node label can be used as metadata of recording data, and is generated along with the recording data and reported to a server, so that the subsequent analysis is facilitated.
Referring to fig. 2, the recorded traffic may also be current network traffic, and the traffic path information of the current network traffic may be obtained after recording, and used for subsequent analysis and screening, where recording of the current network traffic may be triggered by a timing task set in the terminal 102, for example, a daily construction task is configured in the terminal 102, recording the current network traffic according to a preset time period, and recording data carrying the traffic path information is collected and reported to a server for subsequent analysis processing.
The flow recording process information in the embodiment of the invention is generally described below with reference to the accompanying drawings. Referring to fig. 8, fig. 8 is a process diagram of flow recording according to an embodiment of the present invention. The server 101 sends 2 parallel test flows, namely test flow 1 and test flow 2, to the terminal 102 through the network 103, the target program of the terminal 102 comprises a basic block 1, a basic block 2, a basic block 3, a basic block 4 and a basic block 5, the target program has been written into the node label and the target function according to the mode of the embodiment, wherein the node label of the basic block 1 is the node label 1, the node label of the basic block 2 is the node label 2, the node label of the basic block 3 is the node label 3, the node label of the basic block 4 is the node label 4, the node label of the basic block 5 is the node label 5, and the flow recording process of the test flow comprises two steps.
Firstly, aiming at 3 target basic blocks, a basic block 1, a basic block 2 and a basic block 3 are sequentially arranged in a test flow 1, and aiming at 3 target basic blocks, a basic block 1, a basic block 2 and a basic block 4 are sequentially arranged in a test flow 2; triggering an objective function when the test flow 1 passes through the basic block 1 after recording starts, acquiring a node tag 1 and writing the node tag 1 into a call record table, wherein an information set of flow path information 1 is generated for the test flow 1 in the call record table, then the test flow 1 passes through the basic block 2, triggering the objective function to acquire the node tag 2 and write the flow path information 1, then the test flow 1 passes through the basic block 3, triggering the objective function to acquire the node tag 3 and write the flow path information 1; meanwhile, in a similar manner to the test flow 1, the parallel input test flow 2 sequentially passes through the basic block 1, the basic block 2 and the basic block 4, and triggers the objective function to acquire the node tag and write the flow path information 2 of the call record table when passing through the corresponding target basic block, and the basic block 5 is not passed through by the two test flows, so that the reporting and writing of the node tag 5 are not triggered.
Then, when the test flow 1 and the test flow 2 are recorded, the flow path information 1 is obtained as recording data of the test flow 1, and the flow path information 2 is obtained as recording data of the test flow 2, wherein the flow path information 1 is recorded with the node tag 1, the node tag 2 and the node tag 3, and the flow path information 2 is recorded with the node tag 1, the node tag 2 and the node tag 4.
In some possible implementations, the number of the test flows is multiple, and after determining the flow path information of the test flows, at least one target test flow is selected from the multiple test flows according to a preset flow screening rule to obtain a target flow set consisting of at least one target test flow; and determining the node coverage rate of the target flow set to the target program according to the flow path information of each target test flow.
After the flow recording is completed, a target test flow is required to be screened out from the recorded test flows according to a flow screening rule, wherein the flow screening rule is a screening condition or rule of the target test flow, the test flow conforming to the flow screening rule is determined to be the target test flow, then the node coverage rate of the target flow set to the target program is determined according to the flow path information of the target test flow, the subsequent operation is determined according to the specific condition of the node coverage rate, for example, when the node coverage rate meets a preset threshold value, operation analysis is performed according to the target flow set to obtain operation data of each stage, and for example, when the node coverage rate is smaller than the preset threshold value, data analysis is performed aiming at the target flow set to determine root cause of the node coverage rate being too low, thereby adjusting the target service module and the like. In addition, after the node coverage rate is determined, the screened target test flow, the node coverage rate and the operation data of each stage can be displayed on a Web end page of the terminal.
It should be noted that, the screening of the target test flow according to the flow screening rule may be performed after each test flow is recorded, or may be performed after all test flows are recorded, which is not limited in this embodiment.
In some possible implementation manners, determining node coverage rate of a target flow set to a target program, and summarizing a set of target basic blocks corresponding to the target flow set according to flow path information of each target test flow; and determining node coverage rate according to the set of the target basic blocks.
The flow path information of the target test flow consists of node labels of all target basic blocks, the number of basic blocks of the target file can be determined according to the injection information list, and the node coverage rate can be determined according to the number of basic blocks related to the target test flow and the total number of basic blocks of the target file.
Illustratively, when the target traffic set includes a target test traffic whose traffic path information includes 4 node labels, it can be determined that the target traffic set relates to 4 target basic blocks, and the node coverage is 40%.
For example, when the target traffic set includes multiple target test traffic and the node labels recorded in the traffic path information of the multiple target test traffic may overlap, a union of target basic blocks corresponding to the target traffic set may be determined, and node coverage rate may be determined according to the union, for example, the target file includes 10 basic blocks, the target traffic set includes target test traffic 1 and target test traffic 2, the target basic block corresponding to the target test traffic 1 includes target basic block 1, target basic block 2 and target basic block 3, the target basic block corresponding to the target test traffic 2 includes target basic block 1, target basic block 2 and target basic block 4, and the obtained set of target basic blocks is { target basic block 1, target basic block 2, target basic block 3, target basic block 4}, and node coverage rate may be determined to be 40%.
In some possible implementation manners, at least one target test flow is screened out from a plurality of test flows according to a preset flow screening rule, and a target label list is generated specifically according to a union of node labels triggered and written by the recorded test flows; converting the target tag list into a target feature vector, wherein vector elements of the target feature vector are all node tags of the target tag list; performing OR operation according to the flow path information of the newly recorded test flow and the target feature vector; and when the target feature vector is added with new vector elements through OR operation, determining the newly recorded test flow as the target test flow.
The recorded test flow may be a test flow recorded in the recording operation, or may be a pre-recorded test flow, and this embodiment is illustrated by taking the pre-recorded test flow as an example. The flow path information of each test flow consists of node labels, so that the node labels corresponding to the recorded test flows can be processed in a union mode to obtain a target label list; then, in order to facilitate OR operation, the target tag list needs to be converted into a target feature vector, and each node tag in the target tag list is taken as a vector element; then, performing OR operation on the node labels in the flow path information of the newly recorded test flow and the target feature vector, if the newly recorded test flow has a new node label compared with the target feature vector, the new vector element is added to the target feature vector after OR operation, then the newly recorded test flow can be determined to pass through a new basic block compared with the recorded test flow, and the node coverage rate of the target flow set can be improved, so that the newly recorded test flow can be determined as the target test flow, namely, the flow screening rule of the embodiment is that the test flow with the newly added basic block relative to the recorded test flow is determined as the target test flow; if the vector elements of the target feature vector are not increased after OR operation, the basic blocks through which the newly recorded test flow passes can be determined, all the recorded test flow passes, the node coverage rate of the target flow set is not helped to be improved, the newly recorded test flow can be discarded, and therefore flow screening or extraction is achieved.
In addition, the target flow set obtained through the flow screening rule of the embodiment can reduce the repeated test flow of the path, can realize higher coverage rate with fewer flows, and improves the effectiveness and efficiency of interface test.
The following describes a specific process of screening a target test flow according to a flow screening rule in an embodiment of the present invention with reference to fig. 9, and fig. 9 is a flowchart of a process of screening a target test flow according to a flow screening rule in an embodiment of the present invention. The recorded test traffic is exemplified by the test traffic 1 and the test traffic 2 shown in fig. 8, and the method for obtaining the traffic path information 1 and the traffic path information 2 and the related node labels may refer to the description of the embodiment shown in fig. 8, and the description is not repeated here. Taking the newly recorded test flow as an example of test flow 3 and test flow 4, the basic blocks in the target program refer to 5 basic blocks shown in fig. 8 as an example, and the screening of the target test flow according to the flow screening rule specifically comprises 3 steps.
Firstly, a union set is obtained according to flow path information 1 and flow path information 2 of recorded flow, a target tag list is obtained, the target tag list comprises a node tag 1, a node tag 2, a node tag 3 and a node tag 4, the target tag list is converted into target feature vectors, each node tag is used as a vector element of the target feature vector, and the obtained target feature vectors are { node tag 1, node tag 2, node tag 3 and node tag 4}.
Then, the target basic blocks corresponding to the test flow 3 are the basic blocks 1 and 5, the flow path information 3 of the recorded test flow 3 comprises a node tag 1 and a node tag 5 (the specific process and principle are described with reference to the embodiment shown in fig. 8), the flow path information 3 and the target feature vector are subjected to OR operation, and the result is { node tag 1, node tag 2, node tag 3, node tag 4 and node tag 5}, and as the node tag 5 is added, the test flow 3 meets the flow screening rule, the test flow 3 is determined as the target test flow, and the target flow set is added; in addition, since the test flow 3 is the recorded flow, the result { node tag 1, node tag 2, node tag 3, node tag 4, node tag 5} obtained by the OR operation can be used as a new target feature vector;
then, the target basic blocks corresponding to the test flow 4 are the basic blocks 2, 3 and 5, the node label 2, 3 and 5 are recorded in the flow path information 4 obtained according to the same principle of the test flow 3, the flow path information 4 and the new target feature vector are subjected to OR operation, and the obtained result is { node label 1, node label 2, node label 3, node label 4 and node label 5}, and the test flow 4 is discarded because no vector element is added.
In addition, referring to fig. 10, fig. 10 is a complete flowchart of a data processing method according to an embodiment of the present invention, where the data processing method includes, but is not limited to, the following steps 1001 to 1015:
step 1001, determining a file recorded with service logic in a target service module as a target file, and performing grammar analysis on a target program in the target file to generate a dump file;
step 1002, parse the recognizable characters and the node sections in the dump file to determine a plurality of program branch nodes, extract node information and boundary information from the node sections corresponding to the program branch nodes according to a preset protocol, and generate a program control flow graph;
step 1003, extracting scope information of each program branch node according to the program control flow diagram;
step 1004, judging whether the program branch node is a program sub-branch node, if yes, jumping to step 1005, otherwise jumping to step 1006;
step 1005, determining an information set with empty sub-node information as the scope information of the program sub-branch node in a plurality of information sets of the scope information of the program sub-branch node, and removing the rest information sets;
step 1006, generating a corresponding basic block according to the scope information of the program branch node;
Step 1007, determining injection information of each basic block, and generating an injection information list according to all injection information, wherein the injection information comprises entry position information of the basic block, node labels of corresponding program branch nodes and file identifications of target files;
step 1008, acquiring a preset objective function, and sequentially writing the objective function and the corresponding node tag in the corresponding entry position information according to each piece of injection information of the injection information list;
step 1009, recording the test flow, triggering the objective function to write the node label of the objective basic block into the call record table when the test flow calls the objective basic block, and triggering the written node label to generate flow path information according to the test flow after recording is completed;
step 1010, generating a target label list according to the recorded node label union of the test flow, and converting the target label list into a target feature vector;
step 1011, performing OR operation on the flow path information of the newly recorded test flow and the target feature vector;
step 1012, determining whether the result of the OR operation has vector elements added to the target feature vector, if yes, jumping to step 1013, otherwise jumping to step 1014;
Step 1013, adding the newly recorded test flow to the target flow set, and jumping to step 1014;
step 1014, discarding the newly recorded test traffic;
step 1015, report the target traffic set to the server.
In the steps 1011 to 1015, the embodiment of the present invention obtains the program control flow diagram by parsing the target program, and because the node of the program control flow diagram corresponds to the program branch node of the target program, the basic block corresponding to each program branch node can be generated according to the program control flow diagram; next, determining injection information of the basic block, wherein the injection information comprises node labels for identifying program branch nodes by entry position information of the basic block; then, writing a node tag and a preset target function in a target program according to the entry position information, so that when the basic block is called, triggering the target function to automatically write the node tag into a call record table; and then, screening target test flow from the test flow according to flow path information of the test flow recorded by the calling record table and combining a flow screening rule, and reporting a target flow set formed by the target test flow to a server for subsequent data analysis. Therefore, the data processing method provided by the embodiment of the invention can automatically report the node label when the basic block is called, realize the perspective of the program branch node, can carry out flow screening through the flow path information formed by the node label, realize higher coverage rate with less flow, and effectively improve the efficiency of flow test and analysis.
It will be appreciated that, although the steps in the flowcharts described above are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited in order unless explicitly stated in the present embodiment, and may be performed in other orders. Moreover, at least some of the steps in the flowcharts described above may include a plurality of steps or stages that are not necessarily performed at the same time but may be performed at different times, and the order of execution of the steps or stages is not necessarily sequential, but may be performed in turn or alternately with at least a portion of the steps or stages in other steps or other steps.
Referring to fig. 11, fig. 11 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present invention, where the data processing apparatus includes:
the grammar parsing module 1101 is configured to parse the target program to obtain a program control flow graph of the target program;
a basic block generating module 1102, configured to generate a basic block corresponding to a program branch node of a target program according to a program control flow diagram;
An injection information generating module 1103, configured to determine injection information of the basic block, where the injection information includes entry position information of the basic block and a node tag for identifying a corresponding program branch node;
the function injection module 1104 is configured to write a node tag and a preset objective function in the objective program according to the entry location information, where the objective function is configured to acquire the node tag when the basic block is called and write the node tag into the call record table.
Further, the above grammar parsing module 1101 is specifically configured to:
carrying out grammar analysis on the target program to obtain node information and boundary information of program branch nodes;
and generating a program control flow graph according to the node information and the boundary information.
Further, the above grammar parsing module 1101 is specifically configured to:
analyzing the target program to obtain a node information pool, wherein the node information pool comprises a plurality of identifiable characters and a plurality of node intervals;
identifying an entry statement for the basic block based on a grammatical parsing of the continuous plurality of recognizable characters;
based on a preset protocol, node information and boundary information are extracted from contents recorded in a node section where an entry sentence is located.
Further, the object program includes a plurality of basic blocks, the node information includes start position information and end position information, and the basic block generation module 1102 is specifically configured to:
Analyzing the program control flow graph to determine sub-node information of each program branch node, wherein the sub-node information is used for identifying the program sub-branch nodes of the program branch nodes;
determining scope information of the program branch node based on the starting point position information, the end point position information and the child node information corresponding to the program branch node;
generating basic blocks from scope information
Further, when the program branch node is a program parent branch node and includes a program child branch node, the basic block generation module 1102 is specifically further configured to:
determining a first scope interval based on the starting point position information of the branch father node and the starting point position information of the program child branch node;
determining a second action scope interval based on the starting point position information of the program sub-branch node and the ending point position information of the program sub-branch node, wherein the first action scope interval and the second action scope interval are mutually disjoint;
generating a first information set according to the first scope interval and the child node information of the program parent branch node, and generating a second information set according to the second scope interval and the child node information of the program child branch node;
determining a first information set as scope information of a program parent branch node;
And when the sub-node information of the program sub-branch node is empty, determining the second information set as the scope information of the program sub-branch node.
Further, the data processing apparatus further comprises a file identification module 1105, specifically configured to:
determining a target service module, wherein the target service module comprises a plurality of module files;
determining a module file recorded with business logic as a target file;
the program described in the target file is determined as the target program.
Further, the object program includes a plurality of basic blocks, and the basic block generation module 1102 is specifically configured to:
generating target injection information of the basic block based on the file identification of the target file and the injection information of the corresponding basic block;
and generating an injection information list of the target file according to all the target injection information.
Further, the data processing apparatus further includes a flow processing module 1106, where the flow processing module 1106 is specifically configured to:
recording test flow, when the test flow calls a target basic block, acquiring a corresponding node label based on a target function corresponding to the target basic block, and writing the node label into a call record table;
when the test flow is recorded, acquiring a node tag triggered and written by the test flow from a calling record list;
And triggering the written node label based on the test traffic, and determining traffic path information of the test traffic.
Further, the number of the test flows is plural, and the flow processing module 1106 is specifically configured to:
screening at least one target test flow from a plurality of test flows according to a preset flow screening rule to obtain a target flow set consisting of at least one target test flow;
and determining the node coverage rate of the target flow set to the target program according to the flow path information of each target test flow.
Further, the flow processing module 1106 is specifically configured to:
summarizing a set of target basic blocks corresponding to the target flow set according to the flow path information of each target test flow;
and determining node coverage rate according to the set of the target basic blocks.
Further, the flow processing module 1106 is specifically configured to:
generating a target label list based on the union of node labels triggered and written by the recorded test flow;
converting the target tag list into a target feature vector, wherein vector elements of the target feature vector are all node tags of the target tag list;
performing OR operation according to the flow path information of the newly recorded test flow and the target feature vector;
And when the target feature vector is added with new vector elements through OR operation, determining the newly recorded test flow as the target test flow.
The data processing apparatus 1100 and the data processing method are based on the same inventive concept, the syntax analysis module 1101 obtains a program control flow graph by performing syntax analysis on the target program, and the basic block generating module 1102 may generate basic blocks corresponding to the program branch nodes of each program according to the program control flow graph because the nodes of the program control flow graph correspond to the program branch nodes of the target program; next, the injection information generating module 1103 determines injection information of the basic block, including node tags for identifying program branch nodes, which are used by entry location information of the basic block; then, the function injection module 1104 writes the node tag and the preset target function in the target program according to the entry position information, so that when the basic block is called, the target function is triggered to automatically write the node tag into the call record table, and the called program branch node is automatically determined according to the call record table. Therefore, the data processing method provided by the embodiment of the invention can automatically report the node label when the basic block is called, realize the perspective of the program branch node and provide a basis for improving the efficiency of flow test and analysis.
The electronic device for performing the data processing method according to the embodiment of the present invention may be a terminal, referring to fig. 12, fig. 12 is a block diagram of a portion of a terminal 1200 provided in the embodiment of the present invention, where the terminal 1200 may have a relatively large difference due to different configurations or performances, and may include one or more central processing units (Central Processing Units, abbreviated as CPUs) 1222 (e.g., one or more processors) and a memory 1232, and one or more storage media 1230 (e.g., one or more mass storage devices) storing application programs 1242 or data 1244. Wherein memory 1232 and storage medium 1230 can be transitory or persistent. The program stored in the storage medium 1230 may include one or more modules (not shown), each of which may include a series of instruction operations in the terminal. Still further, the central processor 1222 may be configured to communicate with the storage medium 1230, executing a series of instruction operations on the storage medium 1230 on the terminal 1200.
Terminal 1200 can also include one or more power sources 1226, one or more wired or wireless network interfaces 1250, one or more input/output interfaces 1258, and/or one or more operating systems 1241, e.g., windows Server, mac OS XTM, unixTM, linuxTM, freeBSDTM, etc.
A processor in the terminal may be used to perform the data processing method.
The embodiments of the present invention also provide a computer readable storage medium storing a program code for executing the data processing method of each of the foregoing embodiments.
Embodiments of the present invention also disclose a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device may read the computer instructions from the computer-readable storage medium, and execute the computer instructions to cause the computer device to perform the data processing method of the foregoing embodiments.
The terms "first," "second," "third," "fourth," and the like in the description of the invention and in the above figures, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or apparatus.
It should be understood that in the present invention, "at least one (item)" means one or more, and "a plurality" means two or more. "and/or" for describing the association relationship of the association object, the representation may have three relationships, for example, "a and/or B" may represent: only a, only B and both a and B are present, wherein a, B may be singular or plural. The character "/" generally indicates that the context-dependent object is an "or" relationship. "at least one of" or the like means any combination of these items, including any combination of single item(s) or plural items(s). For example, at least one (one) of a, b or c may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
It should be understood that in the description of the embodiments of the present invention, plural (or multiple) means two or more, and that greater than, less than, exceeding, etc. are understood to not include the present number, and that greater than, less than, within, etc. are understood to include the present number.
In the several embodiments provided in the present invention, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of elements is merely a logical functional division, and there may be additional divisions of actual implementation, e.g., multiple elements or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each basic block in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software basic blocks.
The integrated units, if implemented in the form of software basic blocks and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
It should also be appreciated that the various embodiments provided by the embodiments of the present invention may be arbitrarily combined to achieve different technical effects.
While the preferred embodiment of the present invention has been described in detail, the present invention is not limited to the above embodiments, and those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit and scope of the present invention, and these equivalent modifications or substitutions are included in the scope of the present invention as defined in the appended claims.

Claims (15)

1. A method of data processing, comprising:
carrying out grammar analysis on a target program to obtain a program control flow graph of the target program;
generating a basic block corresponding to a program branch node of the target program according to the program control flow diagram;
determining injection information of the basic block, wherein the injection information comprises entry position information of the basic block and a node label for identifying a corresponding program branch node;
and writing the node tag and a preset target function in the target program according to the entry position information, wherein the target function is used for acquiring the node tag when the basic block is called and writing the node tag into a call record table.
2. The data processing method according to claim 1, wherein the parsing the object program to obtain a program control flow graph of the object program includes:
carrying out grammar analysis on the target program to obtain node information and boundary information of the program branch nodes;
and generating the program control flow graph according to the node information and the boundary information.
3. The data processing method according to claim 2, wherein the parsing the target program to obtain node information and boundary information of the program branch node includes:
analyzing the target program to obtain a node information pool, wherein the node information pool comprises a plurality of identifiable characters and a plurality of node intervals;
identifying an entry statement for the basic block based on a grammatical parsing of a continuous plurality of the recognizable characters;
and extracting the node information and the boundary information from the content recorded in the node section where the entry sentence is located based on a preset protocol.
4. The data processing method according to claim 2, wherein the target program includes a plurality of the basic blocks, the node information includes start point position information and end point position information, the generating the basic block corresponding to the program branch node of the target program according to the program control flow graph includes:
Analyzing the program control flow graph to determine sub-node information of each program branch node, wherein the sub-node information is used for identifying program sub-branch nodes of the program branch nodes;
determining scope information of the program branch node based on the starting point position information, the end point position information and the child node information corresponding to the program branch node;
and generating the basic block according to the scope information.
5. The data processing method according to claim 4, wherein when the program branch node is a program parent branch node and is provided with the program child branch node, the determining the scope information of the program child branch node based on the start point position information, the end point position information, and the child node information corresponding to the program child branch node includes:
determining a first scope interval based on the starting point position information of the branch parent node and the starting point position information of the program child branch node;
determining a second scope section based on the start point position information of the program sub-branch node and the end point position information of the program sub-branch node, wherein the first scope section and the second scope section are mutually disjoint;
Generating a first information set according to the first scope interval and the child node information of the program parent branch node, and generating a second information set according to the second scope interval and the child node information of the program child branch node;
determining the first information set as the scope information of the program parent branch node;
and when the sub-node information of the program sub-branch node is empty, determining the second information set as the scope information of the program sub-branch node.
6. The data processing method according to claim 1, wherein before the parsing of the object program, the method further comprises:
determining a target service module, wherein the target service module comprises a plurality of module files;
determining the module file recorded with the business logic as a target file;
and determining the program recorded in the target file as the target program.
7. The data processing method according to claim 6, wherein the object program includes a plurality of the basic blocks, and before the writing of the node tag and a preset object function in the object program according to the entry position information, the method further comprises:
Generating target injection information of the basic block based on a file identification of the target file and the injection information of the corresponding basic block;
and generating an injection information list of the target file according to all the target injection information.
8. The data processing method according to claim 1, wherein after the writing of the node tag and a preset objective function in the objective program according to the entry position information, the method further comprises:
recording test flow, when the test flow calls a target basic block, acquiring a corresponding node label based on the target function corresponding to the target basic block, and writing the node label into the call record table;
when the test flow is recorded, acquiring the node label triggered and written by the test flow from the call record list;
and determining the flow path information of the test flow based on the node label which is written in by triggering the test flow.
9. The data processing method according to claim 8, wherein the number of the test traffic is plural, and after the determining traffic path information of the test traffic based on the node tag written triggered by the test traffic, the method further comprises:
Screening at least one target test flow from a plurality of test flows according to a preset flow screening rule to obtain a target flow set consisting of at least one target test flow;
and determining node coverage rate of the target flow set to the target program according to the flow path information of each target test flow.
10. The data processing method according to claim 9, wherein the determining node coverage of the target program by the target traffic set according to the traffic path information of each of the target traffic includes:
summarizing a set of target basic blocks corresponding to the target flow set according to the flow path information of each target test flow;
and determining the node coverage rate according to the set of the target basic blocks.
11. The data processing method according to claim 9, wherein the screening at least one target test traffic from the plurality of test traffic according to a preset traffic screening rule includes:
generating a target label list based on the recorded union of the node labels triggered and written by the test flow;
Converting the target tag list into a target feature vector, wherein vector elements of the target feature vector are the node tags of the target tag list;
performing OR operation according to the newly recorded flow path information of the test flow and the target feature vector;
and when the target feature vector is added with a new vector element through the OR operation, determining the newly recorded test flow as the target test flow.
12. A data processing apparatus, comprising:
the grammar analysis module is used for carrying out grammar analysis on the target program to obtain a program control flow diagram of the target program;
the basic block generation module is used for generating basic blocks corresponding to program branch nodes of the target program according to the program control flow diagram;
the injection information generation module is used for determining injection information of the basic block, wherein the injection information comprises entry position information of the basic block and a node label used for identifying a corresponding program branch node;
and the function injection module is used for writing the node tag and a preset target function in the target program according to the entry position information, wherein the target function is used for acquiring the node tag and writing the node tag into a call record table when the basic block is called.
13. An electronic device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the data processing method of any of claims 1 to 11 when executing the computer program.
14. A computer-readable storage medium storing a program, characterized in that the program, when executed by a processor, implements the data processing method of any one of claims 1 to 11.
15. A computer program product comprising a computer program, characterized in that the computer program, when executed by a processor, implements the data processing method of any of claims 1 to 11.
CN202211163933.3A 2022-09-23 2022-09-23 Data processing method, device, electronic equipment, storage medium and program product Pending CN116991701A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211163933.3A CN116991701A (en) 2022-09-23 2022-09-23 Data processing method, device, electronic equipment, storage medium and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211163933.3A CN116991701A (en) 2022-09-23 2022-09-23 Data processing method, device, electronic equipment, storage medium and program product

Publications (1)

Publication Number Publication Date
CN116991701A true CN116991701A (en) 2023-11-03

Family

ID=88532720

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211163933.3A Pending CN116991701A (en) 2022-09-23 2022-09-23 Data processing method, device, electronic equipment, storage medium and program product

Country Status (1)

Country Link
CN (1) CN116991701A (en)

Similar Documents

Publication Publication Date Title
US11829739B2 (en) Blackbox matching engine
US20220091827A1 (en) Pruning Engine
US11061648B2 (en) Method and system for arbitrary-granularity execution clone detection
Xin et al. Production machine learning pipelines: Empirical analysis and optimization opportunities
US20200319878A1 (en) Library Model Addition
US8312440B2 (en) Method, computer program product, and hardware product for providing program individuality analysis for source code programs
US10261967B2 (en) Data extraction
CN102054149A (en) Method for extracting malicious code behavior characteristic
US20140006010A1 (en) Parsing rules for data
CN103713933A (en) Method, device and system for converging hotspot functions and variables in computer programs
KR101696694B1 (en) Method And Apparatus For Analysing Source Code Vulnerability By Using TraceBack
CN111240772B (en) Block chain-based data processing method, device and storage medium
CN111355696A (en) Message identification method and device, DPI (deep packet inspection) equipment and storage medium
CN111767217A (en) JS unit test case generation method and device
CN113596043A (en) Attack detection method, attack detection device, storage medium and electronic device
CN111581057B (en) General log analysis method, terminal device and storage medium
CN116756021A (en) Fault positioning method and device based on event analysis, electronic equipment and medium
CN116860583A (en) Database performance optimization method and device, storage medium and electronic equipment
CN116991701A (en) Data processing method, device, electronic equipment, storage medium and program product
CN107193721B (en) Method and device for generating log
CN115062144A (en) Log anomaly detection method and system based on knowledge base and integrated learning
CN115454702A (en) Log fault analysis method and device, storage medium and electronic equipment
CN115016782A (en) vue component generation method and device
CN113037521B (en) Method for identifying state of communication equipment, communication system and storage medium
CN114186233A (en) Code anti-obfuscation method, device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination