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 PDF

Info

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
Application number
JP2014129814A
Other languages
Japanese (ja)
Other versions
JP2016009344A (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.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2014129814A priority Critical patent/JP6331756B2/en
Publication of JP2016009344A publication Critical patent/JP2016009344A/en
Application granted granted Critical
Publication of JP6331756B2 publication Critical patent/JP6331756B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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).

特開2013−156961号公報JP2013-156916A

上述したように、通常のシンボリック実行は、プログラム内の全パスを対象範囲とする。例えば図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.

図1は、テストケース生成装置のブロック図の一例である。FIG. 1 is an example of a block diagram of a test case generation apparatus. 図2は、対象プログラム格納部に格納される対象プログラムの一例である。FIG. 2 is an example of a target program stored in the target program storage unit. 図3は、対象プログラムについて生成されたコールツリーである。FIG. 3 is a call tree generated for the target program. 図4は、関数の複製と最大マッチングの一例を説明するための図である。FIG. 4 is a diagram for explaining an example of function duplication and maximum matching. 図5は、パス条件表の統合処理の一例を説明するための図である。FIG. 5 is a diagram for explaining an example of the integration process of the path condition table. 図6は、パス条件表の統合処理の一例を説明するための図である。FIG. 6 is a diagram for explaining an example of a path condition table integration process. 図7は、パス条件表の統合処理の一例を説明するための図である。FIG. 7 is a diagram for explaining an example of the integration process of the path condition table. 図8は、関数の統合及び最大マッチングの一例を説明するための図である。FIG. 8 is a diagram for explaining an example of function integration and maximum matching. 図9は、パス条件表の統合処理の一例を説明するための図である。FIG. 9 is a diagram for explaining an example of the path condition table integration process. 図10は、パス条件表の統合処理の一例を説明するための図である。FIG. 10 is a diagram for explaining an example of the integration process of the path condition table. 図11は、関数の統合及び最大マッチングの一例を説明するための図である。FIG. 11 is a diagram for explaining an example of function integration and maximum matching. 図12は、パス条件表の統合処理の一例を説明するための図である。FIG. 12 is a diagram for explaining an example of the integration process of the path condition table. 図13は、関数の統合及びテストケース生成の一例を説明するための図である。FIG. 13 is a diagram for explaining an example of function integration and test case generation. 図14は、計算時間の短縮を説明するためのグラフである。FIG. 14 is a graph for explaining a reduction in calculation time. 図15は、コールスタックについて説明するための図である。FIG. 15 is a diagram for explaining the call stack. 図16は、プログラムの実行木を示す図である。FIG. 16 is a diagram illustrating an execution tree of a program. 図17は、テストケース生成装置の動作の一例を示すフローチャートである。FIG. 17 is a flowchart illustrating an example of the operation of the test case generation device. 図18は、ドライバ・スタブ生成処理の動作の一例を示すフローチャートである。FIG. 18 is a flowchart showing an example of the operation of the driver / stub generation process. 図19は、対象関数、ドライバ及びスタブの一例を説明するための図である。FIG. 19 is a diagram for describing an example of a target function, a driver, and a stub. 図20は、シンボリック実行の動作の一例を示すフローチャートである。FIG. 20 is a flowchart illustrating an example of the symbolic execution operation. 図21は、シンボリック実行の動作の一例を示すフローチャートである。FIG. 21 is a flowchart illustrating an example of the symbolic execution operation. 図22は、シンボリック実行の動作の一例を示すフローチャートである。FIG. 22 is a flowchart illustrating an example of the symbolic execution operation. 図23は、追加処理の動作の一例を示すフローチャートである。FIG. 23 is a flowchart illustrating an example of the operation of the addition process. 図24は、パス条件表の統合処理の動作の一例を示すフローチャートである。FIG. 24 is a flowchart illustrating an example of operation of path condition table integration processing. 図25は、テストケース生成装置のハードウェア構成の一例である。FIG. 25 is an example of a hardware configuration of the test case generation device. 図26は、シンボリック実行の対象になるプログラムと、そのプログラムの制御構造の一例である。FIG. 26 shows an example of a program to be subjected to symbolic execution and a control structure of the program.

以下、本件を実施するための形態について図面を参照して説明する。   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 case generation device 100. As shown in FIG. 1, the test case generation apparatus 100 includes an input unit 101, a target program storage unit 102, a driver / stub generation unit 103, and a driver / stub storage unit 104. The test case generation apparatus 100 includes a symbolic execution unit 105, an execution state storage unit 106, a path condition table storage unit 107, and a call tree storage unit 108 as first generation means. The test case generation device 100 includes a path condition integration unit 109 as an integration unit, a test case generation unit 110 as a second generation unit, and a test case storage unit 111.

入力部101は、テストケースが生成されるべきプログラムの入力を受け付ける。入力部101は受け付けたプログラムを対象プログラムとして対象プログラム格納部102に格納する。
ドライバ・スタブ生成部103は、対象プログラム格納部102に格納されている対象プログラムに基づき、シンボリック実行で利用されるドライバ及びスタブを関数(ノードとも呼ばれる)毎に並列に生成し、ドライバ・スタブ格納部104に格納する。
The input unit 101 receives an input of a program for which a test case is to be generated. The input unit 101 stores the received program in the target program storage unit 102 as a target program.
Based on the target program stored in the target program storage unit 102, the driver / stub generation unit 103 generates a driver and a stub used in symbolic execution in parallel for each function (also called a node), and stores the driver / stub. Stored in the unit 104.

シンボリック実行部105は、対象プログラム格納部102に格納されている対象プログラムと、ドライバ・スタブ格納部104に格納されているドライバ及びスタブとを利用して、シンボリック実行を関数毎に並列に行い、シンボリック実行中における後述の実行状態を実行状態格納部106に格納する。シンボリック実行では、数値だけでなく文字又は文字列も扱われる。また、シンボリック実行部105は、シンボリック実行により生成したパス条件及び返却値(返り値とも呼ばれる)等を含むパス条件表をパス条件表格納部107に格納する。さらに、シンボリック実行部105は、関数の呼び出し関係を表すコールツリーを生成し、生成したコールツリーをコールツリー格納部108に格納する。   The symbolic execution unit 105 performs symbolic execution in parallel for each function using the target program stored in the target program storage unit 102 and the driver and stub stored in the driver / stub storage unit 104. The execution state described later during symbolic execution is stored in the execution state storage unit 106. In symbolic execution, not only numerical values but also characters or character strings are handled. Further, the symbolic execution unit 105 stores a path condition table including a path condition generated by symbolic execution, a return value (also referred to as a return value), and the like in the path condition table storage unit 107. Further, the symbolic execution unit 105 generates a call tree representing the function calling relationship, and stores the generated call tree in the call tree storage unit 108.

パス条件統合部109は、パス条件表格納部107に格納されているパス条件表及びコールツリー格納部108に格納されているコールツリーを用いて、パス条件表を統合し、処理結果をパス条件表格納部107に格納する。尚、パス条件統合部109の詳細な説明は後述する。
テストケース生成部110は、パス条件表格納部107に最終的に格納されたパス条件表におけるパス条件を満たすテストケースを生成し、テストケース格納部111に格納する。
The path condition integration unit 109 integrates the path condition table using the path condition table stored in the path condition table storage unit 107 and the call tree stored in the call tree storage unit 108, and the processing result is stored in the path condition. Store in the table storage unit 107. The detailed description of the path condition integration unit 109 will be described later.
The test case generation unit 110 generates a test case that satisfies the path condition in the path condition table finally stored in the path condition table storage unit 107 and stores the test case in the test case storage unit 111.

図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 target program 10 stored in the target program storage unit 102.
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 target program 10 to be processed.

図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 target program 10 shown in FIG. Each rectangular area represents a function, and the characters shown in the rectangular area correspond to the function name. For example, the rectangular area indicated by the letter “A” represents the function funcA. In FIG. 3, the function pointed to by the arrow is the function to be called. In the following description, a function to be called is appropriately called a called function, and a function to be called is called a calling function. For example, a function funcB indicated by an arrow from the function funcA corresponds to a called function for the function funcA, and the function funcA corresponds to a calling function. In the call tree 20, the highest function is the function funcA, and the lowest functions are the function funcC and the function funcE. The call tree storage unit 108 stores a call tree 20 representing such a function calling relationship.

次に、図4乃至図13を参照して、パス条件統合部109の詳細について説明する。   Next, the details of the path condition integration unit 109 will be described with reference to FIGS. 4 to 13.

パス条件統合部109は、コールツリー格納部108に格納されたコールツリーに基づいて、複数の呼出関数から呼び出されている被呼出関数が存在すると判断した場合、被呼出関数を呼び出し元ごとに複製する。したがって、図4(a)に示すように、関数funcDと関数funcFから呼び出されている被呼出関数funcEは複製されて、被呼出関数funcEとは別の被呼出関数funcE´が生成される。被呼出関数funcE´は関数funcFから呼び出される。尚、複数の呼出関数から呼び出されている被呼出関数が存在しない場合、当該複製処理は行われない。   If the path condition integration unit 109 determines that there is a called function called from a plurality of calling functions based on the call tree stored in the call tree storage unit 108, the path condition integration unit 109 copies the called function for each caller. To do. Therefore, as shown in FIG. 4A, the called function funcE called from the function funcD and the function funcF is duplicated, and a called function funcE ′ different from the called function funcE is generated. The called function funcE ′ is called from the function funcF. Note that when there is no called function called from a plurality of calling functions, the duplication processing is not performed.

パス条件統合部109は、関数の複製を終えると、コールツリーの最大マッチングを求める。グラフ理論においてマッチングとはグラフ(ここではコールツリー)内の任意の1つのノードが他の高々1つのノードからの関連(ここでは関数の呼出または被呼出)を持つような関連の集合のことである。最大マッチングとはマッチングで関連の数が最大となるものである。最大マッチングのアルゴリズムは、Hopcroft-Karpのアルゴリズムが有名であるが、近年並列計算による近似アルゴリズムによって線形時間で結果を出力できる。ここでは正確に最大であるマッチングとならなくても結果には影響しないため、近似アルゴリズムを採用する。ここでは、一例として図4(b)に示すように、関数funcAと関数funcB、関数funcDと関数funcE、関数funcFと関数funcE´をそれぞれペアとするマッチングで関連の数が最大であるとして最大マッチングが求められている。   The path condition integration unit 109 obtains the maximum matching of the call tree when the function replication is completed. In graph theory, matching is a set of associations in which any one node in the graph (here, the call tree) has an association (here, a function call or called) from at most one other node. is there. Maximum matching is the matching that maximizes the number of associations. The Hopcroft-Karp algorithm is famous as the maximum matching algorithm, but in recent years, the result can be output in linear time by an approximation algorithm based on parallel computation. In this case, an approximation algorithm is adopted because the result is not affected even if the matching is not exactly maximum. Here, as an example, as shown in FIG. 4B, the maximum matching is performed assuming that the number of associations is the maximum in the pairing of the function funcA and the function funcB, the function funcD and the function funcE, and the function funcF and the function funcE ′. Is required.

パス条件統合部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 condition integration unit 109 obtains the maximum matching, and then integrates the path condition tables of the calling function and the called function that are the maximum matching in parallel by AND. The path condition table is stored in the path condition table storage unit 107 as described above. Specifically, as shown in FIGS. 5 to 7, the path condition tables T1,..., T6 each include an ID, a path condition, and a return value. ID is an ID of a path condition. The path condition includes a path condition itself (first condition) representing a history of tracing a branch related to a symbol variable, and a condition for a call function argument (second condition). For example, in the path condition table T1 shown in FIG. 5, “x> 0” and “funcB_ret> 0” correspond to the path condition itself. On the other hand, “funcB_x == x” and “funcD_x == funcB_ret” correspond to the conditions for the arguments of the calling function. Note that funcB_ret represents the return value of funcB, and funcB_x represents the argument x of funcB. The same applies to other return values and arguments. The return values of the path condition tables T1,..., T6 in FIGS. 5 to 7 are the return values of funcA,.

パス条件表の統合処理は、最大マッチングとなった呼出関数と被呼出関数との間で行われ、図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 condition integration unit 109 stores the SAT data among the generated path condition tables T7, T8, and T9 in the path condition table storage unit 107.

パス条件統合部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 condition integration unit 109 finishes the integration process of the path condition table, the path function table and the called function that have become the maximum matching are integrated, and the maximum matching is obtained again using the integrated one function. Integrate condition tables. Specifically, in FIG. 8A, the path condition integration unit 109 integrates the function funcA and the function funcB, the function funcD and the function funcE, and the function funcF and the function funcE ′ based on the maximum matching. Perform integration with. Hereinafter, the function after the function funcA and the function funcB are integrated is referred to as a function funcAB. A function after the function funcD and the function funcE are integrated is called a function funcDE. A function after the function funcF and the function funcE ′ are integrated is called a function funcE′F. The path condition integration unit 109 obtains the maximum matching again after the integration of the calling function and the called function is completed. Here, as an example, as shown in FIG. 8 (b), the maximum matching is obtained on the assumption that the number of associations is the largest in the pairing of the function funcAB and the function funcC, the function funcDE and the function funcE′F. .

パス条件統合部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 condition integration unit 109 integrates the path condition table of the calling function that has reached the maximum matching and the path condition table of the called function in parallel by AND. As shown in FIGS. 9 and 10, the path condition table integration process includes the path condition table T10 of the function funcC that is the called function and the function that is SAT in the path condition table T7 of the function funcAB that is the calling function. In addition, the path condition table T8 of the function funcDE that is the calling function becomes SAT and the path condition table T9 of the function funcE′F that is the called function is integrated in parallel by logical product. Is done. As a result, if the path condition table T7 of the function funcAB and the path condition table T10 of the function funcC are integrated, an integrated path condition table T11 is generated as shown in FIG. Similarly, if the path condition table T8 of the function funcDE and the path condition table T9 of the function funcE′F are integrated, an integrated path condition table T12 is generated as shown in FIG. The path condition integration unit 109 stores the SAT one of the generated path condition tables T11 and T12 in the path condition table storage unit 107.

パス条件統合部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 condition integration unit 109 finishes the integration process of the path condition table, the path function table and the called function that have become the maximum matching are integrated, and the maximum matching is obtained again using the integrated one function. Integrate condition tables. Specifically, in FIG. 11A, the path condition integration unit 109 executes integration of the function funcAB and the function funcC and integration of the function funcDE and the function funcE′F based on the maximum matching. Hereinafter, a function after the function funcAB and the function funcC are integrated is referred to as a function funcABC. A function after the function funcDE and the function funcE′F are integrated is referred to as a function funcDEE′F. The path condition integration unit 109 obtains the maximum matching again after the integration of the calling function and the called function is completed. Here, as an example, as shown in FIG. 11B, the maximum matching is obtained on the assumption that the number of associations is the maximum in the pairing of the function funcABC, the function funcC, and the function funcDEE′F.

パス条件統合部109は、最大マッチングを求めた後、最大マッチングとなった呼出関数と被呼出関数のそれぞれのパス条件表を論理積によって並列に統合する。パス条件表の統合処理は、図12に示すように、呼出関数である関数funcABCのパス条件表T11のうちSATとなったものと被呼出関数である関数funcDEE´Fのパス条件表T12のうちSATとなったものを論理積によって並列に統合することで行われる。この結果、関数funcABCのパス条件表T11と関数funcDEE´Fのパス条件表T12の統合から、図12に示すように、統合したパス条件表T13が生成される。パス条件統合部109は、生成したパス条件表T13のうちSATのものをパス条件表格納部107に格納する。   The path condition integration unit 109 obtains the maximum matching, and then integrates the path condition tables of the calling function and the called function that are the maximum matching in parallel by AND. As shown in FIG. 12, the integration processing of the path condition table consists of the path condition table T11 of the function funcABC that is the calling function and the path condition table T12 of the function funcDEE'F that is the called function. This is done by integrating the SAT in parallel by AND. As a result, as a result of the integration of the path condition table T11 of the function funcABC and the path condition table T12 of the function funcDEE′F, an integrated path condition table T13 is generated as shown in FIG. The path condition integration unit 109 stores the SAT of the generated path condition table T13 in the path condition table storage unit 107.

パス条件統合部109は、パス条件表の統合処理を終えると、最大マッチングとなった呼出関数と被呼出関数を統合し、統合した1つの関数を利用して、再度、最大マッチングを求め、パス条件表を統合する。具体的には、図13(a)に示すように、パス条件統合部109は、最大マッチングに基づいて、関数funcABCと関数funcDEE´Fとの統合を実行する。これにより、関数funcABCと関数funcDEE´Fとを統合した1つの関数funcABCDEE´Fが生成される。パス条件統合部109は、関数が1つになると最大マッチングを求めるマッチング処理及びパス条件表を統合する統合処理を終了する。   When the path condition integration unit 109 finishes the integration process of the path condition table, the path function table and the called function that have become the maximum matching are integrated, and the maximum matching is obtained again using the integrated one function. Integrate condition tables. Specifically, as illustrated in FIG. 13A, the path condition integration unit 109 executes integration of the function funcABC and the function funcDEE′F based on the maximum matching. As a result, one function funcABCDE'F is generated by integrating the function funcABC and the function funcDEE′F. The path condition integration unit 109 ends the matching process for obtaining the maximum matching when the number of functions becomes one and the integration process for integrating the path condition table.

統合処理が終了すると、テストケース生成部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 case generation unit 110 performs a test using a solver from the path condition table T13 stored in the path condition table storage unit 107 that has become SAT (FIG. 13B). Generate a case. The solver is a calculation method for calculating the optimum value by determining the mutual relationship between variables while changing the values of a plurality of variables. As a result, as shown in FIG. 13B, a test case including the value of the symbol variable that satisfies the path condition shown in the SAT path condition table T13 is generated. The test case generation unit 110 stores the generated test case in the test case storage unit 111. When the test of the target program 10 shown in FIG. 2 is executed using such a test case, it is possible to cover lines excluding lines that cannot be passed when the functions funcA,..., FuncF are combined. it can.

また、本実施形態ではパス条件表の統合処理を含む一部の処理が並列化されている。仮に、統合処理の全てが並列(パラレル)に行えるとした場合、並列の最大マッチングの計算量はO(log n)で表すことができる。ここで、nは関数の数、Oはオーダーである。また、反復回数はO(log n)で表すことができるため、統合処理にかかるコスト(計算量)をsとした場合、本実施形態の計算量はO((log n)+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)であれば計算時間を短縮することができる。ここで、図14に示すように、y=(log n)/nは、n≧1においてn=eのとき最大値y=4/eとなる。したがって、コストsが最大値4/eよりも大きい場合には、n≧1であればnに関わらず計算時間を短縮することができる。すなわち、s>(log n)/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 maximum value 4 / e 2 , the calculation time can be shortened regardless of n if n ≧ 1. That is, if the condition of s> (log n) 2 / n is satisfied, the calculation time can be shortened.

次に、図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 instructions 1 to 7 has the identification information “stack3”. The call stack during execution of any one of the instructions 8 to 15 has the identification information “stack2”. The call stack during execution of any one of the instructions 16 to 19 has the identification information “stack1”.

図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 state storage unit 106 stores the execution state of the program during symbolic execution in a format as indicated by reference numeral 60 in FIG.

次に、図17を参照して、テストケース生成装置100の動作について説明する。   Next, the operation of the test case generation device 100 will be described with reference to FIG.

図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 case generation device 100.
First, the input unit 101 in the test case generation apparatus 100 receives an input of the target program 10 from the user and stores it in the target program storage unit 102. When the target program 10 is stored, the symbolic execution unit 105 generates the call tree 20 from the target program 10 (step S101). The call tree 20 is stored in the call tree storage unit 108. When the call tree 20 is generated, the driver / stub generation unit 103 then executes a driver / stub generation process to be described later (step S102). The driver stub generation process is executed in parallel for each function. Thereby, a driver and a stub for each function are generated.

ドライバ・スタブ生成処理が完了すると、次いで、シンボリック実行部105は、後述するシンボリック実行を行う(ステップS103)。シンボリック実行は、各関数に対して並列に行われる。シンボリック実行が行われることで、シンボリック実行中における実行状態が実行状態格納部106に格納される。また、シンボリック実行が行われることで、シンボリック実行時に得られたパス条件及び返却値(返り値とも呼ばれる)等を含むパス条件表がパス条件表格納部107に格納される。   When the driver stub generation processing is completed, the symbolic execution unit 105 performs symbolic execution described later (step S103). Symbolic execution is performed in parallel for each function. By executing the symbolic execution, the execution state during the symbolic execution is stored in the execution state storage unit 106. Further, by performing symbolic execution, a path condition table including a path condition and a return value (also called a return value) obtained at the time of symbolic execution is stored in the path condition table storage unit 107.

シンボリック実行が完了すると、次いで、パス条件統合部109は、複数の関数から呼び出される関数を複製し(ステップS104)、コールツリーの最大マッチングを求める(ステップS105)。最大マッチングが求められると、さらに、パス条件統合部109は、パス条件表の統合処理を実行する(ステップS106)パス条件表の統合処理は、最大マッチングとなった2つの関数のそれぞれのパス条件表に対して並列に実行される。パス条件統合部109は、パス条件表の統合処理が完了すると、最大マッチングとなった2つの関数を1つに統合し(ステップS107)、統合した1つの関数が全ての関数を含むか否かを判断する(ステップS108)。   When the symbolic execution is completed, the path condition integration unit 109 then duplicates a function called from a plurality of functions (step S104) and obtains the maximum matching of the call tree (step S105). When the maximum matching is obtained, the path condition integration unit 109 further executes a path condition table integration process (step S106). The path condition table integration process is performed for each path condition of the two functions having the maximum matching. Runs in parallel on the table. When the integration process of the path condition table is completed, the path condition integration unit 109 integrates the two functions having the maximum matching into one (step S107), and whether or not the integrated one function includes all the functions. Is determined (step S108).

パス条件統合部109は、統合した1つの関数が全ての関数を含まないと判断した場合(ステップS108:NO)、ステップS105〜S107の処理を繰り返す。そして、パス条件統合部109は、統合した1つの関数が全ての関数を含むと判断した場合(ステップS108:YES)、テストケース生成部110は、ソルバを利用してテストケースを生成する(ステップS109)。テストケース生成部110は、生成したテストケースをテストケース格納部111に格納する。   When the path condition integration unit 109 determines that one integrated function does not include all the functions (step S108: NO), the processing of steps S105 to S107 is repeated. When the path condition integration unit 109 determines that one integrated function includes all functions (step S108: YES), the test case generation unit 110 generates a test case using a solver (step S108). S109). The test case generation unit 110 stores the generated test case in the test case storage unit 111.

次に、図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 / stub generation unit 103 analyzes a target function to be processed, and extracts a called function called from the parameter and the target function from the target function (step S201). For example, in the case of the function funcA shown in FIG. 2, the function funcB is called as the called function. Next, the driver / stub generation unit 103 sacrifices a corresponding stub for each called function extracted in step S201 (step S202), and stores it in the driver / stub storage unit 104. A stub is a program that is called from a driver and returns a symbol in response to the call. Next, the driver / stub generation unit 103 generates a driver that is a program for setting a parameter of the target function and a symbol variable corresponding to the called function (step S203), and stores the driver in the driver / stub storage unit 104. Then, the process ends.

図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 symbolic execution unit 105 reads one instruction based on the value of the program counter in the execution state p stored in the execution state storage unit 106 (step S301). For example, when the value of the program counter is “2”, the instruction on the second line of the target function is read. Hereinafter, the instruction read in step S301 is referred to as a “processing target instruction”.

シンボリック実行部105は、処理対象の命令が、関数を呼び出す命令であるか判断する(ステップS302)。関数を呼び出す命令ではない場合(ステップS302:NO)、図21のステップS401の処理に移行する。一方、関数を呼び出す命令である場合(ステップS302:YES)、シンボリック実行部105は、被呼出関数の引数に関数ポインタが含まれるか判断する(ステップS303)。被呼出関数の引数に関数ポインタが含まれていない場合(ステップS303:NO)、ステップS305の処理に移行する。被呼出関数の引数に関数ポインタが含まれている場合(ステップS303:YES)、シンボリック実行部105は、関数ポインタについての条件を、実行中のパスについての条件に追加する(ステップS304)。   The symbolic execution unit 105 determines whether the instruction to be processed is an instruction for calling a function (step S302). If it is not an instruction for calling a function (step S302: NO), the process proceeds to step S401 in FIG. On the other hand, if the instruction is a function call instruction (step S302: YES), the symbolic execution unit 105 determines whether a function pointer is included in the argument of the called function (step S303). When the function pointer is not included in the argument of the called function (step S303: NO), the process proceeds to step S305. When the function pointer is included in the argument of the called function (step S303: YES), the symbolic execution unit 105 adds the condition for the function pointer to the condition for the path being executed (step S304).

次いで、シンボリック実行部105は、被呼出関数の実引数と仮引数との関係を表す条件を、実行中のパスについての条件に追加する(ステップS305)。尚、被呼出関数が複数回呼び出される場合、ステップS305においては、引数についての条件が呼び出し毎に追加される。次いで、シンボリック実行部105は、被呼出関数をコールツリーに追加するための追加処理を実行する(ステップS306)。追加処理の詳細については、後述する。   Next, the symbolic execution unit 105 adds a condition representing the relationship between the actual argument and the dummy argument of the called function to the condition for the path being executed (step S305). When the called function is called a plurality of times, in step S305, a condition for an argument is added for each call. Next, the symbolic execution unit 105 executes an addition process for adding the called function to the call tree (step S306). Details of the addition process will be described later.

ここで、ステップ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 symbolic execution unit 105 determines that the instruction to be processed reads a global variable or It is determined whether it is a command to write (step S401). If it is neither an instruction to read a global variable nor an instruction to write (step S401; NO), the process proceeds to step S404. On the other hand, if it is an instruction to read or write a global variable (step S401; YES), the process proceeds to step S402. If the command is a command for reading a global variable, the symbolic execution unit 105 identifies a write command corresponding to the read by the call tree 20 stored in the call tree storage unit 108 (step S402). If the command is for writing a global variable, the process of step S402 is not performed.

シンボリック実行部105は、ステップS401においてグローバル変数の読み込みであると判定された場合にはグローバル変数の読み込みについての条件を、ステップS401においてグローバル変数の書き込みであると判定された場合にはグローバル変数の書き込みについての条件を、実行中のパスについての条件に追加する(ステップS403)。   The symbolic execution unit 105 determines a condition for reading a global variable when it is determined in step S401 that the global variable is read. If it is determined that the global variable is written in step S401, the symbolic execution unit 105 The condition for writing is added to the condition for the path being executed (step S403).

ここで、ステップ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 symbolic execution unit 105 determines whether the instruction to be processed is a branch related to the symbol. It is determined whether it is a command (step S404). A branch instruction related to a symbol is, for example, an instruction in which a symbol variable is included in an if statement.

シンボルに関わる分岐の命令である場合(ステップ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 symbolic execution unit 105 is stored in the execution state p (that is, the execution state rating unit 106) in the execution state P in which symbolic execution is newly performed. The current execution state) is copied (duplicated) (step S405). The symbolic execution unit 105 identifies one unprocessed branch destination in the instruction to be processed (step S406). Then, the symbolic execution unit 105 adds the branch condition (that is, the path condition) to the condition for the path being executed (step S407). The symbolic execution unit 105 recursively executes symbolic execution for the execution state P (step S408).

ステップS408におけるシンボリック実行が完了すると、シンボリック実行部105は、処理対象の命令において未処理の分岐先があるか判断する(ステップS409)。未処理の分岐先が有る場合(ステップS409:YES)、次の分岐先について処理するため、ステップS406の処理に戻る。一方、未処理の分岐先が無い場合(ステップS409:NO)、呼び出し元の処理に戻る。   When the symbolic execution in step S408 is completed, the symbolic execution unit 105 determines whether there is an unprocessed branch destination in the instruction to be processed (step S409). If there is an unprocessed branch destination (step S409: YES), the process returns to step S406 to process the next branch destination. On the other hand, when there is no unprocessed branch destination (step S409: NO), the process returns to the caller process.

ステップ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 symbolic execution unit 105 executes the instruction to be processed, and advances the value of the program counter stored in the execution state storage unit 106 by 1 (step S501). The symbolic execution unit 105 determines whether or not the execution state p is an end state (step S502). The end state is, for example, a state where the value of the program counter has reached the number of the last line in the program. If it is not in an end state (step S502: NO), the symbolic execution unit 105 returns to the process of step S301 shown in FIG. 20 in order to process the next instruction. On the other hand, when the execution state p is the end state (step S502: YES), the symbolic execution unit 105 uses the path condition table including the path condition and return value for each path obtained by the symbolic execution. The data is stored in the storage unit 107 (step S503). Then, the process returns to the calling process.

以上の処理により、各関数についてシンボリック実行が行われ、満たすべき条件及び関数の返却値がパス条件表格納部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 table storage unit 107. Note that the result of symbolic execution for each function (that is, the path condition table) is stored in the path condition table storage unit 107.

次に、図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 symbolic execution unit 105 sets the position of the function added most recently to the call tree 20 stored in the call tree storage unit 108 as the current position (S601). The symbolic execution unit 105 determines whether the called function exists at a position higher than the current position in the call tree (step S602). If it does not exist at a position higher than the current position (step S602: NO), since it does not correspond to a recursive call, the symbolic execution unit 105 adds a function below the current position in the call tree (step S603). On the other hand, when it exists in a position higher than the current position (step S602: YES), it corresponds to a recursive call. Therefore, the symbolic execution unit 105 deletes the condition for the called function from the condition for the path being executed (step S604). Then, the process returns to the calling process. In addition, when adding a function to the call tree, it is desirable to add the function to the lower right of the current position so that the new function appears to the right in order to make it easier to search.

次に、図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 condition integration unit 109 determines whether the path condition table storage unit 107 includes two path condition tables to be integrated (in this case, expressed as a path condition table A and a path condition table B) (steps). S701). The path condition table A and the path condition table B correspond to, for example, the above-described path condition table T1 and path condition table T2. If the two path condition tables A and B to be integrated do not exist (step S701: NO), the process returns to the caller process.

一方、統合すべき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 condition integration unit 109 determines an unprocessed condition from the path condition table A (here, the path condition a). Is identified (step S702). In addition, the path condition integration unit 109 identifies one unprocessed condition (here, the path condition b) from the path condition table B (step S703). In steps S702 and S703, the path condition integration unit 109 specifies conditions in units of paths.

パス条件統合部109は、パス条件aとパス条件bとの論理積を求めることにより、パス条件cを生成し(ステップS704)、メインメモリ等の記憶装置に格納する。パス条件統合部109は、パス条件cを満たす解が存在するか、例えばソルバによって判断する(ステップS705)。パス条件cを満たす解が存在しない場合(ステップS705:NO)、ステップS707の処理に移行する。一方、パス条件cを満たす解が存在する場合(ステップS705:YES)、パス条件統合部109は、パス条件cをパス条件表Cに追加する(ステップS706)。尚、パス条件表Cが存在しない場合には、ステップS706において新たに条件表Cが生成される。   The path condition integration unit 109 obtains a logical product of the path condition a and the path condition b, thereby generating a path condition c (step S704) and stores it in a storage device such as a main memory. The path condition integration unit 109 determines whether there is a solution satisfying the path condition c, for example, using a solver (step S705). If there is no solution that satisfies the path condition c (step S705: NO), the process proceeds to step S707. On the other hand, when there is a solution that satisfies the path condition c (step S705: YES), the path condition integration unit 109 adds the path condition c to the path condition table C (step S706). If no path condition table C exists, a new condition table C is generated in step S706.

パス条件統合部109は、パス条件表Bに未処理の条件があるか判断する(ステップS707)。未処理の条件がある場合(ステップS707:YES)、次の条件について処理するため、ステップS703の処理に戻る。一方、パス条件表Bに未処理の条件がない場合(ステップS707:NO)、パス条件統合部109は、パス条件表Bにおけるパス条件を全て未処理に設定する(ステップS708)。   The path condition integration unit 109 determines whether there is an unprocessed condition in the path condition table B (step S707). If there is an unprocessed condition (step S707: YES), the process returns to the process of step S703 to process the next condition. On the other hand, when there is no unprocessed condition in the path condition table B (step S707: NO), the path condition integration unit 109 sets all the path conditions in the path condition table B to be unprocessed (step S708).

次いで、パス条件統合部109は、パス条件表Aに未処理の条件があるか判断する(ステップS709)。未処理の条件がある場合(ステップS709:YES)、次の条件について処理するため、ステップS702の処理に戻る。一方、パス条件表Aに未処理の条件がない場合(ステップS709:NO)、パス条件統合部109は、パス条件表Cをパス条件表格納部107に格納し(ステップS710)、呼び出し元の処理に戻る。以上のような処理を実行すれば、各関数について生成されたパス条件をまとめることができるようになる。   Next, the path condition integration unit 109 determines whether there is an unprocessed condition in the path condition table A (step S709). If there is an unprocessed condition (step S709: YES), the process returns to step S702 to process the next condition. On the other hand, when there is no unprocessed condition in the path condition table A (step S709: NO), the path condition integration unit 109 stores the path condition table C in the path condition table storage unit 107 (step S710), and Return to processing. By executing the processing as described above, the path conditions generated for each function can be collected.

次に、図25を参照して、テストケース生成装置100のハードウェア構成について説明する。   Next, a hardware configuration of the test case generation device 100 will be described with reference to FIG.

図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 case generation device 100.
As shown in FIG. 25, the test case generation apparatus 100 includes at least a central processing unit (CPU) 100A, a random access memory (RAM) 100B, a read only memory (ROM) 100C, and a network I / F (interface) 100D. Yes. The test case generation device 100 may include at least one of a hard disk drive (HDD) 100E, an input I / F 100F, an output I / F 100G, an input / output I / F 100H, and a drive device 100I as necessary. CPU 100A,..., Drive device 100I are connected to each other by an internal bus 100J. At least the CPU 100A and the RAM 100B cooperate to realize a computer.

入力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 input device 210 is connected to the input I / F 100F. Examples of the input device 210 include a keyboard and a mouse.
The display device 220 is connected to the output I / F 100G. An example of the display device 220 is a liquid crystal display.
The semiconductor memory 230 is connected to the input / output I / F 100H. Examples of the semiconductor memory 230 include a universal serial bus (USB) memory and a flash memory. The input / output I / F 100 </ b> H reads programs and data stored in the semiconductor memory 230.
The input I / F 100F and the input / output I / F 100H include, for example, a USB port. The output I / F 100G includes a display port, for example.

ドライブ装置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 case generation device 100 is connected to the network via the network I / F 100D.

上述したRAM100Bには、ROM100CやHDD100Eに記憶されたプログラムがCPU100Aによって格納される。RAM100Bには、可搬型記録媒体240に記録されたプログラムがCPU100Aによって格納される。格納されたプログラムをCPU100Aが実行することにより、上述した各種の動作が実行される。尚、プログラムは上述したフローチャートに応じたものとすればよい。   In the above-described RAM 100B, a program stored in the ROM 100C or the HDD 100E is stored by the CPU 100A. In the RAM 100B, the program recorded on the portable recording medium 240 is stored by the CPU 100A. When the CPU 100A executes the stored program, the various operations described above are executed. In addition, what is necessary is just to make a program according to the flowchart mentioned above.

以上、本発明の好ましい実施形態について詳述したが、本発明に係る特定の実施形態に限定されるものではなく、特許請求の範囲に記載された本発明の要旨の範囲内において、種々の変形・変更が可能である。   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 1, further comprising a process of duplicating the second function for each caller when the second function is called from a plurality of the first functions. Case generator.
(Supplementary note 3) The test case generation program according to supplementary note 1 or 2, wherein the process of generating the path condition table is executed in parallel for each of the plurality of functions.
(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 functions 4. The test case generation program according to any one of supplementary notes 1 to 3, wherein
(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 additional remark 6 characterized by the above-mentioned Test case generator.
(Supplementary note 8) The test case generation device according to supplementary note 6 or 7, wherein the first generation unit generates the path condition table in parallel for each of the plurality of functions.
(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 appendices 6 to 8, wherein the stub is generated in parallel.

100 テストケース生成装置
103 ドライバ・スタブ生成部(第3の生成手段)
105 シンボリック実行部(第1の生成手段)
109 パス条件統合部(統合手段)
110 テストケース生成部(第2の生成手段)
DESCRIPTION OF SYMBOLS 100 Test case production | generation apparatus 103 Driver stub production | generation part (3rd production | generation means)
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.
前記第2の関数が複数の前記第1の関数から呼び出される場合に、前記第2の関数を呼出元毎に複製する処理をさらに含むことを特徴とする請求項1に記載のテストケース生成プログラム。   2. The test case generation program according to claim 1, further comprising a process of copying the second function for each caller when the second function is called from a plurality of the first functions. . 前記パス条件表を生成する処理を、前記複数の関数の各々について並列に実行させることを特徴とする請求項1又は2に記載のテストケース生成プログラム。   The test case generation program according to claim 1, wherein the process of generating the path condition table is executed in parallel for each of the plurality of functions. 前記シンボル変数を設定するためのドライバと当該ドライバにおいて呼び出されるスタブを生成する処理をさらに含み、
前記ドライバと前記スタブを生成する処理を、前記複数の関数の各々について並列に実行させることを特徴とする請求項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の条件と、当該関数の引数及び返却値についての第2の条件の少なくともいずれかを含むパス条件表を前記複数の関数の各々について生成する第1の生成手段と、
前記コールツリーに基づいて、前記複数の関数に含まれるいずれかの関数を呼び出す第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の関数と前記第2の関数のペア毎に、前記パス条件表を論理積によって並列に統合する、The processing integrates the path condition table in parallel by logical product for each pair of the first function and the second function having the maximum number of associations.
ことを特徴とする請求項1に記載のテストケース生成プログラム。The test case generation program according to claim 1, wherein:
JP2014129814A 2014-06-25 2014-06-25 Test case generation program, test case generation method, and test case generation apparatus Active JP6331756B2 (en)

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)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
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

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