JP6331756B2 - Test case generation program, test case generation method, and test case generation apparatus - Google Patents
Test case generation program, test case generation method, and test case generation apparatus Download PDFInfo
- Publication number
- JP6331756B2 JP6331756B2 JP2014129814A JP2014129814A JP6331756B2 JP 6331756 B2 JP6331756 B2 JP 6331756B2 JP 2014129814 A JP2014129814 A JP 2014129814A JP 2014129814 A JP2014129814 A JP 2014129814A JP 6331756 B2 JP6331756 B2 JP 6331756B2
- Authority
- JP
- Japan
- Prior art keywords
- function
- path condition
- functions
- condition table
- test case
- 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.)
- Active
Links
Images
Description
本件は、テストケース生成プログラム、テストケース生成方法、及びテストケース生成装置に関する。 The present case relates to a test case generation program, a test case generation method, and a test case generation apparatus.
シンボリック実行とは、プログラム内の変数を具体化せず、変数をシンボル化して(すなわち、記号のまま)プログラムを実行する技術である(例えば特許文献1参照)。シンボリック実行中においては、具体値ではなくシンボル変数が満たすべき条件(以下、パス条件と呼ぶ)がシンボル変数の値としてメモリ等に保持される。そして、シンボリック実行が完了すると、プログラムにおける各パスについてパス条件が得られるため、パス条件を満たすシンボル変数の具体値を求めることで、プログラムをテストするためのテストケースを得ることができる。 Symbolic execution is a technique for executing a program by converting variables into symbols (that is, as symbols) without embodying variables in the program (see, for example, Patent Document 1). During symbolic execution, not a specific value but a condition to be satisfied by a symbol variable (hereinafter referred to as a path condition) is held in a memory or the like as a symbol variable value. When the symbolic execution is completed, a path condition is obtained for each path in the program. Therefore, a test case for testing the program can be obtained by obtaining a specific value of a symbol variable that satisfies the path condition.
例えば、図26に示した、絶対値取得関数bad_absとして問題があるプログラムについてシンボリック実行を行うことを考える。図26には、シンボリック実行の対象になるプログラムPと、そのプログラムPの制御構造CSとが示されている。このプログラムPには変数xが含まれている。このプログラムPを対象としてシンボリック実行を行うと、x=−2というテストケース(パス条件はx<0)と、x=1234というテストケース(パス条件はx≧0かつx=1234)と、x=3というテストケース(パス条件はx≧0かつx≠1234)とを得ることができる。 For example, consider symbolic execution of a program having a problem as the absolute value acquisition function bad_abs shown in FIG. FIG. 26 shows a program P to be subjected to symbolic execution and a control structure CS of the program P. This program P includes a variable x. When symbolic execution is performed on the program P, a test case x = −2 (pass condition is x <0), a test case x = 1234 (pass condition is x ≧ 0 and x = 1234), x = 3 (pass condition is x ≧ 0 and x ≠ 1234).
上述したように、通常のシンボリック実行は、プログラム内の全パスを対象範囲とする。例えば図26に示したような単純なプログラムPであれば、たとえ全パスについてシンボリック実行を行ったとしても、最終的なテストケースを得るまでの時間はさほどかからない。しかしながら、複数のプログラムが連携して実行されるなどの場合についてシンボリック実行を行うと、パスの数が非常に多いことに起因して、最終的なテストケースを得るまでに非常に時間がかかるという問題がある。 As described above, normal symbolic execution covers all paths in the program. For example, in the case of a simple program P as shown in FIG. 26, even if symbolic execution is performed for all paths, it does not take much time to obtain a final test case. However, when symbolic execution is performed for cases where multiple programs are executed in cooperation, it takes a very long time to obtain the final test case due to the large number of paths. There's a problem.
そこで、1つの側面では、本件は、シンボリック実行を利用したテストケースを短時間で生成するテストケース生成プログラム、テストケース生成方法、及びテストケース生成装置を提供することを目的とする。 Therefore, in one aspect, an object of the present invention is to provide a test case generation program, a test case generation method, and a test case generation apparatus that generate a test case using symbolic execution in a short time.
本明細書に開示のテストケース生成プログラムは、対象プログラムにおいて実行される複数の関数の呼び出し関係を表すコールツリーを生成し、前記複数の関数の各々についてシンボリック実行により、シンボル変数に関わる分岐を辿った履歴を表す第1の条件と、当該関数の引数及び返却値についての第2の条件の少なくともいずれかを含むパス条件表を前記複数の関数の各々について生成し、前記コールツリーに基づいて、前記複数の関数に含まれるいずれかの関数を呼び出す第1の関数と前記第1の関数に呼び出される第2の関数との関連数を求め、前記関連数の大きさに基づいた前記第1の関数と前記第2の関数のペア毎に、前記パス条件表を並列に統合し、統合後のパス条件表を満たすシンボル変数の値を算出し、当該値をテストケースとして生成する、処理をコンピュータに実行させるテストケース生成プログラムである。 The test case generation program disclosed in this specification generates a call tree representing a calling relationship of a plurality of functions executed in a target program, and follows a branch related to a symbol variable by symbolic execution for each of the plurality of functions. A path condition table including at least one of the first condition representing the history and the second condition for the argument and return value of the function is generated for each of the plurality of functions, and based on the call tree, A number of associations between a first function that calls any one of the plurality of functions and a second function that is called by the first function is obtained, and the first number based on the magnitude of the number of associations for each pair of the second function and the function to integrate the pre-symbol path condition table parallel, it calculates the value of the symbol variable that satisfies the path condition table after integration, testing the value Produced as over scan, a lutein stringent case generation program to execute the process to the computer.
本明細書に開示のテストケース生成方法は、対象プログラムにおいて実行される複数の関数の呼び出し関係を表すコールツリーを生成し、前記複数の関数の各々についてシンボリック実行により、シンボル変数に関わる分岐を辿った履歴を表す第1の条件と、当該関数の引数及び返却値についての第2の条件の少なくともいずれかを含むパス条件表を前記複数の関数の各々について生成し、前記コールツリーに基づいて、前記複数の関数に含まれるいずれかの関数を呼び出す第1の関数と前記第1の関数に呼び出される第2の関数との関連数を求め、前記関連数の大きさに基づいた前記第1の関数と前記第2の関数のペア毎に、前記パス条件表を並列に統合し、統合後のパス条件表を満たすシンボル変数の値を算出し、当該値をテストケースとして生成する、処理をコンピュータが実行するテストケース生成方法である。 The test case generation method disclosed in the present specification generates a call tree representing a calling relationship of a plurality of functions executed in a target program, and follows a branch related to a symbol variable by symbolic execution for each of the plurality of functions. A path condition table including at least one of the first condition representing the history and the second condition for the argument and return value of the function is generated for each of the plurality of functions, and based on the call tree, A number of associations between a first function that calls any one of the plurality of functions and a second function that is called by the first function is obtained, and the first number based on the magnitude of the number of associations for each pair of the second function and the function to integrate the pre-symbol path condition table parallel, it calculates the value of the symbol variable that satisfies the path condition table after integration, test case the value And to generate a test case generation method processing computer executes.
本明細書に開示のテストケース生成装置は、対象プログラムにおいて実行される複数の関数の呼び出し関係を表すコールツリーを生成し、前記複数の関数の各々についてシンボリック実行により、シンボル変数に関わる分岐を辿った履歴を表す第1の条件と、当該関数の引数及び返却値についての第2の条件の少なくともいずれかを含むパス条件表を前記複数の関数の各々について生成する第1の生成手段と、前記コールツリーに基づいて、前記複数の関数に含まれるいずれかの関数を呼び出す第1の関数と前記第1の関数に呼び出される第2の関数との関連数を求め、前記関連数の大きさに基づいた前記第1の関数と前記第2の関数のペア毎に、前記パス条件表を並列に統合する統合手段と、統合後のパス条件表を満たすシンボル変数の値を算出し、当該値をテストケースとして生成する第2の生成手段と、を有するテストケース生成装置である。 The test case generation apparatus disclosed in the present specification generates a call tree representing a calling relationship of a plurality of functions executed in a target program, and traces a branch related to a symbol variable by symbolic execution for each of the plurality of functions. a first condition representing a history of a first generation means for generating for each of the plurality of functions the path condition table including at least one of the second condition of the arguments and return value of the function, the Based on the call tree, the number of associations between the first function that calls any one of the functions included in the plurality of functions and the second function that is called by the first function is obtained, and the size of the association number is obtained. each pair of said second function and said first function based, and integrating means for integrating the pre symbol path condition table parallel, the value of the symbol variable that satisfies the path condition table after integration Calculated, a test case generating device having a second generating unit configured to generate the value as test case, the.
本明細書に開示のテストケース生成プログラム、テストケース生成方法、及びテストケース生成装置によれば、シンボリック実行を利用したテストケースを短時間で生成することができる。 According to the test case generation program, the test case generation method, and the test case generation apparatus disclosed in the present specification, a test case using symbolic execution can be generated in a short time.
以下、本件を実施するための形態について図面を参照して説明する。 Hereinafter, an embodiment for carrying out this case will be described with reference to the drawings.
図1は、テストケース生成装置100のブロック図の一例である。図1に示すように、テストケース生成装置100は、入力部101と、対象プログラム格納部102と、ドライバ・スタブ生成部103と、ドライバ・スタブ格納部104とを含んでいる。テストケース生成装置100は、第1の生成手段としてのシンボリック実行部105と、実行状態格納部106と、パス条件表格納部107と、コールツリー格納部108とを含んでいる。テストケース生成装置100は、統合手段としてのパス条件統合部109と、第2の生成手段としてのテストケース生成部110と、テストケース格納部111とを含んでいる。
FIG. 1 is an example of a block diagram of the test
入力部101は、テストケースが生成されるべきプログラムの入力を受け付ける。入力部101は受け付けたプログラムを対象プログラムとして対象プログラム格納部102に格納する。
ドライバ・スタブ生成部103は、対象プログラム格納部102に格納されている対象プログラムに基づき、シンボリック実行で利用されるドライバ及びスタブを関数(ノードとも呼ばれる)毎に並列に生成し、ドライバ・スタブ格納部104に格納する。
The
Based on the target program stored in the target
シンボリック実行部105は、対象プログラム格納部102に格納されている対象プログラムと、ドライバ・スタブ格納部104に格納されているドライバ及びスタブとを利用して、シンボリック実行を関数毎に並列に行い、シンボリック実行中における後述の実行状態を実行状態格納部106に格納する。シンボリック実行では、数値だけでなく文字又は文字列も扱われる。また、シンボリック実行部105は、シンボリック実行により生成したパス条件及び返却値(返り値とも呼ばれる)等を含むパス条件表をパス条件表格納部107に格納する。さらに、シンボリック実行部105は、関数の呼び出し関係を表すコールツリーを生成し、生成したコールツリーをコールツリー格納部108に格納する。
The
パス条件統合部109は、パス条件表格納部107に格納されているパス条件表及びコールツリー格納部108に格納されているコールツリーを用いて、パス条件表を統合し、処理結果をパス条件表格納部107に格納する。尚、パス条件統合部109の詳細な説明は後述する。
テストケース生成部110は、パス条件表格納部107に最終的に格納されたパス条件表におけるパス条件を満たすテストケースを生成し、テストケース格納部111に格納する。
The path
The test
図2は、対象プログラム格納部102に格納される対象プログラム10の一例である。
図2の例では、関数funcAを表すプログラムと、関数funcBを表すプログラムと、関数funcCを表すプログラムと、関数funcDを表すプログラムと、関数funcEを表すプログラムと、関数funcFを表すプログラムとが格納される。関数funcAは4行目において関数funcBを、7行目において関数funcDを呼び出す。関数funcBは5行目において関数funcCを呼び出す。関数funcDは2行目において関数funcEを、4行目において関数funcFを呼び出す。関数funcFは3行目において関数funcEを呼び出す。したがって、本実施形態においては、図2に示すように、複数の関数が実行されるプログラムが処理対象の対象プログラム10になる。
FIG. 2 is an example of the
In the example of FIG. 2, a program representing the function funcA, a program representing the function funcB, a program representing the function funcC, a program representing the function funcD, a program representing the function funcE, and a program representing the function funcF are stored. The The function funcA calls the function funcB on the fourth line and the function funcD on the seventh line. The function funcB calls the function funcC on the fifth line. The function funcD calls the function funcE on the second line and the function funcF on the fourth line. The function funcF calls the function funcE on the third line. Therefore, in the present embodiment, as shown in FIG. 2, a program that executes a plurality of functions is the
図3は、図2に示した対象プログラム10について生成されたコールツリー20である。各矩形領域は関数を表しており、矩形領域内に示された文字が関数名と対応している。例えば、文字「A」が示された矩形領域は関数funcAを表している。図3において、矢印に指されている関数は呼び出される側の関数である。以下の説明では、適宜、呼び出される側の関数を被呼出関数と呼び、呼び出す側の関数を呼出関数と呼ぶ。例えば、関数funcAから矢印で指されている関数funcBは、関数funcAに対する被呼出関数に該当し、関数funcAは呼出関数に該当する。このコールツリー20においては、最も上位の関数は関数funcAであり、最も下位の関数は関数funcC及び関数funcEである。コールツリー格納部108には、このような関数の呼び出し関係を表すコールツリー20が格納される。
FIG. 3 is a call tree 20 generated for the
次に、図4乃至図13を参照して、パス条件統合部109の詳細について説明する。
Next, the details of the path
パス条件統合部109は、コールツリー格納部108に格納されたコールツリーに基づいて、複数の呼出関数から呼び出されている被呼出関数が存在すると判断した場合、被呼出関数を呼び出し元ごとに複製する。したがって、図4(a)に示すように、関数funcDと関数funcFから呼び出されている被呼出関数funcEは複製されて、被呼出関数funcEとは別の被呼出関数funcE´が生成される。被呼出関数funcE´は関数funcFから呼び出される。尚、複数の呼出関数から呼び出されている被呼出関数が存在しない場合、当該複製処理は行われない。
If the path
パス条件統合部109は、関数の複製を終えると、コールツリーの最大マッチングを求める。グラフ理論においてマッチングとはグラフ(ここではコールツリー)内の任意の1つのノードが他の高々1つのノードからの関連(ここでは関数の呼出または被呼出)を持つような関連の集合のことである。最大マッチングとはマッチングで関連の数が最大となるものである。最大マッチングのアルゴリズムは、Hopcroft-Karpのアルゴリズムが有名であるが、近年並列計算による近似アルゴリズムによって線形時間で結果を出力できる。ここでは正確に最大であるマッチングとならなくても結果には影響しないため、近似アルゴリズムを採用する。ここでは、一例として図4(b)に示すように、関数funcAと関数funcB、関数funcDと関数funcE、関数funcFと関数funcE´をそれぞれペアとするマッチングで関連の数が最大であるとして最大マッチングが求められている。
The path
パス条件統合部109は、最大マッチングを求めた後、最大マッチングとなった呼出関数と被呼出関数のそれぞれのパス条件表を論理積によって並列に統合する。パス条件表は、上述したように、パス条件表格納部107に格納されている。具体的には、図5から図7までに示すように、パス条件表T1,・・・,T6は、それぞれID、パス条件及び返却値を含んでいる。IDは、パス条件のIDである。パス条件には、シンボル変数に関わる分岐を辿った履歴を表すパス条件そのもの(第1の条件)と、呼出関数の引数についての条件(第2の条件)とが含まれる。例えば、図5に示すパス条件表T1では、「x>0」及び「funcB_ret>0」がパス条件そのものに該当する。一方、「funcB_x==x」及び「funcD_x==funcB_ret」は呼出関数の引数についての条件に該当する。尚、funcB_retはfuncBの返却値を表し、funcB_xはfuncBの引数xを表している。他の返却値や引数についても基本的に同様である。図5から図7におけるパス条件表T1,・・・,T6の返却値は、それぞれfuncA,・・・,funcE´の返却値である。
The path
パス条件表の統合処理は、最大マッチングとなった呼出関数と被呼出関数との間で行われ、図5から図7に示すように、呼出関数funcAのパス条件表T1と被呼出関数funcBのパス条件表T2、呼出関数funcDのパス条件表T3と被呼出関数funcEのパス条件表T4、及び呼出関数funcFのパス条件表T5と被呼出関数funcE´のパス条件表T6をそれぞれ論理積によって並列に統合することで行われる。この結果、呼出関数funcAのパス条件表T1と被呼出関数funcBのパス条件表T2の統合であれば、図5に示すように、統合したパス条件表T7が生成される。 The integration process of the path condition table is performed between the calling function and the called function that have the maximum matching, and as shown in FIGS. 5 to 7, the path condition table T1 of the calling function funcA and the called function funcB. The path condition table T2, the path condition table T3 of the calling function funcD, the path condition table T4 of the called function funcE, and the path condition table T5 of the calling function funcF and the path condition table T6 of the called function funcE ′ are paralleled by logical product. It is done by integrating with. As a result, if the path condition table T1 of the calling function funcA and the path condition table T2 of the called function funcB are integrated, an integrated path condition table T7 is generated as shown in FIG.
図5において、パス条件表T7のパス条件によっては2つの括弧が含まれている。左側の括弧にはfuncAのパス条件が含まれている。右側の括弧には、funcBのパス条件とfuncBの返却値を変換したパス条件が含まれている。例えば、funcBの返却値「0」は、「funcB_ret==0」に変換されて、右側の括弧に追加される。2つの括弧内のパス条件は論理積によって結合されている。パス条件の欄の右に設けられているSATの欄には、パス条件を満たす解が存在するか否かについての判定結果が示されている。SAT(Satisfied)である場合には、パス条件を満たす解が存在する。UNSAT(Unsatisfied)である場合には、パス条件を満たす解が存在しない。例えば、統合したパス条件表において、「funcB_ret>0」と「funcB_ret==0」を同時に満たす解は存在しないため、SATの欄にはUNSATが記録される。 In FIG. 5, two parentheses are included depending on the path condition of the path condition table T7. The parentheses on the left include the funcA path condition. The parenthesis on the right side includes a path condition obtained by converting the funcB path condition and the funcB return value. For example, the return value “0” of funcB is converted to “funcB_ret == 0” and added to the right parenthesis. The path conditions in the two parentheses are connected by AND. In the SAT column provided to the right of the path condition column, a determination result as to whether or not there is a solution that satisfies the path condition is shown. In the case of SAT (Satisfied), there exists a solution that satisfies the path condition. In the case of UNSAT (Unsatisfied), there is no solution that satisfies the path condition. For example, in the integrated path condition table, since there is no solution that satisfies both “funcB_ret> 0” and “funcB_ret == 0”, UNSAT is recorded in the SAT column.
以上説明したパス条件の統合処理と同様に、呼出関数funcDのパス条件表T3と被呼出関数funcEのパス条件表T4の統合であれば、図6に示すように、統合したパス条件表T8が生成される。呼出関数funcFのパス条件表T5と被呼出関数funcE´のパス条件表T6の統合であれば、図7に示すように、統合したパス条件表T9が生成される。パス条件統合部109は、生成したパス条件表T7,T8,T9のうちSATのものをパス条件表格納部107に格納する。
Similar to the path condition integration process described above, if the path condition table T3 of the calling function funcD and the path condition table T4 of the called function funcE are integrated, as shown in FIG. Generated. If the path condition table T5 of the calling function funcF and the path condition table T6 of the called function funcE ′ are integrated, an integrated path condition table T9 is generated as shown in FIG. The path
パス条件統合部109は、パス条件表の統合処理を終えると、最大マッチングとなった呼出関数と被呼出関数を統合し、統合した1つの関数を利用して、再度、最大マッチングを求め、パス条件表を統合する。具体的には、パス条件統合部109は、図8(a)において、最大マッチングに基づいて、関数funcAと関数funcBとの統合、関数funcDと関数funcEとの統合、及び関数funcFと関数funcE´との統合を実行する。以下、関数funcAと関数funcBとを統合した後の関数を関数funcABと呼ぶ。関数funcDと関数funcEとを統合した後の関数を関数funcDEと呼ぶ。関数funcFと関数funcE´とを統合した後の関数を関数funcE´Fと呼ぶ。パス条件統合部109は、呼出関数と被呼出関数との統合を終えると、再度、最大マッチングを求める。ここでは、一例として図8(b)に示すように、関数funcABと関数funcC、関数funcDEと関数funcE´Fをそれぞれペアとするマッチングで関連の数が最大であるとして最大マッチングが求められている。
When the path
パス条件統合部109は、最大マッチングを求めた後、最大マッチングとなった呼出関数のパス条件表と被呼出関数のパス条件表を論理積によって並列に統合する。パス条件表の統合処理は、図9及び図10に示すように、呼出関数である関数funcABのパス条件表T7のうちSATとなったものと被呼出関数である関数funcCのパス条件表T10、及び呼出関数である関数funcDEのパス条件表T8のうちSATとなったものと被呼出関数である関数funcE´Fのパス条件表T9のうちSATとなったものをそれぞれ論理積によって並列に統合することで行われる。この結果、関数funcABのパス条件表T7と関数funcCのパス条件表T10の統合であれば、図9に示すように、統合したパス条件表T11が生成される。同様に、関数funcDEのパス条件表T8と関数funcE´Fのパス条件表T9の統合であれば、図10に示すように、統合したパス条件表T12が生成される。パス条件統合部109は、生成したパス条件表T11,T12のうちSATのものをパス条件表格納部107に格納する。
After obtaining the maximum matching, the path
パス条件統合部109は、パス条件表の統合処理を終えると、最大マッチングとなった呼出関数と被呼出関数を統合し、統合した1つの関数を利用して、再度、最大マッチングを求め、パス条件表を統合する。具体的には、図11(a)において、パス条件統合部109は、最大マッチングに基づいて、関数funcABと関数funcCとの統合、及び関数funcDEと関数funcE´Fとの統合を実行する。以下、関数funcABと関数funcCとを統合した後の関数を関数funcABCと呼ぶ。関数funcDEと関数funcE´Fとを統合した後の関数を関数funcDEE´Fと呼ぶ。パス条件統合部109は、呼出関数と被呼出関数との統合を終えると、再度、最大マッチングを求める。ここでは、一例として図11(b)に示すように、関数funcABCと関数funcC、関数funcDEE´Fをペアとするマッチングで関連の数が最大であるとして最大マッチングが求められている。
When the path
パス条件統合部109は、最大マッチングを求めた後、最大マッチングとなった呼出関数と被呼出関数のそれぞれのパス条件表を論理積によって並列に統合する。パス条件表の統合処理は、図12に示すように、呼出関数である関数funcABCのパス条件表T11のうちSATとなったものと被呼出関数である関数funcDEE´Fのパス条件表T12のうちSATとなったものを論理積によって並列に統合することで行われる。この結果、関数funcABCのパス条件表T11と関数funcDEE´Fのパス条件表T12の統合から、図12に示すように、統合したパス条件表T13が生成される。パス条件統合部109は、生成したパス条件表T13のうちSATのものをパス条件表格納部107に格納する。
The path
パス条件統合部109は、パス条件表の統合処理を終えると、最大マッチングとなった呼出関数と被呼出関数を統合し、統合した1つの関数を利用して、再度、最大マッチングを求め、パス条件表を統合する。具体的には、図13(a)に示すように、パス条件統合部109は、最大マッチングに基づいて、関数funcABCと関数funcDEE´Fとの統合を実行する。これにより、関数funcABCと関数funcDEE´Fとを統合した1つの関数funcABCDEE´Fが生成される。パス条件統合部109は、関数が1つになると最大マッチングを求めるマッチング処理及びパス条件表を統合する統合処理を終了する。
When the path
統合処理が終了すると、テストケース生成部110は、パス条件表格納部107に格納されたパス条件表T13のうちSATになったもの(図13(b))からソルバ(solver)を用いてテストケースを生成する。ソルバとは、複数の変数の値を変化させながら変数の相互関係を判断し、最適な値を算出する算出手法である。この結果、図13(b)に示すように、SATのパス条件表T13に示されるパス条件を満たすシンボル変数の値を含むテストケースが生成される。テストケース生成部110は、生成したテストケースをテストケース格納部111に格納する。尚、このようなテストケースを用いて図2に示した対象プログラム10のテストを実行すると、関数funcA,・・・,funcFを組み合わせたときに通りえない行を除いた行を網羅することができる。
When the integration process is completed, the test
また、本実施形態ではパス条件表の統合処理を含む一部の処理が並列化されている。仮に、統合処理の全てが並列(パラレル)に行えるとした場合、並列の最大マッチングの計算量はO(log n)で表すことができる。ここで、nは関数の数、Oはオーダーである。また、反復回数はO(log n)で表すことができるため、統合処理にかかるコスト(計算量)をsとした場合、本実施形態の計算量はO((log n)2+s log n)で表すことができる。一方、統合処理の全てが直列(シリアル)に行えるとした場合、計算量はsnで表すことができる。 In the present embodiment, some processes including the path condition table integration process are parallelized. If all the integration processes can be performed in parallel, the parallel maximum matching calculation amount can be expressed as O (log n). Here, n is the number of functions, and O is the order. In addition, since the number of iterations can be expressed by O (log n), when the cost (computation amount) required for the integration process is s, the computation amount of the present embodiment is O ((log n) 2 + s log n). Can be expressed as On the other hand, when all the integration processes can be performed in series, the amount of calculation can be represented by sn.
ここで、sn>s log nは自明であるため、sn>(log n)2であれば計算時間を短縮することができる。ここで、図14に示すように、y=(log n)2/nは、n≧1においてn=e2のとき最大値y=4/e2となる。したがって、コストsが最大値4/e2よりも大きい場合には、n≧1であればnに関わらず計算時間を短縮することができる。すなわち、s>(log n)2/nの条件を満たせば、計算時間を短縮することができる。
Here, since sn> slog n is self-evident, if sn> (log n) 2 , the calculation time can be shortened. Here, as shown in FIG. 14, y = (log n) 2 / n is the maximum value y = 4 / e 2 when n ≧ 1 and n = e 2 . Therefore, when the cost s is larger than the
次に、図15及び図16を用いて、上述した実行状態について説明する。 Next, the execution state described above will be described with reference to FIGS. 15 and 16.
図15は、コールスタックについて説明するための図である。図16は、プログラムの実行木を示す図である。
まず、図15を用いて、コールスタックについて説明する。図15に示したプログラムQは、メインの処理を表すコードQ1において関数funcAを呼び出し、関数funcAにおいて関数absを呼び出すプログラムである。命令1乃至7におけるいずれかの命令を実行中におけるコールスタックは識別情報「stack3」のようになっている。命令8乃至15におけるいずれかの命令を実行中におけるコールスタックは識別情報「stack2」のようになっている。命令16乃至19におけるいずれかの命令を実行中におけるコールスタックは識別情報「stack1」のようになっている。
FIG. 15 is a diagram for explaining the call stack. FIG. 16 is a diagram illustrating an execution tree of a program.
First, the call stack will be described with reference to FIG. The program Q shown in FIG. 15 is a program that calls the function funcA in the code Q1 representing the main process and calls the function abs in the function funcA. The call stack during execution of any one of the
図16に、図15に示したプログラムQの実行木を示す。図16の実行木においては、各実行状態について、プログラムカウンタの値、コールスタックの識別情報(図15における識別情報に対応している)、メモリの内容、及びパス条件(本実施の形態においては、シンボル変数に関わる分岐を辿った履歴を表す条件)が示されている。例えば、プログラムカウンタの値が12である場合には、実行状態はstate2又はstate5である。「*」は、変数がシンボル変数であることを表す。実行状態格納部106には、シンボリック実行中におけるプログラムの実行状態が、図16における符号60のような形式で格納される。
FIG. 16 shows an execution tree of the program Q shown in FIG. In the execution tree of FIG. 16, for each execution state, the value of the program counter, call stack identification information (corresponding to the identification information in FIG. 15), memory contents, and path conditions (in this embodiment) , A condition representing a history of tracing a branch related to a symbol variable). For example, when the value of the program counter is 12, the execution state is state2 or state5. “*” Indicates that the variable is a symbol variable. The execution
次に、図17を参照して、テストケース生成装置100の動作について説明する。
Next, the operation of the test
図17は、テストケース生成装置100の動作の一例を示すフローチャートである。
まず、テストケース生成装置100における入力部101は、ユーザから対象プログラム10の入力を受け付け、対象プログラム格納部102に格納する。対象プログラム10が格納されると、シンボリック実行部105は、対象プログラム10からコールツリー20を生成する(ステップS101)。コールツリー20は、コールツリー格納部108に格納される。コールツリー20が生成されると、次いで、ドライバ・スタブ生成部103は、後述するドライバ・スタブ生成処理を実行する(ステップS102)。ドライバ・スタブ生成処理は、各関数に対して並列に実行される。これにより、関数毎のドライバ及びスタブが生成される。
FIG. 17 is a flowchart illustrating an example of the operation of the test
First, the
ドライバ・スタブ生成処理が完了すると、次いで、シンボリック実行部105は、後述するシンボリック実行を行う(ステップS103)。シンボリック実行は、各関数に対して並列に行われる。シンボリック実行が行われることで、シンボリック実行中における実行状態が実行状態格納部106に格納される。また、シンボリック実行が行われることで、シンボリック実行時に得られたパス条件及び返却値(返り値とも呼ばれる)等を含むパス条件表がパス条件表格納部107に格納される。
When the driver stub generation processing is completed, the
シンボリック実行が完了すると、次いで、パス条件統合部109は、複数の関数から呼び出される関数を複製し(ステップS104)、コールツリーの最大マッチングを求める(ステップS105)。最大マッチングが求められると、さらに、パス条件統合部109は、パス条件表の統合処理を実行する(ステップS106)パス条件表の統合処理は、最大マッチングとなった2つの関数のそれぞれのパス条件表に対して並列に実行される。パス条件統合部109は、パス条件表の統合処理が完了すると、最大マッチングとなった2つの関数を1つに統合し(ステップS107)、統合した1つの関数が全ての関数を含むか否かを判断する(ステップS108)。
When the symbolic execution is completed, the path
パス条件統合部109は、統合した1つの関数が全ての関数を含まないと判断した場合(ステップS108:NO)、ステップS105〜S107の処理を繰り返す。そして、パス条件統合部109は、統合した1つの関数が全ての関数を含むと判断した場合(ステップS108:YES)、テストケース生成部110は、ソルバを利用してテストケースを生成する(ステップS109)。テストケース生成部110は、生成したテストケースをテストケース格納部111に格納する。
When the path
次に、図18及び図19を参照して、上述したドライバ・スタブ生成処理の詳細について説明する。 Next, the details of the driver stub generation process described above will be described with reference to FIGS.
図18は、ドライバ・スタブ生成処理の動作の一例を示すフローチャートである。
ドライバ・スタブ生成部103は、まず、処理対象となる対象関数を解析し、対象関数から、パラメータ及び対象関数から呼び出される被呼出関数を抽出する(ステップS201)。例えば、図2に示した関数funcAの場合、被呼出関数として関数funcBが呼び出される。ドライバ・スタブ生成部103は、次いで、ステップS201において抽出された被呼出関数それぞれについて対応するスタブを生咸し(ステップS202)、ドライバ・スタブ格納部104に格納する。スタブはドライバから呼び出され、呼び出しに応じてシンボルを返すプログラムである。次いで、ドライバ・スタブ生成部103は、対象関数のパラメータ及び被呼出関数に対応するシンボル変数を設定するためのプログラムであるドライバを生成し(ステップS203)、ドライバ・スタブ格納部104に格納する。そして処理を終了する。
FIG. 18 is a flowchart showing an example of the operation of the driver / stub generation process.
First, the driver /
図19は、対象関数から生成されるスタブとドライバの一例である。
図19に示したスタブの6行目において、ドライバに対してシンボルを返すようになっている。また、図19に示したドライバにおいては、3行目及び4行目においてシンボル変数を設定し、5行目においてスタブを呼び出し、6行目においてfuncAを呼び出している。以上のようなドライバ・スタブ生成処理を実行すれば、関数単体でシンボリック実行を行えるようになる。
FIG. 19 is an example of a stub and driver generated from the target function.
In the sixth line of the stub shown in FIG. 19, a symbol is returned to the driver. In the driver shown in FIG. 19, symbol variables are set in the third and fourth lines, a stub is called in the fifth line, and funcA is called in the sixth line. If the driver stub generation process as described above is executed, symbolic execution can be performed by a single function.
次に、図20乃至図22を参照して、上述したシンボリック実行の詳細について説明する。 Next, the details of the symbolic execution described above will be described with reference to FIGS.
図20乃至図22は、シンボリック実行の動作の一例を示すフローチャートである。尚、図20における「シンボリック実行(p)」とは、実行状態pについてシンボリック実行を行うことを表している。
まず、シンボリック実行部105は、実行状態格納部106に格納されている、実行状態pのプログラムカウンタの値に基づき、命令を1つ読み出す(ステップS301)。例えばプログラムカウンタの値が「2」である場合、対象関数の2行目の命令を読み出す。以下では、ステップS301において読み出された命令を「処理対象の命令」と呼ぶ。
20 to 22 are flowcharts showing an example of the symbolic execution operation. Note that “symbolic execution (p)” in FIG. 20 represents performing symbolic execution for the execution state p.
First, the
シンボリック実行部105は、処理対象の命令が、関数を呼び出す命令であるか判断する(ステップS302)。関数を呼び出す命令ではない場合(ステップS302:NO)、図21のステップS401の処理に移行する。一方、関数を呼び出す命令である場合(ステップS302:YES)、シンボリック実行部105は、被呼出関数の引数に関数ポインタが含まれるか判断する(ステップS303)。被呼出関数の引数に関数ポインタが含まれていない場合(ステップS303:NO)、ステップS305の処理に移行する。被呼出関数の引数に関数ポインタが含まれている場合(ステップS303:YES)、シンボリック実行部105は、関数ポインタについての条件を、実行中のパスについての条件に追加する(ステップS304)。
The
次いで、シンボリック実行部105は、被呼出関数の実引数と仮引数との関係を表す条件を、実行中のパスについての条件に追加する(ステップS305)。尚、被呼出関数が複数回呼び出される場合、ステップS305においては、引数についての条件が呼び出し毎に追加される。次いで、シンボリック実行部105は、被呼出関数をコールツリーに追加するための追加処理を実行する(ステップS306)。追加処理の詳細については、後述する。
Next, the
ここで、ステップS302の処理において、関数を呼び出す命令ではない場合、又は、ステップS306の処理が完了した場合、図21に移り、シンボリック実行部105は、処理対象の命令がグローバル変数を読み込む命令又は書き込む命令であるか判断する(ステップS401)。グローバル変数を読み込む命令又は書き込む命令のいずれでもない場合(ステップS401;NO)、処理はステップS404に移行する。一方、グローバル変数を読み込む命令又は書き込む命令である場合(ステップS401;YES)、ステップS402の処理に移行する。そして、グローバル変数を読み込む命令である場合、シンボリック実行部105は、読み込みに対応する書き込みの命令を、コールツリー格納部108に格納されているコールツリー20によって特定する(ステップS402)。尚、グローバル変数を書き込む命令である場合には、ステップS402の処理は行われない。
Here, in the process of step S302, if the instruction is not an instruction for calling a function, or if the process of step S306 is completed, the process proceeds to FIG. 21, and the
シンボリック実行部105は、ステップS401においてグローバル変数の読み込みであると判定された場合にはグローバル変数の読み込みについての条件を、ステップS401においてグローバル変数の書き込みであると判定された場合にはグローバル変数の書き込みについての条件を、実行中のパスについての条件に追加する(ステップS403)。
The
ここで、ステップS401の処理において、グローバル変数を読み込む命令又は書き込む命令のいずれでもない場合、又は、ステップS403の処理が完了した場合、シンボリック実行部105は、処理対象の命令がシンボルに関わる分岐の命令であるか判断する(ステップS404)。シンボルに関わる分岐の命令とは、例えば、if文にシンボル変数が含まれている命令である。
Here, in the process of step S401, when neither the instruction to read the global variable nor the instruction to write is performed, or when the process of step S403 is completed, the
シンボルに関わる分岐の命令である場合(ステップS404:YES)、シンボリック実行部105は、新たにシンボリック実行が行われる実行状態Pに実行状態p(すなわち、実行状態格紬部106に格納されている現在の実行状態)をコピー(複製)する(ステップS405)。シンボリック実行部105は、処理対象の命令において未処理の分岐先を1つ特定する(ステップS406)。そして、シンボリック実行部105は、分岐の条件(すなわち、パス条件)を、実行中のパスについての条件に追加する(ステップS407)。シンボリック実行部105は、実行状態Pについてのシンボリック実行を再帰的に行う(ステップS408)。
If the instruction is a branch instruction related to a symbol (step S404: YES), the
ステップS408におけるシンボリック実行が完了すると、シンボリック実行部105は、処理対象の命令において未処理の分岐先があるか判断する(ステップS409)。未処理の分岐先が有る場合(ステップS409:YES)、次の分岐先について処理するため、ステップS406の処理に戻る。一方、未処理の分岐先が無い場合(ステップS409:NO)、呼び出し元の処理に戻る。
When the symbolic execution in step S408 is completed, the
ステップS404の処理において、処理対象の命令がシンボルに関わる分岐ではない場合(ステップS404:NO)、新たにシンボリック実行を行わなくてもよい。従って、図22に示すように、シンボリック実行部105は、処理対象の命令を実行し、実行状態格納部106に格納されているプログラムカウンタの値を1進める(ステップS501)。シンボリック実行部105は、実行状態pが終了の状態であるか判断する(ステップS502)。終了の状態とは、例えば、プログラムカウンタの値がプログラムにおける最後の行の番号に達している状態である。終了の状態ではない場合(ステップS502:NO)、シンボリック実行部105は、次の命令について処理するため、図20に示すステップS301の処理に戻る。一方、実行状態pが終了の状態である場合(ステップS502:YES)、シンボリック実行部105は、シンボリック実行によって得られた、各パスについてのパス条件及び返却値を含むパス条件表をパス条件表格納部107に格納する(ステップS503)。そして呼び出し元の処理に戻る。
In the process of step S404, if the instruction to be processed is not a branch related to a symbol (step S404: NO), it is not necessary to newly perform symbolic execution. Therefore, as shown in FIG. 22, the
以上の処理により、各関数についてシンボリック実行が行われ、満たすべき条件及び関数の返却値がパス条件表格納部107に保存されるようになる。尚、各関数についてのシンボリック実行の結果(すなわち、パス条件表)ほ、パス条件表格納部107に保存される。
Through the above processing, symbolic execution is performed for each function, and the condition to be satisfied and the return value of the function are stored in the path condition
次に、図23を参照して、上述した追加処理の詳細について説明する。 Next, with reference to FIG. 23, details of the above-described addition processing will be described.
図23は、追加処理の動作の一例を示すフローチャートである。
まず、シンボリック実行部105は、コールツリー格納部108に格納されているコールツリー20に最も後に追加された関数の位置を現在位置に設定する(S601)。シンボリック実行部105は、被呼出関数がコールツリーにおける現在位置より上位の位置に存在するか判断する(ステップS602)。現在位置より上位の位に存在しない場合(ステップS602:NO)、再帰呼び出しには該当しないので、シンボリック実行部105は、コールツリーにおける現在位置の下に関数を追加する(ステップS603)。一方、現在位置より上位の位置に存在する場合(ステップS602:YES)、再帰呼び出しに該当する。そこで、シンボリック実行部105は、被呼出関数についての条件を、実行中のパスについての条件から削除する(ステップS604)。そして呼び出し元の処理に戻る。尚、コールツリーへの関数追加時に、現在位置の右下に追加するようにすることで、追加順が新しい関数ほど右に出現するようにし、検索しやすいようにすることが望ましい。
FIG. 23 is a flowchart illustrating an example of the operation of the addition process.
First, the
次に、図24を参照して、上述したパス条件表の統合処理の詳細について説明する。 Next, with reference to FIG. 24, the details of the above-described path condition table integration processing will be described.
図24は、パス条件表の統合処理の動作の一例を示すフローチャートである。
まず、パス条件統合部109は、パス条件表格納部107に、統合すべき2つのパス条件表(ここでは、パス条件表A及びパス条件表Bと表記する)が存在するか判断する(ステップS701)。パス条件表Aやパス条件表Bは、例えば上述したパス条件表T1やパス条件表T2に対応する。統合すべき2つのパス条件表A及びBが存在しない場合(ステップS701:NO)、呼び出し元の処理に戻る。
FIG. 24 is a flowchart illustrating an example of operation of path condition table integration processing.
First, the path
一方、統合すべき2つのパス条件表A及びBが存在する場合(ステップS701:YES)、パス条件統合部109は、パス条件表Aから未処理の条件(ここでは、パス条件aとする)を1つ特定する(ステップS702)。また、パス条件統合部109は、パス条件表Bから未処理の条件(ここでは、パス条件bとする)を1つ特定する(ステップS703)。ステップS702及びS703において、パス条件統合部109は、パス単位で条件を特定する。
On the other hand, when there are two path condition tables A and B to be integrated (step S701: YES), the path
パス条件統合部109は、パス条件aとパス条件bとの論理積を求めることにより、パス条件cを生成し(ステップS704)、メインメモリ等の記憶装置に格納する。パス条件統合部109は、パス条件cを満たす解が存在するか、例えばソルバによって判断する(ステップS705)。パス条件cを満たす解が存在しない場合(ステップS705:NO)、ステップS707の処理に移行する。一方、パス条件cを満たす解が存在する場合(ステップS705:YES)、パス条件統合部109は、パス条件cをパス条件表Cに追加する(ステップS706)。尚、パス条件表Cが存在しない場合には、ステップS706において新たに条件表Cが生成される。
The path
パス条件統合部109は、パス条件表Bに未処理の条件があるか判断する(ステップS707)。未処理の条件がある場合(ステップS707:YES)、次の条件について処理するため、ステップS703の処理に戻る。一方、パス条件表Bに未処理の条件がない場合(ステップS707:NO)、パス条件統合部109は、パス条件表Bにおけるパス条件を全て未処理に設定する(ステップS708)。
The path
次いで、パス条件統合部109は、パス条件表Aに未処理の条件があるか判断する(ステップS709)。未処理の条件がある場合(ステップS709:YES)、次の条件について処理するため、ステップS702の処理に戻る。一方、パス条件表Aに未処理の条件がない場合(ステップS709:NO)、パス条件統合部109は、パス条件表Cをパス条件表格納部107に格納し(ステップS710)、呼び出し元の処理に戻る。以上のような処理を実行すれば、各関数について生成されたパス条件をまとめることができるようになる。
Next, the path
次に、図25を参照して、テストケース生成装置100のハードウェア構成について説明する。
Next, a hardware configuration of the test
図25は、テストケース生成装置100のハードウェア構成の一例である。
図25に示すように、テストケース生成装置100は、少なくともCentral Processing Unit(CPU)100A、Random Access Memory(RAM)100B、Read Only Memory(ROM)100C及びネットワークI/F(インタフェース)100Dを含んでいる。テストケース生成装置100は、必要に応じて、Hard Disk Drive(HDD)100E、入力I/F100F、出力I/F100G、入出力I/F100H、ドライブ装置100Iの少なくとも1つを含んでいてもよい。CPU100A,・・・,ドライブ装置100Iは、内部バス100Jによって互いに接続されている。少なくともCPU100AとRAM100Bとが協働することによってコンピュータが実現される。
FIG. 25 is an example of a hardware configuration of the test
As shown in FIG. 25, the test
入力I/F100Fには、入力装置210が接続される。入力装置210としては、例えばキーボードやマウスなどがある。
出力I/F100Gには、表示装置220が接続される。表示装置220としては、例えば液晶ディスプレイがある。
入出力I/F100Hには、半導体メモリ230が接続される。半導体メモリ230としては、例えばUniversal Serial Bus(USB)メモリやフラッシュメモリなどがある。入出力I/F100Hは、半導体メモリ230に記憶されたプログラムやデータを読み取る。
入力I/F100F及び入出力I/F100Hは、例えばUSBポートを備えている。出力I/F100Gは、例えばディスプレイポートを備えている。
An
The
The
The input I /
ドライブ装置100Iには、可搬型記録媒体240が挿入される。可搬型記録媒体240としては、例えばCompact Disc(CD)−ROM、Digital Versatile Disc(DVD)といったリムーバブルディスクがある。ドライブ装置100Iは、可搬型記録媒体240に記録されたプログラムやデータを読み込む。
ネットワークI/F100Dは、例えばポートとPhysical Layer Chip(PHYチップ)とを備えている。テストケース生成装置100は、ネットワークI/F100Dを介してネットワークと接続される。
A portable recording medium 240 is inserted into the drive device 100I. Examples of the portable recording medium 240 include a removable disk such as a Compact Disc (CD) -ROM and a Digital Versatile Disc (DVD). The drive device 100I reads a program and data recorded on the portable recording medium 240.
The network I / F 100D includes, for example, a port and a physical layer chip (PHY chip). The test
上述したRAM100Bには、ROM100CやHDD100Eに記憶されたプログラムがCPU100Aによって格納される。RAM100Bには、可搬型記録媒体240に記録されたプログラムがCPU100Aによって格納される。格納されたプログラムをCPU100Aが実行することにより、上述した各種の動作が実行される。尚、プログラムは上述したフローチャートに応じたものとすればよい。
In the above-described
以上、本発明の好ましい実施形態について詳述したが、本発明に係る特定の実施形態に限定されるものではなく、特許請求の範囲に記載された本発明の要旨の範囲内において、種々の変形・変更が可能である。 The preferred embodiments of the present invention have been described in detail above, but the present invention is not limited to the specific embodiments according to the present invention, and various modifications are possible within the scope of the gist of the present invention described in the claims.・ Change is possible.
なお、以上の説明に関して更に以下の付記を開示する。
(付記1)対象プログラムにおいて実行される複数の関数の各々についてシンボリック実行を行うとともに、シンボル変数に関わる分岐を辿った履歴を表す第1の条件と、当該関数の引数及び返却値についての第2の条件の少なくともいずれかを含むパス条件表を前記複数の関数の各々について生成し、前記複数の関数に含まれるいずれかの関数を呼び出す第1の関数と前記第1の関数に呼び出される第2の関数とのマッチングを求め、求めたマッチングの少なくとも1つより大きなマッチングを求めた前記第1の関数と前記第2の関数との間毎に、関数毎の前記パス条件表を論理積によって並列に統合し、統合後のパス条件表を満たすシンボル変数の値を算出し、算出した当該シンボル変数の値を含むテストケースを生成する処理をコンピュータに実行させるためのテストケース生成プログラム。
(付記2)前記第2の関数が複数の前記第1の関数から呼び出される場合に、前記第2の関数を呼出元毎に複製する処理をさらに含むことを特徴とする付記1に記載のテストケース生成プログラム。
(付記3)前記パス条件表を生成する処理を、前記複数の関数の各々について並列に実行させることを特徴とする付記1又は2に記載のテストケース生成プログラム。
(付記4)前記シンボル変数を設定するためのドライバと当該ドライバにおいて呼び出されるスタブを生成する処理をさらに含み、前記ドライバと前記スタブを生成する処理を、前記複数の関数の各々について並列に実行させることを特徴とする付記1から3のいずれか1項に記載のテストケース生成プログラム。
(付記5)対象プログラムにおいて実行される複数の関数の各々についてシンボリック実行を行うとともに、シンボル変数に関わる分岐を辿った履歴を表す第1の条件と、当該関数の引数及び返却値についての第2の条件の少なくともいずれかを含むパス条件表を前記複数の関数の各々について生成し、前記複数の関数に含まれるいずれかの関数を呼び出す第1の関数と前記第1の関数に呼び出される第2の関数とのマッチングを求め、求めたマッチングの少なくとも1つより大きなマッチングを求めた前記第1の関数と前記第2の関数との間毎に、関数毎の前記パス条件表を論理積によって並列に統合し、統合後のパス条件表を満たすシンボル変数の値を算出し、算出した当該シンボル変数の値を含むテストケースを生成する処理をコンピュータが実行するテストケース生成方法。
(付記6)対象プログラムにおいて実行される複数の関数の各々についてシンボリック実行を行うとともに、シンボル変数に関わる分岐を辿った履歴を表す第1の条件と、当該関数の引数及び返却値についての第2の条件の少なくともいずれかを含むパス条件表を前記複数の関数の各々について生成する第1の生成手段と、前記複数の関数に含まれるいずれかの関数を呼び出す第1の関数と前記第1の関数に呼び出される第2の関数とのマッチングを求め、求めたマッチングの少なくとも1つより大きなマッチングを求めた前記第1の関数と前記第2の関数との間毎に、関数毎の前記パス条件表を論理積によって並列に統合する統合手段と、統合後のパス条件表を満たすシンボル変数の値を算出し、算出した当該シンボル変数の値を含むテストケースを生成する第2の生成手段と、を有するテストケース生成装置。
(付記7)前記統合手段は、前記第2の関数が複数の前記第1の関数から呼び出される場合に、前記第2の関数を呼出元毎に複製することを特徴とする付記6に記載のテストケース生成装置。
(付記8)前記第1の生成手段は、前記複数の関数の各々について前記パス条件表を並列に生成することを特徴とする付記6又は7に記載のテストケース生成装置。
(付記9)前記シンボル変数を設定するためのドライバと当該ドライバにおいて呼び出されるスタブを生成する第3の生成手段をさらに含み、前記第3の生成手段は、前記複数の関数の各々について前記ドライバと前記スタブを並列に生成することを特徴とする付記6から8のいずれか1項に記載のテストケース生成装置。
In addition, the following additional notes are disclosed regarding the above description.
(Supplementary Note 1) Symbolic execution is performed for each of a plurality of functions executed in the target program, and a first condition representing a history of tracing a branch related to a symbol variable, and a second condition regarding an argument and a return value of the function A path condition table including at least one of the above conditions is generated for each of the plurality of functions, and a first function that calls one of the functions included in the plurality of functions and a second function that is called by the first function The path condition table for each function is paralleled by logical product between each of the first function and the second function for which a matching greater than at least one of the obtained matching is obtained. The process of calculating the symbol variable value that satisfies the integrated path condition table and generating a test case that includes the calculated symbol variable value Test case generation program to be executed by the over data.
(Supplementary note 2) The test according to
(Supplementary note 3) The test case generation program according to
(Additional remark 4) It further includes the process which produces | generates the driver for setting the said symbol variable, and the stub called in the said driver, The process which produces | generates the said driver and the said stub is performed in parallel about each of these
(Supplementary note 5) Symbolic execution is performed for each of a plurality of functions executed in the target program, and a first condition indicating a history of tracing a branch related to a symbol variable, and a second condition regarding an argument and a return value of the function A path condition table including at least one of the above conditions is generated for each of the plurality of functions, and a first function that calls one of the functions included in the plurality of functions and a second function that is called by the first function The path condition table for each function is paralleled by logical product between each of the first function and the second function for which a matching greater than at least one of the obtained matching is obtained. The process of calculating the symbol variable value that satisfies the integrated path condition table and generating a test case that includes the calculated symbol variable value Test case generation method over data to be executed.
(Appendix 6) Symbolic execution is performed for each of a plurality of functions executed in the target program, and a first condition indicating a history of tracing a branch related to a symbol variable, and a second condition regarding an argument and a return value of the function A first condition generation unit that generates a path condition table including at least one of the conditions for each of the plurality of functions, a first function that calls one of the functions included in the plurality of functions, and the first The path condition for each function is obtained every time between the first function and the second function for which a matching with a second function called by the function is obtained and a matching larger than at least one of the obtained matchings is obtained. Integration means for integrating tables in parallel by logical product and a symbol variable value satisfying the combined path condition table is calculated, and a test including the calculated symbol variable value is performed. Test case generation device comprising a second generating means for generating a case, the.
(Additional remark 7) The said integration means replicates the said 2nd function for every call origin, when the said 2nd function is called from the said several 1st function, The
(Supplementary note 8) The test case generation device according to
(Supplementary note 9) Further includes a driver for setting the symbol variable and third generation means for generating a stub to be called in the driver, wherein the third generation means includes the driver for each of the plurality of functions. The test case generation device according to any one of
100 テストケース生成装置
103 ドライバ・スタブ生成部(第3の生成手段)
105 シンボリック実行部(第1の生成手段)
109 パス条件統合部(統合手段)
110 テストケース生成部(第2の生成手段)
DESCRIPTION OF
105 Symbolic execution unit (first generation means)
109 Path condition integration unit (integration means)
110 Test case generation unit (second generation means)
Claims (7)
前記複数の関数の各々についてシンボリック実行により、シンボル変数に関わる分岐を辿った履歴を表す第1の条件と、当該関数の引数及び返却値についての第2の条件の少なくともいずれかを含むパス条件表を前記複数の関数の各々について生成し、
前記コールツリーに基づいて、前記複数の関数に含まれるいずれかの関数を呼び出す第1の関数と前記第1の関数に呼び出される第2の関数との関連数を求め、
前記関連数の大きさに基づいた前記第1の関数と前記第2の関数のペア毎に、前記パス条件表を並列に統合し、
統合後のパス条件表を満たすシンボル変数の値を算出し、
当該値をテストケースとして生成する、
処理をコンピュータに実行させるテストケース生成プログラム。 Generate a call tree that represents the calling relationship of multiple functions executed in the target program ,
A path condition table including at least one of a first condition representing a history of tracing a branch related to a symbol variable by symbolic execution for each of the plurality of functions , and a second condition for an argument and a return value of the function. For each of the plurality of functions,
Based on the call tree, a number of associations between a first function that calls one of the functions included in the plurality of functions and a second function that is called by the first function;
Wherein based on the related coefficient magnitude first function and for each pair of said second function, to integrate the pre-Symbol path condition table parallel,
Calculate the value of the symbol variable that satisfies the path condition table after integration,
It generates the value as test cases,
Rute strike case generation program to execute the process to the computer.
前記ドライバと前記スタブを生成する処理を、前記複数の関数の各々について並列に実行させることを特徴とする請求項1から3のいずれか1項に記載のテストケース生成プログラム。 A process for generating a driver for setting the symbol variable and a stub called in the driver;
4. The test case generation program according to claim 1, wherein the process of generating the driver and the stub is executed in parallel for each of the plurality of functions. 5.
前記複数の関数の各々についてシンボリック実行により、シンボル変数に関わる分岐を辿った履歴を表す第1の条件と、当該関数の引数及び返却値についての第2の条件の少なくともいずれかを含むパス条件表を前記複数の関数の各々について生成し、
前記コールツリーに基づいて、前記複数の関数に含まれるいずれかの関数を呼び出す第1の関数と前記第1の関数に呼び出される第2の関数との関連数を求め、
前記関連数の大きさに基づいた前記第1の関数と前記第2の関数のペア毎に、前記パス条件表を並列に統合し、
統合後のパス条件表を満たすシンボル変数の値を算出し、
当該値をテストケースとして生成する、
処理をコンピュータが実行するテストケース生成方法。 Generate a call tree that represents the calling relationship of multiple functions executed in the target program ,
A path condition table including at least one of a first condition representing a history of tracing a branch related to a symbol variable by symbolic execution for each of the plurality of functions , and a second condition for an argument and a return value of the function. For each of the plurality of functions,
Based on the call tree, a number of associations between a first function that calls one of the functions included in the plurality of functions and a second function that is called by the first function;
Wherein based on the related coefficient magnitude first function and for each pair of said second function, to integrate the pre-Symbol path condition table parallel,
Calculate the value of the symbol variable that satisfies the path condition table after integration,
It generates the value as test cases,
A test case generation method in which processing is executed by a computer.
前記コールツリーに基づいて、前記複数の関数に含まれるいずれかの関数を呼び出す第1の関数と前記第1の関数に呼び出される第2の関数との関連数を求め、前記関連数の大きさに基づいた前記第1の関数と前記第2の関数のペア毎に、前記パス条件表を並列に統合する統合手段と、
統合後のパス条件表を満たすシンボル変数の値を算出し、当該値をテストケースとして生成する第2の生成手段と、
を有するテストケース生成装置。 A first condition representing a history of tracing a branch related to a symbol variable by generating a call tree representing a calling relationship of a plurality of functions executed in the target program and performing symbolic execution for each of the plurality of functions , and the function First generation means for generating, for each of the plurality of functions, a path condition table including at least one of the second conditions for the argument and the return value of
Based on the call tree, the number of associations between a first function that calls one of the functions included in the plurality of functions and a second function that is called by the first function is obtained, and the magnitude of the number of associations said each pair of said second function and the first function, integration means for integrating the pre Symbol path condition table parallel based on,
It calculates the value of the symbol variable that satisfies the path condition table after integration, and a second generating means for generating the value as test cases,
A test case generation device having:
ことを特徴とする請求項1に記載のテストケース生成プログラム。The test case generation program according to claim 1, wherein:
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2014129814A JP6331756B2 (en) | 2014-06-25 | 2014-06-25 | Test case generation program, test case generation method, and test case generation apparatus |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2014129814A JP6331756B2 (en) | 2014-06-25 | 2014-06-25 | Test case generation program, test case generation method, and test case generation apparatus |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2016009344A JP2016009344A (en) | 2016-01-18 |
JP6331756B2 true JP6331756B2 (en) | 2018-05-30 |
Family
ID=55226855
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2014129814A Active JP6331756B2 (en) | 2014-06-25 | 2014-06-25 | Test case generation program, test case generation method, and test case generation apparatus |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP6331756B2 (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP6579022B2 (en) * | 2016-04-11 | 2019-09-25 | 富士通株式会社 | Generating program, generating method, and generating apparatus |
JP6659955B2 (en) * | 2016-05-12 | 2020-03-04 | 富士通株式会社 | Program analysis method, program analysis device, and analysis program |
CN107818051B (en) * | 2017-11-27 | 2020-07-03 | 北京新能源汽车股份有限公司 | Test case jump analysis method and device and server |
JP7244756B2 (en) * | 2019-06-24 | 2023-03-23 | 富士通株式会社 | Analysis program, program analysis method and program analysis device |
JP7322964B2 (en) * | 2019-10-28 | 2023-08-08 | 日本電信電話株式会社 | Test information extraction device, test information extraction method and program |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP5761056B2 (en) * | 2012-01-31 | 2015-08-12 | 富士通株式会社 | Generating device, generating program, and generating method |
JP5900212B2 (en) * | 2012-07-18 | 2016-04-06 | 富士通株式会社 | Test data generation apparatus, program, and method |
US8997064B2 (en) * | 2012-08-16 | 2015-03-31 | Fujitsu Limited | Symbolic testing of software using concrete software execution |
-
2014
- 2014-06-25 JP JP2014129814A patent/JP6331756B2/en active Active
Also Published As
Publication number | Publication date |
---|---|
JP2016009344A (en) | 2016-01-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6331756B2 (en) | Test case generation program, test case generation method, and test case generation apparatus | |
JP5894954B2 (en) | Test case generation method, test case generation device, and program | |
JP6070936B2 (en) | Information processing apparatus, information processing method, and program | |
WO2017090475A1 (en) | Information processing system, function creation method, and function creation program | |
JP6281491B2 (en) | Text mining device, text mining method and program | |
RU2716553C1 (en) | Signature creation device, signature creation method, recording medium in which signature creation program is recorded, and software determination system | |
JP2017045080A (en) | Business flow specification regeneration method | |
JPWO2020008991A1 (en) | Verification automation equipment, verification automation methods, and programs | |
US8510693B2 (en) | Changing abstraction level of portion of circuit design during verification | |
US20230153491A1 (en) | System for estimating feature value of material | |
JP6364332B2 (en) | Specification generation method, specification generation device, and program | |
JP5867208B2 (en) | Data model conversion program, data model conversion method, and data model conversion apparatus | |
JPWO2018096686A1 (en) | Verification program, verification apparatus, verification method, index generation program, index generation apparatus, and index generation method | |
JP6831307B2 (en) | Solution calculation device, solution calculation method and solution calculation program | |
JP2018022433A (en) | Control program, apparatus, and method | |
WO2013147172A1 (en) | Cfd updating device and method, data cleansing apparatus and method, and programs | |
JP2019153047A (en) | Generation device, generation method, and program | |
JP7238361B2 (en) | Error output device, error output method, learning device, trained model generation method, program, and trained model | |
JP7430274B2 (en) | Computer system and character recognition method | |
JP6409639B2 (en) | Compiler program, system, method, and apparatus | |
WO2013105440A1 (en) | Data cleansing system, data cleansing method and program for data cleansing | |
JP6563549B1 (en) | Data trend analysis method, data trend analysis system, and narrowing and restoring device | |
US8566758B2 (en) | Data dependency managing apparatus, design data dependency managing method and program | |
WO2013115261A1 (en) | Data cleansing system, data cleansing method, and program | |
JP6305356B2 (en) | Specification extraction device, specification extraction method and program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20170309 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20180131 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20180206 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20180316 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20180403 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20180416 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 6331756 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |