JP6748357B2 - Analysis device, analysis program, and analysis method - Google Patents
Analysis device, analysis program, and analysis method Download PDFInfo
- Publication number
- JP6748357B2 JP6748357B2 JP2016185100A JP2016185100A JP6748357B2 JP 6748357 B2 JP6748357 B2 JP 6748357B2 JP 2016185100 A JP2016185100 A JP 2016185100A JP 2016185100 A JP2016185100 A JP 2016185100A JP 6748357 B2 JP6748357 B2 JP 6748357B2
- Authority
- JP
- Japan
- Prior art keywords
- test
- decision tree
- node
- result
- mutation
- 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 invention relates to an analysis device, an analysis program, and an analysis method.
ソフトウェア開発の現場では、ソフトウェアの品質向上を図るため、ソフトウェアのプログラムに対するテストが行われることがある。また、テスト自体の有効性が評価されることもある。例えば、テストの評価指標としてカバレッジ(網羅率)が挙げられる。カバレッジは、プログラム内の所定の箇所(行、分岐または条件など)がテストにより実行された割合である。カバレッジを向上させることで、テスト未実行のコードを減らせる。 In the field of software development, in order to improve the quality of software, the software program may be tested. In addition, the effectiveness of the test itself may be evaluated. For example, coverage (coverage rate) is an evaluation index of the test. Coverage is the percentage of times a test executed a given location (line, branch, condition, etc.) in a program. Improve coverage to reduce untested code.
例えば、カバレッジを向上させるために入力データを自動生成する検証支援装置の提案がある。この提案では、検証支援装置がソースコードを構文解析してデータ処理ノードおよび分岐処理ノードを含むグラフ構造を生成し、グラフ構造に基づいてプログラムの実行経路を抽出し、当該実行経路をプログラムに実行させるための入力データを生成する。 For example, there is a proposal of a verification support device that automatically generates input data in order to improve coverage. In this proposal, a verification support device parses a source code to generate a graph structure including a data processing node and a branch processing node, extracts a program execution path based on the graph structure, and executes the execution path to the program. Input data for generating is generated.
また、ソースコードが提供されずにバイナリデータしか手元にないソフトウェアに対しても、デバッガなどの装置を用いずに網羅試験を可能にする網羅試験装置の提案もある。
ところで、テストの他の評価手法として、ミューテーション解析と呼ばれる手法が用いられることがある。ミューテーション解析は、プログラムの1以上の要素を意図的に変化させることでプログラムにバグを埋め込み、テストが該当のバグをどの程度検出できるかを調べる手法である。ミューテーション解析では、例えば、プログラムにバグを埋め込んだ状態で所定の入力を与えたときの出力を確認し、テストがバグを検出できるかを確認することがある。
Further, there is also a proposal of an exhaustive testing apparatus that enables exhaustive testing without using a device such as a debugger, even for software in which source code is not provided and only binary data is available.
By the way, as another evaluation method of the test, a method called mutation analysis may be used. Mutation analysis is a method of embedding a bug in a program by intentionally changing one or more elements of the program and checking how much the test can detect the bug. In the mutation analysis, for example, the output when a predetermined input is given in a state where the bug is embedded in the program is checked, and it may be checked whether the test can detect the bug.
ミューテーション解析を行うために、ソースコードの変更箇所に対して変更内容を適用した変更後のソースコードをコンパイルし、コンパイル後のプログラムによりテストを実行することが考えられる。しかし、変更箇所(ミューテーション箇所)の組合せ毎に変更内容(ミューテーション内容)を適用したソースコードのコンパイルおよびテスト実行を個別に行っていると、解析に時間がかかるという問題がある。 In order to perform mutation analysis, it is possible to compile the modified source code in which the modified content is applied to the modified part of the source code and execute the test by the compiled program. However, if the source code to which the changed contents (mutation contents) are applied is separately compiled and the test is executed individually for each combination of changed parts (mutation parts), there is a problem that analysis takes time.
1つの側面では、本発明は、解析を高速化することを目的とする。 In one aspect, the invention aims to speed up the analysis.
1つの態様では、解析装置が提供される。解析装置は、記憶部と演算部とを有する。記憶部は、プログラムの入力に対する出力を確認する複数のテストケースを含むテストを行う際のプログラムの複数の変更箇所および複数の変更箇所それぞれの変更内容の情報を記憶する。演算部は、変更箇所の第1の組合せに対して変更内容を適用してテストを実行し、実行された変更箇所を終端ノード以外のノード、変更箇所の変更内容をエッジ、実行結果を終端ノードとした決定木の情報をテストケース毎に生成し、生成された複数の決定木に基づいて、テスト結果を未取得である変更箇所の第2の組合せに対して変更内容を適用した場合のテスト結果を決定する。 In one aspect, an analysis device is provided. The analysis device has a storage unit and a calculation unit. The storage unit stores a plurality of changed portions of the program when performing a test including a plurality of test cases for confirming the output with respect to the input of the program, and information on the changed contents of each of the plurality of changed portions. The arithmetic unit applies the change contents to the first combination of the changed parts and executes the test, and executes the executed changed part on a node other than the end node, the changed contents of the changed part on the edge, and the execution result on the end node. A test in which the information of the decision tree is generated for each test case, and the change contents are applied to the second combination of the changed portions for which the test result has not been acquired, based on the plurality of generated decision trees. Determine the result.
1つの側面では、解析を高速化できる。 In one aspect, the analysis can be speeded up.
以下、本実施の形態について図面を参照して説明する。
[第1の実施の形態]
図1は、第1の実施の形態の解析装置を示す図である。解析装置1は、ソフトウェアのプログラムに対するテストを行う。解析装置1は、テストを行うとともに、ミューテーション解析の手法によりテスト自体の評価も行う。解析装置1は、テストの評価結果をユーザ(ソフトウェアの開発者)に提供し、ユーザによるテストの改善を支援する。
Hereinafter, the present embodiment will be described with reference to the drawings.
[First Embodiment]
FIG. 1 is a diagram showing an analyzing apparatus according to the first embodiment. The
解析装置1は、記憶部1aおよび演算部1bを有する。
記憶部1aは、RAM(Random Access Memory)などの揮発性記憶装置でもよいし、HDD(Hard Disk Drive)やフラッシュメモリなどの不揮発性記憶装置でもよい。演算部1bは、CPU(Central Processing Unit)、DSP(Digital Signal Processor)、ASIC(Application Specific Integrated Circuit)、FPGA(Field Programmable Gate Array)などを含み得る。演算部1bはプログラムを実行するプロセッサでもよい。プロセッサは、複数のプロセッサの集合(マルチプロセッサ)を含み得る。解析装置1は、「コンピュータ」と呼ばれてもよい。
The
The
記憶部1aは、ソースコードP1を記憶する。ソースコードP1は、テスト対象となるソフトウェアのプログラムの一例である。ソースコードP1は、例えば、整数型の関数funcを含む。関数funcには、整数型の値(x)が入力される。
The
記憶部1aは、ソースコードP1において、バグを埋め込む変更箇所(ミューテーション箇所)を、ミューテーションを行う所定のメタミューテーション関数(以下、単にメタ関数と称することがある)で置換したソースコードP2を記憶する。このように変更箇所をメタ関数に置換し、事後的にミューテーション情報を与える手法は、MSG(Mutant Schema Generation)と呼ばれることもある。図1の例では各メタ関数は、3つの引数をもつ。第1引数は変更箇所の識別子である。第2引数は入力値(この例では何れも“x”)である。第3引数は演算に用いられる値である。例えば、ソースコードP2は、ソースコードP1に基づいて、演算部1bにより生成される。
The
具体的には、ソースコードP2では、ソースコードP1の2行目の“x<0”という記述が、“bop_lt(1,x,0)”というメタ関数の記述に置換されている。メタ関数bop_lt(1,x,0)の第1引数“1”は変更箇所の識別子である。同第2引数“x”は入力値である。同第3引数“0”は入力値に対する比較演算に用いられる値である。例えば、メタ関数bop_ltは、関係演算子(比較演算子と呼ばれてもよい)“<”を“>=”に変更する。変更箇所“1”の変更内容は“<”を“>=”とすること、および、変更箇所“1”を変更しないこと(ここでは、“<”を“<”のままとすること)である。ここで、変更しないことを“nop”(Non-OPeration)と表記する。 Specifically, in the source code P2, the description "x<0" on the second line of the source code P1 is replaced with the description of the meta function "bop_lt(1,x,0)". The first argument “1” of the meta function bop_lt(1, x, 0) is the identifier of the changed part. The second argument “x” is an input value. The third argument “0” is a value used for a comparison operation on the input value. For example, the meta-function bop_lt changes a relational operator (which may also be called a comparison operator) “<” into “>=”. The change content of the changed part "1" is that "<" is set to ">=", and the changed part "1" is not changed (here, "<" remains "<"). is there. Here, not changing is referred to as “nop” (Non-OPeration).
また、ソースコードP2では、ソースコードP1の3行目の“x+1”という記述が、“bop_add(2,x,1)”というメタ関数の記述に置換されている。メタ関数bop_addは、算術演算子“+”(加算)を“−”(減算)に変更する。すなわち、変更箇所“2”の変更内容は“+”を“−”にすること、および、“nop”である。 In the source code P2, the description "x+1" on the third line of the source code P1 is replaced with the description of the meta function "bop_add(2, x, 1)". The meta function bop_add changes the arithmetic operator "+" (addition) to "-" (subtraction). That is, the changed contents of the changed portion "2" are "+" to "-" and "nop".
また、ソースコードP2では、ソースコードP1の4行目の“x>0”という記述が、“bop_gt(3,x,0)”というメタ関数の記述に置換されている。メタ関数bop_gtは、関係演算子“>”を“<=”に変更する。すなわち、変更箇所“3”の変更内容は“>”を“<=”に変更すること、および、“nop”である。 In the source code P2, the description "x>0" on the fourth line of the source code P1 is replaced with the description of the meta function "bop_gt(3,x,0)". The meta function bop_gt changes the relational operator “>” to “<=”. That is, the changed contents of the changed portion “3” are “>” is changed to “<=” and “nop”.
更に、ソースコードP2では、ソースコードP1の5行目の“x*2”という記述が、“bop_mul(4,x,2)”というメタ関数の記述に置換されている。メタ関数bop_mulは、算術演算子“*”(乗算)を“/”(除算)または“%”(剰余演算)に変更する。すなわち、変更箇所“4”の変更内容は、“*”を“/”や“%”に変更すること、および、“nop”である。ここで、関数funcのreturn命令による返り値は、整数に丸められることに注意されたい(例えば、演算“−1/2”の結果は整数“0”に丸められる)。 Further, in the source code P2, the description "x*2" on the fifth line of the source code P1 is replaced with the description of the meta function "bop_mul(4,x,2)". The meta-function bop_mul changes the arithmetic operator “*” (multiplication) to “/” (division) or “%” (modulo operation). That is, the changed contents of the changed portion “4” are “*” is changed to “/” and “%”, and “nop”. Note that the return value of the function func's return instruction is rounded to an integer (for example, the result of the operation "-1/2" is rounded to an integer "0").
上記のように、記憶部1aは、プログラムのテストを行う際のプログラムの複数の変更箇所および複数の変更箇所それぞれの変更内容の情報を記憶する。演算部1bは、ソースコードP2を用いてテストを実行することで、ソースコードP2のうち、実行経路に応じた変更箇所に変更内容が適用される。このため、実行経路に沿った変更箇所の組合せ(1以上の変更箇所を要素とする)に対して変更内容が適用されることになる。演算部1bは、ソースコードP2をコンパイルして生成された中間コードによりテストを実行してもよい(当該手法はBitcode Mutationと呼ばれることもある)。また、中間コードによるプログラムの実行状態に動的にミューテーション情報を与える手法は、Online Adaptation Techniqueと呼ばれることもある。更に、実行箇所で実行状態を分割し、当該実行箇所までの実行を共通化することで実行コストを減らす手法は、SSE(Split-Stream Execution)と呼ばれることもある。
As described above, the
記憶部1aは、テストの内容を記述したテストプログラム(図1では図示を省略している)も記憶する。テストは、プログラムの入力に対する出力を確認する複数のテストケースを含む。図1では、テストは一例として3つのテストケースを含む。
The
第1のテストケース(testcase1)は、func(0)==0である。すなわち、第1のテストケースは、関数funcにx=0を入力したとき、出力が確認値0になるか否かの確認である。
The first test case (testcase1) is func(0)==0. That is, the first test case is confirmation whether or not the output becomes the
第2のテストケース(testcase2)は、func(1)==2である。すなわち、第2のテストケースは、関数funcにx=1を入力したとき、出力が確認値2になるか否かの確認である。
The second test case (testcase2) is func(1)==2. That is, the second test case is confirmation whether the output becomes the
第3のテストケース(testcase3)は、func(−1)==0である。すなわち、第3のテストケースは、関数funcにx=−1を入力したとき、出力が確認値0になるか否かの確認である。
In the third test case (testcase3), func(-1)==0. That is, the third test case is confirmation whether the output becomes the
演算部1bは、ソースコードP2を用いてテストを実行し、ミューテーション解析によりテストの評価を行う。
例えば、ある変更箇所の組合せに対して変更内容を適用したとき、3つのテストケースの少なくとも1つで確認値と異なる出力(Fail)となれば、当該テストにより、該当の変更箇所の組合せに対してバグを適切に検出できることになる。また、ある変更箇所の組合せに対して変更内容を適用したとき、3つのテストケースの何れも確認値と同じ出力(Pass)となれば、当該テストでは、該当の変更箇所の組合せに対してバグを適切に検出できないことになる。なお、バグを検出できることを示すテスト結果を“Killed”、バグを検出できないことを示すテスト結果を“Unkilled”と表記する。
The
For example, when the change content is applied to a certain combination of changed parts, if at least one of the three test cases produces an output (Fail) different from the confirmation value, the test causes the combination of the corresponding changed parts to be changed. Therefore, the bug can be properly detected. Also, when the change contents are applied to a certain combination of changed parts and all three test cases have the same output (Pass) as the confirmation value, in the test, a bug is generated for the combination of the corresponding changed parts. Will not be detected properly. A test result indicating that a bug can be detected is referred to as "Killed", and a test result indicating that a bug cannot be detected is referred to as "Unkilled".
演算部1bは、記憶部1aを参照して、変更箇所の第1の組合せに対して変更内容を適用してテストを実行する。演算部1bは、テストを実行しながら、実行された変更箇所を終端ノード以外のノード、変更箇所の変更内容(変更しない場合(nopの場合)を含む)をエッジ、実行結果を終端ノードとした決定木の情報をテストケース毎に生成する。すなわち、演算部1bは、各テストケースの実行中に、プログラム中の経由した変更箇所で変更内容毎(変更しなかった場合はnop)に枝分かれし、終端ノードに実行結果が格納される決定木を生成する。実行結果は、確認値と同じこと(すなわち、Pass)、または、確認値と異なること(すなわち、Fail)の何れかを示す。決定木は、有向グラフで表される。
The
前述の例によれば、演算部1bは、第1のテストケースに対して、決定木T1の情報を生成する。演算部1bは、第2のテストケースに対して、決定木T2の情報を生成する。演算部1bは、第3のテストケースに対して、決定木T3の情報を生成する。例えば、識別情報“1”の変更箇所に対応するノードをノードm1とする。識別情報“2”の変更箇所に対応するノードをノードm2とする。識別情報“3”の変更箇所に対応するノードをノードm3とする。識別情報“4”の変更箇所に対応するノードをノードm4とする。以下、決定木T1の構造を具体的に説明する。
According to the above example, the
ノードm1は、“nop”に対応するエッジ、および、“>=”に対応するエッジを有する。決定木T1において、ノードm1の“nop”に対応するエッジの先は、ノードm3である。ノードm1の“>=”に対応するエッジの先はノードm2である。 The node m1 has an edge corresponding to “nop” and an edge corresponding to “>=”. In the decision tree T1, the edge of the edge corresponding to “nop” of the node m1 is the node m3. The tip of the edge corresponding to “>=” of the node m1 is the node m2.
ノードm2は、“nop”に対応するエッジ、および、“−”に対応するエッジを有する。決定木T1において、ノードm2の“nop”に対応するエッジの先、および、“−”に対応するエッジの先は、“Fail”に対応する終端ノードである。 The node m2 has an edge corresponding to “nop” and an edge corresponding to “−”. In the decision tree T1, the end of the edge corresponding to “nop” and the end of the edge corresponding to “−” of the node m2 are the end nodes corresponding to “Fail”.
ノードm3は、“nop”に対応するエッジ、および、“<=”に対応するエッジを有する。決定木T1において、ノードm3の“nop”に対応するエッジの先は、“Pass”に対応する終端ノードである。ノードm3の“<=”に対応するエッジの先は、ノードm4である。 The node m3 has an edge corresponding to “nop” and an edge corresponding to “<=”. In the decision tree T1, the tip of the edge corresponding to “nop” of the node m3 is the terminal node corresponding to “Pass”. The tip of the edge corresponding to “<=” of the node m3 is the node m4.
ノードm4は、“nop”に対応するエッジ、“/”に対応するエッジ、および、“%”に対応するエッジを有する。決定木T1において、ノードm4の“nop”に対応するエッジの先、“/”に対応するエッジの先、および、“%”に対応するエッジの先は、何れも“Pass”に対応する終端ノードである。 The node m4 has an edge corresponding to "nop", an edge corresponding to "/", and an edge corresponding to "%". In the decision tree T1, the end of the edge corresponding to “nop” of the node m4, the end of the edge corresponding to “/”, and the end of the edge corresponding to “%” are all terminations corresponding to “Pass”. It is a node.
決定木T2,T3も、第2,第3のテストケースによる実行経路に応じた構造をもつ。
なお、上記のテスト実行により、演算部1bは、変更箇所の幾つかの組合せに対しては、“Killed”または“Unkilled”を示すテスト結果を得られる。ただし、何れかのテストケースまたは全てのテストケースで実行されない経路に対する変更箇所の組合せも存在する。あるテストケースで実行されない経路に対する変更箇所の組合せがある場合、別のテストケースの実行結果が何れも“Pass”であると、該当の組合せに対するテスト結果が“Killed”なのか“Unkilled”なのか不明になる。また、全てのテストケースで実行されない経路に対する変更箇所の組合せがある場合、該当の組合せに対するテスト結果が“Killed”なのか“Unkilled”なのか不明になる。
The decision trees T2 and T3 also have a structure according to the execution paths by the second and third test cases.
By the above test execution, the
図1の例において、演算部1bは、上記のテスト実行では、例えば識別情報“1”,“2”の変更箇所を“nop”、識別情報“3”の変更箇所を“<=”、識別情報“4”の変更箇所を“/”とする組合せ(組合せAとする)に対するテスト結果を得られない。なぜなら、第1のテストケースでは、ソースコードP1(または、ソースコードP2)に組合せAの変更内容を適用した場合に実行結果が“Pass”となり、第2,第3のテストケースでは、組合せAの変更内容が同時に適用されることはないからである。
In the example of FIG. 1, in the test execution described above, the
また、演算部1bは、例えば識別情報“1”の変更箇所を“>=”、識別情報“2”の変更箇所を“nop”、識別情報“3”の変更箇所を“<=”、識別情報“4”の変更箇所を“/”とする組合せ(組合せBとする)に対するテスト結果を得られない。なぜなら、第1,第2のテストケースでは、組合せBの変更内容が同時に適用されることはなく、第3のテストケースではソースコードP1(または、ソースコードP2)に組合せBの変更内容を適用した場合に実行結果が“Pass”となるからである。
Further, the
演算部1bは、生成された複数の決定木(すなわち、決定木T1,T2,T3)に基づいて、テスト結果を未取得である変更箇所の第2の組合せに対して変更内容を適用した場合のテスト結果を決定する。具体的には、演算部1bは、Failを“0”、Passを“1”として扱い、決定木T1,T2,T3を論理積で統合(マージ)することで、統合後(マージ後)の決定木T4を生成する。演算部1bは、決定木T1,T2,T3のマージ処理に、二分決定図(OBDD:Ordered Binary Decision Diagram)のマージアルゴリズムを活用できる。例えば、演算部1bは、まず、決定木T2,T3をマージしてマージ後の決定木を生成し、更に作成したマージ後の決定木と決定木T1とをマージすることで、決定木T4を生成する。
When the
決定木T4は、決定木T1,T2,T3と同様に、ノードm1,m2,m3,m4と、“Pass”や“Fail”に対応するノードとを有する。ただし、図1中、決定木T4において、識別情報“2”の変更箇所に対応するノード(ノードm2)は2つ存在する(以下ではノードm2(1)、ノードm2(2)と表記して区別する)。決定木T4において、ノードm1の“nop”に対応するエッジの先は、ノードm2(1)である。ノードm1の“>=”に対応するエッジの先は、ノードm2(2)である。 The decision tree T4 has nodes m1, m2, m3, m4 and nodes corresponding to “Pass” and “Fail”, like the decision trees T1, T2, T3. However, in FIG. 1, in the decision tree T4, there are two nodes (node m2) corresponding to the changed portion of the identification information “2” (hereinafter referred to as node m2(1) and node m2(2). Distinguish). In the decision tree T4, the edge of the edge corresponding to the "nop" of the node m1 is the node m2(1). The tip of the edge corresponding to “>=” of the node m1 is the node m2(2).
決定木T4において、ノードm2(1)の“nop”に対応するエッジの先は、ノードm3である。ノードm2(1)の“−”に対応するエッジの先は“Fail”に対応する終端ノードである。また、ノードm2(2)の“nop”に対応するエッジの先、および、ノードm2(2)の“−”に対応するエッジの先は何れも“Fail”に対応する終端ノードである。 In the decision tree T4, the tip of the edge corresponding to “nop” of the node m2(1) is the node m3. The tip of the edge corresponding to "-" of the node m2(1) is the terminal node corresponding to "Fail". Further, both the tip of the edge corresponding to “nop” of the node m2(2) and the tip of the edge corresponding to “−” of the node m2(2) are end nodes corresponding to “Fail”.
決定木T4において、ノードm3の“nop”に対応するエッジの先は、ノードm4である。ノードm3の“<=”に対応するエッジの先は、“Fail”に対応する終端ノードである。 In the decision tree T4, the edge of the edge corresponding to the "nop" of the node m3 is the node m4. The end of the edge corresponding to “<=” of the node m3 is the terminal node corresponding to “Fail”.
決定木T4において、ノードm4の“nop”に対応するエッジの先は、“Pass”に対応する終端ノードである。ノードm4の“/”に対応するエッジの先、および、“%”に対応するエッジの先は、何れも“Fail”に対応する終端ノードである。 In the decision tree T4, the edge of the edge corresponding to “nop” of the node m4 is the terminal node corresponding to “Pass”. The tip of the edge corresponding to “/” and the tip of the edge corresponding to “%” of the node m4 are both terminal nodes corresponding to “Fail”.
そして、演算部1bは、決定木T4を辿ることで、テスト結果が未取得である第2の組合せ(例えば、前述の組合せA,B)に対するテスト結果を決定する。
1つの例として、前述の組合せAを考える。演算部1bは、決定木T4において、ノードm1の“nop”に対応するエッジ、ノードm2(1)の“nop”に対応するエッジ、ノードm3の“<=”に対応するエッジを順に辿ることで、“Fail”に対応する終端ノードに達する。よって、演算部1bは、組合せAに対するテスト結果を“Killed”と決定する。
Then, the
As an example, consider the combination A described above. In the decision tree T4, the
また、別の例として、前述の組合せBを考える。演算部1bは、決定木T4において、ノードm1の“>=”に対応するエッジ、ノードm2(2)の“nop”に対応するエッジを順に辿ることで、“Fail”に対応する終端ノードに達する。よって、演算部1bは、組合せBに対するテスト結果を“Killed”と決定する。
As another example, consider the combination B described above. In the decision tree T4, the
演算部1bは、決定したテスト結果を、記憶部1aに出力(格納)する。演算部1bは、決定したテスト結果を、解析装置1に接続された表示装置(図1では図示を省略している)により表示させてもよい。また、演算部1bは、決定木T4により決定したテスト結果を考慮して、テスト対象とする変更箇所の複数の組合せのうち、テスト結果が“Killed”となる組合せの割合などをテストの評価指標として算出し、出力してもよい。
The
例えば、上記のようにSSEの手法により、実行経路に応じたミューテーションを行うことも考えられる。この手法では、実行コストを削減できる半面、幾つかの変更箇所の組合せに対する変更が試行されないことがある。このため、ある変更箇所の組合せ(例えば、前述の組合せA,Bなど)に対してテスト結果を得られないことがある。 For example, it is conceivable to carry out the mutation according to the execution path by the SSE method as described above. This method can reduce the execution cost, but may not try to change a combination of some changes. Therefore, a test result may not be obtained for a certain combination of changed parts (for example, the above-mentioned combinations A and B).
この場合、解析装置1は、各テストケースに対して試行されていない変更箇所の組合せについて、個別に変更内容を適用したソースコードを用意し、コンパイルして、テスト実行することで該当の組合せに対するテスト結果を補完することが考えられる。しかし、このようにバグを埋め込んだソースコードを個別にコンパイル(ミュータント生成)し、テスト実行していると、解析に時間がかかるという問題がある。
In this case, the
そこで、解析装置1は、テストの実行時に決定木T1,T2,T3を生成し、決定木T1,T2,T3に基づいて、決定木T4を生成し、決定木T4を辿ることで、テスト結果を未取得である変更箇所の組合せに対するテスト結果を決定する。ここで、解析装置1の処理では、決定木T1,T2,T3の生成、および、マージといった処理コストが生じる。しかし、ミュータントを個別に生成して実行する処理コストと比べると、決定木T1,T2,T3の生成、および、マージの処理コストは十分に小さいと考えられる。
Therefore, the
こうして、解析装置1は、決定木T1,T2,T3に基づいて、テスト結果を未取得である変更箇所の組合せに対するテスト結果を決定することで、ミュータントを個別に生成して実行せずに済み、その分の実行時間を削減できる。これにより、解析装置1は、解析を高速化できる。以下では、より具体的な例を示し、解析装置1の機能を更に詳細に説明する。
In this way, the
[第2の実施の形態]
図2は、第2の実施の形態の解析装置のハードウェア例を示す図である。解析装置100は、プロセッサ101、RAM102、HDD103、画像信号処理部104、入力信号処理部105、媒体リーダ106および通信インタフェース107を有する。各ユニットは解析装置100のバスに接続されている。
[Second Embodiment]
FIG. 2 is a diagram illustrating a hardware example of the analysis device according to the second embodiment. The
プロセッサ101は、解析装置100の情報処理を制御する。プロセッサ101は、マルチプロセッサであってもよい。プロセッサ101は、例えばCPU、DSP、ASICまたはFPGAなどである。プロセッサ101は、CPU、DSP、ASIC、FPGAなどのうちの2以上の要素の組合せであってもよい。
The
RAM102は、解析装置100の主記憶装置である。RAM102は、プロセッサ101に実行させるOS(Operating System)のプログラムやアプリケーションプログラムの少なくとも一部を一時的に記憶する。また、RAM102は、プロセッサ101による処理に用いる各種データを記憶する。
The
HDD103は、解析装置100の補助記憶装置である。HDD103は、内蔵した磁気ディスクに対して、磁気的にデータの書き込みおよび読み出しを行う。HDD103は、OSのプログラム、アプリケーションプログラム、および各種データを記憶する。解析装置100は、フラッシュメモリやSSD(Solid State Drive)などの他の種類の補助記憶装置を備えてもよく、複数の補助記憶装置を備えてもよい。
The
画像信号処理部104は、プロセッサ101からの命令に従って、解析装置100に接続されたディスプレイ11に画像を出力する。ディスプレイ11としては、CRT(Cathode Ray Tube)ディスプレイや液晶ディスプレイなどを用いることができる。
The image
入力信号処理部105は、解析装置100に接続された入力デバイス12から入力信号を取得し、プロセッサ101に出力する。入力デバイス12としては、例えば、マウスやタッチパネルなどのポインティングデバイス、キーボードなどを用いることができる。
The input
媒体リーダ106は、記録媒体13に記録されたプログラムやデータを読み取る装置である。記録媒体13として、例えば、フレキシブルディスク(FD:Flexible Disk)やHDDなどの磁気ディスク、CD(Compact Disc)やDVD(Digital Versatile Disc)などの光ディスク、光磁気ディスク(MO:Magneto-Optical disk)を使用できる。また、記録媒体13として、例えば、フラッシュメモリカードなどの不揮発性の半導体メモリを使用することもできる。媒体リーダ106は、例えば、プロセッサ101からの命令に従って、記録媒体13から読み取ったプログラムやデータをRAM102またはHDD103に格納する。
The
通信インタフェース107は、ネットワーク14を介して他の装置と通信を行う。通信インタフェース107は、有線通信インタフェースでもよいし、無線通信インタフェースでもよい。
The
図3は、ミューテーション解析の例を示す図である。ここでは、テスト対象のプログラムP10を用いて、解析装置100によるミューテーション解析を例示する。プログラムP10は、関数absの記述を含む。ここで、ミューテーション解析とは、プログラムの1要素を変化させることでバグを埋め込み、テストが埋め込んだバグをどれだけ検出できるかを調べる手法である。バグが埋め込まれたプログラムは「ミュータント」と呼ばれる。ミュータントは、例えば、(ミューテーション箇所,ミューテーション内容)の組(ミューテーション記述子)で表される。
FIG. 3 is a diagram illustrating an example of mutation analysis. Here, the mutation analysis by the
具体的には、プログラムP11は、プログラムP10の2行目に含まれる“<=”の記述を、“>”に変化させたミュータントである。プログラムP11の識別名は“mutant1”である。 Specifically, the program P11 is a mutant in which the description of “<=” included in the second line of the program P10 is changed to “>”. The identification name of the program P11 is "mutant1".
また、プログラムP12は、プログラムP10の2行目に含まれる“0”の記述を、“1”に変化させたミュータントである。プログラムP12の識別名は“mutant2”である。 The program P12 is a mutant in which the description of "0" included in the second line of the program P10 is changed to "1". The identification name of the program P12 is "mutant2".
更に、プログラムP13は、プログラムP10の3行目に含まれる“−”の記述を、“−−”に変化させたミュータントである。プログラムP13の識別名は“mutant3”である。 Further, the program P13 is a mutant in which the description of "-" included in the third line of the program P10 is changed to "---". The identification name of the program P13 is "mutant3".
図3の例では、2つのテストケースを考える。第1のテストケース(Testcase1)は、abs(2)==2である。すなわち、第1のテストケースは、関数absにx=2を入力したとき、出力が“2”になるか否かを確認する。abs(2)==2が成立すれば“Pass”、成立しなければ“Fail”である。 In the example of FIG. 3, consider two test cases. The first test case (Testcase1) is abs(2)==2. That is, the first test case confirms whether or not the output becomes “2” when x=2 is input to the function abs. If abs(2)==2 holds, it is "Pass", and if not, "Fail".
第2のテストケース(Testcase2)は、abs(−2)==2である。すなわち、第2のテストケースは、関数absにx=−2を入力したとき、出力が“2”になるか否かを確認する。abs(−2)==2が成立すれば“Pass”、成立しなければ“Fail”である。 The second test case (Testcase2) is abs(-2)==2. That is, the second test case confirms whether the output becomes “2” when x=−2 is input to the function abs. If abs(−2)==2 is satisfied, it is “Pass”, and if not, “Fail”.
プログラムP11では、第1,第2のテストケースの何れも実行結果はFailである。プログラムP12では、第1のテストケースの実行結果はPass、第2のテストケースの実行結果はPassである。プログラムP13では、第1のテストケースの実行結果はPass、第2のテストケースの実行結果はFailである。 In the program P11, the execution result of both the first and second test cases is Fail. In the program P12, the execution result of the first test case is Pass, and the execution result of the second test case is Pass. In the program P13, the execution result of the first test case is Pass and the execution result of the second test case is Fail.
この場合、第1のテストケースおよび第2のテストケースにより、プログラムP11に埋め込まれたバグを検出できることになる。したがって、プログラムP11に対するテスト結果はKilledである。 In this case, the bugs embedded in the program P11 can be detected by the first test case and the second test case. Therefore, the test result for the program P11 is Killed.
また、第1のテストケースおよび第2のテストケースでは、プログラムP12に埋め込まれたバグを検出できないことになる。したがって、プログラムP12に対するテスト結果はUnkilledである。 Further, in the first test case and the second test case, the bug embedded in the program P12 cannot be detected. Therefore, the test result for the program P12 is Unkilled.
更に、第2のテストケースにより、プログラムP13に埋め込まれたバグを検出できることになる。したがって、プログラムP13に対するテスト結果はKilledである。
例えば、解析装置100は、検出されたバグの割合(ミューテーションスコア(mutation score))を算出し出力する。この場合、ミューテーションスコアは、2/3=0.667である。ソフトウェアの開発者は、ミューテーションスコアを向上させるようにテストケースを改善することで、テストの信頼性を向上させることができる。
In addition, the second test case makes it possible to detect a bug embedded in the program P13. Therefore, the test result for the program P13 is Killed.
For example, the
なお、図3の例では、1つの変更(ミューテーション)が適用されたプログラムP11,P12,P13を例示した。このようなプログラムは、1次ミュータント(FOM:First Order Mutant)と呼ばれる。また、FOMを組み合わせることで、2つ以上のミューテーションが適用されたプログラムを考えることもできる。2つ以上のミューテーションが適用されたプログラムは、高次ミュータント(HOM:High Order Mutant)と呼ばれる。 Note that the example of FIG. 3 illustrates the programs P11, P12, and P13 to which one change (mutation) is applied. Such a program is called a first order mutant (FOM). Further, by combining FOM, it is possible to consider a program to which two or more mutations are applied. A program to which two or more mutations are applied is called a high order mutant (HOM).
ミュータント解析では、ミュータントを網羅的に生成し、テスト実行していると、テストに時間がかかる。例えば、コンパイルやテスト実行に要する時間を考慮すると、複数のミュータントに対するテストの合計時間は次の式で表される。 In the mutant analysis, if the mutants are comprehensively generated and the test is executed, the test takes a long time. For example, considering the time required for compilation and test execution, the total test time for a plurality of mutants is expressed by the following equation.
合計時間=(ミュータント数)*(ミューテーション時間+コンパイル時間)+(ミュータント数)*(テストケース数)*(テストケース1つ当たりの平均実行時間)
そこで、通常のミューテーションの代わりに、プログラムのミューテーション箇所を、ミューテーションを行うメタ関数に置き換え、ミューテーション用のパラメータを事後的に与えることで、コンパイルのコストを抑える手法(MSG)がある。MSGでは、メタ関数に置換後のプログラムを1回コンパイルすればよい。MSGについては、文献“Mutation Analysis Using Mutant Schemata, Untch, Offutt, and Harrold, ISSTA, 1993”が参考になる。
Total time = (number of mutants) * (mutation time + compile time) + (number of mutants) * (number of test cases) * (average execution time per test case)
Therefore, there is a method (MSG) that suppresses the compile cost by replacing the normal mutation by replacing the mutation part of the program with a metafunction that performs the mutation and giving the mutation parameter afterwards. .. In MSG, the program after replacement with the metafunction may be compiled once. For MSG, the document “Mutation Analysis Using Mutant Schemata, Untch, Offutt, and Harrold, ISSTA, 1993” can be referred to.
また、ソースコードからコンパイルされたビットコードに対してミューテーションを行うことでコンパイル回数を減らす手法(Bitcode Mutation)もある。Bitcode Mutationについては、文献“Mujava: An Automated Class Mutation System, Mar, Offutt, and Kwon, STVR, 2005”が参考になる。 There is also a method (Bitcode Mutation) that reduces the number of compilations by performing mutation on the bit code compiled from the source code. For the Bitcode Mutation, refer to the document “Mujava: An Automated Class Mutation System, Mar, Offutt, and Kwon, STVR, 2005”.
更に、Online Adaptation Techniqueと呼ばれる手法により、実行状態に動的にミューテーション情報を与えることで、冗長なミュータントの実行を回避し、実行時間を短縮することもある。特に、SSEでは、プログラムの実行箇所で実行状態を分割し、当該実行箇所までの実行を共通化することで実行コストを減らせる。SSEでは、HOM生成を考慮すると、実行状態は多段に分割されることになる。 Furthermore, a method called Online Adaptation Technique may be used to dynamically provide the execution state with mutation information, thereby avoiding execution of redundant mutants and shortening the execution time. In particular, in SSE, the execution state can be divided at the execution points of the program, and the execution up to the execution points can be shared to reduce the execution cost. In SSE, the execution state is divided into multiple stages in consideration of HOM generation.
ただし、Online AdaptationおよびSSEを用いることで、実行コストを減らせる半面、冗長なHOMが実行されず、当該HOMに対するKilled/Unkilledのテスト結果が不明になることがある。なお、SSEで実行されないミュータントを図44で例示する。ただし、省略されたHOMもkillされる可能性はある。そこで、解析装置100は、テスト結果を得られていないHOMに対して効率的にテスト結果を取得する機能を提供する。
However, by using Online Adaptation and SSE, the execution cost can be reduced, but the redundant HOM is not executed, and the Killed/Unkilled test result for the HOM may become unknown. Note that a mutant that is not executed in SSE is illustrated in FIG. However, the omitted HOM may be killed. Therefore, the
図4は、解析装置の機能例を示す図である。解析装置100は、記憶部110、メタ関数置換部120、コンパイラ130、決定木作成部140、決定木マージ部150および結果出力部160を有する。
FIG. 4 is a diagram illustrating an example of functions of the analysis device. The
記憶部110は、RAM102またはHDD103の所定の記憶領域により実現される。メタ関数置換部120、コンパイラ130、決定木作成部140、決定木マージ部150および結果出力部160は、RAM102に記憶されたプログラムをプロセッサ101により実行することで実現される。
The
記憶部110は、ソースコードおよび置換後ソースコードを記憶する。置換後ソースコードは、ソースコード内のミューテーション箇所の記述をメタ関数に置換したものである。また、記憶部110は、置換後ソースコードをコンパイルして生成されたプログラムを記憶する。当該プログラムは、例えば、LLVM(Low Level Virtual Machine)ビットコードである。更に、記憶部110は、テスト内容を記述したテストプログラム、および、ミューテーション内容を示すミューテーションオペレータリストを記憶する。なお、ソースコード、置換後ソースコード、LLVMビットコード、テストプログラムおよびミューテーションオペレータリストは、解析装置100の外部の記憶装置に記憶されてもよい。
The
記憶部110は、メタミューテーション情報、ミュータント一覧、実行状態集合、決定木およびテスト結果テーブルを記憶する。メタミューテーション情報は、メタ関数に置換されたソースコードの位置を管理するための情報である。ミュータント一覧は、ミュータントの一覧の情報である。実行状態集合は、プログラム実行に伴う実行状態の記録に用いられる情報である。決定木は、テストによるプログラムの実行結果を、実行により辿ったミュータント箇所とともに記録した情報である。テスト結果テーブルは、各ミュータントに対するテスト結果を記録するための情報である。
The
メタ関数置換部120は、ソースコードの所定の演算に関する記述を、メタ関数に置換することで、置換後ソースコードを生成し、記憶部110に格納する。また、メタ関数置換部120は、当該置換に応じて、メタミューテーション情報およびミュータント一覧を生成し、記憶部110に格納する。
The meta-
コンパイラ130は、記憶部110に記憶された置換後ソースコードをコンパイルして、中間コードのプログラム(LLVMビットコード)を生成し、記憶部110に格納する。
The
決定木作成部140は、記憶部110に記憶された中間コードのプログラムに対して、テストプログラムに基づくテストを実行する。決定木作成部140は、SSEの手法を用いてテストを実行する。このとき、決定木作成部140は、記憶部110に記憶されたミューテーションオペレータリストに従って、ミューテーション箇所に対するミューテーションを行いながら、決定木の作成およびプログラムの実行状態の記録を行う。決定木作成部140は、テストケース毎に、決定木の作成を行う。決定木作成部140は、作成した決定木の情報を記憶部110に格納する。
The decision
決定木マージ部150は、記憶部110に記憶されたテストケース毎の決定木をマージする。決定木マージ部150は、決定木のマージに、OBDDのマージアルゴリズムを用いる。当該マージアルゴリズムについて、文献“Merging Ordered Binary Decision Diagrams, http://www.cs.engr.uky.edu/〜lewis/papers/merge‐alg.pdf, 2016年9月7日検索”が参考になる。決定木マージ部150は、“Fail”を“0”、“Pass”を“1”として扱い、決定木f(m1,m2,・・・mn)(nは正の整数)と決定木g(m1,m2,・・・,mn)とマージして決定木h(m1,m2,・・・,mn)を作成する(mnはノードを示す)。より具体的には、決定木マージ部150は、決定木f,g内のノードを深さ優先で選択してミューテーションオペレータを割当て、その順に決定木hのノードとエッジとを作成する。決定木マージ部150は、決定木fまたは決定木gの少なくとも何れかがFailになったら、決定木hのその時点のノードからFailのノードへのエッジを作成する(詳細は後述される)。決定木マージ部150は、マージにより得られた決定木の情報を、記憶部110に格納する。
The decision
結果出力部160は、記憶部110に記憶されたミュータント一覧を参照して、記憶部110に記憶されたマージ後の決定木を辿ることで、各ミュータントに対するテスト結果を決定し、ミューテーションスコアの計算を行う。結果出力部160は、ミューテーションスコアの計算結果を含む結果レポートを、ディスプレイ11に表示させる。結果出力部160は、テストで検出できなかった(killできなかった)ミュータントをディスプレイ11によりリスト表示させる。結果出力部160は、リスト表示されたミュータントのうちの何れかがユーザにより選択されると、記憶部110に記憶されたメタミュータント情報を参照して、選択されたミュータントに対応するソースコードの該当箇所をユーザに提示する。
The
図5は、ソースコードの例を示す図である。ソースコード111は、ユーザにより解析装置100に入力され、記憶部110に格納される。ソースコード111は、C言語による整数型の関数funcの記述を含む。関数funcは、整数型の入力値(x)に対する演算を行う関数である。
FIG. 5 is a diagram showing an example of the source code. The
図6は、置換後ソースコードの例を示す図である。置換後ソースコード112は、ソースコード111に基づいて、メタ関数置換部120により生成され、記憶部110に格納される。置換後ソースコード112は、メタ関数を含む。本例では、メタ関数は、3つの引数をもつ。第1引数は変更箇所の識別子(MMID:Meta Mutation IDentifier)である。第2引数は入力値(この例では何れも“x”)である。第3引数は演算に用いられる値である。
FIG. 6 is a diagram showing an example of the source code after replacement. The replaced
具体的には、置換後ソースコード112では、ソースコード111の2行目の“x < 0”という記述が、“bop_lt(1,x,0)”というメタ関数の記述に置換されている。メタ関数bop_lt(1,x,0)の第1引数“1”はMMIDである。同第2引数“x”は入力値である。同第3引数“0”は入力値に対する比較演算に用いられる値である。メタ関数bop_ltは、関係演算子“<”を“>=”へ変更するミューテーションを行う。
Specifically, in the
また、置換後ソースコード112では、ソースコード111の3行目の“x + 1”という記述が、“bop_add(2,x,1)”というメタ関数の記述に置換されている。メタ関数bop_addは、算術演算子“+”を“−”へ変更するミューテーションを行う。
In the
また、置換後ソースコード112では、ソースコード111の4行目の“x > 0”という記述が、“bop_gt(3,x,0)”というメタ関数の記述に置換されている。メタ関数bop_gtは、関係演算子“>”を“<=”へ変更するミューテーションを行う。
Further, in the
更に、ソースコード112では、ソースコード111の5行目の“x * 2”という記述が、“bop_mul(4,x,2)”というメタ関数の記述に置換されている。メタ関数bop_mulは、算術演算子“*”を“/”および“%”へ変更するミューテーションを行う。
Further, in the
ここで、関数funcのreturn命令による返り値は、整数に丸められることに注意されたい(例えば、演算“−1/2”の結果は0に丸められる)。
図7は、テストプログラムの例を示す図である。テストプログラム113は、ユーザにより解析装置100に入力され、記憶部110に格納される。テストプログラム113は、3つのテストケースを含む。第1のテストケース(testcase1)は、func(0)==0が成立するか否か(関数funcに0を入力したときの関数funcの出力が確認値0に一致するか否か)を確認することを示す。第2のテストケース(testcase2)は、func(1)==2が成立するか否かを確認することを示す。第3のテストケース(testcase3)は、func(−1)==0が成立するか否かを確認することを示す。
Note that the return value of the function func's return instruction is rounded to an integer (for example, the result of the operation "-1/2" is rounded to 0).
FIG. 7 is a diagram showing an example of a test program. The
図8は、ミューテーションオペレータリストの例を示す図である。ミューテーションオペレータリスト114は、ユーザにより解析装置100に入力され、記憶部110に格納される。ミューテーションオペレータリスト114は、テスト時に適用するミューテーションオペレータのリストである。
FIG. 8 is a diagram showing an example of a mutation operator list. The mutation operator list 114 is input to the
OSSNは、Shift operator mutationであり、シフト演算子のミューテーション(例えば、左シフト演算“<<=”を右シフト演算“>>=”に変更するミューテーション)を行うことを示す。 OSSN is a shift operator mutation, and indicates that a mutation of a shift operator (for example, a mutation that changes a left shift operation “<<=” to a right shift operation “>>>=”) is performed.
ORRNは、Relational operator mutationであり、関係演算子のミューテーション(例えば、“>”を“<=”に変更するミューテーション)を行うことを示す。
OIDOは、Increment/Decrement Replacementであり、加算と減算とを変更するミューテーション(例えば、“++”や“+1”を、“−−”や“−1”に変更するミューテーション)を行うことを示す。
ORRN is Relational operator mutation, and indicates that mutation of a relational operator (for example, mutation that changes “>” to “<=”) is performed.
OIDO is Increment/Decrement Replacement, and performs a mutation that changes addition and subtraction (for example, a mutation that changes “++” or “+1” into “−−” or “−1”). Show.
OAANは、Arithmetic operator mutationであり、乗算を除算や剰余を取得する演算に変更するミューテーション(例えば、“*”を、“/”や“%”に変更するミューテーション)を行うことを示す。 OAAN is Arithmetic operator mutation, and indicates that a mutation that changes multiplication into an operation that obtains a division or a remainder (for example, a mutation that changes “*” to “/” or “%”) is performed.
ミューテーションオペレータリスト114は、テスト時におけるミューテーションの内容を指定するための情報と考えてもよい。
図9は、メタミューテーション情報の例を示す図である。メタミューテーション情報115は、置換後ソースコード112の生成時にメタ関数置換部120により生成され、記憶部110に格納される。メタミューテーション情報115は、MMIDおよびソースコード位置情報の項目を含む。
The mutation operator list 114 may be considered as information for specifying the content of the mutation during the test.
FIG. 9 is a diagram showing an example of metamutation information. The
MMIDの項目には、MMIDが登録される。ソースコード位置情報の項目には、ソースコード111のファイル名、および、ソースコード111においてメタ関数に置換された位置の情報が登録される。ここで、ソースコード111のファイル名は、“a.c”である。
The MMID is registered in the MMID item. In the item of source code position information, the file name of the
例えば、メタミューテーション情報115には、MMIDが“1”、ソースコード位置情報が“a.c:2行6桁−2行11桁”という情報が含まれる。これは、ソースコード111における2行6桁−2行11桁に対応する“x < 0”の記述がMMID“1”に対応するメタ関数に置換されたことを示す。
For example, the
メタミューテーション情報115には、他のミューテーション箇所についても同様に、MMIDとソースコード位置情報とが対応付けて登録される。
図10は、中間コードの例を示す図である。中間コード116は、置換後ソースコード112がコンパイラ130によりコンパイルされることで生成され、記憶部110に格納される。中間コード116の1つの行は1つの命令に対応する。中間コード116の命令は、命令ID(IDentifier)によって識別される。中間コード116における“%1”や“%2”などの“%”記号と数値との結合で表される変数はレジスタを示し、各命令の実行結果が格納される。
In the
FIG. 10 is a diagram showing an example of the intermediate code. The
例えば、命令ID“3”の命令は、置換後ソースコード112の2行目のメタ関数bop_lt(1,x,0)に対応する。“%2”には、ミューテーション内容に応じた演算結果が設定される。“%2”の設定値は、演算結果が真なら“1”、偽なら“0”である。
For example, the instruction with the instruction ID “3” corresponds to the metafunction bop_lt(1, x, 0) on the second line of the
命令ID“4”の命令は、“%2”の設定値が0に等しくないとき“%3”に“1”を設定し、“%2”の設定値が0に等しいとき“%3”に“0”を設定する。
命令ID“5”の命令は、“%3”の設定値が“1”なら命令ID“6”にジャンプし、また、“%3”の設定値が“0”なら命令ID“10”にジャンプすることを示す。
The instruction with the instruction ID "4" sets "1" to "%3" when the set value of "%2" is not equal to 0, and "%3" when the set value of "%2" is equal to 0 Is set to "0".
The instruction with the instruction ID “5” jumps to the instruction ID “6” if the setting value of “%3” is “1”, and to the instruction ID “10” if the setting value of “%3” is “0”. Indicates jumping.
同様に、中間コード116は、置換後ソースコード112の3行目に対応する命令群(命令ID“6”〜“9”)を含む。中間コード116は、置換後ソースコード112の4行目に対応する命令群(命令ID“10”〜“13”)を含む。中間コード116は、置換後ソースコード112の5行目に対応する命令群(命令ID“14”〜“17”)を含む。ただし、置換後ソースコード112における“return”に対応する命令は、命令ID“21”〜“23”で共通化している。すなわち、実行結果は“%13”のレジスタに格納された値と、テストケースの確認値との比較によって定まる(両値が一致ならPassであり、不一致ならFailである)。
Similarly, the
図11は、実行状態集合の例を示す図である。実行状態集合117は、決定木作成部140により生成され、記憶部110に格納される。実行状態集合117は、実行状態ID、命令ID、ミューテーション記述子およびメモリの項目を含む。
FIG. 11 is a diagram showing an example of the execution state set. The execution state set 117 is generated by the decision
実行状態IDの項目には、実行状態の識別情報(実行状態ID)が登録される。実行状態は、レジスタの設定値の組合せによって表される。命令IDは、中間コード116のうち、ミューテーションによる状態分岐が発生している命令の命令IDが登録される。ミューテーション記述子の項目には、該当の命令IDに対応する命令において適用するミューテーションの内容を示すミューテーション記述子が登録される。メモリの項目には、プログラム(中間コード116)の実行状態を表すレジスタの設定値の組合せが登録される。
In the item of execution state ID, identification information of execution state (execution state ID) is registered. The execution state is represented by a combination of register setting values. In the instruction ID, the instruction ID of the instruction in the
例えば、実行状態集合117には、実行状態IDが“2”、命令IDが“3”、ミューテーション記述子が“1,>=”、メモリが“%1=0”という情報が登録される。これは、実行状態ID“2”で示される実行状態では、命令ID“3”の命令においてミューテーションによる状態分岐が発生していることを示す。また、実行状態ID“2”で示される実行状態は、レジスタの設定値の組が“%1=0”であること、当該箇所におけるミューテーション記述子が(1,>=)であることを示す。ここで、ミューテーション記述子の左側の数値はMMIDである。ミューテーション記述子の右側の演算子はミューテーション内容を示す。 For example, in the execution state set 117, information that the execution state ID is “2”, the instruction ID is “3”, the mutation descriptor is “1, >=”, and the memory is “%1=0” is registered. .. This indicates that in the execution state indicated by the execution state ID “2”, a state branch due to mutation occurs in the instruction with the instruction ID “3”. The execution state indicated by the execution state ID “2” indicates that the set value of the register is “%1=0” and the mutation descriptor at the location is (1, >=). Show. Here, the numerical value on the left side of the mutation descriptor is the MMID. The operator on the right side of the mutation descriptor indicates the mutation content.
実行状態集合117では、テスト実行に伴って現在生じている複数の状態分岐が記録され得る。図11の例では、実行状態ID“2”の他にも、実行状態ID“3”、“4”、“5”に対応する実行状態が記録されている(後述する図31の実行状態に相当する)。 In the execution state set 117, a plurality of state branches currently occurring in association with the test execution may be recorded. In the example of FIG. 11, in addition to the execution state ID “2”, the execution states corresponding to the execution state IDs “3”, “4”, and “5” are recorded (see the execution state of FIG. 31, which will be described later). Equivalent to).
図12は、ミュータント一覧の例を示す図である。ミュータント一覧118は、メタ関数置換部120により生成され、記憶部110に格納される。ミュータント一覧118は、ミュータントIDおよびミューテーション記述子の項目を含む。
FIG. 12 is a diagram showing an example of the mutant list. The
ミュータントIDの項目には、ミュータントの識別情報(ミュータントID)が登録される。ミューテーション記述子の項目には、ミューテーション記述子が登録される。ミュータントは、ミューテーション記述子の組合せで表される。テスト対象とするミュータントの最高次数は、ユーザにより指定される。一例として、ミュータントの最高次数“3”が指定されているものとする(3次以下のミュータントを作成することを示す)。 Mutant identification information (mutant ID) is registered in the mutant ID item. A mutation descriptor is registered in the mutation descriptor item. Mutants are represented by a combination of mutation descriptors. The highest order of the mutant to be tested is specified by the user. As an example, it is assumed that the highest order of mutants, “3”, is specified (indicating that a mutant of third order or lower is created).
本例では、5種類のFOMが存在する。ミュータントIDは、文字“M”とFOMを識別する数値の組合せ(1以上の数値を要素とする)を示す添え字との結合によって表される。ミュータントID“M1”のミュータントは、ミューテーション記述子(1,>=)に対応する。ここで、以下では、ミュータントID“M1”のミュータントを、「ミュータントM1」のように表記することがある。 In this example, there are five types of FOM. The mutant ID is represented by a combination of the letter “M” and a subscript indicating a combination of numerical values for identifying the FOM (one or more numerical values are elements). The mutant with the mutant ID “M 1 ”corresponds to the mutation descriptor (1, >=). Here, in the following, the mutant with the mutant ID “M 1 ”may be expressed as “mutant M 1 ”.
ミュータントM2は、ミューテーション記述子(2,−)に対応する。ミュータントM3は、ミューテーション記述子(3,<=)に対応する。ミュータントM4は、ミューテーション記述子(4,/)に対応する。ミュータントM5は、ミューテーション記述子(4,%)に対応する。ミュータントM1,M2,M3,M4,M5は、FOMである。 Mutant M 2 is mutation descriptor (2, -) corresponding to. Mutant M 3 corresponds to mutation descriptor (3,<=). Mutant M 4 corresponds to mutation descriptor (4,/). Mutant M 5 corresponds to the mutation descriptor (4%). Mutants M 1 , M 2 , M 3 , M 4 and M 5 are FOMs.
HOMは、FOMのミューテーション記述子の組合せで表される。例えば、ミュータントM1,2は、ミューテーション記述子{(1,>=),(2,−)}に対応する。また、例えば、ミュータントM1,2,3は、ミューテーション記述子{(1,>=),(2,−),(3,<=)}に対応する。ミュータント一覧118では、他のミュータントも同様にして、ミューテーション記述子に対応付けられている。この例では、ミュータントの合計数は21である。
The HOM is represented by a combination of FOM mutation descriptors. For example, the mutant M 1,2 corresponds to the mutation descriptor {(1, >=), (2, −)}. Further, for example, the mutants M 1,2,3 correspond to mutation descriptors {(1, >=), (2, −), (3, <=)}. In the
例えば、メタ関数置換部120は、ユーザにより入力されたFOMの一覧(ミュータントM1,M2,M3,M4,M5のミュータントIDとミューテーション記述子との対応を示すリスト)および指定次数に基づいて、ミュータント一覧118を作成してもよい。
For example, the meta-
図13は、テスト結果テーブルの例を示す図である。テスト結果テーブル119は、記憶部110に格納され、決定木作成部140および結果出力部160により更新される。テスト結果テーブル119は、ミュータントID、Test1、Test2、Test3およびミュータント生存結果の項目を含む。
FIG. 13 is a diagram showing an example of the test result table. The test result table 119 is stored in the
ミュータントIDの項目には、ミュータントIDが登録される。Test1の項目には、第1のテストケース(testcase1)の実行結果が登録される。Test2の項目には、第2のテストケース(testcase2)の実行結果が登録される。Test3の項目には、第3のテストケース(testcase3)の実行結果が登録される。ミュータント生存結果の項目には、テストプログラム113によりミュータントがkillされたか否かを示す情報(テスト結果)が登録される。前述のように、少なくとも1つのテストケースの実行結果が“Failed”であれば、ミュータント生存結果は“Killed”となる。また、何れのテストケースの実行結果も“Passed”であれば、ミュータント生存結果は“Unkilled”となる。
The mutant ID is registered in the mutant ID item. The execution result of the first test case (testcase1) is registered in the item Test1. The execution result of the second test case (testcase2) is registered in the item Test2. The execution result of the third test case (testcase3) is registered in the Test3 item. Information (test result) indicating whether or not the mutant has been killed by the
ここで、テスト結果テーブル119では、通常のSSEによるミュータント解析の結果が登録された状態を示している。
例えば、テスト結果テーブル119には、ミュータントIDが“M1”、Test1が“Failed”、Test2が“Passed”、Test3が“Passed”、ミュータント生存結果が“Killed”という情報が登録される。これは、ミュータントM1がテストプログラム113によって検出されることを示す。
Here, the test result table 119 shows a state in which the result of the normal mutant analysis by SSE is registered.
For example, in the test result table 119, information that the mutant ID is “M 1 ”, Test 1 is “Failed”,
テスト結果テーブル119には、他のミュータントIDに対しても、同様に各テストケースの実行結果およびミュータント生存結果が登録される。ただし、設定なし“−”(ハイフン記号)となっている箇所は、通常のSSEでは試行されず、該当のテストケースに対する実行結果や、ミュータント生存結果が未取得であることを示す。ミュータント生存結果が未取得の箇所は、後述の手順によって補完されることになる。 In the test result table 119, execution results and mutant survival results of each test case are similarly registered for other mutant IDs. However, a place where "-" (hyphen symbol) is not set indicates that the execution result for the corresponding test case and the mutant survival result have not been acquired because the normal SSE does not try. Locations for which mutant survival results have not been obtained will be supplemented by the procedure described below.
図14は、決定木の例を示す図である。図14(A)は、第1のテストケース(testcase1)に対する決定木T10を示す。図14(B)は、第2のテストケース(testcase2)に対する決定木T20を示す。図14(C)は、第3のテストケース(testcase3)に対する決定木T30を示す。決定木T10,T20,T30は、有向グラフにより表される。 FIG. 14 is a diagram showing an example of a decision tree. FIG. 14A shows a decision tree T10 for the first test case (testcase1). FIG. 14B shows a decision tree T20 for the second test case (testcase2). FIG. 14C shows a decision tree T30 for the third test case (testcase3). The decision trees T10, T20, T30 are represented by a directed graph.
ここで、決定木T10を、Test1(m1,m2,m3,m4)と表す。m1,m2,m3,m4は、ノードの識別子である。例えば、識別子m1のノードを「ノードm1」のように表す。ノードの識別子に付された数値は、MMIDに対応する。各ノードを起点とするエッジは、該当のノードのMMIDで示されるミューテーション箇所におけるミューテーション内容を表す。ミューテーションを行っていない場合は“nop”のエッジに対応する。 Here, the decision tree T10 is represented as Test1(m1, m2, m3, m4). m1, m2, m3 and m4 are node identifiers. For example, the node with the identifier m1 is represented as “node m1”. The numerical value attached to the node identifier corresponds to the MMID. The edge starting from each node represents the mutation content at the mutation location indicated by the MMID of the corresponding node. When no mutation is performed, it corresponds to the edge of "nop".
図15は、各決定木のマージ結果の例を示す図である。決定木T40は、決定木T10,T20,T30を、論理積(Test1(m1,m2,m3,m4)∧Test2(m1,m2,m3,m4)∧Test3(m1,m2,m3,m4))でマージした結果である。決定木マージ部150は、前述のOBDDのマージアルゴリズムを用いて、決定木T40を生成する(決定木のマージ処理の手順の詳細は後述される)。
FIG. 15 is a diagram showing an example of the result of merging decision trees. The decision tree T40 is a logical product of the decision trees T10, T20, T30 (Test1(m1, m2, m3, m4)∧Test2(m1,m2,m3,m4)∧Test3(m1,m2,m3,m4)). It is the result of merging with. The decision
図16は、ノード・エッジのコード例を示す図である。コードC1は、決定木T10,T20,T30,T40それぞれに属するノードおよびエッジを管理するためのコードである。例えば、ノードは、MMID(図16中のmmidに相当)をもち、ミューテーションオペレータ(コードC1の10行目で定義される“nop”、“lt”、“le”など)に応じた次ノードへのポインタ(エッジに相当)をもつ。終端ノード(葉ノードと称する)は、ブーリアン型の変数“isPassed”により、true(“Pass”に相当)またはfalse(“Fail”に相当)の何れかをもつ。 FIG. 16 is a diagram showing a code example of a node/edge. The code C1 is a code for managing the nodes and edges belonging to the decision trees T10, T20, T30, T40, respectively. For example, the node has the MMI D (corresponding to mmid in FIG. 16) and is the next node according to the mutation operator (“nop”, “lt”, “le”, etc. defined in the 10th line of the code C1). Has a pointer to (corresponding to an edge). The terminal node (referred to as a leaf node) has either true (corresponding to "Pass") or false (corresponding to "Fail") depending on a boolean type variable "isPassed".
図17は、決定木のデータ例を示す図である。データD1は、決定木T10に等価な情報を示している。具体的には、ノードm1では、ミューテーションオペレータ[nop]に対してノードm3へのポインタが設定される。ノードm1では、ミューテーションオペレータ[ge](演算子“>=”に相当)に対してノードm2へのポインタが設定される。 FIG. 17 is a diagram showing a data example of a decision tree. The data D1 indicates information equivalent to the decision tree T10. Specifically, in the node m1, the pointer to the node m3 is set for the mutation operator [nop]. In the node m1, a pointer to the node m2 is set for the mutation operator [ge] (corresponding to the operator “>=”).
ノードm2では、ミューテーションオペレータ[nop]に対して、Failの葉ノードへのポインタが設定される。ノードm2では、ミューテーションオペレータ[sub](演算子“−”に相当)に対して、Failの葉ノードへのポインタが設定される。 At the node m2, a pointer to the leaf node of Fail is set for the mutation operator [nop]. At the node m2, a pointer to the leaf node of Fail is set for the mutation operator [sub] (corresponding to the operator "-").
ノードm3では、ミューテーションオペレータ[nop]に対して、Passの葉ノードへのポインタが設定される。ノードm3では、ミューテーションオペレータ[le](<=)に対して、ノードm4へのポインタが設定される。 In the node m3, a pointer to the leaf node of Pass is set for the mutation operator [nop]. In the node m3, a pointer to the node m4 is set for the mutation operator [le] (<=).
ノードm4では、ミューテーションオペレータ[nop]に対して、Passの葉ノードへのポインタが設定される。ノードm4では、ミューテーションオペレータ[div](演算子“/”に相当)に対して、Passの葉ノードへのポインタが設定される。ノードm4では、ミューテーションオペレータ[rem](演算子“%”に相当)に対して、Passの葉ノードへのポインタが設定される。 In the node m4, a pointer to the leaf node of Pass is set for the mutation operator [nop]. In the node m4, a pointer to the leaf node of Pass is set for the mutation operator [div] (corresponding to the operator “/”). At the node m4, a pointer to the leaf node of Pass is set for the mutation operator [rem] (corresponding to the operator "%").
決定木T20,T30,T40の情報についても、決定木T10と同様のデータ構造により管理される。
図18は、結果レポートの出力例を示す図である。結果レポートR1は、結果出力部160により出力される結果レポートの例である。結果レポートR1は、一例として、関数func1に対するミュータント解析の結果を表す。結果レポートR1は、ミューテーションスコア(Mutation Score)の計算結果(例えば、“75%”(9/12)の表示)や検出されなかったミュータント(Unkilled mutants)のリストを含む。リストの1要素は、ソースコードの位置、オリジナルのコード、および、ミュータントのコードを含む。該当の位置において複数のミュータントを生成した場合は、該当の位置に対する複数のミュータントが表示され得る。ユーザは、リストから任意のミュータントを選択可能である。結果出力部160は、ユーザにより選択されたミュータントに対応するソースコードの該当箇所を結果レポートR1内に表示させる。例えば、結果出力部160は、該当箇所を強調するようハイライト表示したり、該当箇所に下線を付したりすることで、ユーザによる問題箇所の認識を支援する。ユーザは、結果レポートR1を確認して、ミューテーションスコアを向上させるようテスト内容の見直しを行える。
The information of the decision trees T20, T30, T40 is also managed by the same data structure as the decision tree T10.
FIG. 18 is a diagram showing an output example of the result report. The result report R1 is an example of a result report output by the
次に、解析装置100によるミューテーション解析の処理手順を説明する。
図19は、解析装置の処理例を示すフローチャートである。以下、図19に示す処理をステップ番号に沿って説明する。
Next, a processing procedure of mutation analysis by the
FIG. 19 is a flowchart showing a processing example of the analysis device. Hereinafter, the process illustrated in FIG. 19 will be described in order of step number.
(S1)メタ関数置換部120は、ソースコード111の入力を受け付ける。すると、メタ関数置換部120は、ソースコード111へのメタ関数の埋め込みを行う。具体的には、メタ関数置換部120は、予め定められた所定の演算子を用いた演算に対応するコードを当該演算に対応するメタ関数のコードに置換する。その結果、メタ関数置換部120は、置換後ソースコード112を生成し、記憶部110に格納する。メタ関数置換部120は、埋め込んだメタ関数に応じて、ミュータント一覧118を生成し、記憶部110に格納する。また、メタ関数置換部120は、メタミューテーション情報115を生成し、記憶部110に格納する。このとき、メタ関数置換部120は、ミューテーションオペレータリスト114やFOM一覧およびミューテーションの次数のユーザによる入力を受け付けて、各ミュータントのミューテーション記述子を特定してもよい。
(S1) The meta
(S2)コンパイラ130は、置換後ソースコード112を中間コード116へコンパイルする。コンパイラ130は、コンパイルによって生成した中間コード116を記憶部110に格納する。
(S2) The
(S3)決定木作成部140は、決定木作成処理を行う。具体的には、決定木作成部140は、中間コード116を用いて、テストプログラム113によるテストを実行し、決定木T10,T20,T30の情報を生成する。決定木作成部140は、決定木T10,T20,T30の情報を記憶部110に格納する。決定木作成部140は、テスト実行にSSEの手法を用いる。決定木作成部140は、テスト実行に伴って、記憶部110に記憶されたテスト結果テーブル119を更新する。また、決定木作成部140は、テスト時に機能させるミューテーションの内容を示すミューテーションオペレータリスト114のユーザによる入力を予め受け付け、記憶部110に格納している。本例では、ミューテーションオペレータリスト114により、少なくともORRN、OIDO、OAANが指定されているものとする。決定木作成処理の詳細は、後述される。
(S3) The decision
(S4)決定木マージ部150は、決定木マージ処理を行う。具体的には、決定木マージ部150は、決定木T10,T20,T30をマージし、決定木T40の情報を生成する。決定木マージ部150は、決定木T40の情報を記憶部110に格納する。決定木マージ処理の詳細は、後述される。
(S4) The decision
(S5)結果出力部160は、結果レポート出力処理を行う。具体的には、結果出力部160は、記憶部110に記憶された決定木T40の情報を参照して、テスト結果テーブル119の登録内容を補完する。結果出力部160は、テスト結果テーブル119に基づいて、結果レポートを生成し、ディスプレイ11に表示させる。
(S5) The
図20は、決定木作成処理例を示すフローチャートである。以下、図20に示す処理をステップ番号に沿って説明する。以下に示す処理は、図19のステップS3に相当する。
(S11)決定木作成部140は、初期化処理を行う。具体的には、決定木作成部140は、新たなテストケースによる決定木を新規に作成する準備を行う。初期化処理の詳細は、後述される。
FIG. 20 is a flowchart showing an example of decision tree creation processing. Hereinafter, the process illustrated in FIG. 20 will be described in order of step number. The process described below corresponds to step S3 in FIG.
(S11) The decision
(S12)決定木作成部140は、記憶部110に記憶された実行状態集合117を参照して、実行状態を選択する。あるテストケースに対して、ステップS12を最初に実行する場合、前述の初期化処理で用意される初期実行状態を選択する。初期実行状態は、実行状態ID“1”であり、当初の命令ID、ミューテーション記述子およびメモリ(レジスタの組)に対する設定はなしである。なお、決定木作成部140は、着目する実行状態IDに対する命令IDおよびメモリに対する記録内容を中間コード116の実行に伴い更新する。
(S12) The decision
(S13)決定木作成部140は、記憶部110に記憶された中間コード116から次の命令を取り出す。前述のように、命令は、命令IDによって識別される。
(S14)決定木作成部140は、取り出した命令がメタ関数の呼び出しであるか否かを判定する。メタ関数の呼び出しである場合、処理をステップS16に進める。メタ関数の呼び出しでない場合、処理をステップS15に進める。
(S13) The decision
(S14) The decision
(S15)決定木作成部140は、ステップS13で取り出した元の命令を実行する。そして、決定木作成部140は、処理をステップS19に進める。
(S16)決定木作成部140は、メタ関数に含まれるMMIDが現在の実行状態に未記録のMMIDであるか否かを判定する。現在の実行状態に未記録のMMIDである場合、処理をステップS17に進める。現在の実行状態に未記録のMMIDでない場合(すなわち、現在の実行状態に記録済のMMIDである場合)、処理をステップS18に進める。
(S15) The decision
(S16) The
(S17)決定木作成部140は、決定木内部ノード追加処理を行う。決定木内部ノード追加処理の詳細は、後述される。
(S18)決定木作成部140は、取り出した命令に対応するミューテーション記述子(“nop”の場合もある)の命令を実行する。すなわち、決定木作成部140は、ミューテーション記述子で示されるミューテーション内容を、取り出した命令に適用して該当の命令を実行する。“nop”が適用される場合、該当の命令(ステップS13で取り出した元の命令)についてミューテーションを行わずに当該命令が実行されることになる。
(S17) The decision
(S18) The decision
(S19)決定木作成部140は、中間コード116を参照して、次の命令が空であるか否かを判定する。空である(すなわち、命令ID“24”に達した)場合、処理をステップS20に進める。空でない(すなわち、命令ID“24”に達していない)場合、処理をステップS13に進める。
(S19) The decision
(S20)決定木作成部140は、決定木葉ノード追加処理を行う。決定木葉ノード追加処理の詳細は、後述される。
(S21)決定木作成部140は、実行状態集合117が空であるか否かを判定する。空である場合、処理をステップS22に進める。空でない場合、処理をステップS12に進める。
(S20) The decision
(S21) The decision
(S22)決定木作成部140は、次のテストが空であるか否かを判定する。次のテストが空である(すなわち、全てのテストケースを実行した)場合、処理を終了する。次のテストが空でない(すなわち、未実行のテストケースがある)場合、処理をステップS11に進める。
(S22) The
図21は、初期化処理例を示すフローチャートである。以下、図21に示す処理をステップ番号に沿って説明する。以下に示す処理は、図20のステップS11に相当する。
(S31)決定木作成部140は、次のテストを中間コード116へ入力する。次のテストとは、テストプログラム113に含まれる3つのテストケースのうち、次に実行するテストケースを示す。例えば、決定木作成部140は、第1のテストケース(testcase1)、第2のテストケース(testcase2)、第3のテストケース(testcase3)の順に、次のテストを選択する。
FIG. 21 is a flowchart showing an example of initialization processing. Hereinafter, the process illustrated in FIG. 21 will be described in order of step number. The process described below corresponds to step S11 of FIG.
(S31) The
(S32)決定木作成部140は、初期実行状態を用意する。前述のように、初期実行状態は、実行状態ID“1”であり、当初は、命令ID、ミューテーション記述子およびメモリ(レジスタの組)に対する設定をもたない。決定木作成部140は、初期実行状態を実行状態集合117に登録する。
(S32) The decision
(S33)決定木作成部140は、新たに空の決定木を用意する。用意された決定木は、ステップS33の段階では、ノードやエッジをもたない。
図22は、決定木内部ノード追加処理例を示すフローチャートである。以下、図22に示す処理をステップ番号に沿って説明する。以下に示す処理は、図20のステップS17に相当する。
(S33) The decision
FIG. 22 is a flowchart showing an example of decision tree internal node addition processing. In the following, the process illustrated in FIG. 22 will be described in order of step number. The process described below corresponds to step S17 in FIG.
(S41)決定木作成部140は、メタ関数に対応するミューテーションオペレータの数だけ元の実行状態をコピーし、新しい実行状態を生成して、実行状態集合117に登録する。決定木作成部140は、記憶部110に格納されたミューテーションオペレータリスト114からミューテーションオペレータおよびミューテーションオペレータの数(ここでは“nop”を含まなくてよい)を特定できる。
(S41) The decision
(S42)決定木作成部140は、新しい実行状態のミューテーション記述子に、MMIDと、メタ関数に対応するミューテーションオペレータとを記録する。
(S43)決定木作成部140は、現在の実行状態のミューテーション記述子をMとして、決定木の現在位置特定処理(M)を実行する。決定木の現在位置特定処理の詳細は、後述される。ただし、今回のテストケースにおいて決定木が空の場合、現在位置は決定木の起点を示す。
(S42) The decision
(S43) The decision
(S44)決定木作成部140は、決定木の現在位置にMMIDをノードとして加え、対応するミューテーションオペレータをそのノードからのエッジとして追加する。なお、決定木が空のとき、現在位置は決定木の起点となる。その場合、ステップS44において、今回のテストケースに対して最初に(決定木の起点に)追加されたノードが根ノードとなる。それ以降は、決定木の現在位置(エッジの先)に順次内部ノードが追加されることになる。
(S44) The decision
図23は、決定木葉ノード追加処理例を示すフローチャートである。以下、図23に示す処理をステップ番号に沿って説明する。以下に示す処理は、図20のステップS20に相当する。 FIG. 23 is a flowchart showing an example of decision tree leaf node addition processing. The process illustrated in FIG. 23 will be described below in order of step number. The process described below corresponds to step S20 of FIG.
(S51)決定木作成部140は、テスト結果テーブル119に実行結果を記録する。テスト結果テーブル119で例示したように、実行結果は、ミュータントID、テストID(テストケースのID)、テスト合否(PassまたはFail)の組合せにより表される。ただし、決定木作成部140は、今回の葉ノード追加に対して何れのミューテーションも行われていない場合(ミュータントではなく元のプログラムの実行の場合)にはテスト合否をテスト結果テーブル119に記録しなくてもよい。
(S51) The decision
(S52)決定木作成部140は、現在の実行状態のミューテーション記述子をMとして、決定木の現在位置特定処理(M)を実行する。決定木の現在位置特定処理の詳細は、後述される。
(S52) The decision
(S53)決定木作成部140は、テスト合否(PassまたはFail)を表す葉ノードを決定木の現在位置に追加する。
(S54)決定木作成部140は、実行状態集合117から現在の実行状態を削除する。
(S53) The decision
(S54) The decision
図24は、決定木の現在位置特定処理例を示すフローチャートである。以下、図24に示す処理をステップ番号に沿って説明する。以下に示す処理は、図22のステップS43および図23のステップS52に相当する(ただし、後述の結果レポート出力時にも用いられる)。 FIG. 24 is a flowchart showing an example of the current position identification processing of a decision tree. In the following, the process illustrated in FIG. 24 will be described in order of step number. The processing described below corresponds to step S43 in FIG. 22 and step S52 in FIG. 23 (however, it is also used when outputting a result report described later).
(S61)決定木作成部140は、現在のテストケースに対応する決定木(着目する決定木)の根ノードを選択する。
(S62)決定木作成部140は、現在選択されているノードのMMIDが入力のミューテーション記述子Mに含まれているか否かを判定する。含まれている場合、処理をステップS63に進める。含まれていない場合、処理をステップS65に進める。
(S61) The decision
(S62) The
(S63)決定木作成部140は、ミューテーション記述子Mから、現在選択されているノードのMMIDに対応するミューテーションオペレータを取得する。
(S64)決定木作成部140は、取得したミューテーションオペレータに対応するエッジを選択する。そして、決定木作成部140は、処理をステップS66に進める。
(S63) From the mutation descriptor M, the decision
(S64) The decision
(S65)決定木作成部140は、“nop”に対応するエッジを選択する。
(S66)決定木作成部140は、ステップS64またはステップS65で選択したエッジについて、当該エッジの先にノードが存在しない、または、当該エッジの先のノードが葉ノードであるか否かを判定する。該当のエッジの先にノードが存在しない、または、該当のエッジの先のノードが葉ノードである場合、処理をステップS68に進める。該当のエッジの先に葉ノード以外のノードが存在する場合、処理をステップS67に進める。
(S65) The decision
(S66) The decision
(S67)決定木作成部140は、該当のエッジの先のノードを選択する。そして、決定木作成部140は、処理をステップS62に進める。
(S68)決定木作成部140は、該当のエッジの先を現在位置とする。
(S67) The
(S68) The
こうして、決定木作成部140は、各テストケースに対する決定木T10,T20,T30を作成する。
図25は、決定木マージ処理例を示すフローチャートである。以下、図25に示す処理をステップ番号に沿って説明する。以下に示す処理は、図19のステップS4に相当する。ここで、決定木マージ処理の入力は、(T1,T2,n)である。T1は、1つ目の決定木(あるいは決定木内の部分木)を表す。T2は、2つ目の決定木(あるいは決定木内の部分木)を表す。部分木が葉ノードのみをもつ場合、T1,T2が葉ノードを表すこともある。nは、MMIDである。本例ではnの初期値は1である。本決定木マージ処理は、以下に示すステップS79,S84において再帰的に呼び出されて実行される。
In this way, the decision
FIG. 25 is a flowchart showing an example of decision tree merge processing. Hereinafter, the process illustrated in FIG. 25 will be described in order of step number. The process described below corresponds to step S4 in FIG. Here, the input of the decision tree merge processing is (T 1 , T 2 , n). T 1 represents the first decision tree (or a subtree within the decision tree). T 2 represents the second decision tree (or a subtree within the decision tree). If the subtree has only leaf nodes, T 1 and T 2 may represent leaf nodes. n is the MMID. In this example, the initial value of n is 1. This decision tree merge processing is recursively called and executed in steps S79 and S84 shown below.
(S71)決定木マージ部150は、出力する決定木Toutを用意する。決定木Toutの初期値は空である。
(S72)決定木マージ部150は、T1またはT2がFailの葉ノードであるか否かを判定する。T1またはT2がFailの葉ノードである場合、処理をステップS73に進める。T1およびT2の何れもFailの葉ノードでない場合、処理をステップS74に進める。
(S71) The decision
(S72) The decision
(S73)決定木マージ部150は、ToutをFailの葉ノードとする。そして、決定木マージ部150は、処理をステップS86に進める。
(S74)決定木マージ部150は、T1がPassの葉ノードであるか否かを判定する。T1がPassの葉ノードである場合、処理をステップS75に進める。T1がPassの葉ノードでない場合、処理をステップS76に進める。
(S73) The decision
(S74) The decision
(S75)決定木マージ部150は、Tout=T2とする。そして、決定木マージ部150は、処理をステップS86に進める。
(S76)決定木マージ部150は、T2がPassの葉ノードであるか否かを判定する。T2がPassの葉ノードである場合、処理をステップS77に進める。T2がPassの葉ノードでない場合、処理をステップS78に進める。
(S75) The decision
(S76) The decision
(S77)決定木マージ部150は、Tout=T1とする。そして、決定木マージ部150は、処理をステップS86に進める。
(S78)決定木マージ部150は、T1,T2ともにNnが存在しないか否かを判定する。ここで、Nnは、MMIDがnのノードを示す(ノードNnと表記することもある)。T1,T2ともにNnが存在しない場合、処理をステップS79に進める。T1,T2の両方または何れか一方にNnが存在する場合、処理をステップS80に進める。
(S77) The decision
(S78) The decision
(S79)決定木マージ部150は、Tout=決定木マージ処理(T1,T2,n+1)とする。すなわち、決定木マージ部150は、nに1を加算して、決定木マージ処理を実行し、その結果をToutとする。そして、決定木マージ部150は、処理をステップS86に進める。
(S79) The decision
(S80)決定木マージ部150は、ToutにノードNnを追加する。
(S81)決定木マージ部150は、MMIDがnのときのミューテーションオペレータ(nopを含む)をmとし、各mについてステップS85までの処理を繰り返し実行する。
(S80) The decision
(S81) The decision
(S82)決定木マージ部150は、T1|[n,m]を取得する。T1|[n,m]は、T1内のNn(を根とした部分木)をT1内のen,mの先の部分木に置き換えた木である。ここで、en,mは、ノードNnから出ているミューテーションオペレータmのエッジを示す。なお、T1内にNnがない場合、T1|[n,m]=T1とする。
(S82) The decision
(S83)決定木マージ部150は、T2|[n,m]を取得する。T2|[n,m]は、T2内のNn(を根とした部分木)をT2内のen,mの先の部分木に置き換えた木である。なお、T2内にNnがない場合、T2|[n,m]=T2とする。
(S83) The decision
(S84)決定木マージ部150は、Tout内のen,mの先に対し決定木マージ処理(T1|[n,m],T2|[n,m],n+1)の出力を加える。
(S85)決定木マージ部150は、MMID=nに対する全てのmについてステップS81以降の処理を終えると、処理をステップS86に進める。
(S84) The decision
(S85) When the decision
(S86)決定木マージ部150は、Toutを出力する。
このように、決定木マージ部150は、決定木マージ処理を再帰的に実行することで、2つの決定木をマージする。3つの決定木T10,T20,T30をマージする場合、決定木マージ部150は、まず、決定木マージ処理の手順により、2つの決定木(例えば、決定木T20,T30)をマージする。次に、決定木マージ部150は、当該マージ結果として得られた決定木と、残りの1つの決定木(例えば、決定木T10)とを、上記の決定木マージ処理の手順によりマージする。こうして、決定木マージ部150は、3つの決定木T10,T20,T30のマージ結果である決定木T40を得る。4以上の決定木をマージする場合も同様である。例えば、4つの決定木をマージする場合、3つの決定木のマージ結果である決定木T40および残りの1つの決定木に対して決定木マージ処理を行えばよい。
(S86) The decision
In this way, the decision
図26は、結果レポート出力処理例を示すフローチャートである。以下、図26に示す処理をステップ番号に沿って説明する。以下に示す処理は、図19のステップS5に相当する。 FIG. 26 is a flowchart showing an example of the result report output processing. In the following, the process illustrated in FIG. 26 will be described in order of step number. The process described below corresponds to step S5 of FIG.
(S91)結果出力部160は、テスト結果テーブル119において、何れかのテストケースによる実行結果がFailを含むミュータントのミュータント生存結果をKilledとする。
(S91) In the test result table 119, the
(S92)結果出力部160は、ミュータント生存結果が未確定のミュータントのミューテーション記述子をMとして、ステップS97までの処理を繰り返し実行する。
(S93)結果出力部160は、決定木T40に対する決定木の現在位置特定処理(M)により葉ノードを特定する。具体的には、結果出力部160は、決定木T40に対する決定木の現在位置特定処理(M)を、決定木作成部140により実行させ、その結果を得る(当該処理により葉ノードが特定されることになる)。決定木の現在位置特定処理の手順は、図24で例示した手順と同様である。なお、結果出力部160が、決定木の現在位置特定処理を行ってもよい。
(S92) The
(S93) The
(S94)結果出力部160は、決定木T40の現在位置の先の葉ノードがFailの葉ノードであるか否かを判定する。Failの葉ノードである場合、処理をステップS95に進める。Failの葉ノードでない場合(すなわち、Passの葉ノードである場合)、処理をステップS96に進める。
(S94) The
(S95)結果出力部160は、ミューテーション記述子Mに対応するミュータントのミュータント生存結果をKilledと決定し、テスト結果テーブル119の該当箇所にKilledを記録する。決定木T40でFailに辿り着いたということは、ミューテーション記述子Mに対応するミュータントに対し、3つのテストケースのうちの少なくとも1つでFailになることを示すからである。そして、処理をステップS97に進める。
(S95) The
(S96)結果出力部160は、ミューテーション記述子Mに対応するミュータントのミュータント生存結果をUnkilledと決定し、テスト結果テーブル119の該当箇所にUnkilledを記録する。決定木T40でPassに辿り着いたということは、ミューテーション記述子Mに対応するミュータントに対し、3つのテストケースの全てでPassになることを示すからである。
(S96) The
(S97)結果出力部160は、全てのMについてステップS92以降の処理を終えると、処理をステップS98に進める。
(S98)結果出力部160は、テスト結果テーブル119におけるミュータント生存結果に基づいて、ミューテーションスコア(MS)を算出する。ミューテーションスコアは、全ミュータント数に対するKilledの数の割合である。
(S97) When the
(S98) The
(S99)結果出力部160は、記憶部110に記憶されたメタミューテーション情報115を用いて、ミュータントの位置情報を復元する。
(S100)結果出力部160は、ミューテーションスコア(MS)とUnkilledミュータントとを結果レポートとして出力する。例えば、結果出力部160は、ディスプレイ11により、結果レポートを表示させる。また、ユーザによりUnkilledミュータントが選択されると、当該ミュータントに対応するソースコードの該当箇所をディスプレイ11により表示させる。
(S99) The
(S100) The
このように、結果出力部160は、テストの実行により取得された第1のテスト結果および決定木T10,T20,T30に基づいて決定された第2のテスト結果に応じて、結果レポートを出力する。前述のように、結果レポートは、複数のミュータント(ミューテーション箇所の複数の組合せ)のうち、複数のテストケースにより検出可能なミュータントに関する情報(例えば、ミューテーションスコア(MS))を含んでもよい。また、結果レポートは、複数のテストケースにより検出不可能なミュータントに関する情報(例えば、Unkilledミュータントのリストやソースコードの該当箇所の情報)を含んでもよい。
In this way, the
次に、解析装置100の上記手順による処理の具体例を説明する。まず、図20の手順による決定木T10の作成方法を具体的に説明する。
図27は、決定木の作成例(その1)を示す図である。以下では、テストID“Test1”に対応する第1のテストケース(testcase1)を想定する。テストプログラム113によれば、第1のテストケースでは、func(0)==0を確認する。図27以降の決定木の作成例では、中間コード116による処理内容が分かり易いようにソースコード111も図示する。中間コード116における参照中の命令、および、当該命令に対応するソースコード111の該当箇所を四角形で囲って示す。
Next, a specific example of the processing of the
FIG. 27 is a diagram illustrating an example (part 1) of creating a decision tree. Below, the 1st test case (testcase1) corresponding to test ID "Test1" is assumed. According to the
まず、決定木作成部140は、初期実行状態(実行状態ID“1”の実行状態)を選択した上で、中間コード116における命令ID“3”の命令に到達する。命令ID“3”の命令は、メタ関数bop_ltを含む。当該メタ関数bop_ltの第1引数で示されるMMID=1は、実行状態ID“1”の実行状態に未記録のMMIDである。そこで、決定木作成部140は、この段階における実行状態ID“1”の実行状態を複製して、実行状態ID“2”の実行状態(この段階では命令ID=3)を実行状態集合117に追加する。図中では、実行状態ID“X”の実行状態を“StateX”のように表す。なお、実行状態ID“1”の実行状態におけるミューテーション記述子は“nop”(変更しないことを示す)である。実行状態ID“2”の実行状態におけるミューテーション記述子は(1,>=)である。
First, the decision
また、決定木作成部140は、根ノードとしてMMID=1のノードm1を決定木T10に追加する。決定木作成部140は、“nop”に対応するエッジおよび“>=”に対応するエッジをノードm1に追加する。
Further, the decision
決定木作成部140は、ノードm1の“nop”に対応するエッジを選択し、当該エッジの先を現在位置とする。この場合、決定木作成部140は、命令ID“3”の命令を元の演算“<”のまま実行する。
The decision
図28は、決定木の作成例(その2)を示す図である。決定木作成部140は、中間コード116の実行を継続し、命令ID“11”の命令に到達する。命令ID“11”の命令は、メタ関数bop_gtを含む。当該メタ関数bop_gtの第1引数で示されるMMID=3は、実行状態ID“1”の実行状態に未記録のMMIDである。そこで、決定木作成部140は、この段階における実行状態ID“1”の実行状態を複製して、実行状態ID“3”の実行状態(この段階では命令ID=11)を実行状態集合117に追加する。実行状態ID“3”の実行状態におけるミューテーション記述子は(3,<=)である。
FIG. 28 is a diagram illustrating an example (No. 2) of creating a decision tree. The decision
また、決定木作成部140は、ノードm1の“nop”に対応するエッジの先に、MMID=3のノードm3を追加する。決定木作成部140は、“nop”に対応するエッジおよび“<=”に対応するエッジをノードm3に追加する。
Further, the decision
決定木作成部140は、ノードm3の“nop”に対応するエッジを選択し、当該エッジの先を現在位置とする。この場合、決定木作成部140は、命令ID“11”の命令を元の演算“>”のまま実行する。
The decision
図29は、決定木の作成例(その3)を示す図である。決定木作成部140は、中間コード116の実行を継続し、実行状態ID“1”の実行状態において%13=0となり、func(0)==0が成立することを確認する。このため、決定木作成部140は、ノードm3の“nop”に対応するエッジの先にPassの葉ノードを追加する。そして、決定木作成部140は、実行状態集合117から、実行状態ID“1”の実行状態を削除する。
FIG. 29 is a diagram illustrating an example (part 3) of creating a decision tree. The decision
次に、決定木作成部140は、実行状態集合117に登録された実行状態のうち、実行状態ID“3”の実行状態を選択する。ここで、決定木作成部140は、SSEの手法を用いている。決定木作成部140による実行状態の選択順は、深さ優先探索のアルゴリズムに基づく(実行状態IDを昇順に付与していくので、実行状態IDの大きいものから選択する)。ただし、別のアルゴリズムを用いて、次の実行状態を選択してもよい。
Next, the decision
決定木作成部140は、実行状態ID“3”の情報を参照して、中間コード116における命令ID“11”の命令に戻り、ミューテーション記述子(3,<=)に対応するエッジを選択し、当該エッジの先を現在位置とする。この場合、決定木作成部140は、命令ID“11”の命令を“<=”の演算に変更して実行する。
The decision
図30は、決定木の作成例(その4)を示す図である。決定木作成部140は、中間コード116の実行を継続し、命令ID“15”の命令に到達する。命令ID“15”の命令は、メタ関数bop_mulを含む。当該メタ関数bop_mulの第1引数で示されるMMID=4は、実行状態ID“3”の実行状態に未記録のMMIDである。
FIG. 30 is a diagram showing an example (part 4) of creating a decision tree. The decision
そこで、決定木作成部140は、この段階における実行状態ID“3”の実行状態を複製して、実行状態ID“4”の実行状態(この段階では命令ID=15)を実行状態集合117に追加する。実行状態ID“4”の実行状態におけるミューテーション記述子は、{(3,<=),(4,/)}である。
Therefore, the decision
更に、決定木作成部140は、この段階における実行状態ID“3”の実行状態を複製して、実行状態ID“5”の実行状態(この段階では命令ID=15)を実行状態集合117に追加する。実行状態ID“5”の実行状態におけるミューテーション記述子は、{(3,<=),(4,%)}である。
Further, the decision
また、決定木作成部140は、ノードm3の“<=”に対応するエッジの先に、MMID=4のノードm4を追加する。決定木作成部140は、“nop”に対応するエッジ、“/”に対応するエッジ、および、“%”に対応するエッジをノードm4に追加する。
Further, the decision
決定木作成部140は、ノードm4の“nop”に対応するエッジを選択し、当該エッジの先を現在位置とする。この場合、決定木作成部140は、命令ID“15”の命令を元の演算“*”のまま実行する。
The decision
図31は、決定木の作成例(その5)を示す図である。決定木作成部140は、中間コード116の実行を継続し、実行状態ID“3”の実行状態において、%13=0となり、func(0)==0が成立することを確認する。決定木作成部140は、テスト結果テーブル119のミュータントID“M3”およびテストID“Test1”に対して、“Passed”を記録する。決定木作成部140は、ノードm4の“nop”に対応するエッジの先にPassの葉ノードを追加する。そして、決定木作成部140は、実行状態集合117から、実行状態ID“3”の実行状態を削除する。
FIG. 31 is a diagram illustrating an example (No. 5) of creating a decision tree. The decision
次に、決定木作成部140は、実行状態集合117に登録された実行状態のうち、実行状態ID“5”の実行状態を選択する。
決定木作成部140は、実行状態ID“5”の情報を参照して、中間コード116における命令ID“15”の命令に戻り、ミューテーション記述子(4,%)に対応するエッジを選択し、当該エッジの先を現在位置とする。この場合、決定木作成部140は、命令ID“15”の命令を“%”の演算に変更して実行する。
Next, the decision
The decision
図32は、決定木の作成例(その6)を示す図である。決定木作成部140は、中間コード116の実行を継続し、実行状態ID“5”の実行状態において、%13=0となり、func(0)==0が成立することを確認する。決定木作成部140は、テスト結果テーブル119のミュータントID“M3,5”およびテストID“Test1”に対して、“Passed”を記録する。決定木作成部140は、ノードm4の“%”に対応するエッジの先にPassの葉ノードを追加する。そして、決定木作成部140は、実行状態集合117から実行状態ID“5”の実行状態を削除する。
FIG. 32 is a diagram illustrating an example (No. 6) of creating a decision tree. The decision
次に、決定木作成部140は、実行状態集合117に登録された実行状態のうち、実行状態ID“4”の実行状態を選択する。
決定木作成部140は、実行状態ID“4”の情報を参照して、中間コード116における命令ID“15”の命令に戻り、ミューテーション記述子(4,/)に対応するエッジを選択し、当該エッジの先を現在位置とする。この場合、決定木作成部140は、命令ID“15”の命令を“/”の演算に変更して実行する。
Next, the decision
The decision
図33は、決定木の作成例(その7)を示す図である。決定木作成部140は、中間コード116の実行を継続し、実行状態ID“4”の実行状態において、%13=0となり、func(0)==0が成立することを確認する。決定木作成部140は、テスト結果テーブル119のミュータントID“M3,4”およびテストID“Test1”に対して、“Passed”を記録する。決定木作成部140は、ノードm4の“/”に対応するエッジの先にPassの葉ノードを追加する。そして、決定木作成部140は、実行状態集合117から実行状態ID“4”の実行状態を削除する。
FIG. 33 is a diagram showing an example (No. 7) of creating a decision tree. The decision
次に、決定木作成部140は、実行状態集合117に登録された実行状態ID“2”の実行状態を選択する。
決定木作成部140は、実行状態ID“2”の情報を参照して、中間コード116における命令ID“3”の命令に戻り、ミューテーション記述子(1,>=)に対応するエッジを選択し、当該エッジの先を現在位置とする。この場合、決定木作成部140は、命令ID“3”の命令を“>=”の演算に変更して実行する。
Next, the decision
The decision
図34は、決定木の作成例(その8)を示す図である。決定木作成部140は、中間コード116の実行を継続し、命令ID“7”の命令に到達する。命令ID“7”の命令は、メタ関数bop_addを含む。当該メタ関数bop_addの第1引数で示されるMMID=2は、実行状態ID“2”の実行状態に未記録のMMIDである。そこで、決定木作成部140は、この段階における実行状態ID“2”の実行状態を複製して、実行状態ID“6”の実行状態(この段階では命令ID=7)を実行状態集合117に追加する。実行状態ID“6”の実行状態におけるミューテーション記述子は、{(1,>=),(2,−)}である。
FIG. 34 is a diagram illustrating an example (No. 8) of creating a decision tree. The decision
また、決定木作成部140は、ノードm1の“>=”に対応するエッジの先に、MMID=2のノードm2を追加する。決定木作成部140は、“nop”に対応するエッジおよび“−”に対応するエッジをノードm2に追加する。
In addition, the decision
決定木作成部140は、ノードm2の“nop”に対応するエッジを選択し、当該エッジの先を現在位置とする。この場合、決定木作成部140は、命令ID“7”の命令を元の演算“+”のまま実行する。
The decision
図35は、決定木の作成例(その9)を示す図である。決定木作成部140は、中間コード116の実行を継続し、実行状態ID“2”の実行状態において、%13=1となり、func(0)==0が成立しないことを確認する。決定木作成部140は、テスト結果テーブル119のミュータントID“M1”およびテストID“Test1”に対して、“Failed”を記録する。決定木作成部140は、ノードm2の“nop”に対応するエッジの先にFailの葉ノードを追加する。そして、決定木作成部140は、実行状態集合117から、実行状態ID“2”の実行状態を削除する。
FIG. 35 is a diagram showing an example (No. 9) of creating a decision tree. The decision
次に、決定木作成部140は、実行状態集合117に登録された実行状態ID“6”の実行状態を選択する。
決定木作成部140は、実行状態ID“6”の情報を参照して、中間コード116における命令ID“7”の命令に戻り、ミューテーション記述子(2,−)に対応するエッジを選択し、当該エッジの先を現在位置とする。この場合、決定木作成部140は、命令ID“7”の命令を“−”の演算に変更して実行する。
Next, the decision
The decision
図36は、決定木の作成例(その10)を示す図である。決定木作成部140は、中間コード116の実行を継続し、実行状態ID“6”の実行状態において、%13=−1となり、func(0)==0が成立しないことを確認する。決定木作成部140は、テスト結果テーブル119のミュータントID“M1,2”およびテストID“Test1”に対して、“Failed”を記録する。決定木作成部140は、ノードm2の“−”に対応するエッジの先にFailの葉ノードを追加する。そして、決定木作成部140は、実行状態集合117から、実行状態ID“6”の実行状態を削除する。
FIG. 36 is a diagram illustrating an example (No. 10) of creating a decision tree. The decision
この段階で、実行状態集合117に登録された実行状態がなくなる。このため、決定木作成部140は、テストID“Test1”のテストケースの実行を完了する。また、決定木作成部140は、決定木T10の作成を完了する。決定木作成部140は、次のテストID“Test2”のテストケースを選択する。決定木作成部140は、他のテストケースについても同様にして、決定木T20,T30を作成する。
At this stage, the execution states registered in the execution state set 117 disappear. Therefore, the decision
次に、2つの決定木のマージ例を説明する。以下では、決定木T20,T30をマージする場合を例示する。
図37は、決定木のマージ例(その1)を示す図である。図37(A)は、決定木作成部140により作成された決定木T20(Test2(m1,m2,m3,m4))を示す。図37(B)は、決定木作成部140により作成された決定木T30(Test3(m1,m2,m3,m4))を示す。決定木作成部140は、決定木Tout(1)を用意する。ここで、決定木マージ処理の再帰的な実行により登場するToutを、Tout(1)、Tout(2)、・・・のように表記して区別する。決定木Tout(1)は、この段階では空である。
Next, an example of merging two decision trees will be described. Below, the case where the decision trees T20 and T30 are merged is illustrated.
FIG. 37 is a diagram showing an example (part 1) of merging decision trees. FIG. 37A shows the decision tree T20 (Test2(m1, m2, m3, m4)) created by the decision
まず、決定木マージ処理の入力は、(T1,T2,n)=(Test2(m1,m2,m3,m4),Test3(m1,m2,m3,m4),1)である。T1=Test2(m1,m2,m3,m4)およびT2=Test3(m1,m2,m3,m4)は、何れも、Failの葉ノードのみの木ではない(ステップS72 No)。また、T1=Test2(m1,m2,m3,m4)およびT2=Test3(m1,m2,m3,m4)は、何れも、Passの葉ノードのみの木ではない(ステップS74 NoかつステップS76 No)。更に、T1=Test2(m1,m2,m3,m4)およびT2=Test3(m1,m2,m3,m4)には、N1に相当するノードm1が存在する(ステップS78 No)。 First, the input of the decision tree merge processing is (T 1 , T 2 , n)=(Test2(m1, m2, m3, m4), Test3(m1, m2, m3, m4), 1). Neither T 1 =Test2 (m1, m2, m3, m4) nor T 2 =Test3 (m1, m2, m3, m4) is a tree of Fail leaf nodes only (step S72 No). Moreover, neither T 1 =Test2 (m1, m2, m3, m4) nor T 2 =Test3 (m1, m2, m3, m4) is a tree having only Pass leaf nodes (No in step S74 and step S76). No). Furthermore, at T 1 =Test2 (m1, m2, m3, m4) and T 2 =Test3 (m1, m2, m3, m4), a node m1 corresponding to N1 exists (step S78 No).
よって、決定木マージ部150は、Tout(1)にノードm1を追加する(ステップS80)。
図38は、決定木のマージ例(その2)を示す図である。ノードm1におけるミューテーションオペレータは、“>=”および“nop”である。そこで、決定木マージ部150は、これら2つのミューテーションオペレータに対して、ステップS81〜S85を実行する。まず、“>=”について考える。
Therefore, the decision
FIG. 38 is a diagram illustrating an example (part 2) of merging decision trees. The mutation operators in the node m1 are “>=” and “nop”. Therefore, the decision
この場合、T1|[1,>=]=Test2|[1,>=](m2,m3,m4)は、決定木T20のノードm1の“>=”に対応するエッジの先の部分木T21である(ステップS82)。 In this case, T 1 | [1,>=] =Test2| [1,>=] (m2,m3,m4) is the subtree at the end of the edge corresponding to “>=” of the node m1 of the decision tree T20. It is T21 (step S82).
また、T2|[1,>=]=Test3|[1,>=](m2,m3,m4)は、決定木T30のノードm1の“>=”に対応するエッジの先の部分木T31である(ステップS83)。
決定木マージ部150は、入力を(T1|[1,>=],T2|[1,>=],2)として、決定木マージ処理を実行する。決定木マージ部150は、決定木Tout(1)におけるノードm1の“>=”に対応するエッジ(e1,>=)の先に、決定木マージ処理(T1|[1,>=],T2|[1,>=],2)の出力Tout(2)を追加する(ステップS84)。
Further, T 2 | [1,>=] =Test3| [1,>=] (m2, m3, m4) is a subtree T31 at the end of the edge corresponding to “>=” of the node m1 of the decision tree T30. (Step S83).
The decision
次に、“nop”について考える。
この場合、T1|[1,nop]=Test2|[1,nop](m2,m3,m4)は、決定木T20のノードm1の“nop”に対応するエッジの先の部分木T22である(ステップS82)。
Next, consider “nop”.
In this case, T 1 | [1,nop] =Test2| [1,nop] (m2, m3, m4) is the subtree T22 ahead of the edge corresponding to “nop” of the node m1 of the decision tree T20. (Step S82).
また、T2|[1,nop]=Test3|[1,nop](m2,m3,m4)は、決定木T30のノードm1の“nop”に対応するエッジの先の部分木T32である(ステップS83)。 Further, T 2 | [1,nop] =Test3| [1,nop] (m2, m3, m4) is the subtree T32 at the end of the edge corresponding to the “nop” of the node m1 of the decision tree T30 ( Step S83).
決定木マージ部150は、入力を(T1|[1,nop],T2|[1,nop],2)として、決定木マージ処理を実行し、その出力を、決定木Tout(1)におけるノードm1の“nop”に対応するエッジ(e1,nop)の先に追加する(ステップS84)。
The decision
次に、前述の部分木T21,T31のマージ例(決定木マージ処理(T1|[1,>=],T2|[1,>=],2))を説明する。
決定木作成部140は、決定木Tout(2)を用意する。決定木Tout(2)は、この段階では空である。
Next, an example of merging the above-mentioned subtrees T21 and T31 (decision tree merge processing (T 1 | [1,>=] , T 2 | [1,>=] , 2)) will be described.
The decision
T1|[1,>=]およびT2|[1,>=]は、何れも、Failの葉ノードのみの木ではない(ステップS72 No)。また、T1|[1,>=]およびT2|[1,>=]は、何れも、Passの葉ノードのみの木ではない(ステップS74 NoかつステップS76 No)。更に、T1|[1,>=]には、N2に相当するノードm2が存在する(ステップS78 No)。 Neither T 1 | [1,>=] nor T 2 | [1,>=] is a tree of Fail leaf nodes only (step S 72 No). Further, neither T 1 | [1,>=] or T 2 | [1,>=] is a tree having only leaf nodes of Pass (step S 74 No and step S 76 No). Furthermore, a node m2 corresponding to N2 exists in T 1 | [1, >=] (No in step S78).
よって、決定木マージ部150は、決定木Tout(2)にノードm2を追加する(ステップS80)。
図39は、決定木のマージ例(その3)を示す図である。ノードm2におけるミューテーションオペレータは、“−”および“nop”である。そこで、決定木マージ部150は、これら2つのミューテーションオペレータに対して、ステップS81〜S85を実行する。まず、“−”について考える。
Therefore, the decision
FIG. 39 is a diagram illustrating an example (part 3) of merging decision trees. The mutation operators at node m2 are "-" and "nop". Therefore, the decision
この場合、T1|[1,>=],[2,-]=Test2|[1,>=],[2,-](m3,m4)は、部分木T21のノードm2の“−”に対応するエッジの先の部分木T21aである(ステップS82)。部分木T21aは、Failの葉ノードのみを要素にもつ。 In this case, T 1 | [1,>=],[2,-] =Test2| [1,>=],[2,-] (m3,m4) is "-" of the node m2 of the subtree T21. It is the partial tree T21a at the end of the edge corresponding to (step S82). The subtree T21a has only a leaf node of Fail as an element.
また、部分木T31は、ノードm2をもたない。このため、T2|[1,>=],[2,-]=Test3|[1,>=],[2,-](m3,m4)は、部分木T31と同じ構造をもつ部分木T31aである(ステップS83)。 Further, the subtree T31 does not have the node m2. Therefore, T 2 | [1,>=],[2,-] =Test3| [1,>=],[2,-] (m3,m4) is a subtree having the same structure as the subtree T31. It is T31a (step S83).
決定木マージ部150は、入力を(T1|[1,>=],[2,-],T2|[1,>=],[2,-],3)として、決定木マージ処理を実行する。決定木マージ部150は、決定木Tout(2)におけるノードm2の“−”に対応するエッジ(e2,-)の先に、決定木マージ処理(T1|[1,>=],[2,-],T2|[1,>=],[2,-],3)の出力Tout(3)を追加する(ステップS84)。
The decision
この場合、T1|[1,>=],[2,-]は、Failの葉ノードのみをもつ部分木T21aを示すので、Tout(3)はFailの葉ノードとなる(ステップS72 Yes,S73,S86)。 In this case, T 1 | [1, >=], [2,-] indicates a subtree T21a having only Fail leaf nodes, and thus Tout(3) is a Fail leaf node (step S72 Yes, S73, S86).
次に、“nop”について考える。
この場合、T1|[1,>=],[2,nop]=Test2|[1,>=],[2,nop](m3,m4)は、部分木T21のノードm2の“nop”に対応するエッジの先の部分木T21bである(ステップS82)。部分木T21bは、Passの葉ノードのみを要素にもつ。
Next, consider “nop”.
In this case, T 1 | [1,>=],[2,nop] =Test2| [1,>=],[2,nop] (m3,m4) is the “nop” of the node m2 of the subtree T21. It is the partial tree T21b at the end of the edge corresponding to (step S82). The subtree T21b has only leaf nodes of Pass as elements.
また、部分木T31は、ノードm2をもたない。このため、T2|[1,>=],[2,nop]=Test3|[1,>=],[2,nop](m3,m4)は、部分木T31と同じ構造をもつ部分木T31bである(ステップS83)。 Further, the subtree T31 does not have the node m2. Therefore, T 2 | [1,>=],[2,nop] =Test3| [1,>=],[2,nop] (m3,m4) is a subtree having the same structure as the subtree T31. It is T31b (step S83).
決定木マージ部150は、入力を(T1|[1,>=],[2,nop],T2|[1,>=],[2,nop],3)として、決定木マージ処理を実行する。決定木マージ部150は、決定木Tout(2)におけるノードm2の“nop”に対応するエッジ(e2,nop)の先に、決定木マージ処理(T1|[1,>=],[2,nop],T2|[1,>=],[2,nop],3)の出力Tout(4)を追加する(ステップS84)。
The decision
この場合、T1|[1,>=],[2,nop]およびT2|[1,>=],[2,nop]は、何れも、Failの葉ノードのみの木ではない(ステップS72 No)。
一方、T1|[1,>=],[2,nop]は、Passの葉ノードのみをもつ部分木T21bを示すので、Tout(4)=T2|[1,>=],[2,nop]となる(ステップS74 Yes,S75,S86)。
In this case, T 1 | [1,>=],[2,nop] and T 2 | [1,>=],[2,nop] are not trees of Fail leaf nodes only (step S72 No).
On the other hand, T 1 | [1,>=],[2,nop] indicates a subtree T21b having only leaf nodes of Pass, so Tout(4)=T 2 | [1,>=],[2 , nop] (step S74 Yes, S75, S86).
図40は、決定木のマージ例(その4)を示す図である。木T51は、決定木T20,T30のマージ途中の木であり、図39で例示したマージ処理の結果(決定木Tout(2))が決定木Tout(1)に追加された段階を示している。 FIG. 40 is a diagram showing an example (part 4) of merging decision trees. The tree T51 is a tree in the middle of merging the decision trees T20 and T30, and shows the stage in which the result of the merge processing illustrated in FIG. 39 (decision tree Tout(2)) is added to the decision tree Tout(1). ..
決定木マージ部150は、木T51におけるノードm1の“nop”に対応するエッジの先も同様にしてマージ処理を実行し、決定木T20,T30をマージした決定木T52を得る。決定木T52は、Tout(1)の出力結果である。
The decision
決定木マージ部150は、決定木T52と決定木T10とに対して決定木マージ処理を実行することで、決定木T40を得る。
図41は、決定木を辿る例(その1)を示す図である。結果出力部160は、テスト結果テーブル119に記録された各ミュータントに対するテストケースの実行結果(PassedまたはFailed)に基づいて、各ミュータントのミュータント生存結果を得る。ただし、結果出力部160は、テスト結果テーブル119において、実行結果“Failed”が記録されていないミュータントについては、ミュータント生存結果を得ることができない。そこで、結果出力部160は、決定木T40を辿ることで、ミュータント生存結果を得られていないミュータントに対するミュータント生存結果を決定する。
The decision
FIG. 41 is a diagram illustrating an example (part 1) of tracing a decision tree. The
例えば、図13で例示したテスト結果テーブル119では、2次のミュータントM3,4について、テストID“Test1”のテストケースに“Passed”が記録されているのみであり、ミュータント生存結果が得られていない。 For example, in the test result table 119 illustrated in FIG. 13, only “Passed” is recorded in the test case of the test ID “Test1” for the secondary mutant M 3,4 , and the mutant survival result is obtained. Not not.
そこで、結果出力部160は、ミュータントM3,4について、決定木T40によりミュータント生存結果を決定する。コード111aは、ミュータントM3,4に対応するコード例である。コード111aでは、ソースコード111のMMID“3”に対応する箇所(4行目)の演算子“>”が演算子“<=”に変更されている。コード111aでは、ソースコード111のMMID“4”に対応する箇所(5行目)の演算子“*”が演算子“/”に変更されている。
Therefore, the
まず、結果出力部160は、決定木T40の根ノードであるノードm1を選択する。ミュータントM3,4は、MMID“1”のミューテーションオペレータを含まない(すなわち、MMID“1”に対するミューテーションオペレータは“nop”である)。このため、結果出力部160は、ノードm1の“nop”のエッジを辿り、ノードm2を選択する。
First, the
ミュータントM3,4は、MMID“2”のミューテーションオペレータを含まない(すなわち、MMID“2”に対するミューテーションオペレータは“nop”である)。このため、結果出力部160は、ノードm2の“nop”のエッジを辿り、ノードm3を選択する。
Mutant M 3,4 does not include the mutation operator of MMID “2” (that is, the mutation operator for MMID “2” is “nop”). Therefore, the
ミュータントM3,4のMMID“3”のミューテーションオペレータは、“<=”である。このため、結果出力部160は、ノードm3の“<=”のエッジを辿り、Failの葉ノードに辿り着く。Failの葉ノードに辿り着いたので、結果出力部160は、ミュータントM3,4がkillされると判断する。したがって、結果出力部160は、テスト結果テーブル119のミュータントM3,4に対して、ミュータント生存結果“Killed”を登録する。
The mutation operator of the MMID “3” of the mutant M 3,4 is “<=”. Therefore, the
なお、テストID“Test2”のテストケース(func(1)==2)に対し、コード111aを実際に実行すると、func(1)=0なので、ミュータントM3,4に対する実行結果は“Fail”である。また、テストID“Test3”のテストケース(func(−1)==0)に対し、コード111aを実際に実行すると、func(−1)=0なので、ミュータントM3,4に対する実行結果は“Pass”である。テストID“Test2”のテストケースで“Fail”なので、決定木T40を辿ることで得られたミュータント生存結果“Killed”は正しいテスト結果である。解析装置100は、実際にテストID“Test2”、“Test3”のテストケースを実行せずに、ミュータントM3,4に対するテスト結果を得られたことになる。
Incidentally, with respect to test case of the test ID "Test2" (func (1 ) == 2), when actually executing the
図42は、決定木を辿る例(その2)を示す図である。次に、3次のミュータントM1,3,4を考える。図13で例示したテスト結果テーブル119では、3次のミュータントM1,3,4について、テストID“Test3”のテストケースに“Passed”が記録されているのみであり、ミュータント生存結果が得られていない。 FIG. 42 is a diagram illustrating an example (part 2) of tracing a decision tree. Next, consider the third-order mutants M 1,3,4 . In the test result table 119 illustrated in FIG. 13, for the third-order mutants M 1,3,4 , only “Passed” is recorded in the test case of the test ID “Test3”, and the mutant survival result is obtained. Not not.
そこで、結果出力部160は、ミュータントM1,3,4について、決定木T40によりミュータント生存結果を決定する。コード111bは、ミュータントM1,3,4に対応するコード例である。コード111bでは、ソースコード111のMMID“1”に対応する箇所(2行目)の演算子“<”が演算子“>=”に変更されている。また、コード111bでは、ソースコード111のMMID“3”に対応する箇所(4行目)の演算子“>”が演算子“<=”に変更されている。更に、コード111bでは、ソースコード111のMMID“4”に対応する箇所(5行目)の演算子“*”が演算子“/”に変更されている。
Therefore, the
まず、結果出力部160は、決定木T40の根ノードであるノードm1を選択する。ミュータントM1,3,4のMMID“1”のミューテーションオペレータは、“>=”である。このため、結果出力部160は、ノードm2の“>=”のエッジを辿り、ノードm2を選択する。
First, the
ミュータントM1,3,4は、MMID“2”のミューテーションオペレータを含まない(すなわち、MMID“2”に対してミューテーションオペレータは“nop”である)。このため、結果出力部160は、ノードm2の“nop”のエッジを辿り、Failの葉ノードに辿り着く。Failの葉ノードに辿り着いたので、結果出力部160は、テスト結果テーブル119のミュータントM1,3,4に対して、ミュータント生存結果“Killed”を登録する。
Mutants M 1,3,4 do not include the mutation operator of MMID “2” (that is, the mutation operator is “nop” for MMID “2”). Therefore, the
なお、テストID“Test1”のテストケース(func(0)==0)に対し、コード111bを実際に実行すると、func(0)=1なので、ミュータントM1,3,4に対する実行結果は“Fail”である。また、テストID“Test2”のテストケース(func(1)==2)に対し、コード111bを実際に実行すると、func(1)=2なので、ミュータントM1,3,4に対する実行結果は“Pass”である。テストID“Test1”のテストケースで“Fail”なので、決定木T40を辿ることで得られたミュータント生存結果“Killed”は正しいテスト結果である。解析装置100は、実際にテストID“Test1”、“Test2”のテストケースを実行せずに、ミュータントM1,3,4に対するテスト結果を得られたことになる。
When the
図43は、テスト結果の取得例を示す図である。結果出力部160は、こうして、決定木T40を辿ることで、ミュータント生存結果を得られていないミュータントに対するミュータント生存結果を補完し、テスト結果テーブル119aを得る。
FIG. 43 is a diagram illustrating an example of acquisition of test results. In this way, the
具体的には、SSEによるテスト実行では、図13のテスト結果テーブル119で示したように、21個のミュータントのうち、ミュータントM1,M2,M3,M4,M5,M1,2,M1,3,M1,3,5のミュータント生存結果を得られる。一方、残りの13個のミュータントについては、ミュータント生存結果を得られない。 Specifically, in the test execution by SSE, as shown in the test result table 119 of FIG. 13, among the 21 mutants, the mutants M 1 , M 2 , M 3 , M 4 , M 5 , M 1, Mutant survival results of 2 , M 1,3 , M 1,3,5 are obtained. On the other hand, no mutant survival results can be obtained for the remaining 13 mutants.
そこで、結果出力部160は、各ミュータントについて決定木T40を辿ることで、各ミュータントのミュータント生存結果を得る。これにより、結果出力部160は、前述のミュータントM3,4,M1,3,4を含むミュータント生存結果を得られていないミュータントに対し、ミュータント生存結果を得られる。このとき、結果出力部160は、全てのテストケースで試行されなかったミュータント(例えば、ミュータントM1,4,M1,2,3など)に対するミュータント生存結果も得ることができる。
Therefore, the
すなわち、解析装置100は、一部のテストケースにより試行されるミュータント箇所(変更箇所)の組合せのうち、当該一部のテストケースの実行結果からはミュータント生存結果(テスト結果)を取得できない組合せに対して、効率的にテスト結果を得られる。また、解析装置100は、現在用意されている複数のテストケースでは試行されないミュータント箇所の組合せに対しても、効率的にテスト結果を得られる。
That is, the
テスト結果テーブル119aの例では、ユーザにより指定された3次以下のミュータントのミュータント生存結果が全て“Killed”である。このため、結果出力部160は、ミューテーションスコアMS=21/21=100%を出力する。したがって、現在のテストプログラム113により、3次以下のミュータントを全て検出できることが分かる。ミューテーションスコアMSが100%未満であれば、ユーザは、例えば、ミュータントの検出率(ミューテーションスコア)を向上するように、テストプログラムの改善を図れる。
In the example of the test result table 119a, all the mutant survival results of the third or lower mutants designated by the user are “Killed”. Therefore, the
図44は、SSEでは実行されないミュータントの例を示す図である。SSEでは、前述のように、ソースコード111をコンパイルして得られた中間コード116に対して、命令の実行順に、実行状態を分岐させながらミューテーションを行う。このため、ユーザにより指定された次数のミュータントのうち、比較的高次のミュータントの実行が省略されることがある。
FIG. 44 is a diagram illustrating an example of a mutant that is not executed in SSE. In SSE, as described above, the
ここで、図44では、一例として、ミュータントM1に対応するコード111x、ミュータントM3に対応するコード111y、ミュータントM3,4に対応するコード111a、および、ミュータントM1,3,4に対応するコード111bを示す。コード111xは、ソースコード111のMMID“1”に対応する箇所(2行目)の演算子“<”を演算子“>=”に変更したものである。コード111yは、ソースコード111のMMID“3”に対応する箇所(4行目)の演算子“>”を演算子“<=”に変更したものである。
In FIG. 44, as an example, the code corresponding to the
この場合、テストID“Test1”のテストケース(func(0)==0)に対し、ミュータントM1,M3,M3,4は実行されるが、ミュータントM1,3,4は実行されない。なぜなら、テストID“Test1”のテストケースでは、MMID=1,3,4に対応する3つのミューテーション箇所に同時に到達しないからである。すなわち、ミュータントM1が実行される場合、ミュータントM3,M4に対応するミューテーション箇所が実行経路から外れるので、ミュータントM1に対して、ミュータントM3,M4に相当する変更内容が更に適用されることはない。また、ミュータントM3が実行される場合、ミュータントM1に対応するミューテーション箇所が実行経路から外れるので、ミュータントM3に対して、ミュータントM1に相当する変更内容が更に適用されることはない。このように、SSEでは実行されないミュータントが存在し得る。また、一部のテストケースで実行されるものの実行結果がPassとなってミュータント生存結果を判断できないミュータントが存在し得る。 In this case, the mutants M 1 , M 3 , M 3,4 are executed but the mutants M 1,3,4 are not executed for the test case (func(0)=0) of the test ID “Test1”. .. This is because, in the test case with the test ID “Test1”, the three mutation locations corresponding to MMID=1, 3, 4 are not reached at the same time. That is, when the mutant M 1 is executed, the mutation points corresponding to the mutants M 3 and M 4 are deviated from the execution path, so that the change content corresponding to the mutants M 3 and M 4 is further added to the mutant M 1 . It does not apply. In addition, when the mutant M 3 is executed, the mutation portion corresponding to the mutant M 1 is deviated from the execution path, so that the modification corresponding to the mutant M 1 is not applied to the mutant M 3 . .. Thus, there may be mutants that are not implemented in SSE. In addition, there may be a mutant which is executed in some test cases but whose execution result is Pass and whose mutant survival result cannot be determined.
ミュータントM3,4も、一部のテストケース(ここではテストID“Test1”のテストケースのみ)では実行されるものの実行結果がPassである。このため、解析装置100は、現在のテストケースをSSEで実行しただけではミュータントM3,4に対するミュータント生存結果を判断できない。
The mutant M 3,4 is also executed in some test cases (here, only the test case of the test ID “Test1”), but the execution result is Pass. Therefore, the
図45は、テスト結果取得の比較例を示す図である。テスト結果テーブル119の例では、計13個のミュータントに対して、ミュータント生存結果を得られていない。これらのミュータントに対してミュータント生存結果を得るために、該当のミュータントに対して個別に、計13回のコンパイルを行い、実行結果を得られていない各テストケースについて該当のミュータントのテスト実行を計36回行うことも考えられる。しかし、このように、ミュータント毎にコンパイルおよびテスト実行を個別に行っていると、テストに時間がかかるという問題がある。 FIG. 45 is a diagram illustrating a comparative example of test result acquisition. In the example of the test result table 119, the mutant survival result is not obtained for a total of 13 mutants. In order to obtain the mutant survival results for these mutants, the relevant mutants are individually compiled 13 times in total, and the test execution of the relevant mutants is calculated for each test case for which an execution result is not obtained. It is also possible to do it 36 times. However, if the compilation and the test execution are individually performed for each mutant in this way, there is a problem that the test takes a long time.
そこで、解析装置100は、テスト結果テーブル119を作成する過程で、決定木T10,T20,T30を作成し、決定木T10,T20,T30をマージした決定木T40を作成する。解析装置100は、決定木T40を辿ることで、テスト結果テーブル119ではミュータント生存結果を得られていない13個のミュータントに対するミュータント生存結果を決定する。これにより、解析装置100は、マージ後の決定木T40を計13回辿ることで、ミュータント生存結果を得られることになる。
Therefore, the
解析装置100の処理では決定木T10,T20,T30の生成、および、マージといった処理コストが生じる。しかし、各ミュータントを個別にコンパイルして実行する処理コストと比べると、決定木T10,T20,T30の生成、および、マージの処理コストは十分に小さいと考えられる。
In the processing of the
こうして、解析装置100は、決定木T10,T20,T30に基づいて作成した決定木T40を辿るだけでテスト結果を判断できる。このため、各ミュータントを個別にコンパイルして実行せずに済み、その分の実行時間を削減できる。その結果、ミューテーション解析を高速化できる。更に、ミューテーション解析によるテストの評価結果の精度を向上でき、ユーザによるテスト自体の信頼性向上の作業を支援できる。テストの信頼性向上に寄与することで、ソフトウェアの品質向上に貢献できる。
In this way, the
なお、第1の実施の形態の情報処理は、演算部1bにプログラムを実行させることで実現できる。また、第2の実施の形態の情報処理は、プロセッサ101にプログラムを実行させることで実現できる。プログラムは、コンピュータ読み取り可能な記録媒体13に記録できる。
The information processing according to the first embodiment can be realized by causing the
例えば、プログラムを記録した記録媒体13を配布することで、プログラムを流通させることができる。また、プログラムを他のコンピュータに格納しておき、ネットワーク経由でプログラムを配布してもよい。コンピュータは、例えば、記録媒体13に記録されたプログラムまたは他のコンピュータから受信したプログラムを、RAM102やHDD103などの記憶装置に格納し(インストールし)、当該記憶装置からプログラムを読み込んで実行してもよい。
For example, the program can be distributed by distributing the
1 解析装置
1a 記憶部
1b 演算部
P1,P2 ソースコード
T1,T2,T3,T4 決定木
1
Claims (7)
変更箇所の第1の組合せに対して前記変更内容を適用して前記テストを実行し、実行された前記変更箇所を終端ノード以外のノード、前記変更箇所の前記変更内容をエッジ、実行結果を前記終端ノードとした決定木の情報をテストケース毎に生成し、生成された複数の決定木に基づいて、テスト結果を未取得である前記変更箇所の第2の組合せに対して前記変更内容を適用した場合の前記テスト結果を決定する、演算部と、
を有する解析装置。 A storage unit that stores a plurality of changed portions of the program when performing a test including a plurality of test cases for confirming an output with respect to an input of the program and information of change contents of the plurality of changed portions,
The test is executed by applying the change contents to the first combination of change parts, the executed change part is a node other than the terminal node, the change contents of the change part is an edge, and the execution result is the Information on a decision tree as a terminal node is generated for each test case, and the change contents are applied to a second combination of the changed portions for which a test result has not been acquired, based on the plurality of generated decision trees. An operation unit that determines the test result in the case of
An analyzer having a.
生成された複数の決定木に基づいて、テスト結果を未取得である前記変更箇所の第2の組合せに対して前記変更内容を適用した場合の前記テスト結果を決定する、
処理をコンピュータに実行させる解析プログラム。 A first combination of changed portions by referring to information of a plurality of changed portions of the program and change contents of each of the plurality of changed portions when performing a test including a plurality of test cases for confirming output with respect to input of the program The test is executed by applying the change content to a node other than the end node, the change content of the change location being an edge, and the execution result being the end node. Generate information for each test case,
Determining the test result when the change content is applied to the second combination of the change points for which the test result has not been acquired, based on the plurality of generated decision trees,
An analysis program that causes a computer to perform processing.
プログラムの入力に対する出力を確認する複数のテストケースを含むテストを行う際の前記プログラムの複数の変更箇所および前記複数の変更箇所それぞれの変更内容の情報を参照して、変更箇所の第1の組合せに対して前記変更内容を適用して前記テストを実行し、実行された前記変更箇所を終端ノード以外のノード、前記変更箇所の前記変更内容をエッジ、実行結果を前記終端ノードとした決定木の情報をテストケース毎に生成し、
生成された複数の決定木に基づいて、テスト結果を未取得である前記変更箇所の第2の組合せに対して前記変更内容を適用した場合の前記テスト結果を決定する、
解析方法。 Computer
A first combination of changed portions by referring to information of a plurality of changed portions of the program and change contents of each of the plurality of changed portions when performing a test including a plurality of test cases for confirming output with respect to input of the program The test is executed by applying the change content to a node other than the end node, the change content of the change location being an edge, and the execution result being the end node. Generate information for each test case,
Determining the test result when the change content is applied to the second combination of the change points for which the test result has not been acquired, based on the plurality of generated decision trees,
analysis method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2016185100A JP6748357B2 (en) | 2016-09-23 | 2016-09-23 | Analysis device, analysis program, and analysis method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2016185100A JP6748357B2 (en) | 2016-09-23 | 2016-09-23 | Analysis device, analysis program, and analysis method |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2018049492A JP2018049492A (en) | 2018-03-29 |
JP6748357B2 true JP6748357B2 (en) | 2020-09-02 |
Family
ID=61766418
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2016185100A Active JP6748357B2 (en) | 2016-09-23 | 2016-09-23 | Analysis device, analysis program, and analysis method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP6748357B2 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114297012B (en) * | 2021-12-31 | 2023-03-10 | 上海赛美特软件科技有限公司 | Method and device for detecting equipment precision, electronic equipment and storage medium |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH07210424A (en) * | 1994-01-14 | 1995-08-11 | Toshiba Corp | Software test supporting system |
FR2873832B1 (en) * | 2004-07-30 | 2006-09-15 | Certess Sarl | METHOD AND SYSTEM FOR EVALUATING TESTS OF A COMPUTER PROGRAM BY ANALYSIS OF MUTATIONS |
JP6364263B2 (en) * | 2014-07-08 | 2018-07-25 | 株式会社エヌ・ティ・ティ・データ | Verification support method, verification support apparatus, and program |
JP6365276B2 (en) * | 2014-12-08 | 2018-08-01 | 富士通株式会社 | Program, information processing apparatus and information processing method |
JP2016115175A (en) * | 2014-12-16 | 2016-06-23 | 株式会社東芝 | Software test apparatus and software test program |
-
2016
- 2016-09-23 JP JP2016185100A patent/JP6748357B2/en active Active
Also Published As
Publication number | Publication date |
---|---|
JP2018049492A (en) | 2018-03-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Pradel et al. | A framework for the evaluation of specification miners based on finite state machines | |
US8516434B2 (en) | Methods for marking, merging, and managing the results of software program analysis | |
US11775414B2 (en) | Automated bug fixing using deep learning | |
Kirbas et al. | The relationship between evolutionary coupling and defects in large industrial software | |
JP5845888B2 (en) | Software correction apparatus, software correction system, software correction method, and software correction program | |
Kessentini et al. | Automated metamodel/model co-evolution using a multi-objective optimization approach | |
JP2012150535A (en) | Program verification method and program verification program | |
JP6070847B2 (en) | Verification method, verification apparatus, and verification program | |
Lee et al. | Automatic detection and update suggestion for outdated API names in documentation | |
Carr et al. | Automatic contract insertion with ccbot | |
JP6440895B2 (en) | Software analysis apparatus and software analysis method | |
JP6748357B2 (en) | Analysis device, analysis program, and analysis method | |
JP6651974B2 (en) | Information processing apparatus, compiling method and compiler program | |
Corso et al. | Generating Java Methods: An Empirical Assessment of Four AI-Based Code Assistants | |
Frick | Understanding software changes: Extracting, classifying, and presenting fine-grained source code changes | |
Chekhaba et al. | Coach: classification-based architectural patterns detection in Android apps | |
JP5758311B2 (en) | Test code generation device, test code generation method, test code generation program | |
JP5578625B2 (en) | Program analysis apparatus, program analysis method, and program | |
CN114356783A (en) | Method and device for automatically generating unit test code, storage medium and equipment | |
JP6217440B2 (en) | Symbolic execution program, symbolic execution method, and symbolic execution device | |
Huang et al. | ConfFix: Repairing Configuration Compatibility Issues in Android Apps | |
Ribeiro et al. | A mechanized textbook proof of a type unification algorithm | |
JP7469999B2 (en) | Search device, search method, and search program | |
JP5900212B2 (en) | Test data generation apparatus, program, and method | |
WO2020230241A1 (en) | Testing device, testing method, and program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20190611 |
|
RD02 | Notification of acceptance of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7422 Effective date: 20190613 |
|
RD04 | Notification of resignation of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7424 Effective date: 20190613 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20200521 |
|
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: 20200707 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20200720 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 6748357 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |