CN101216803A - Test program control stream path set creation method based on base path - Google Patents

Test program control stream path set creation method based on base path Download PDF

Info

Publication number
CN101216803A
CN101216803A CNA2008100451392A CN200810045139A CN101216803A CN 101216803 A CN101216803 A CN 101216803A CN A2008100451392 A CNA2008100451392 A CN A2008100451392A CN 200810045139 A CN200810045139 A CN 200810045139A CN 101216803 A CN101216803 A CN 101216803A
Authority
CN
China
Prior art keywords
statement
control flow
execution
program
path
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.)
Granted
Application number
CNA2008100451392A
Other languages
Chinese (zh)
Other versions
CN101216803B (en
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.)
Sichuan University
Original Assignee
Sichuan University
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 Sichuan University filed Critical Sichuan University
Priority to CN2008100451392A priority Critical patent/CN101216803B/en
Publication of CN101216803A publication Critical patent/CN101216803A/en
Application granted granted Critical
Publication of CN101216803B publication Critical patent/CN101216803B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention pertains to a path testing in a program testing. The concept of a program control flow base path is defined through bringing in the concept of base in mathematics, a data structure showing a program structure of a source program slice is obtained by using a compiler module first; then through traversing the data structure, a control flow path generating algorithm is utilized to generate a subset compiler module of a program control flow path which is based on a base path to interpret the semanteme on a tested source program, an abstract syntax tree structure showing the structural information of the tested program control flow is output. An adjacency matrix of a control flow graph generates a module ergodicity abstract syntax tree structure, and generates the adjacency matrix representation of a program flow chart. A control flow path subset generating module acquires the control flow information of the tested program through traversing the adjacency matrix, traverses the adjacency matrix by adopting a depth-first multiple backtracking method, and processes sentence nodes, thus a program control flow path subset based on the base path is generated. The method has the outstanding advantages in generating results and flows, and can be widely used in the engineering practice of a path cover testing in a software structure testing.

Description

Test program control stream path set creation method based on basic path
One, affiliated technical field
The present invention relates to the program testing method of computing machine, belong to the path testing technology in the structural test, particularly tested programmed control flow path effective subset generation method.
Two, background technology
As the structural method of testing of one of widely used two class testing methods in the software test, owing to be based on the source code of tested program rather than based on the definition of tested program, make this method support strict difinition, mathematical analysis and accurate tolerance.These advantages have determined the structure property testing to be widely adopted in the software test engineering.And as most important a kind of measuring technology---path testing in the structural test, various technology based on its method of testing just proposed from the seventies in 20th century, and the presenter of these methods has released the extremely successful instrument of realizing these technology to market.But because the complicacy of tested program structure, even small program, the logical path quantity that comprises also is sizable, thereby makes that path testing does not have very big feasibility in the software configuration property testing of reality completely.Therefore how to find out the active path subclass of all logical paths in the tested program, come mistake as much as possible in the discovery procedure so that can cover the use-case of this effective logical path subclass by design, just become the Research And Engineering key issue in application and the difficult point problem of path testing.In the prior art, tested programmed control flow path effective subset generation method often can not satisfy the demand of path coverage test.The automatic generation method of the active path subclass of especially tested programmed control flow path yet there are no report.
Three, summary of the invention
The generation method that the purpose of this invention is to provide the active path subclass of tested programmed control flow path in a kind of path testing, this method has not only realized correctness, validity and the completeness of the control flow path subclass that generated, has also realized the process automation of The whole control flow path subclass generative process.
The objective of the invention is to reach like this: a kind of test program control stream path subclass generation method based on basic path, it is characterized in that: in compiler module, finish the generation of test program control stream path subclass in control flow graph adjacency matrix generation module and the control flow path subclass generation module three module: the vector that at first the control flow path of tested source program sheet is defined as have length (mould) and direction attribute, then the control flow path of specific program segment set with and on the vector operations that can apply just formed a vector space, must there be a basic set of paths in its existence, use the compiler module acquisition to comprise the data structure of source program sheet program structure information, use the programmed control flow path subclass of control flow path generating algorithm generation by this data structure of traversal then based on basic path.Its concrete method is:
1, use compiler module that tested source program is handled, in order to tested source program is carried out semantic interpretation, tested source program and the test computing engines that the control flow path generates are connected, forming the data structure that reasonably is enough to represent tested program control stream information---abstract syntax tree (AST), compiler module are exported this structure and are handled for control flow graph adjacency matrix generation module.
2, treatment scheme enters programmed control flow graph adjacency matrix generation module, whether this module traversal abstract syntax tree construction has condition redirect semanteme or unconditional jump semanteme according to statement and calls condition redirect statement respectively and handle function and unconditional jump and handle that function is handled and the adjacency matrix of generator program flow graph is represented to carry out subsequent operation for control flow path subclass generation module.
3, control flow path subclass generation module obtains tested program control stream information by the traversal adjacency matrix, the mode that adopts depth-first repeatedly to recall travels through adjacency matrix, follow the tracks of the statement node that the also execution of logging program control stream is arrived, and this information handled, generate programmed control flow path subclass based on basic path.
Described compiler module is handled tested source program, has added to be used for preserving the territory of some customizing messages and to have set up source code statement and the internodal one-to-one relationship of intermediate structure AST in the compilation process strictness.
Programmed control flow graph adjacency matrix generation module service routine algorithm realizes that automatically the adjacency matrix that travels through abstract syntax tree construction and generator program flow graph represents that the basic thought of process is: the static state control stream information when carrying out by every statement of traversal abstract syntax tree, flow statement and carry out special processing having the control that influence source program control flow operation semanteme; Its basic procedure step is as follows:
The step 1) initialization is as the statement number i of pre-treatment statement;
Step 2) if statement i is the last item statement of tested program sheet, then algorithm finishes.Otherwise execution in step 3;
Step 3) is then called condition redirect statement processing function conjmpproc (i) statement i is handled if statement i has condition redirect semanteme (EQ, GE, GT, LE, LT, NE), and flow process jumps to step 6 simultaneously; Otherwise execution in step 4;
Step 4) is then called unconditional jump statement processing function unconjmpproc (i) function statement i is handled if statement i has unconditional jump semanteme (JUMP), and flow process jumps to step 6 simultaneously; Otherwise execution in step 5;
Step 5) is with AdjoiningMatrix[i] [i+1] assignment is 1;
Step 6) increases progressively statement number i value to handle next bar statement; Repeated execution of steps 2;
Exist in the programmed control flow graph adjacency matrix generating algorithm calling of function conjmpproc (i) and unconditional jump statement processing function unconjmpproc (i) handled in condition redirect statement, the statement i that is respectively applied for having condition redirect semanteme and unconditional jump semanteme handles.
The concrete process flow steps that function handled in described condition redirect statement is:
Step 1) is if statement i+1 has condition redirect semanteme (EQ, GE, GT, LE, LT, NE), and then recursive call condition redirect statement is handled function conjmpproc (i+1) statement i+1 is handled, and flow process jumps to step 4 simultaneously; Otherwise execution in step 2;
Step 2) if statement i+1 has unconditional jump semanteme (JUMP), then call unconditional jump statement processing function unconjmpproc (i+1) statement i+1 is handled, flow process jumps to step 4 simultaneously; Otherwise execution in step 3;
Step 3) is not if statement i+1 is the last item statement of tested program sheet, then with AdjoiningMatrix[i+1] [i+2] assignment is 1;
The statement number j at the label place that step 4) computing statement i condition jumps to is with AdjoiningMatrix[i] [j] assignment is 1;
The concrete process flow steps that function handled in described unconditional jump statement is:
The source statement at the label place that step 1) computing statement i unconditional jump arrives number and assignment are given j;
Step 2) with AdjoiningMatrix[i] [i+1] assignment is 1;
Described tested program control flow path subclass generation module service routine algorithm is realized traveling through adjacency matrix automatically and is obtained tested program control stream information, and this information is handled generation based on the basic procedure of the programmed control flow path subclass in basic path is:
Step 1) will be represented the storehouse node pop down of first statement of tested program sheet;
Step 2) if storehouse is then algorithm end of sky, otherwise execution in step 3;
Step 3) is got the stack top node i, gives interim loop variable m with the value assignment in its m_nLoopPos territory;
Step 4) is if the value of m is not more than the statement number of tested program, algorithm execution in step 5; Otherwise execution in step 8;
If step 5) is adjacency matrix elements A djoiningMatrix[i] [m] value is 1, algorithm execution in step 7; Otherwise execution in step 6;
Step 6) m=m+1, repeated execution of steps 4;
The value in the m_bHasChild territory of step 7) i is set to true, the adjacent node m that expression i did not travel through in addition;
Value for m is composed to note the position that can Gong recall when anterior layer in the m_nLoopPos territory of step 8) node i;
Step 9) is if the m_nLoopPos thresholding of node i is not more than tested program statement number; Execution in step 10; Otherwise execution in step 16;
Step 10) is that the node of m is gone into storehouse with sequence number; Get the stack top node and be made as present node i, its m_nLoopPos thresholding is composed to m;
Step 11) is if the value of m is not more than the statement number of tested program, algorithm execution in step 12; Otherwise execution in step 15;
If step 12) is adjacency matrix elements A djoiningMatrix[i] [m] value is 1, algorithm execution in step 14; Otherwise execution in step 13;
Step 13) m=m+1, repeated execution of steps 11;
The value in the m_bHasChild territory of step 14) i is set to true, the adjacent node m that expression i did not travel through in addition;
Value for m is composed to note the position that can Gong recall when anterior layer in the m_nLoopPos territory of step 15) node i; Repeated execution of steps 9;
Step 16) if the value in the m_bHasChild territory of node i is false, algorithm execution in step 17; Otherwise execution in step 18;
Step 17) note this moment all statement node numbers in the stack, this is a control flow path;
Step 18) node i is ejected from storehouse; Repeated execution of steps 2;
The execution of above-mentioned algorithm flow can generate whole control flow paths.
The present invention has following good effect:
1, the generation method of the basic path of tested source program code control stream subclass in a kind of path testing has been proposed.
How to obtain the active path subclass of all control flow paths of tested program, can come to reach that the purpose of mistake as much as possible is the emphasis and the primary work of path testing in the discovery procedure by the use-case that design can cover this effective logical path subclass.In the prior art, exist tested programmed control flow path effective subset generation method can not satisfy the demand of path coverage test.The automatic generation method of the active path subclass of especially tested programmed control flow path yet there are no report.The present invention proposes a kind of generation method of the test source program control flow subclass based on tested source program code base path, in actual software is tested the actual engineering of particularly path coverage test, great application value is arranged.
2, solved the problem of completeness of the route result in the calculating of tested program control flow path in the path testing.
When program itself contains circulation time, all control flow paths that cover tested program are a kind of irrational test targets.The computational problem of tested program control flow path also should be converted to active path subclass how to calculate all control flow paths of tested program, can be by designing the purpose that the use-case that can cover this effective logical path subclass comes mistake as much as possible in the discovery procedure to reach.The present invention is by the introducing and the application of the notion of mathematical " base ", realized the correct calculation in all basic paths in the tested program control flow set of paths, and guaranteed the correctness and the completeness of the basic set of paths calculated, can reach test result when making the path computing result of this method of use carry out the path coverage test with all control flow path equivalences that cover tested program.
3, solved the automation issues that generates the flow process of the basic path of control stream subclass by tested source program.
Stream treatment by each module of The whole control flow path generating algorithm, the present invention has realized being generated by tested source program the robotization of the whole flow process of the basic path of control stream subclass, from importing tested source program to the basic set of paths of direct generation control stream, whole process does not need hand labor and intervention, thereby effective simplification software test personnel's workload, the mistake of having avoided manually-operated to introduce.
4, the support of compiler module test function.
Collector has adopted the source code semantic interpretation technology based on compiler technologies, be different from the simple code words French method analytical work that conventional compiler is done, and embodied more towards the support of testing, and to traditional compiler front-end export structure---abstract syntax tree improves, added the territory that is used to preserve some customizing messages, source code statement and the internodal one-to-one relationship of intermediate structure AST have been set up in strictness in compilation process, make it can be more suitable for the use of remaining module testing and work of treatment.
5, introduce the adjacency matrix data structure in path subclass generative process, make that generating the process of controlling the flow path subclass by abstract syntax tree is simplified, it had both kept the enough information that is used to control flow path set generation that comprises in the abstract syntax tree, had simplified the complicacy of the data structure of traversal object again.
Four, description of drawings
Fig. 1 is the inventive method process flowchart.
Fig. 2 is an implementation system structural representation of the present invention.
Fig. 3 is the product process figure of the adjacency matrix in the control flow graph of the present invention.
Fig. 4 is the processing flow chart that function was handled in the condition redirect when adjacency matrix generated in the control flow graph of the present invention.
Fig. 5 is the processing flow chart that unconditional jump was handled function when adjacency matrix generated in the control flow graph of the present invention.
Fig. 6 is control flow path subclass product process figure of the present invention.
Five, embodiment
Accompanying drawing has provided a specific embodiment of the present invention.
Referring to accompanying drawing.This method comprises the processing procedure of three nucleus modules of treatment scheme.The present invention has introduced the notion of " base " on the mathematics, that is to say this method be based on the vector.
Generally adopt the structure of " vector space " to define base on the mathematics, this is a set of element and corresponding multiplication and the add operation that this vector is defined.If also use several other criterions, then this structure is exactly a vector space, and all vector spaces all have a base (in fact a plurality of bases can be arranged).Basis of vector space is one group of separate vector, and base " covering " whole vector space makes that any other vector in this space can be represented with base vector.Therefore, one group of base vector can be represented " essence " of whole vector space to a certain extent.In the space all can be used basis representation, if and a base element is deleted, then this coverage property also can be lost, and to the potential significance of testing is, if can regard program as a kind of vector space, then this basis of vector space is exactly the very significant element set that will test.If base is no problem, all that then can wish can enough base tables to state all are no problem.And the control flow path of program itself has just comprised length (mould) and two attributes of direction, therefore according to the viewpoint of Thomas McCabe, the control flow path can be defined as vector, then the control flow path of specific program segment set with and on the vector operations that can apply just formed a vector space, must there be a basic set of paths (in fact a plurality of bases can be arranged) in it, this set possesses the coverage property of The whole control flow path set, according to above-mentioned notion, make that path testing is carried out in the basic path of specific program segment can reach the result who carries out the path testing equivalence with all control flow paths to this program segment.Therefore, this method has been utilized a kind of easy and practical method.
In compiler module, at first tested source program code sheet is carried out semantic interpretation.Because structural test is a kind of measuring technology according to the inner structure design test case of tested program, itself be based on the internal logic structure of tested program.Therefore, collector is finished the process of tested source program being carried out semantic interpretation, and tested source program and the test computing engines that the control flow path generates are connected the data structure that reasonably is enough to represent tested program internal logic structure information to form.This process is the prerequisite that generates the set of source program internal control flow path, also is the basis of total property testing process.What compiler module was finished is not only the work that conventional compiler is done, more embodiments towards the test this purpose: at first, from its purpose, it is in order to carry out semantic interpretation to the tested object of being supported, its process is the basis of whole test process.Secondly, this module connects tested object and follow-up test computing engines, forms rational system data structure.The present invention is used to represent that to conventional compiler its front-end processing result's intermediate data structure redesigns, and has added the territory that is used to preserve some customizing messages, and these territories provide essential information for follow-up test computing engines.Simultaneously, source code statement and the internodal one-to-one relationship of intermediate structure AST have been set up in compiler module of the present invention strictness in compilation process, make follow-up test processes module can pass through the positional information of the complete reproduction source statement of intermediate structure in source file.For the purpose that improves its generating code efficient, conventional compiler in compilation process often to need to the compiling front end intermediate result be optimized, but, the requirement of software test own carries out semantic the modification to prevent to introduce new mistake because can not treating test source code, so compiler module of the present invention has been abandoned the optimization process of all conventional compiler, and as role's appearance of the tested object of being supported being carried out pure semantic interpretation.
Referring to Fig. 3,4,5.After the work of collector was finished, flow process just entered the processing of programmed control flow graph adjacency matrix generation module.Why introduce the adjacency matrix data structure in the disposal route of the present invention, be to be simplified so that generate the process of controlling the flow path subclass by abstract syntax tree by adjacency matrix, it had both kept the enough information that is used to control flow path set generation that comprises in the abstract syntax tree, had simplified the complicacy of the data structure of traversal object again.Programmed control flow graph adjacency matrix generation module obtains the control stream information of program inside by traversal abstract syntax tree construction, carry out special processing to having the control stream statement that influences source program control flow operation semanteme, and the adjacency matrix of service routine algorithm generator flow graph is represented.
The process step of programmed control flow graph adjacency matrix generating algorithm is as follows:
The step 1) initialization is as the statement number i of pre-treatment statement;
Step 2) if statement i is the last item statement of tested program sheet, then algorithm finishes.Otherwise execution in step 3;
Step 3) is then called condition redirect statement processing function conjmpproc (i) statement i is handled if statement i has condition redirect semanteme (EQ, GE, GT, LE, LT, NE), and flow process jumps to step 6 simultaneously; Otherwise execution in step 4
Step 4) is then called unconditional jump statement processing function unconjmpproc (i) function statement i is handled if statement i has unconditional jump semanteme (JUMP), and flow process jumps to step 6 simultaneously; Otherwise execution in step 5;
Step 5) is with AdjoiningMatrix[i] [i+1] assignment is 1;
Step 6) increases progressively statement number i value to handle next bar statement; Repeated execution of steps 2;
Exist in the programmed control flow graph adjacency matrix generating algorithm calling of function conjmpproc (i) and unconditional jump statement processing function unconjmpproc (i) handled in condition redirect statement, the statement i that is respectively applied for having condition redirect semanteme and unconditional jump semanteme handles.
The algorithm flow step that function handled in condition redirect statement is:
Step 1) is if statement i+1 has condition redirect semanteme (EQ, GE, GT, LE, LT, NE), and then recursive call condition redirect statement is handled function conjmpproc (i+1) statement i+1 is handled, and flow process jumps to step 4 simultaneously; Otherwise execution in step 2;
Step 2) if statement i+1 has unconditional jump semanteme (JUMP), then call unconditional jump statement processing function unconjmpproc (i+1) statement i+1 is handled, flow process jumps to step 4 simultaneously; Otherwise execution in step 3;
Step 3) is not if statement i+1 is the last item statement of tested program sheet, then with AdjoiningMatrix[i+1] [i+2] assignment is 1;
The statement number j at the label place that step 4) computing statement i condition jumps to is with AdjoiningMatrix[i] [j] assignment is 1;
The process step that the algorithm of function handled in the unconditional jump statement is:
The source statement at the label place that step 1) computing statement i unconditional jump arrives number and assignment are given j;
Step 2) with AdjoiningMatrix[i] [i+1] assignment is 1;
Tested program control flow path subclass generation module is used for the adjacency matrix of programmed control flow graph adjacency matrix generation module output is handled.This module obtains tested program control stream information by the traversal adjacency matrix, and this information is handled, and generates tested program control flow path subclass.
Referring to Fig. 6.The step of this resume module flow process is as follows:
Step 1) will be represented the storehouse node pop down of first statement of tested program sheet;
Step 2) if storehouse is then algorithm end of sky, otherwise execution in step 3;
Step 3) is got the stack top node i, gives interim loop variable m with the value assignment in its m_nLoopPos territory;
Step 4) is if the value of m is not more than the statement number of tested program, algorithm execution in step 5; Otherwise execution in step 8;
If step 5) is adjacency matrix elements A djoiningMatrix[i] [m] value is 1, algorithm execution in step 7; Otherwise execution in step 6;
Step 6) m=m+1, repeated execution of steps 4;
The value in the m_bHasChild territory of step 7) i is set to true, the adjacent node m that expression i did not travel through in addition;
Value for m is composed to note the position that can Gong recall when anterior layer in the m_nLoopPos territory of step 8) node i;
Step 9) is if the m_nLoopPos thresholding of node i is not more than tested program statement number; Execution in step 10; Otherwise execution in step 16;
Step 10) is that the node of m is gone into storehouse with sequence number; Get the stack top node and be made as present node i, its m_nLoopPos thresholding is composed to m;
Step 11) is if the value of m is not more than the statement number of tested program, algorithm execution in step 12; Otherwise execution in step 15;
If step 12) is adjacency matrix elements A djoiningMatrix[i] [m] value is 1, algorithm execution in step 14; Otherwise execution in step 13;
Step 13) m=m+1, repeated execution of steps 11;
The value in the m_bHasChild territory of step 14) i is set to true, the adjacent node m that expression i did not travel through in addition;
Value for m is composed to note the position that can Gong recall when anterior layer in the m_nLoopPos territory of step 15) node i; Repeated execution of steps 9;
Step 16) if the value in the m_bHasChild territory of node i is false, algorithm execution in step 17; Otherwise execution in step 18;
Step 17) note this moment all statement node numbers in the stack, this is a control flow path;
Step 18) node i is ejected from storehouse; Repeated execution of steps 2;
Execution by above-mentioned algorithm flow can generate whole control flow paths.
Handle accordingly separately and harmonious work by above-mentioned three modules, this method has realized the generation method of the basic path subclass of tested programmed control flow path in the path testing, and this method has not only realized correctness, validity and the completeness of the control flow path subclass that generated.Also realized the robotization of the flow process of The whole control flow path subclass generative process.This method has improved the computing machine internal performance at the outstanding advantage that generates on result and the product process, can be widely used in the engineering practice of path coverage test in the software white-box testing (structural test).

Claims (6)

1. test program control stream path subclass generation method based on basic path, it is characterized in that: in compiler module, finish the generation of test program control stream path subclass in control flow graph adjacency matrix generation module and the control flow path subclass generation module three module: the vector that at first the control flow path of tested source program sheet is defined as have length (mould) and direction attribute, then the control flow path of specific program segment set with and on the vector operations that can apply just formed a vector space, must there be a basic set of paths in its existence, use compiler module to obtain to comprise the data structure of source program sheet program structure information, use the programmed control flow path subclass of control flow path generating algorithm generation based on basic path by this data structure of traversal then, its concrete method is:
Use compiler module that tested source program is handled, in order to tested source program is carried out semantic interpretation, tested source program and the test computing engines that the control flow path generates are connected, forming the data structure that reasonably is enough to represent tested program control stream information---abstract syntax tree (AST), compiler module are exported this structure and are handled for control flow graph adjacency matrix generation module;
Treatment scheme enters programmed control flow graph adjacency matrix generation module, whether this module traversal abstract syntax tree construction has condition redirect semanteme or unconditional jump semanteme according to statement and calls condition redirect statement respectively and handle function and unconditional jump and handle that function is handled and the adjacency matrix of generator program flow graph is represented to carry out subsequent operation for control flow path subclass generation module;
Control flow path subclass generation module obtains tested program control stream information by the traversal adjacency matrix, the mode that adopts depth-first repeatedly to recall travels through adjacency matrix, follow the tracks of the statement node that the also execution of logging program control stream is arrived, and this information handled, generate programmed control flow path subclass based on basic path.
2. test program control stream as claimed in claim 1 path subclass generation method, it is characterized in that: described compiler module is handled tested source program, has added to be used for preserving the territory of some customizing messages and to have set up source code statement and the internodal one-to-one relationship of intermediate structure AST in the compilation process strictness.
3. test program control stream as claimed in claim 1 path subclass generation method, it is characterized in that: programmed control flow graph adjacency matrix generation module service routine algorithm realizes that automatically the adjacency matrix that travels through abstract syntax tree construction and generator program flow graph represents that the basic thought of process is: the static state control stream information when carrying out by every statement of traversal abstract syntax tree, flow statement and carry out special processing having the control that influence source program control flow operation semanteme;
Its basic procedure step is as follows:
The step 1) initialization is as the statement number i of pre-treatment statement;
Step 2) if statement i is the last item statement of tested program sheet, then algorithm finishes.Otherwise execution in step 3;
Step 3) is then called condition redirect statement processing function conjmpproc (i) statement i is handled if statement i has condition redirect semanteme (EQ, GE, GT, LE, LT, NE), and flow process jumps to step 6 simultaneously; Otherwise execution in step 4;
Step 4) is then called unconditional jump statement processing function unconjmpproc (i) function statement i is handled if statement i has unconditional jump semanteme (JUMP), and flow process jumps to step 6 simultaneously; Otherwise execution in step 5;
Step 5) is with AdjoiningMatrix[i] [i+1] assignment is 1;
Step 6) increases progressively statement number i value to handle next bar statement; Repeated execution of steps 2;
Exist in the programmed control flow graph adjacency matrix generating algorithm calling of function conjmpproc (i) and unconditional jump statement processing function unconjmpproc (i) handled in condition redirect statement, the statement i that is respectively applied for having condition redirect semanteme and unconditional jump semanteme handles.
4. test program control stream as claimed in claim 3 path subclass generation method is characterized in that: the concrete process flow steps that function handled in described condition redirect statement is:
Step 1) is if statement i+1 has condition redirect semanteme (EQ, GE, GT, LE, LT, NE), and then recursive call condition redirect statement is handled function conjmpproc (i+1) statement i+1 is handled, and flow process jumps to step 4 simultaneously; Otherwise execution in step 2;
Step 2) if statement i+1 has unconditional jump semanteme (JUMP), then call unconditional jump statement processing function unconjmpproc (i+1) statement i+1 is handled, flow process jumps to step 4 simultaneously; Otherwise execution in step 3;
Step 3) is not if statement i+1 is the last item statement of tested program sheet, then with AdjoiningMatrix[i+1] [i+2] assignment is 1;
The statement number j at the label place that step 4) computing statement i condition jumps to is with AdjoiningMatrix[i] [j] assignment is 1;
5. test program control stream as claimed in claim 3 path subclass generation method is characterized in that: the concrete process flow steps that function handled in described unconditional jump statement is:
The source statement at the label place that step 1) computing statement i unconditional jump arrives number and assignment are given j;
Step 2) with AdjoiningMatrix[i] [i+1] assignment is 1;
6. test program control stream as claimed in claim 1 path subclass generation method, it is characterized in that: described tested program control flow path subclass generation module service routine algorithm is realized traveling through adjacency matrix automatically and is obtained tested program control stream information, and this information is handled generation based on the basic procedure of the programmed control flow path subclass in basic path is:
Step 1) will be represented the storehouse node pop down of first statement of tested program sheet;
Step 2) if storehouse is then algorithm end of sky, otherwise execution in step 3;
Step 3) is got the stack top node i, gives interim loop variable m with the value assignment in its m_nLoopPos territory;
Step 4) is if the value of m is not more than the statement number of tested program, algorithm execution in step 5; Otherwise execution in step 8;
If step 5) is adjacency matrix elements A djoiningMatrix[i] [m] value is 1, algorithm execution in step 7; Otherwise execution in step 6;
Step 6) m=m+1, repeated execution of steps 4;
The value in the m_bHasChild territory of step 7) i is set to true, the adjacent node m that expression i did not travel through in addition;
Value for m is composed to note the position that can Gong recall when anterior layer in the m_nLoopPos territory of step 8) node i;
Step 9) is if the m_nLoopPos thresholding of node i is not more than tested program statement number; Execution in step 10; Otherwise execution in step 16;
Step 10) is that the node of m is gone into storehouse with sequence number; Get the stack top node and be made as present node i, its m_nLoopPos thresholding is composed to m;
Step 11) is if the value of m is not more than the statement number of tested program, algorithm execution in step 12; Otherwise execution in step 15;
If step 12) is adjacency matrix elements A djoiningMatrix[i] [m] value is 1, algorithm execution in step 14; Otherwise execution in step 13;
Step 13) m=m+1, repeated execution of steps 11;
The value in the m_bHasChild territory of step 14) i is set to true, the adjacent node m that expression i did not travel through in addition;
Value for m is composed to note the position that can Gong recall when anterior layer in the m_nLoopPos territory of step 15) node i; Repeated execution of steps 9;
Step 16) if the value in the m_bHasChild territory of node i is false, algorithm execution in step 17; Otherwise execution in step 18;
Step 17) note this moment all statement node numbers in the stack, this is a control flow path;
Step 18) node i is ejected from storehouse; Repeated execution of steps 2;
The execution of above-mentioned algorithm flow can generate whole control flow paths.
CN2008100451392A 2008-01-09 2008-01-09 Test program control stream path set creation method based on base path Expired - Fee Related CN101216803B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2008100451392A CN101216803B (en) 2008-01-09 2008-01-09 Test program control stream path set creation method based on base path

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2008100451392A CN101216803B (en) 2008-01-09 2008-01-09 Test program control stream path set creation method based on base path

Publications (2)

Publication Number Publication Date
CN101216803A true CN101216803A (en) 2008-07-09
CN101216803B CN101216803B (en) 2010-06-16

Family

ID=39623238

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2008100451392A Expired - Fee Related CN101216803B (en) 2008-01-09 2008-01-09 Test program control stream path set creation method based on base path

Country Status (1)

Country Link
CN (1) CN101216803B (en)

Cited By (26)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101901188A (en) * 2010-07-23 2010-12-01 哈尔滨工程大学 Reachable path-based software testing method
CN102141958A (en) * 2011-03-09 2011-08-03 中国矿业大学 Method for evolving and generating path coverage test data facing defects
CN102158388A (en) * 2010-02-12 2011-08-17 国际商业机器公司 Extremum route determination engine and method
CN101714119B (en) * 2009-12-09 2011-11-02 北京邮电大学 Test data generating device and method based on binary program
CN102360336A (en) * 2011-10-20 2012-02-22 上海达梦数据库有限公司 Automatic testing system based on grammatical rules and method
WO2012037732A1 (en) * 2010-09-26 2012-03-29 Wang Jiaxiang Method for constructing data structures and method for describing running states of computer and state transitions thereof
CN102567169A (en) * 2010-12-29 2012-07-11 无锡江南计算技术研究所 Test method and device of microprocessor
CN102662644A (en) * 2012-02-29 2012-09-12 浙江大学 Method for generating test case by using flow chart
CN102915271A (en) * 2012-10-31 2013-02-06 北京邮电大学 Method for optimizing unit regression test case set based on control flow diagram
CN103049377A (en) * 2012-12-14 2013-04-17 中国信息安全测评中心 Parallel symbolic execution method based on path cluster reductions
CN103186406A (en) * 2011-12-30 2013-07-03 国际商业机器公司 Method and device for control flow analysis
CN103559125A (en) * 2013-10-25 2014-02-05 北京广利核系统工程有限公司 Method for verifying compiler by graph isomorphism
CN103645986A (en) * 2013-11-29 2014-03-19 北京广利核系统工程有限公司 Generation method and reconstruction method of visualization syntax tree of compiler
CN103885874A (en) * 2012-12-20 2014-06-25 百度在线网络技术(北京)有限公司 Method and equipment for determining test data corresponding to program files
CN103902255A (en) * 2012-12-24 2014-07-02 腾讯科技(深圳)有限公司 Generating method and system of function relationship call tree
CN104035864A (en) * 2013-12-17 2014-09-10 北京邮电大学 Path generation method based on contradiction fragment mode
CN104298590A (en) * 2013-07-16 2015-01-21 爱德万测试(新加坡)私人有限公司 Rapid semantic processor for pin-based APG (Automatic Pattern Generator)
CN104662513A (en) * 2012-07-10 2015-05-27 洛林·克雷默 Method and system for automated improvement of parallelism in program compilation
CN104834603A (en) * 2015-05-26 2015-08-12 牟永敏 Regression-testing-oriented control flow change influence domain analyzing method and system
CN105117330A (en) * 2015-08-07 2015-12-02 百度在线网络技术(北京)有限公司 CNN (Convolutional Neural Network) code testing method and apparatus
CN107423893A (en) * 2017-07-19 2017-12-01 北京京东尚科信息技术有限公司 The all standing method of testing and device of a kind of operation flow
CN109377177A (en) * 2018-10-18 2019-02-22 东软集团股份有限公司 Flow path processing method, device, equipment and computer readable storage medium
CN109710307A (en) * 2018-12-29 2019-05-03 深圳点猫科技有限公司 Method, the electronic equipment of abstract syntax tree are rebuild based on Python code
CN111324718A (en) * 2020-02-26 2020-06-23 网易(杭州)网络有限公司 Conversation flow testing method and device, electronic equipment and readable storage medium
CN111949505A (en) * 2019-05-14 2020-11-17 阿里巴巴集团控股有限公司 Test method, device and equipment
CN114116534A (en) * 2022-01-27 2022-03-01 广东省新一代通信与网络创新研究院 Method and device for improving cache hit rate of superscalar processor

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1567222A (en) * 2003-07-09 2005-01-19 松下电器产业株式会社 Programe generating device
CN1952818B (en) * 2005-10-22 2010-12-15 康佳集团股份有限公司 Testing method of program unit with capability of checking test result automatically
CN100451969C (en) * 2006-12-27 2009-01-14 北京大学 Method for recognizing composite conditional branch structure

Cited By (49)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101714119B (en) * 2009-12-09 2011-11-02 北京邮电大学 Test data generating device and method based on binary program
CN102158388A (en) * 2010-02-12 2011-08-17 国际商业机器公司 Extremum route determination engine and method
CN101901188A (en) * 2010-07-23 2010-12-01 哈尔滨工程大学 Reachable path-based software testing method
WO2012037732A1 (en) * 2010-09-26 2012-03-29 Wang Jiaxiang Method for constructing data structures and method for describing running states of computer and state transitions thereof
US9519569B2 (en) 2010-09-26 2016-12-13 Antaios (Beijing) Information Technology Co., Ltd. Method for constructing data structures and method for describing running states of computer and state transitions thereof
CN103080898B (en) * 2010-09-26 2015-07-08 北京中天安泰信息技术有限公司 Method for constructing data structures and method for describing running states of computer and state transitions thereof
CN103080898A (en) * 2010-09-26 2013-05-01 北京中天安泰信息科技有限公司 Method for constructing data structures and method for describing running states of computer and state transitions thereof
CN102567169A (en) * 2010-12-29 2012-07-11 无锡江南计算技术研究所 Test method and device of microprocessor
CN102567169B (en) * 2010-12-29 2014-02-26 无锡江南计算技术研究所 Test method and device of microprocessor
CN102141958A (en) * 2011-03-09 2011-08-03 中国矿业大学 Method for evolving and generating path coverage test data facing defects
CN102141958B (en) * 2011-03-09 2014-07-30 中国矿业大学 Method for evolving and generating path coverage test data facing defects
CN102360336A (en) * 2011-10-20 2012-02-22 上海达梦数据库有限公司 Automatic testing system based on grammatical rules and method
CN102360336B (en) * 2011-10-20 2014-12-17 上海达梦数据库有限公司 Automatic testing system based on grammatical rules and method
CN103186406A (en) * 2011-12-30 2013-07-03 国际商业机器公司 Method and device for control flow analysis
US9176842B2 (en) 2011-12-30 2015-11-03 International Business Machines Corporation Control flow analysis utilizing function dominator trees
CN103186406B (en) * 2011-12-30 2016-08-17 国际商业机器公司 Method and apparatus for control flow analysis
CN102662644B (en) * 2012-02-29 2015-03-18 浙江大学 Method for generating test case by using flow chart
CN102662644A (en) * 2012-02-29 2012-09-12 浙江大学 Method for generating test case by using flow chart
CN104662513B (en) * 2012-07-10 2018-07-13 洛林·克雷默 The automatic method and its system for improving the parallel processing in program compiling
CN104662513A (en) * 2012-07-10 2015-05-27 洛林·克雷默 Method and system for automated improvement of parallelism in program compilation
US9864590B2 (en) 2012-07-10 2018-01-09 Loring G. Craymer, III Method and system for automated improvement of parallelism in program compilation
CN102915271A (en) * 2012-10-31 2013-02-06 北京邮电大学 Method for optimizing unit regression test case set based on control flow diagram
CN103049377A (en) * 2012-12-14 2013-04-17 中国信息安全测评中心 Parallel symbolic execution method based on path cluster reductions
CN103049377B (en) * 2012-12-14 2016-01-13 中国信息安全测评中心 Based on the parallel symbol manner of execution of path cluster reduction
CN103885874A (en) * 2012-12-20 2014-06-25 百度在线网络技术(北京)有限公司 Method and equipment for determining test data corresponding to program files
CN103885874B (en) * 2012-12-20 2018-03-23 百度在线网络技术(北京)有限公司 A kind of method and apparatus for being used to determine the test data corresponding to program file
CN103902255A (en) * 2012-12-24 2014-07-02 腾讯科技(深圳)有限公司 Generating method and system of function relationship call tree
CN104298590A (en) * 2013-07-16 2015-01-21 爱德万测试(新加坡)私人有限公司 Rapid semantic processor for pin-based APG (Automatic Pattern Generator)
CN104298590B (en) * 2013-07-16 2019-05-10 爱德万测试公司 For pressing the quick semantic processor of pin APG
CN103559125A (en) * 2013-10-25 2014-02-05 北京广利核系统工程有限公司 Method for verifying compiler by graph isomorphism
CN103559125B (en) * 2013-10-25 2015-12-09 北京广利核系统工程有限公司 A kind of method utilizing isomorphism of graph certifying compilation device
CN103645986A (en) * 2013-11-29 2014-03-19 北京广利核系统工程有限公司 Generation method and reconstruction method of visualization syntax tree of compiler
CN103645986B (en) * 2013-11-29 2016-08-17 北京广利核系统工程有限公司 The generation method of the visualization syntax tree of a kind of compiler and reconstructing method
CN104035864A (en) * 2013-12-17 2014-09-10 北京邮电大学 Path generation method based on contradiction fragment mode
CN104035864B (en) * 2013-12-17 2017-10-20 北京邮电大学 A kind of path generating method based on contradiction fragment schema
CN104834603B (en) * 2015-05-26 2017-12-01 牟永敏 A kind of controlling stream towards regression test changes domain of influence analysis method and system
CN104834603A (en) * 2015-05-26 2015-08-12 牟永敏 Regression-testing-oriented control flow change influence domain analyzing method and system
CN105117330B (en) * 2015-08-07 2018-04-03 百度在线网络技术(北京)有限公司 CNN code test methods and device
CN105117330A (en) * 2015-08-07 2015-12-02 百度在线网络技术(北京)有限公司 CNN (Convolutional Neural Network) code testing method and apparatus
CN107423893A (en) * 2017-07-19 2017-12-01 北京京东尚科信息技术有限公司 The all standing method of testing and device of a kind of operation flow
CN109377177A (en) * 2018-10-18 2019-02-22 东软集团股份有限公司 Flow path processing method, device, equipment and computer readable storage medium
CN109377177B (en) * 2018-10-18 2020-12-01 东软集团股份有限公司 Flow processing method, device, equipment and computer readable storage medium
CN109710307B (en) * 2018-12-29 2022-03-11 深圳点猫科技有限公司 Python code based method and electronic device for reconstructing abstract syntax tree
CN109710307A (en) * 2018-12-29 2019-05-03 深圳点猫科技有限公司 Method, the electronic equipment of abstract syntax tree are rebuild based on Python code
CN111949505A (en) * 2019-05-14 2020-11-17 阿里巴巴集团控股有限公司 Test method, device and equipment
CN111324718A (en) * 2020-02-26 2020-06-23 网易(杭州)网络有限公司 Conversation flow testing method and device, electronic equipment and readable storage medium
CN111324718B (en) * 2020-02-26 2023-06-30 网易(杭州)网络有限公司 Session flow testing method and device, electronic equipment and readable storage medium
CN114116534A (en) * 2022-01-27 2022-03-01 广东省新一代通信与网络创新研究院 Method and device for improving cache hit rate of superscalar processor
CN114116534B (en) * 2022-01-27 2022-05-06 广东省新一代通信与网络创新研究院 Method and device for improving cache hit rate of processor

Also Published As

Publication number Publication date
CN101216803B (en) 2010-06-16

Similar Documents

Publication Publication Date Title
CN101216803B (en) Test program control stream path set creation method based on base path
US8930919B2 (en) Modernization of legacy software systems based on modeled dependencies
Aridhi et al. A MapReduce-based approach for shortest path problem in large-scale networks
CN103077183B (en) A kind of data lead-in method and its system of distributed sequence list
CN104820613A (en) Compiling method for heterogeneous multi-core routine
CN105138335B (en) A kind of function call path extraction method and device based on controlling stream graph
CN103473171A (en) Coverage rate dynamic tracking method and device based on function call paths
CN102662644A (en) Method for generating test case by using flow chart
CN107704382A (en) Towards Python function call path generating method and system
CN112199086A (en) Automatic programming control system, method, device, electronic device and storage medium
CN106371887A (en) System and method for MSVL compiling
CN106875320A (en) The efficient visual analysis method of ship aeronautical data under cloud environment
CN106383701A (en) Common multi-protocol data access interface technology-based data service system
CN110020834A (en) A kind of on-line intelligence big data development approach of modeling and debugging fusion
CN103942081A (en) Method for generating IL instruction lists of PLC ladder diagrams
CN104331315A (en) Analysis and generation method and system of json object of any level
CN109683881A (en) A kind of code format method of adjustment and device
CN117009038B (en) Graph computing platform based on cloud native technology
CN106096159A (en) Distributed system behavior simulation under a kind of cloud platform analyzes the implementation method of system
CN104267936A (en) Semantic tree based asynchronous dynamic push-down network reachability analysis method
CN102902739B (en) Towards the workflow view building method in uncertain data source under cloud computing environment
CN105487912A (en) Public problem modification multi-branch maintenance system and method
CN107203406B (en) Processing method for distributed storage structure
CN116484947A (en) Operator automatic generation method, device, equipment and medium
CN105446788B (en) A kind of information processing method and electronic equipment

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20100616

Termination date: 20140109