JP2008071075A - Program inspection device, program inspection method, and program inspection program - Google Patents

Program inspection device, program inspection method, and program inspection program Download PDF

Info

Publication number
JP2008071075A
JP2008071075A JP2006248483A JP2006248483A JP2008071075A JP 2008071075 A JP2008071075 A JP 2008071075A JP 2006248483 A JP2006248483 A JP 2006248483A JP 2006248483 A JP2006248483 A JP 2006248483A JP 2008071075 A JP2008071075 A JP 2008071075A
Authority
JP
Japan
Prior art keywords
program
statement
information
sentence
inspection
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2006248483A
Other languages
Japanese (ja)
Inventor
Kazuyoshi Kono
和義 河野
Tomoko Ishibashi
朋子 石橋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Toshiba Corp
Original Assignee
Toshiba Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Toshiba Corp filed Critical Toshiba Corp
Priority to JP2006248483A priority Critical patent/JP2008071075A/en
Publication of JP2008071075A publication Critical patent/JP2008071075A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a program inspection device, a program inspection method, and a program inspection program, shortening test time while reducing an inspector's labor. <P>SOLUTION: This device comprises a program analysis part 11 for analyzing a program 8 to be inspected for each function to create program analysis data 21; a coverage information analysis part 12 for creating, based on coverage information 22 obtained by executing the inspection object program 8 and the program analysis data 21, analysis data 23 composed of an activation route that is a route from an input variable and/or constant of the program 8 to an unexecuted sentence and an activation condition that is a group of input variables and/or constants to be set to satisfy a condition sentence existing in the route; and an input data creation part 13 for creating input data 24 by setting, based on the analysis data 23, appropriate values to input variables needed to be set for executing the unexecuted sentence. <P>COPYRIGHT: (C)2008,JPO&INPIT

Description

本発明は、プログラム検査装置、プログラム検査方法、及びプログラム検査プログラムに関し、特に、ソフトウェアプログラムの動的検査における、カバレッジテストについてのプログラム検査装置、プログラム検査方法、及びプログラム検査プログラムに関する。   The present invention relates to a program inspection device, a program inspection method, and a program inspection program, and more particularly to a program inspection device, a program inspection method, and a program inspection program for a coverage test in a dynamic inspection of a software program.

従来、プログラム言語によって実装されたソフトウェアプログラム(以下、単にプログラムと示す)の作成途中や作成後において、当該プログラムの品質を推定するために、様々な検査が行われている。プログラムの検査は、プログラムを実行させずに目視などで観察する静的検査と、実際にプログラムを実行させて結果を観察する動的検査とに大別される。このうち、プログラムの動的検査は、検査用の入力データを作成し、検査環境に当該入力データを入力して検査対象プログラムを実行させ、得られる出力データを観察することによって行われる。   Conventionally, various inspections have been performed in order to estimate the quality of a software program (hereinafter simply referred to as a program) implemented in a program language during or after the creation. The inspection of the program is roughly divided into a static inspection that is observed visually without executing the program, and a dynamic inspection that is actually executed to observe the result by executing the program. Among these, the dynamic inspection of the program is performed by creating input data for inspection, inputting the input data into the inspection environment, executing the inspection target program, and observing the obtained output data.

このような検査に際し、検査用の入力データによってプログラムのどの部分が実行されて検査されたかを示す情報、すなわちカバレッジ情報は、プログラムの信頼性を推定する指標として使用されているほか、検査が十分に行われたか否かを判定する検査完了基準や、出荷(リリース)判定基準としても使用されている。カバレッジ情報とは、具体的には、プログラムに書かれた各文に対してその文が何回実行されたか、また、その文が条件文の場合には、更に、各条件分岐がどの程度の割合で実行されたか、を示す情報であり、一般的には、プログラム検査装置としてカバレッジツールを用いて自動的に計測される。このようなカバレッジツールとしては、例えば特許文献1に記載された手法を用いたプログラム検査装置が提案されている。   In such an inspection, information indicating which part of the program was executed and inspected by the input data for inspection, that is, the coverage information is used as an index for estimating the reliability of the program, and the inspection is sufficient. It is also used as an inspection completion criterion for determining whether or not it has been performed and a shipping (release) criterion. Specifically, coverage information refers to how many times the statement is executed for each statement written in the program. If the statement is a conditional statement, how much each conditional branch is This is information indicating whether or not it has been executed at a rate, and is generally automatically measured using a coverage tool as a program inspection device. As such a coverage tool, for example, a program inspection apparatus using a technique described in Patent Document 1 has been proposed.

得られたカバレッジ情報により、検査が不十分であると判定された場合、検査が十分に行われるまで、入力データを変更して追加検査を行う必要がある。しかしながら、特許文献1に記載されたプログラム検査装置では、検査不十分な部分、すなわち、未実行の文・条件分岐の検査を行うことができ、また、効率よく検査の網羅度を向上させることができる、新たな入力データを作成するために必要な情報を得ることができなかった。このため、検査者がプログラムを目視などで解析することによって、新たな入力データを作成しなくてはならず、検査者の労力を要し、また、テスト時間の増大を招くという問題があった。
特開平5−324402号公報(図1)
When it is determined that the inspection is insufficient based on the obtained coverage information, it is necessary to perform additional inspection by changing the input data until the inspection is sufficiently performed. However, the program inspection apparatus described in Patent Document 1 can inspect insufficiently tested parts, that is, unexecuted statements and conditional branches, and can efficiently improve the coverage of the inspection. Information necessary to create new input data that could be obtained could not be obtained. For this reason, there is a problem that the inspector must create new input data by visually analyzing the program, which requires labor of the inspector and increases the test time. .
JP-A-5-324402 (FIG. 1)

本発明は、以上の点に鑑みてなされたもので、検査者の労力を減じ、また、テスト時間を短縮することができる、プログラム検査装置、プログラム検査方法、及びプログラム検査プログラムを提供することを目的とする。   The present invention has been made in view of the above points, and provides a program inspection apparatus, a program inspection method, and a program inspection program that can reduce labor of an inspector and can shorten a test time. Objective.

本発明の一形態に係るプログラム検査装置は、検査対象プログラムを関数単位に解析し、外部変数情報と関数情報とからなるプログラム解析データを生成するプログラム解析部と、前記検査対象プログラムを実行して得られるカバレッジ情報と前記プログラム解析データとに基づき、前記検査対象プログラムの入力変数及び/又は定数から未実行の文に至る経路である活性化経路と、前記経路に存在する条件文を満たすために設定すべき前記入力変数及び/又は前記定数の集合である活性化条件とからなる解析データを生成するカバレッジ情報解析部と、前記活性化経路と前記活性化条件とに基づき、前記未実行の文を実行させるために設定が必要な前記入力変数を抽出し、抽出した前記入力変数に適切な値を設定する入力データ生成部と、を備えたことを特徴とする。   A program inspection apparatus according to an aspect of the present invention analyzes a program to be tested in units of functions, generates a program analysis data including external variable information and function information, and executes the program to be tested Based on the obtained coverage information and the program analysis data, in order to satisfy an activation path that is a path from an input variable and / or constant of the program to be inspected to an unexecuted sentence, and a conditional statement existing in the path The unexecuted statement based on the coverage information analysis unit that generates analysis data including the input variable to be set and / or the activation condition that is a set of constants, and the activation path and the activation condition An input data generation unit that extracts the input variable that needs to be set in order to execute and sets an appropriate value to the extracted input variable; Characterized by comprising.

また、本発明の一形態に係るプログラム検査方法は、検査対象プログラムを関数単位に解析して外部変数情報と関数情報とからなるプログラム解析データを生成し、前記検査対象プログラムを実行して得られるカバレッジ情報と前記プログラム解析データとに基づき、前記検査対象プログラムの入力変数及び/又は定数から未実行の文に至る経路である活性化経路と、前記経路に存在する条件文を満たすために設定すべき前記入力変数及び/又は前記定数の集合である活性化条件とからなる解析データを生成し、前記活性化経路と前記活性化条件とに基づき、前記未実行の文を実行させるために設定が必要な前記入力変数を抽出し、抽出した前記入力変数に適切な値を設定することを特徴とする。   A program inspection method according to an aspect of the present invention is obtained by analyzing a test target program in units of functions, generating program analysis data including external variable information and function information, and executing the test target program. Based on the coverage information and the program analysis data, an activation path that is a path from the input variable and / or constant of the program to be inspected to an unexecuted statement and a conditional statement existing in the path are set. The analysis data including the input condition and / or the activation condition that is a set of the constants is generated, and the unexecuted statement is set to be executed based on the activation path and the activation condition. The necessary input variables are extracted, and an appropriate value is set for the extracted input variables.

更に、本発明の一形態に係る半導体集積回路のプログラム検査プログラムは、コンピュータに、検査対象プログラムを関数単位に解析し、外部変数情報と関数情報とからなるプログラム解析データを生成するプログラム解析手順と、前記検査対象プログラムを実行して得られるカバレッジ情報と前記プログラム解析データとに基づき、前記検査対象プログラムの入力変数及び/又は定数から未実行の文に至る経路である活性化経路と、前記経路に存在する条件文を満たすために設定すべき前記入力変数及び/又は前記定数の集合である活性化条件とからなる解析データを生成するカバレッジ情報解析手順と、前記活性化経路と前記活性化条件とに基づき、前記未実行の文を実行させるために設定が必要な前記入力変数を抽出し、抽出した前記入力変数に適切な値を設定する入力データ生成手順と、を実行させることを特徴とする。   Furthermore, a program inspection program for a semiconductor integrated circuit according to an aspect of the present invention includes: a program analysis procedure for analyzing a program to be inspected in units of functions in a computer and generating program analysis data including external variable information and function information; An activation path that is a path from an input variable and / or a constant of the inspection target program to an unexecuted statement based on coverage information obtained by executing the inspection target program and the program analysis data; and the path Coverage information analysis procedure for generating analysis data including the input variable and / or the activation condition that is a set of constants to be set to satisfy the conditional statement existing in the data, the activation path, and the activation condition Based on the above, the input variables that need to be set to execute the unexecuted statement are extracted, and the extracted Characterized in that to execute the input data generation step of setting the appropriate values to the force variable, the.

検査者の労力を減じ、また、テスト時間を短縮することができる、プログラム検査装置、プログラム検査方法、及びプログラム検査プログラムを実現することができる。   It is possible to realize a program inspection apparatus, a program inspection method, and a program inspection program that can reduce the labor of the inspector and reduce the test time.

以下、図面を参照して本発明の実施の形態を説明する。   Embodiments of the present invention will be described below with reference to the drawings.

まず、図1に基づき、本実施の形態に係わるプログラム検査装置の構成を説明する。図1は、本実施の形態に係わるプログラム検査装置の構成を示す構成図である。図1に示すように、プログラム検査装置を構成するコンピュータ1は、中央処理装置(CPU)、ROM、RAMなどを含むコンピュータ本体2を有する。コンピュータ本体2には、CRT、液晶パネルなどの表示装置3と、文字、数字などを入力するためのキーボード4と、表示装置3の画面上のカーソルの移動などをするためのポインティングデバイスであるマウス5と、各種プログラムをストアするためのメモリ装置6とが接続されている。メモリ装置6には、本実施の形態に係わるプログラム検査プログラム7と、検査対象プログラム8とが格納され、検査者9の指示に基づいて実行可能となっている。コンピュータ1は、メモリ装置6にストアされたプログラムを実行し、実行プログラムに従って、表示装置3に所定の画面を表示する。   First, the configuration of the program inspection apparatus according to the present embodiment will be described with reference to FIG. FIG. 1 is a block diagram showing the configuration of the program inspection apparatus according to the present embodiment. As shown in FIG. 1, a computer 1 constituting a program inspection apparatus has a computer main body 2 including a central processing unit (CPU), ROM, RAM, and the like. The computer main body 2 includes a display device 3 such as a CRT or a liquid crystal panel, a keyboard 4 for inputting characters and numbers, and a mouse that is a pointing device for moving a cursor on the screen of the display device 3. 5 and a memory device 6 for storing various programs are connected. The memory device 6 stores a program inspection program 7 and an inspection target program 8 according to the present embodiment, and can be executed based on instructions from the inspector 9. The computer 1 executes a program stored in the memory device 6 and displays a predetermined screen on the display device 3 according to the execution program.

図2は、図1に示すコンピュータ1におけるプログラム検査プログラム7の機能構成を示す機能ブロック図である。プログラム検査プログラム7は、検査対象プログラム8を解析してプログラム解析データ21を生成するプログラム解析部11と、プログラム解析データ21と検査対象プログラム8のカバレッジ情報22とから、検査対象プログラム8において未実行の文を実行するための経路や、該経路に存在する条件文を満たすために設定すべき入力変数・定数の集合などを導出し、解析データ23として生成するカバレッジ情報解析部12と、解析データを基に、未実行の文や未実行の条件を実行するために必要な具体的な入力データを生成する入力データ生成部13とから構成される。   FIG. 2 is a functional block diagram showing a functional configuration of the program inspection program 7 in the computer 1 shown in FIG. The program inspection program 7 is not executed in the inspection target program 8 from the program analysis unit 11 that analyzes the inspection target program 8 and generates the program analysis data 21, and the program analysis data 21 and the coverage information 22 of the inspection target program 8. A coverage information analysis unit 12 for deriving a set of input variables and constants to be set in order to satisfy a conditional statement existing in the path and a conditional statement existing in the path; The input data generation unit 13 generates specific input data necessary for executing an unexecuted statement or an unexecuted condition.

プログラム解析部11は、検査対象プログラム8を関数単位に解析し、外部変数情報と関数情報とからなるプログラム解析データ21を生成する。カバレッジ情報解析部12は、検査対象プログラム8をデバッグオプション付きでコンパイルし、コンピュータ1に実行させることで得られるカバレッジ情報22と、プログラム解析部11で生成されるプログラム解析データ21とを入力とし、検査対象プログラム8に記述されている関数の引数や関数内で使用されている外部変数(以下、関数の引数と外部変数とをまとめて入力変数と示す)、もしくは定数から未実行の文に至るまでの経路と、未実行の条件を実行するために必要な、入力変数もしくは定数の条件とからなる解析データ23を導出して出力する。入力データ生成部13は、解析データ23と検査者9からの入力とに基づき、未実行の文や未実行の条件を実行するために必要な具体的な入力データ24を生成する。   The program analysis unit 11 analyzes the inspection target program 8 in units of functions, and generates program analysis data 21 including external variable information and function information. The coverage information analysis unit 12 receives the coverage information 22 obtained by compiling the inspection target program 8 with a debug option and causing the computer 1 to execute the program, and the program analysis data 21 generated by the program analysis unit 11. Function arguments described in the program 8 to be inspected and external variables used in the function (hereinafter, function arguments and external variables are collectively referred to as input variables) or constants to unexecuted statements Analytical data 23 consisting of the path to the above and the condition of the input variable or constant necessary for executing the unexecuted condition is derived and output. The input data generation unit 13 generates specific input data 24 necessary to execute an unexecuted statement or an unexecuted condition based on the analysis data 23 and the input from the examiner 9.

以下に、例を用いて、本実施の形態に係わるプログラム検査方法の内容を説明する。本実施の形態においては、C言語で記述されたプログラムを関数単位で検査する方法について、図3〜図15を用いて説明する。図3は、本実施の形態におけるプログラム検査方法のデータ処理の流れを説明するデータフロー図、図4は本実施の形態におけるプログラム検査の処理手順を説明するフローチャートである。   The contents of the program inspection method according to this embodiment will be described below using an example. In the present embodiment, a method for inspecting a program written in C language in units of functions will be described with reference to FIGS. FIG. 3 is a data flow diagram for explaining the flow of data processing of the program inspection method in this embodiment, and FIG. 4 is a flowchart for explaining the processing procedure of program inspection in this embodiment.

まず、図3に示すように、検査対象プログラム8をプログラム解析部11に入力する(図4、ステップS1)。プログラム解析部11では、入力された検査対象プログラム8のプログラム解析データ21(外部変数情報と関数情報)が生成される(図4、ステップS2)。外部変数情報は、検査対象プログラム8で定義されている外部変数について、変数名と型とから構成される。例えば、外部変数情報は(変数名、型)とすることができる。検査対象プログラム8が図5に示すプログラムである場合、外部変数は2つであり、外部変数情報は(x , int)、(y , int)となる。図5は、検査対象プログラム8の一例を示す図である。図5において、プログラムの左側に記載された番号は行番号を示している。   First, as shown in FIG. 3, the inspection target program 8 is input to the program analysis unit 11 (FIG. 4, step S1). The program analysis unit 11 generates program analysis data 21 (external variable information and function information) of the input inspection target program 8 (FIG. 4, step S2). The external variable information is composed of a variable name and a type for the external variable defined in the inspection target program 8. For example, the external variable information can be (variable name, type). When the inspection target program 8 is the program shown in FIG. 5, there are two external variables, and the external variable information is (x, int) and (y, int). FIG. 5 is a diagram illustrating an example of the inspection target program 8. In FIG. 5, the numbers written on the left side of the program indicate line numbers.

関数情報は、検査対象プログラム8で定義されている関数について、関数名情報、インタフェース情報、及び実装情報から構成される。図5に示すプログラムの場合、関数名情報はAとなる。   The function information includes function name information, interface information, and implementation information for functions defined in the inspection target program 8. In the case of the program shown in FIG.

インタフェース情報は、関数の引数名と引数の型、関数内で使用されている外部変数名、及び、関数の戻り値の型から構成される。図5に示すプログラムの場合、インタフェース情報は、関数の引数名がs、引数sの型がshort、関数内で使用されている外部変数名はなし、関数の戻り値の型がint、となる。   The interface information includes a function argument name and argument type, an external variable name used in the function, and a function return value type. In the case of the program shown in FIG. 5, the interface information is s for the argument name of the function, short for the type of argument s, no external variable name used in the function, and int for the return value type of the function.

実装情報は、文情報と接続情報とから構成される。文情報は、関数に含まれる文ごとに作成され、属性、位置情報、次実行文、前実行文、親文の5項目から成る基本情報と、文の種類に応じた付加情報とから構成される。   The mounting information is composed of sentence information and connection information. Statement information is created for each statement included in the function, and consists of basic information consisting of five items: attribute, position information, next execution statement, previous execution statement, and parent statement, and additional information according to the type of statement. The

まず、基本情報について説明する。属性は、当該文の種類を識別するための情報であり、例えば代入文、block文、条件文、while文、do文、などと表現される。位置情報は、プログラム中における当該文の位置を識別するための情報であり、例えば行番号が記載される。次実行文は、当該文の次に実行される文を識別するための情報であり、例えば次に実行される文の文情報へのポインタとして表現される。前実行文は、当該文の前に実行される文を識別するための情報であり、例えば前に実行される文の文情報へのポインタとして表現される。親文は、当該文がblock文に含まれている場合、どのblockに含まれているのかを識別するための情報であり、例えば当該block文の文情報へのポインタとして表現される。   First, basic information will be described. The attribute is information for identifying the type of the sentence, and is expressed as, for example, an assignment sentence, a block sentence, a conditional sentence, a while sentence, or a do sentence. The position information is information for identifying the position of the sentence in the program. For example, the line number is described. The next executable statement is information for identifying a statement to be executed next to the statement, and is expressed as, for example, a pointer to statement information of a statement to be executed next. The pre-execution sentence is information for identifying a sentence to be executed before the sentence, and is expressed as, for example, a pointer to sentence information of a sentence to be executed before. When the sentence is included in the block sentence, the parent sentence is information for identifying which block is included in the block sentence. For example, the parent sentence is expressed as a pointer to the sentence information of the block sentence.

次に、付加情報について説明する。付加情報は文の種類によって項目が異なる。ここでは、代表的な種類である代入文、block文、条件文、while文について具体的な例をあげて説明する。   Next, additional information will be described. Additional information has different items depending on the type of sentence. Here, typical types of assignment statements, block statements, conditional statements, and while statements will be described with specific examples.

代入文の付加情報は、入力変数リスト、出力変数リスト、文の処理情報、の3項目から構成されている。入力変数リストは、当該文の右辺に出現する変数を識別するための情報である。複数の変数が出現する場合、例えばリストとして表現される。出力変数リストは、当該文の左辺に出現する変数を識別するための情報である。複数の変数が出現する場合、入力変数リストと同様に、例えばリストとして表現される。文の処理情報は、当該文の処理内容を識別するための情報であり、例えば右辺の構文木として表現される。   The additional information of the assignment statement is composed of three items: an input variable list, an output variable list, and sentence processing information. The input variable list is information for identifying a variable that appears on the right side of the sentence. When a plurality of variables appear, it is expressed as a list, for example. The output variable list is information for identifying a variable that appears on the left side of the sentence. When a plurality of variables appear, it is expressed as a list, for example, similarly to the input variable list. The sentence processing information is information for identifying the processing content of the sentence, and is expressed as a syntax tree on the right side, for example.

例えば、図5のプログラムにおいて8行目に出現するx = a+bという式が代入文に該当する。この文に対応する文情報は、次の通りである。   For example, the expression x = a + b that appears on the eighth line in the program of FIG. 5 corresponds to the assignment statement. The sentence information corresponding to this sentence is as follows.

属性:代入文
位置情報:8
次実行文:(9行目の文の文情報へのポインタ)
前実行文:(7行目の文の文情報へのポインタ)
親文:−(block文でないため、親文を持たない)
入力変数リスト:a,b
出力変数リスト:x
文の処理情報:a+b
上述の文情報は、例えば図6のように記載することができる。図6は、代入文に対して生成される文情報の一例を説明する図である。なお、図6において、基本情報の次実行文、前実行文についての記載は省略している。なお、等価な条件文などに変換可能な代入文は、変換後の文がプログラム中に記載されているものとして文情報が作成される。例えば、x=c?a:b;という代入文は、図7に示す条件文と等価であるため、変換後の条件文について文情報が作成される。図7は、代入文から変換した条件文の一例を説明するプログラムである。
Attribute: Assignment statement Location information: 8
Next execution statement: (Pointer to statement information of the 9th line statement)
Pre-execution statement: (Pointer to statement information of the 7th line statement)
Parent sentence:-(There is no parent sentence because it is not a block sentence)
Input variable list: a, b
Output variable list: x
Sentence processing information: a + b
The above sentence information can be described as shown in FIG. 6, for example. FIG. 6 is a diagram for explaining an example of sentence information generated for an assignment sentence. In FIG. 6, description of the next execution statement and the previous execution statement of the basic information is omitted. In addition, sentence information is created for an assignment statement that can be converted into an equivalent conditional statement or the like, assuming that the converted statement is described in the program. For example, x = c? Since the assignment statement a: b; is equivalent to the conditional statement shown in FIG. 7, sentence information is created for the converted conditional statement. FIG. 7 is a program for explaining an example of a conditional statement converted from an assignment statement.

block文の付加情報は子文である。子文は、当該blockに含まれる文を識別するための情報であり、例えば当該blockに含まれる文の文情報へのポインタとして表現される。当該blockに複数の文が含まれる場合、個々の文を子文とし、各子文へのポインタの集合を付加情報として有する。   Additional information of the block statement is a child statement. The child sentence is information for identifying a sentence included in the block, and is expressed as a pointer to sentence information of a sentence included in the block, for example. When the block includes a plurality of sentences, each sentence is a child sentence, and a set of pointers to each child sentence is included as additional information.

条件文(if文もしくはswitch文)の付加情報は、条件式、(条件式の)入力変数リスト、条件値及び条件値を満たす場合の実行文、の3項目から構成されている。条件式は、if文もしくはswitch文の括弧内に記載されている式の内容を識別するための情報であり、例えば構文木として表現される。(条件式の)入力変数リストは、当該条件式に出現する変数を識別するための情報である。複数の変数が出現する場合、例えばリストとして表現される。条件値及び条件値を満たす場合の実行文は、条件値と条件式が条件値を満たした場合に実行される文とをセットとして識別するための情報であり、例えば、条件値と実行文の文情報へのポインタとが対にして表現される。条件値が複数存在する場合、全ての条件値及び条件値を満たす場合の実行文の集合を付加情報として有する。   The additional information of the conditional statement (if statement or switch statement) is composed of three items: a conditional expression, an input variable list (of the conditional expression), a conditional value, and an executable statement when the conditional value is satisfied. The conditional expression is information for identifying the contents of the expression described in parentheses of the if statement or the switch statement, and is expressed as a syntax tree, for example. The input variable list (of the conditional expression) is information for identifying a variable that appears in the conditional expression. When a plurality of variables appear, it is expressed as a list, for example. The executable statement when the condition value and the conditional value are satisfied is information for identifying the conditional value and the statement that is executed when the conditional expression satisfies the conditional value as a set. A pointer to sentence information is expressed as a pair. When there are a plurality of condition values, all condition values and a set of executable statements when the condition values are satisfied are included as additional information.

block文と条件文(if文)の文情報の具体的な例を、図5のプログラムを用いて説明する。図5において、9行目〜15行目に出現するif文を例にあげると、この文に対する文情報は、次の通りである。   A specific example of sentence information of a block statement and a conditional statement (if statement) will be described using the program of FIG. In FIG. 5, taking the if statement appearing in the ninth to fifteenth lines as an example, the sentence information for this sentence is as follows.

属性:if文(条件文)
位置情報:9
次実行文:(16行目の文の文情報へのポインタ)
前実行文:(8行目の文の文情報へのポインタ)
親文:−(block文でないため、親文を持たない)
条件式:c0&c1
入力変数リスト:c0,c1
条件値及び条件値を満たす場合の実行文(1):[条件値]値1,[実行文](9行目〜12行目のblock文の文情報へのポインタ)
条件値及び条件値を満たす場合の実行文(2):[条件値]値0,[実行文](12行目〜15行目のblock文の文情報へのポインタ)
また、上述のif文の実行文である2つのblock文の文情報は次の通りである。
Attribute: if statement (conditional statement)
Location information: 9
Next execution statement: (Pointer to statement information of the statement on the 16th line)
Pre-execution statement: (Pointer to statement information on the 8th line)
Parent sentence:-(There is no parent sentence because it is not a block sentence)
Conditional expression: c0 & c1
Input variable list: c0, c1
Condition value and executable statement when the condition value is satisfied (1): [condition value] value 1, [executable statement] (pointer to statement information of the block statement in the 9th to 12th lines)
Condition value and executable statement when the condition value is satisfied (2): [condition value] value 0, [executable statement] (pointer to statement information of block statement in 12th to 15th lines)
The sentence information of the two block statements, which are the executable statements of the above if statement, is as follows.

属性:block文
位置情報:9
次実行文:−
前実行文:−
親文:(9行目のif文の文情報へのポインタ)
子文(1):(10行目の文(文0)の文情報へのポインタ)
子文(2):(11行目の文(文1)の文情報へのポインタ)
属性:block文
位置情報:12
次実行文:−
前実行文:−
親文:(9行目のif文の文情報へのポインタ)
子文(1):(13行目の文の文情報へのポインタ)
子文(2):(14行目の文の文情報へのポインタ)
更に、上述のblock文のうち2番目に挙げたblock文の子文(1)(2)である文の文情報は、次の通りである。
Attribute: block statement Location information: 9
Next executable statement:-
Previous executable statement:-
Parent sentence: (Pointer to sentence information of if statement on the 9th line)
Child sentence (1): (pointer to sentence information of sentence (sentence 0) on line 10)
Child sentence (2): (pointer to sentence information of sentence (sentence 1) on line 11)
Attribute: block statement Location information: 12
Next executable statement:-
Previous executable statement:-
Parent sentence: (Pointer to sentence information of if statement on the 9th line)
Child sentence (1): (pointer to sentence information of sentence on line 13)
Child sentence (2): (Pointer to sentence information of sentence on line 14)
Furthermore, the sentence information of the sentence that is the child sentence (1) and (2) of the block sentence listed second among the above-mentioned block sentences is as follows.

属性:代入文
位置情報:13
次実行文:(14行目の文の文情報へのポインタ)
前実行文:−
親文:(12行目のblock文の文情報へのポインタ)
入力変数リスト:(文2の右辺に出現する変数のリスト)
出力変数リスト:(文2の左辺に出現する変数のリスト)
文の処理情報:(文2の処理内容の構文木)
属性:代入文
位置情報:14
次実行文:−
前実行文:(13行目の文の文情報へのポインタ)
親文:(12行目のblock文の文情報へのポインタ)
入力変数リスト:(文3の右辺に出現する変数のリスト)
出力変数リスト:(文3の左辺に出現する変数のリスト)
文の処理情報:(文3の処理内容の構文木)
上述の文情報は、例えば図8のように記載することができる。図8は、if文およびblock文に対して生成される文情報の一例を説明する図である。なお、switch文に関しては、if文とほぼ同様の文情報が生成されるため、具体的な例をあげての説明を省略する。
Attribute: assignment statement Location information: 13
Next execution statement: (Pointer to statement information of statement on line 14)
Previous executable statement:-
Parent sentence: (Pointer to the sentence information of the block sentence on the 12th line)
Input variable list: (List of variables that appear on the right side of sentence 2)
Output variable list: (List of variables that appear on the left side of sentence 2)
Sentence processing information: (Syntax tree of the processing content of sentence 2)
Attribute: assignment statement Location information: 14
Next executable statement:-
Pre-execution statement: (Pointer to statement information on the 13th line)
Parent sentence: (Pointer to the sentence information of the block sentence on the 12th line)
Input variable list: (List of variables that appear on the right side of sentence 3)
Output variable list: (List of variables that appear on the left side of sentence 3)
Sentence processing information: (Syntax tree of the processing content of sentence 3)
The above sentence information can be described as shown in FIG. 8, for example. FIG. 8 is a diagram illustrating an example of sentence information generated for an if sentence and a block sentence. Regarding the switch statement, sentence information that is almost the same as that of the if statement is generated, and therefore a description with a specific example is omitted.

while文の付加情報は、条件式、(条件式の)入力変数リスト、条件式が成立した場合の実行文、の3項目から構成されている。条件式は、while文の括弧内に記載されている式の内容を識別するための情報であり、例えば構文木として表現される。(条件式の)入力変数リストは、当該条件式に出現する変数を識別するための情報である。複数の変数が出現する場合、例えばリストとして表現される。条件式が成立した場合の実行文は、例えば、実行文の文情報へのポインタとして表現される。実行文がblock文である場合、該block文の文情報が生成され、条件式が成立した場合の実行文は該block文の文情報へのポインタとして表現される。   The additional information of the while statement is composed of three items: a conditional expression, an input variable list (of the conditional expression), and an executable statement when the conditional expression is satisfied. The conditional expression is information for identifying the contents of the expression described in parentheses of the while statement, and is expressed as a syntax tree, for example. The input variable list (of the conditional expression) is information for identifying a variable that appears in the conditional expression. When a plurality of variables appear, it is expressed as a list, for example. The executable statement when the conditional expression is satisfied is expressed as a pointer to the statement information of the executable statement, for example. When the executable statement is a block statement, statement information of the block statement is generated, and the executable statement when the conditional expression is satisfied is expressed as a pointer to the statement information of the block statement.

while文の文情報の具体的な例を、図5のプログラムを用いて説明する。図5において、16行目〜18行目に出現するwhile文を例にあげると、この文に対する文情報は、次の通りである。   A specific example of sentence information of the while statement will be described using the program of FIG. In FIG. 5, taking the while statement appearing on the 16th to 18th lines as an example, the sentence information for this sentence is as follows.

属性:while文
位置情報:16
次実行文:(19行目の文の文情報へのポインタ)
前実行文:(15行目の文の文情報へのポインタ)
親文:−(block文でないため、親文を持たない)
条件式:c0
入力変数リスト:c0
条件式が成立した場合の実行文:(16行目〜18行目のblock文の文情報へのポインタ)
また、上述のwhile文の実行文であるblock文の文情報は次の通りである。
Attribute: while statement Location information: 16
Next execution statement: (Pointer to statement information of the 19th line statement)
Pre-execution statement: (pointer to statement information of statement on line 15)
Parent sentence:-(There is no parent sentence because it is not a block sentence)
Conditional expression: c0
Input variable list: c0
Execution statement when the conditional expression is satisfied: (pointer to statement information of block statement of 16th to 18th lines)
The sentence information of the block statement, which is the execution statement of the above while statement, is as follows.

属性:block文
位置情報:16
次実行文:−
前実行文:−
親文:(16行目のwhile文の文情報へのポインタ)
子文(1):(文4の文情報へのポインタ)
子文(2):(文5の文情報へのポインタ)

子文(n−3):(文nの文情報へのポインタ)
上述の文情報は、例えば図9のように記載することができる。図9は、while文に対して生成される文情報の一例を説明する図である。
Attribute: block statement Location information: 16
Next executable statement:-
Previous executable statement:-
Parent sentence: (Pointer to sentence information of the while statement on the 16th line)
Child sentence (1): (Pointer to sentence information of sentence 4)
Child sentence (2): (pointer to sentence information of sentence 5)
...
Child sentence (n-3): (pointer to sentence information of sentence n)
The above sentence information can be described as shown in FIG. 9, for example. FIG. 9 is a diagram illustrating an example of sentence information generated for a while sentence.

文の種類としては、上述の4つの種類のほかにもdo文、for文、break文、continue文、goto文などが考えられる。これらの種類に属する文の文情報について、簡単に説明する。do文はwhile文とほぼ同様の文情報が生成される。また、for文はwhile文を用いて等価な文に変換することができるため、変換後のプログラムについて文情報が生成される。例えば、for(式1;式2;式3)文;というfor文は、図10に示すwhile文と等価であるため、変換後のwhile文について文情報が作成される。図10は、if文から変換したwhile文の一例を説明するプログラムである。   As the types of sentences, in addition to the above four types, do sentences, for sentences, break sentences, continue sentences, goto sentences, and the like can be considered. The sentence information of sentences belonging to these types will be briefly described. The do statement generates almost the same sentence information as the while statement. Moreover, since a for statement can be converted into an equivalent statement using a while statement, statement information is generated for the converted program. For example, a for statement “for (expression 1; expression 2; expression 3) statement” is equivalent to the while statement shown in FIG. 10, and thus sentence information is created for the converted while statement. FIG. 10 is a program for explaining an example of a while statement converted from an if statement.

break文、continue文、goto文は、付加情報を持たず基本情報のみで文情報が構成されるが、代入文など他の種類の文は次実行文として直下の行に記載された文の文情報を記載するのに対し、これらの種類の文は、文中に指定された行に記載された文の文情報を次実行文として記載する点が異なっている。   The break statement, continue statement, and goto statement do not have additional information, and the statement information consists of only basic information, but other types of statements such as assignment statements are statements of statements described in the line immediately below as the next executable statement. In contrast to the description of information, these types of statements differ in that the statement information of the statement described in the line specified in the statement is described as the next executable statement.

次に、実装情報のもう一つの構成要素である接続情報について説明する。接続情報は、文と文との接続に関する接続情報と、変数と文との接続に関する接続情報とに大別される。文と文との接続情報とは、文の実行順序を識別するための情報であり、具体的には、実装情報の基礎情報に含まれる次実行文、前実行文、親文の各項目で構成される。文と文との接続情報は、例えば、関連するノード(点)を接続線で結ぶことにより網目状の外観を有するグラフとして表現することができる。この場合、グラフ上のノードが個々の文に対応し、ノード間を結ぶ接続線によって、当該文に関する次実行文、前実行文、親文を表現することができる。変数と文との接続情報とは、変数がプログラム中にどの文に出現するかを識別するための情報である。   Next, connection information, which is another component of the mounting information, will be described. The connection information is roughly classified into connection information related to the connection between sentences and sentences and connection information related to the connection between variables and sentences. Statement-to-statement connection information is information used to identify the order in which statements are executed. Specifically, in each item of the next execution statement, previous execution statement, and parent statement included in the basic information of the implementation information. Composed. The connection information between sentences can be expressed as a graph having a mesh-like appearance by connecting related nodes (points) with connection lines, for example. In this case, the nodes on the graph correspond to the individual sentences, and the next execution sentence, the previous execution sentence, and the parent sentence relating to the sentence can be expressed by connection lines connecting the nodes. The variable-sentence connection information is information for identifying in which sentence the variable appears in the program.

プログラム解析部11において、上述のようにしてプログラム解析データ21が作成される一方、検査対象プログラム8は、コンパイラ14に入力されてデバックオプション付きでコンパイルされ、実行形式プログラム25が生成される(図4、ステップS3)。引き続き、実行形式プログラム25が実行され、カバレッジツール15によってカバレッジ情報22が生成される(図4、ステップS4)。カバレッジ情報22は、個々の文が実行された回数と、条件分岐の実行有無および実行された割合とから主に構成されている。ここで、プログラムに記述されている文のトータル行数に対する実行された文の行数の割合と、プログラムに出現する条件分岐の総数に対する実行された条件分岐の数の割合とをカバレッジ率という。   In the program analysis unit 11, the program analysis data 21 is created as described above, while the inspection target program 8 is input to the compiler 14 and compiled with the debug option to generate an executable program 25 (see FIG. 4, Step S3). Subsequently, the execution format program 25 is executed, and coverage information 22 is generated by the coverage tool 15 (step S4 in FIG. 4). The coverage information 22 is mainly composed of the number of times each statement is executed, the presence / absence of conditional branch execution, and the execution rate. Here, the ratio of the number of lines of executed statements to the total number of lines of statements described in the program and the ratio of the number of executed conditional branches to the total number of conditional branches appearing in the program are referred to as a coverage rate.

なお、図4において、ステップS3はステップS2の終了を待たずに実行することが可能であり、ステップS1,ステップS2の処理と並行してステップS3,ステップS4の処理を実行してもよい。ステップS4によって得られたカバレッジ情報22におけるカバレッジ率が予め設定された閾値を超えている場合、プログラムの検査を終了する(図4、ステップS5)。一方、取得したカバレッジ率が閾値を越えていない場合、ステップS2で得られたプログラム解析データ21と、ステップS4で得られたカバレッジ情報22とがカバレッジ情報解析部12に入力され、解析データ23が生成される(図4、ステップS6)。   In FIG. 4, step S3 can be executed without waiting for the end of step S2, and the processes of steps S3 and S4 may be executed in parallel with the processes of steps S1 and S2. When the coverage rate in the coverage information 22 obtained in step S4 exceeds a preset threshold value, the program inspection is terminated (FIG. 4, step S5). On the other hand, if the acquired coverage rate does not exceed the threshold value, the program analysis data 21 obtained in step S2 and the coverage information 22 obtained in step S4 are input to the coverage information analysis unit 12, and the analysis data 23 is obtained. It is generated (FIG. 4, step S6).

解析データ23は、入力変数もしくは定数から未実行の文に至る経路(以下、活性化経路と示す)と、該経路に存在する条件文を満たすために設定する必要がある入力変数もしくは定数の集合(以下、活性化条件と示す)とから構成される。活性化経路と活性化条件との具体的な導出方法を、図11に示すようなプログラム(関数)を検査対象プログラム8とし、これに適当な入力を与えて実行させ解析データ23を生成する場合を例にあげて説明する。図11は、検査対象プログラム8の別の一例を示す図である。   The analysis data 23 includes a path from an input variable or constant to an unexecuted statement (hereinafter referred to as an activation path) and a set of input variables or constants that need to be set to satisfy a conditional statement existing in the path. (Hereinafter referred to as activation conditions). As a specific method for deriving the activation path and the activation condition, a program (function) as shown in FIG. 11 is set as the inspection target program 8, and an appropriate input is given to the program to be executed to generate analysis data 23. Will be described as an example. FIG. 11 is a diagram showing another example of the inspection target program 8.

例えば、カバレッジ情報22において、図11のプログラムのswitch文の0番目の分岐中に含まれる文(case(0)のblock文)が実行されていないことを示している場合、カバレッジ情報解析部12では、まず、当該文に対応する文情報がプログラム解析データ21から抽出される。この場合、output = input * input1+ input2という代入文(以下、文siと示す)に対応する文情報が抽出される。次に、プログラム解析データ21における文siの文情報(主に、入力変数リストと出力変数リスト)と接続情報とに基づき、入力変数もしくは定数から文siに至る経路(活性化経路)を導出する。   For example, if the coverage information 22 indicates that the statement included in the 0th branch of the switch statement of the program in FIG. 11 (the block statement of case (0)) has not been executed, the coverage information analysis unit 12 First, sentence information corresponding to the sentence is extracted from the program analysis data 21. In this case, sentence information corresponding to an assignment sentence (hereinafter, referred to as sentence si) of output = input * input1 + input2 is extracted. Next, a path (activation path) from the input variable or constant to the sentence si is derived based on the sentence information (mainly, the input variable list and the output variable list) of the sentence si in the program analysis data 21 and the connection information. .

活性化経路は、例えば、文siを根、入力変数もしくは定数を葉とする木構造として表され、例えば図12に示す関数(getStatementTree(文情報))を用いて導出することができる。図12は、活性化経路を導出する関数を説明するプログラム構成の一例である。getStatementTree(文情報)は文情報を引数としてその文の入力変数の集合を出力する関数(getInputSideVariables(文情報))と、変数を引数としてその変数を出力変数に有する文の集合を出力する関数(getInputSideStatements(変数))とを用いて定義される再帰関数である。   The activation path is represented, for example, as a tree structure with the sentence si as a root and an input variable or constant as a leaf, and can be derived using, for example, a function (getStatementTree (sentence information)) illustrated in FIG. FIG. 12 is an example of a program configuration for explaining a function for deriving an activation path. getStatementTree (sentence information) is a function (getInputSideVariables (sentence information)) that outputs a set of input variables of the sentence with sentence information as an argument, and a function that outputs a set of statements that have the variable as an output variable with arguments (statement). getInputSideStatements (variable)) and a recursive function.

すなわち、getStatementTree(文情報)を実行すると、文siの入力変数を出力変数として有する文を抽出して文siに接続し、接続された文の入力変数を出力変数として有する文を更に抽出して接続する、といった文同士の接続が入力変数もしくは定数が葉として出現するまで繰り返し行われ、例えば図13に示すような活性化経路を表す木構造31が生成される。図13は、活性化経路を表す木構造を説明する図である。   That is, when getStatementTree (sentence information) is executed, a sentence having an input variable of the sentence si as an output variable is extracted and connected to the sentence si, and a sentence having an input variable of the connected sentence as an output variable is further extracted. Connection between sentences such as connecting is repeated until an input variable or constant appears as a leaf, and a tree structure 31 representing an activation path as shown in FIG. 13 is generated, for example. FIG. 13 is a diagram for explaining a tree structure representing an activation path.

なお、図13において、丸の中にアルファベットが書かれている記号は変数を、三角の中にアルファベットが書かれている記号は定数を、変数及び定数を包含する四角は文を、それぞれ示している。また、文を表す四角に設けられた点線の上側に記載された変数及び定数は入力変数(定数)を、点線の下側に記載された変数は出力変数を、それぞれ示している。更に、文を表す四角の外側に記載された変数は、プログラム(関数)への入力変数を示している。   In FIG. 13, symbols with alphabets in circles indicate variables, symbols with alphabets in triangles indicate constants, and squares including variables and constants indicate sentences. Yes. Further, variables and constants described above the dotted line provided in the square representing the sentence indicate input variables (constants), and variables described below the dotted line indicate output variables. Furthermore, the variable described outside the square representing the sentence indicates an input variable to the program (function).

図13において、式101が活性化経路を導出したい未活性文である。getStatementTree(文情報)によって、式101への入力が変数a,変数g,定数x111の3つであることが判明すると、次に、getInputSideStatements(変数)によって変数a,変数g,をそれぞれ出力変数に持つ式が抽出される。図13の場合、変数aを出力変数に持つ式が式102であり、変数gを出力変数に持つ式が式103である。次に、再び、getStatementTree(文情報)を用いて、式102と式103への入力を求める。図13の場合、式102への入力は変数b121,変数c122,定数y112の3つであり、式103への入力は変数d123,変数e124,定数w110の3つである。導出された変数がすべてプログラム(関数)への入力変数であるため、ここで木構造31が完成する。   In FIG. 13, Expression 101 is an inactive sentence for which an activation path is desired to be derived. If getStatementTree (statement information) finds that there are three inputs to expression 101, variable a, variable g, and constant x111, then getInputSideStatements (variable) sets variable a and variable g as output variables, respectively. Expressions that have are extracted. In the case of FIG. 13, an expression having the variable a as an output variable is an expression 102, and an expression having a variable g as an output variable is an expression 103. Next, the input to Expression 102 and Expression 103 is obtained again using getStatementTree (statement information). In the case of FIG. 13, there are three inputs to the expression 102, a variable b121, a variable c122, and a constant y112, and three inputs to the expression 103 are a variable d123, a variable e124, and a constant w110. Since all the derived variables are input variables to the program (function), the tree structure 31 is completed here.

図13により、式101を実行するためには、変数b121,変数c122,変数d123,変数e124,定数w110,定数y112,定数x111の6つの変数または定数の値に適当な値を与え、式102,式103を実行することが必要であることがわかる。なお、プログラム(関数)には変数f125も入力変数として定義されているが、葉として抽出されていないため、式101の実行には無関係であることがわかる。   According to FIG. 13, in order to execute Expression 101, appropriate values are given to six variables or constant values of variable b121, variable c122, variable d123, variable e124, constant w110, constant y112, and constant x111. , It can be seen that it is necessary to execute equation 103. Note that the variable f125 is also defined as an input variable in the program (function), but since it is not extracted as a leaf, it can be seen that it is irrelevant to the execution of Expression 101.

次に、この活性化経路を活性化するための条件値を設定するために、活性化条件を導出する。活性化条件は、例えば、実行したい文(条件文)を根、入力変数もしくは定数を葉とする木構造として表され、例えば図14に示す関数(getConditionForest(木))を用いて導出することができる。図14は、活性化条件を導出する関数を説明するプログラム構成の一例である。   Next, in order to set a condition value for activating this activation path, an activation condition is derived. The activation condition is expressed as a tree structure having, for example, a statement (conditional statement) to be executed as a root and an input variable or constant as a leaf, and may be derived using, for example, a function (getConditionForest (tree)) shown in FIG. it can. FIG. 14 is an example of a program configuration for explaining a function for deriving the activation condition.

getConditionForest(木)は、活性化経路を表す木構造を引数とする関数であり、活性化経路に出現する条件文を抽出する。次に、抽出した各条件文について、条件式の入力変数を出力変数とする文を抽出して該条件文に接続し、接続された文の入力変数を出力変数として有する文を更に抽出して接続する、といった文同士の接続が入力変数もしくは定数が葉として出現するまで繰り返し行われる。この手順によって、活性化条件として、例えば図15に示すように、条件文105を根とする木構造32と、条件文106を根とする木構造33の集合である森構造34が生成される。図15は、活性化条件を表す森構造を説明する図である。なお、図15の表記方法は図13の表記方法に準ずる。   getConditionForest (tree) is a function having a tree structure representing an activation path as an argument, and extracts a conditional statement that appears in the activation path. Next, for each extracted conditional statement, extract a statement that uses the input variable of the conditional expression as an output variable, connect to the conditional statement, and further extract a statement that has the input variable of the connected statement as an output variable The connection between statements such as connecting is repeated until the input variable or constant appears as a leaf. By this procedure, as an activation condition, for example, as shown in FIG. 15, a forest structure 34 that is a set of a tree structure 32 rooted in the conditional sentence 105 and a tree structure 33 rooted in the conditional sentence 106 is generated. . FIG. 15 is a diagram for explaining a forest structure representing an activation condition. Note that the notation method of FIG. 15 conforms to the notation method of FIG.

図15により、活性化経路には2つの条件文105,106が存在しており、条件文105に示された条件を満たすためには、入力変数である変数b121,変数d123,定数113に適切な値を設定し、条件文106に示された条件を満たすためには、入力変数である変数b121,変数c122,変数e124,変数f125,定数t115,定数u114に適切な値を設定する必要があることがわかる。   According to FIG. 15, there are two conditional statements 105 and 106 in the activation path, and in order to satisfy the conditions shown in the conditional statement 105, the input variables are appropriate for the variable b 121, the variable d 123, and the constant 113. In order to satisfy the conditions indicated in the conditional statement 106, it is necessary to set appropriate values for the input variable b121, variable c122, variable e124, variable f125, constant t115, and constant u114. I know that there is.

上述のようにして得られた解析データ23(活性化経路、活性化条件)を表示装置3に表示する場合、図13や図15のような木構造・森構造として表示することができる。また、検査対象プログラム8を表示装置3に表示させておき、木構造(もしくは森構造に含まれる木構造)を構成する文の文情報に含まれる位置情報を利用して、活性化経路に含まれる行を他の行と色を変えるなど強調して表示したり、木構造の葉である変数や定数を強調して表示したりすることもできる。また、未実行文の活性化経路を活性化することによりカバレッジ率がどれくらい向上するのかをコンピュータ1に計算させて表示させてもよい。   When the analysis data 23 (activation path, activation condition) obtained as described above is displayed on the display device 3, it can be displayed as a tree structure / forest structure as shown in FIGS. In addition, the inspection target program 8 is displayed on the display device 3 and is included in the activation path by using position information included in the sentence information of the sentence constituting the tree structure (or the tree structure included in the forest structure). You can also highlight the displayed lines by changing the color of other lines, or highlight variables and constants that are leaves of the tree structure. In addition, the computer 1 may calculate and display how much the coverage rate is improved by activating the activation path of the unexecuted statement.

このようにして活性化経路や活性化条件を表示装置3などにわかりやすく示すことで、未実行文を実行するためにどの入力変数もしくは定数の値を変更したらよいかを検査者9が容易に判別することが可能となり、検査者9の労力を削減することができる。   In this way, by displaying the activation path and activation conditions in an easy-to-understand manner on the display device 3 or the like, the inspector 9 can easily determine which input variable or constant value should be changed in order to execute an unexecuted statement. It becomes possible to discriminate, and the labor of the inspector 9 can be reduced.

ステップS6で生成された解析データ23は、図3に示すように入力データ生成部13に入力され、未実行の文を実行するために必要な具体的な入力データ24が生成される(図4、ステップS7)。入力データ生成部13では、解析データ23から未実行文を実行するために設定する必要がある入力変数・定数を抽出した後、これらの変数・定数に具体的な数値を設定する。この際、乱数などを使用して自動的に数値を導出し、この数値を用いて活性化条件や活性化経路を活性化することが可能か否かを計算し、可能であると判定された場合に該数値を入力データ24としてもよいし、検査者9に数値の入力を促すようにしてもよい。   The analysis data 23 generated in step S6 is input to the input data generation unit 13 as shown in FIG. 3, and specific input data 24 necessary for executing an unexecuted statement is generated (FIG. 4). Step S7). The input data generation unit 13 extracts input variables / constants that need to be set in order to execute an unexecuted statement from the analysis data 23, and then sets specific numerical values for these variables / constants. At this time, a numerical value is automatically derived using a random number, etc., and it is determined whether the activation condition and the activation path can be activated using this numerical value. In this case, the numerical value may be used as the input data 24, or the examiner 9 may be prompted to input the numerical value.

ステップS7において入力データ24が生成されると、ステップS4に戻り、該入力データ24を用いて検査対象プログラム8を再実行する。   When the input data 24 is generated in step S7, the process returns to step S4, and the inspection target program 8 is re-executed using the input data 24.

このように、本実施の形態においては、検査対象プログラムからプログラム解析データを生成し、カバレッジ情報に示される未実行文を実行させるために活性化する必要がある経路や、該経路を活性化させるために設定しなくてはならない入力変数・定数を自動的に抽出することができるため、検査者の労力を減じ、また、テスト時間を短縮することができる。   As described above, in this embodiment, program analysis data is generated from a program to be inspected, and a path that needs to be activated in order to execute an unexecuted statement indicated in coverage information, or the path is activated. Therefore, it is possible to automatically extract input variables and constants that must be set in order to reduce labor of the inspector and shorten test time.

次に、本実施の形態のプログラム検査方法の応用例として、検査対象プログラム8がある処理を行う関数であり、性能を向上させるために、インタフェースを変更せずに実装のみを変更した場合に、実装変更後のプログラムの検査を行う方法について、図16を用いて説明する。図16は、本実施の形態のプログラム検査方法を応用した検査方法の処理手順を説明するフローチャートである。なお、実装変更前のプログラムは十分に検査されており、検査におけるカバレッジ率も設定された閾値を超えており、検査のために使用した入力データ24が存在するものとする。   Next, as an application example of the program inspection method of the present embodiment, the inspection target program 8 is a function that performs a certain process, and in order to improve performance, when only the implementation is changed without changing the interface, A method for inspecting the program after the mounting change will be described with reference to FIG. FIG. 16 is a flowchart for explaining the processing procedure of an inspection method to which the program inspection method of the present embodiment is applied. It is assumed that the program before the implementation change is sufficiently inspected, the coverage rate in the inspection exceeds the set threshold value, and the input data 24 used for the inspection exists.

まず、ステップS11において、既存の検査用入力データ24を用い、実装変更前の検査対象プログラム8(以下、参照モデル8aと示す)を検査する。次に、ステップS12において、ステップS11で使用した入力データ24を用い、実装変更後の検査対象プログラム8(以下、検査対象モデル8bと示す)を検査する。続いて、ステップS13において、ステップS11で得られた検査結果とステップS12で得られた検査結果とを比較し、両者が一致するか否かを判定する。両者が一致しない場合、ステップS14において、検査対象モデル8bを修正し、再びステップS12に戻って検査を行う。   First, in step S11, the inspection target program 8 (hereinafter referred to as a reference model 8a) before the mounting change is inspected using the existing input data 24 for inspection. Next, in step S12, using the input data 24 used in step S11, the inspection object program 8 (hereinafter referred to as inspection object model 8b) after the mounting change is inspected. Subsequently, in step S13, the inspection result obtained in step S11 and the inspection result obtained in step S12 are compared to determine whether or not they match. If the two do not match, the inspection target model 8b is corrected in step S14, and the process returns to step S12 to perform the inspection.

一方、ステップS13において両者が一致する場合、ステップS15に進み、ステップS11で使用した入力データ24を用いて検査対象モデル8bのカバレッジ検査を行う。なお、ステップS15におけるカバレッジ検査は、図4のフローチャートに示す手順で実施される。すなわち、カバレッジ率が所定の閾値を超えるまで、検査対象モデル8bのプログラム解析データ21、カバレッジ情報22、解析データ23を生成し、入力データ24を変更しながら検査を実行する。   On the other hand, if both match in step S13, the process proceeds to step S15, and coverage inspection of the inspection target model 8b is performed using the input data 24 used in step S11. The coverage inspection in step S15 is performed according to the procedure shown in the flowchart of FIG. That is, until the coverage rate exceeds a predetermined threshold, the program analysis data 21, coverage information 22, and analysis data 23 of the inspection target model 8b are generated, and the inspection is executed while changing the input data 24.

このように、本実施の形態のプログラム検査方法は、プログラムを修正した場合のリグレッションテストにも使用することができ、該テストに関する検査者の労力を減じ、テスト時間の短縮を図ることができる。
As described above, the program inspection method according to the present embodiment can also be used for a regression test when a program is modified, thereby reducing the labor of the inspector related to the test and reducing the test time.

本実施の形態に係わるプログラム検査装置の構成を示す構成図。The block diagram which shows the structure of the program inspection apparatus concerning this Embodiment. コンピュータ1におけるプログラム検査プログラムの機能構成を示す機能ブロック図。The functional block diagram which shows the function structure of the program inspection program in the computer. 本実施の形態に係わるプログラム検査方法のデータ処理の流れを説明するデータフロー図。The data flow figure explaining the flow of the data processing of the program inspection method concerning this Embodiment. 本実施の形態に係わるプログラム検査の処理手順を説明するフローチャート。The flowchart explaining the processing procedure of the program test | inspection concerning this Embodiment. 検査対象プログラム8の一例を示す図。FIG. 4 is a diagram showing an example of an inspection target program 8. 代入文に対して生成される文情報の一例を説明する図。The figure explaining an example of the sentence information produced | generated with respect to an assignment sentence. 代入文から変換した条件文の一例を説明するプログラム。A program that explains an example of a conditional statement converted from an assignment statement. if文およびblock文に対して生成される文情報の一例を説明する図。The figure explaining an example of the sentence information produced | generated with respect to an if sentence and a block sentence. while文に対して生成される文情報の一例を説明する図。The figure explaining an example of the sentence information produced | generated with respect to a while sentence. if文から変換したwhile文の一例を説明するプログラム。A program that explains an example of a while statement converted from an if statement. 検査対象プログラム8の別の一例を示す図。FIG. 5 is a diagram showing another example of the inspection target program 8. 活性化経路を導出する関数を説明するプログラム構成の一例。An example of the program structure explaining the function which derives | leads-out an activation path | route. 活性化経路を表す木構造を説明する図。The figure explaining the tree structure showing an activation path | route. 活性化条件を導出する関数を説明するプログラム構成の一例。An example of a program configuration explaining a function for deriving an activation condition. 活性化条件を表す森構造を説明する図。The figure explaining the forest structure showing activation conditions. 本実施の形態のプログラム検査方法を応用した検査方法の処理手順を説明するフローチャート。The flowchart explaining the process sequence of the test | inspection method to which the program test | inspection method of this Embodiment is applied.

符号の説明Explanation of symbols

7…プログラム検査プログラム、11…プログラム解析部、12…カバレッジ情報解析部、13…入力データ生成部、   7 ... Program inspection program, 11 ... Program analysis unit, 12 ... Coverage information analysis unit, 13 ... Input data generation unit,

Claims (5)

検査対象プログラムを関数単位に解析し、外部変数情報と関数情報とからなるプログラム解析データを生成するプログラム解析部と、
前記検査対象プログラムを実行して得られるカバレッジ情報と前記プログラム解析データとに基づき、前記検査対象プログラムの入力変数及び/又は定数から未実行の文に至る経路である活性化経路と、前記経路に存在する条件文を満たすために設定すべき前記入力変数及び/又は前記定数の集合である活性化条件とからなる解析データを生成するカバレッジ情報解析部と、
前記活性化経路と前記活性化条件とに基づき、前記未実行の文を実行させるために設定が必要な前記入力変数を抽出し、抽出した前記入力変数に適切な値を設定する入力データ生成部と、
を備えたことを特徴とする、プログラム検査装置。
A program analysis unit that analyzes a program to be inspected in units of functions and generates program analysis data including external variable information and function information;
Based on the coverage information obtained by executing the inspection target program and the program analysis data, an activation path that is a path from the input variable and / or constant of the inspection target program to an unexecuted statement, and the path A coverage information analysis unit that generates analysis data including the input variable and / or an activation condition that is a set of constants to be set to satisfy an existing conditional statement;
Based on the activation path and the activation condition, an input data generation unit that extracts the input variable that needs to be set in order to execute the unexecuted statement and sets an appropriate value for the extracted input variable When,
A program inspection apparatus comprising:
前記カバレッジ情報解析部は、前記検査対象プログラムにおいて、生成した前記活性化経路と前記活性化条件とが該当する箇所を特定し、前記該当する箇所とその他の箇所とを識別可能に表示装置に表示することを特徴とする、請求項1に記載のプログラム検査装置。   The coverage information analysis unit identifies a location corresponding to the generated activation path and the activation condition in the inspection target program, and displays the corresponding location and other locations on a display device so as to be identifiable The program inspection device according to claim 1, wherein: 検査対象プログラムを関数単位に解析して外部変数情報と関数情報とからなるプログラム解析データを生成し、
前記検査対象プログラムを実行して得られるカバレッジ情報と前記プログラム解析データとに基づき、前記検査対象プログラムの入力変数及び/又は定数から未実行の文に至る経路である活性化経路と、前記経路に存在する条件文を満たすために設定すべき前記入力変数及び/又は前記定数の集合である活性化条件とからなる解析データを生成し、
前記活性化経路と前記活性化条件とに基づき、前記未実行の文を実行させるために設定が必要な前記入力変数を抽出し、抽出した前記入力変数に適切な値を設定することを特徴とする、プログラム検査方法。
Analyzing the program to be inspected in units of functions to generate program analysis data consisting of external variable information and function information,
Based on the coverage information obtained by executing the inspection target program and the program analysis data, an activation path that is a path from the input variable and / or constant of the inspection target program to an unexecuted statement, and the path Generating analysis data consisting of the input variable and / or the activation condition that is a set of constants to be set to satisfy an existing conditional statement;
Extracting the input variable that needs to be set in order to execute the unexecuted statement based on the activation path and the activation condition, and setting an appropriate value to the extracted input variable, A program inspection method.
前記検査対象プログラムにおいて、生成した前記活性化経路と前記活性化条件とが該当する箇所を特定し、前記該当する箇所とその他の箇所とを識別可能に表示装置に表示することを特徴とする、請求項3に記載のプログラム検査方法。   In the inspection target program, the location where the generated activation path and the activation condition correspond is specified, and the corresponding location and other locations are displayed on a display device in an identifiable manner, The program inspection method according to claim 3. コンピュータに、
検査対象プログラムを関数単位に解析し、外部変数情報と関数情報とからなるプログラム解析データを生成するプログラム解析手順と、
前記検査対象プログラムを実行して得られるカバレッジ情報と前記プログラム解析データとに基づき、前記検査対象プログラムの入力変数及び/又は定数から未実行の文に至る経路である活性化経路と、前記経路に存在する条件文を満たすために設定すべき前記入力変数及び/又は前記定数の集合である活性化条件とからなる解析データを生成するカバレッジ情報解析手順と、
前記活性化経路と前記活性化条件とに基づき、前記未実行の文を実行させるために設定が必要な前記入力変数を抽出し、抽出した前記入力変数に適切な値を設定する入力データ生成手順と、
を実行させることを特徴とする、プログラム検査プログラム。
On the computer,
A program analysis procedure for analyzing a program to be inspected in units of functions and generating program analysis data composed of external variable information and function information;
Based on the coverage information obtained by executing the inspection target program and the program analysis data, an activation path that is a path from the input variable and / or constant of the inspection target program to an unexecuted statement, and the path A coverage information analysis procedure for generating analysis data including the input variable and / or the activation condition that is a set of the constants to be set to satisfy an existing conditional statement;
An input data generation procedure for extracting the input variable that needs to be set in order to execute the unexecuted statement based on the activation path and the activation condition, and setting an appropriate value for the extracted input variable When,
A program inspection program characterized in that the program is executed.
JP2006248483A 2006-09-13 2006-09-13 Program inspection device, program inspection method, and program inspection program Pending JP2008071075A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2006248483A JP2008071075A (en) 2006-09-13 2006-09-13 Program inspection device, program inspection method, and program inspection program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2006248483A JP2008071075A (en) 2006-09-13 2006-09-13 Program inspection device, program inspection method, and program inspection program

Publications (1)

Publication Number Publication Date
JP2008071075A true JP2008071075A (en) 2008-03-27

Family

ID=39292612

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2006248483A Pending JP2008071075A (en) 2006-09-13 2006-09-13 Program inspection device, program inspection method, and program inspection program

Country Status (1)

Country Link
JP (1) JP2008071075A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012073692A (en) * 2010-09-28 2012-04-12 Hitachi Ltd Maintenance support device for embedded system
JP2012174166A (en) * 2011-02-24 2012-09-10 Mitsubishi Electric Corp Program testing apparatus, program testing method for program testing apparatus, and program testing program
JP2012221394A (en) * 2011-04-13 2012-11-12 Nec Commun Syst Ltd Test support system, test support method, and program
WO2014087493A1 (en) * 2012-12-04 2014-06-12 株式会社日立製作所 Test pattern creation device and creation method, and software verification device and verification method
JP2017167984A (en) * 2016-03-17 2017-09-21 株式会社東芝 Information processing device, information processing program, and inspection system

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012073692A (en) * 2010-09-28 2012-04-12 Hitachi Ltd Maintenance support device for embedded system
JP2012174166A (en) * 2011-02-24 2012-09-10 Mitsubishi Electric Corp Program testing apparatus, program testing method for program testing apparatus, and program testing program
JP2012221394A (en) * 2011-04-13 2012-11-12 Nec Commun Syst Ltd Test support system, test support method, and program
WO2014087493A1 (en) * 2012-12-04 2014-06-12 株式会社日立製作所 Test pattern creation device and creation method, and software verification device and verification method
JP2017167984A (en) * 2016-03-17 2017-09-21 株式会社東芝 Information processing device, information processing program, and inspection system
US10095607B2 (en) 2016-03-17 2018-10-09 Kabushiki Kaisha Toshiba Information processing device, computer program product, and testing system with acquiring total execution history

Similar Documents

Publication Publication Date Title
US9582396B2 (en) Techniques for generating an executable debugger script
JP2009129179A (en) Program parallelization support device and program parallelization support method
JPWO2006038394A1 (en) Source code tester, method, program, and storage medium
JP6316120B2 (en) Test case generation system and recording medium recording test case
JP2013156786A (en) Software structure visualization program and system
US20190391910A1 (en) Software-testing device, software-testing system, software-testing method, and program
Kaur et al. Improving the quality of software by refactoring
JP2008071075A (en) Program inspection device, program inspection method, and program inspection program
Rask et al. Visual studio code vdm support
Zeller The future of programming environments: Integration, synergy, and assistance
Baumgartner et al. Live Code Smell Detection of Data Clumps in an Integrated Development Environment.
JP2001273169A (en) Device for generating program test specification
JP6002507B2 (en) Software verification program and software verification system
US9600245B2 (en) Computer-implemented method for generating control unit program code and message management environment relating thereto
JP2008059515A (en) Method, system, and program for displaying program execution process
Ludwig et al. A case study using CBR-insight to visualize source code quality
Núñez-Varela et al. A methodology for obtaining universal software code metrics
JP2011100420A (en) Test program creation device
Bader et al. A proposed java forward slicing approach
Atkinson et al. Tool support for iterative software process modeling
Aveledo et al. Responsibilities in the usability requirements elicitation process
Al Dallal et al. Estimating the coverage of the framework application reusable cluster-based test cases
Qaisar et al. A safe regression testing approach for safety critical systems
JP7295599B1 (en) A program, system, and method for comprehensively visualizing aspects of data processing executed by a computer according to source code
JPH0926897A (en) Program analyzer and program analyzing method