JP2015197868A - Computer program checking apparatus - Google Patents

Computer program checking apparatus Download PDF

Info

Publication number
JP2015197868A
JP2015197868A JP2014076549A JP2014076549A JP2015197868A JP 2015197868 A JP2015197868 A JP 2015197868A JP 2014076549 A JP2014076549 A JP 2014076549A JP 2014076549 A JP2014076549 A JP 2014076549A JP 2015197868 A JP2015197868 A JP 2015197868A
Authority
JP
Japan
Prior art keywords
program
phenomenon
value
output value
path
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
JP2014076549A
Other languages
Japanese (ja)
Inventor
俊介 小鮒
Shunsuke Kobuna
俊介 小鮒
加賀 智之
Tomoyuki Kaga
智之 加賀
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.)
Toyota Motor Corp
Original Assignee
Toyota Motor 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 Toyota Motor Corp filed Critical Toyota Motor Corp
Priority to JP2014076549A priority Critical patent/JP2015197868A/en
Publication of JP2015197868A publication Critical patent/JP2015197868A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide a program checking apparatus capable of assessing the presence of a specific phenomenon and detecting an input test pattern that causes the phenomenon for every arithmetic path even when a program has a structure having conditional branches and multiple arithmetic paths.SOLUTION: A program checking apparatus of the present invention detects and stores all arithmetic paths that can arise during execution of a program, and performs generation of input values and an optimization process for assessing the presence of a specific phenomenon in an arithmetic path selected from the stored arithmetic paths. When the specific phenomenon is not detected, the apparatus iterates the process of performing input value generation and the optimization process for an assessment of the specific phenomenon selecting another arithmetic path from the stored arithmetic paths.

Description

本発明は、コンピュータ・プログラム又はソフトウェアの検査を行う装置に係り、より詳細には、コンピュータ・プログラム又はソフトウェアによる不具合現象などの任意の指定された現象(指定現象)の発生の有無を検査するとともに、その指定現象を発生する入力(テストパターン)を検出するための装置に係る。   The present invention relates to an apparatus for inspecting a computer program or software. More specifically, the present invention inspects whether or not any specified phenomenon (specified phenomenon) such as a malfunction phenomenon caused by a computer program or software has occurred. And an apparatus for detecting an input (test pattern) that generates the specified phenomenon.

コンピュータ技術の進歩により、現在、多くの装置や機械器具は、コンピュータ制御によって作動される。かかるコンピュータ制御に於いては、典型的には、装置や機械器具の作動を決定するコンピュータ・プログラム又はソフトウェア(以下、単に、「プログラム」と称する。)が、装置や機械器具に搭載されるコンピュータに実装され、或る入力が装置又は機械器具に対して為されると、CPUが、プログラムに従って、その入力に対応する出力を算定する演算処理を実行し、算定された出力に対応してアクチュエータ等の部位が駆動されることとなる。従って、コンピュータ制御される装置や機械器具が確実に正常に作動するためには、プログラムの装置又は機械器具の制御用コンピュータへの実装に際して、プログラム内のデバッグやエラー検証を行っておくことは勿論のこと、装置又は機械器具に与えられ得る任意の入力に対して、コンピュータ制御による装置又は機械器具の作動に於ける不具合現象、例えば、ハンチング、値の急変(動作量の急変など)、値の所定の範囲外への逸脱、といった現象が発生しないように、プログラムを調製しておくことが必要である。この点に関し、人の作業で不具合現象の有無を検出するテストは、工数が膨大であり、且つ、思考の抜け漏れによって、不具合現象の見逃しが生ずる懸念が存在する。そこで、従前より、プログラムの実装に際して、上記の如き、装置又は機械器具の作動に於ける不具合現象の発生のないことの確認をコンピュータで行う技術が種々提案されている。   Due to advances in computer technology, many devices and machinery are now operated by computer control. In such computer control, typically, a computer program or software (hereinafter simply referred to as “program”) for determining the operation of an apparatus or a machine is a computer mounted on the apparatus or machine. When a certain input is made to the apparatus or machine tool, the CPU executes a calculation process for calculating an output corresponding to the input according to the program, and an actuator corresponding to the calculated output. Etc. will be driven. Therefore, in order to ensure that a computer-controlled device or machine tool operates normally, it is of course necessary to perform debugging or error verification within the program when the program device or machine tool is mounted on the control computer. For any input that may be given to the device or machine tool, malfunctions in the operation of the computer controlled device or machine tool, eg hunting, sudden changes in value (such as sudden changes in the amount of movement), It is necessary to prepare a program so that a phenomenon such as deviation from a predetermined range does not occur. In this regard, a test for detecting the presence or absence of a malfunction phenomenon by human work has a large number of man-hours, and there is a concern that the malfunction phenomenon may be overlooked due to missing thoughts. In view of this, various techniques have been proposed in the past in which, when a program is implemented, a computer confirms that there is no occurrence of a malfunction phenomenon in the operation of the apparatus or machine tool as described above.

そのようなコンピュータを用いて、検査されるべきプログラムによる不具合現象の有無を検出するテストを行う例として、例えば、非特許文献1や特許文献1に於いては、検査されるべきプログラムにテストパターンを入力してプログラムを実行して結果出力を解析する動的テストの手法が開示されている。これらの動的テストでは、端的に述べれば、まず、不具合現象に相当するプログラムの結果出力値の値域が特定され、次いで、テストパターンの入力を用いたプログラムの実行により得られた結果出力値が、不具合現象に相当する値域に近づくように、テストパターンの入力を変化させながら、プログラムの実行による結果出力値の算定が反復して実行される(かかる反復演算過程は、「最適化処理」と称される。)。そして、或るテストパターンの入力に対して、不具合現象に相当する値域に入る結果出力値が算出されたときには、そのプログラムは、不具合現象が発生し得ると判定されるとともに、そのテストパターンが不具合現象を発生するパターンであると特定され、結果出力値が不具合現象に相当する値域に最も近づいたときでも、不具合現象に相当する値域に入らない場合には、そのプログラムは、不具合現象が発生せず、不具合現象を発生するテストパターンが存在しないと判定される。また、スナップショット、ATG(Automated Test Generation)ツールといったプログラム検査技術(例えば、特許文献2)では、プログラム内に、条件分岐が含まれている場合に、そのプログラム中に実行され得る全ての演算処理経路の検出、及び/又は、それぞれの経路の演算処理を実行させる入力のテストパターン又はテストベクターの自動生成を行う手法が実行される。更に、プログラムの実行結果に起き得る不具合や観察したい事象の全ての検出にSAT(充足可能性問題)ソルバーを利用することが行われている。また、更に、コンコリック・テスティング(Concolic testing)と称される手法に於いては、或る入力によるプログラムの実行、記号実行による分岐点における分岐条件の検出、実行されなかった経路を実行するための入力の作成、及び、新たに作成された入力による別の経路によるプログラムの実行の処理の反復実行が行われる(非特許文献2)。   As an example of performing a test for detecting the presence or absence of a malfunction phenomenon by a program to be inspected using such a computer, for example, in non-patent document 1 and patent document 1, a test pattern is included in a program to be inspected. A dynamic test method is disclosed in which a program is executed by inputting, and a result output is analyzed. In short, in these dynamic tests, first, the range of the result output value of the program corresponding to the failure phenomenon is specified, and then the result output value obtained by executing the program using the input of the test pattern is the result output value. The calculation of the result output value by executing the program is repeatedly executed while changing the input of the test pattern so as to approach the value range corresponding to the malfunction phenomenon (this iterative operation process is called “optimization process”. Called.). When a result output value that falls within a value range corresponding to a failure phenomenon is calculated with respect to an input of a certain test pattern, the program determines that the failure phenomenon can occur, and the test pattern is defective. Even if the pattern is identified as a pattern that generates a phenomenon and the result output value is closest to the range corresponding to the malfunction, if it does not fall within the range corresponding to the malfunction, the program will not generate the malfunction. Therefore, it is determined that there is no test pattern that causes a malfunction. Further, in a program inspection technique such as snapshot and ATG (Automated Test Generation) tool (for example, Patent Document 2), when a conditional branch is included in a program, all arithmetic processes that can be executed in the program A method of detecting a path and / or automatically generating an input test pattern or a test vector for executing a calculation process of each path is executed. In addition, a SAT (satisfiability problem) solver is used to detect all problems that may occur in the execution result of a program and events to be observed. Furthermore, in a method called “concolic testing”, to execute a program by a certain input, to detect a branch condition at a branch point by symbol execution, and to execute a route that has not been executed. And the repetitive execution of the program execution process by another route by the newly created input (Non-Patent Document 2).

特開2010−002370JP2010-002370 特開2006−244195JP 2006-244195 A

ツールズ・アンド・アルゴリズム・フォー・ザ・コンストラクション・アンド・アナリシス・オブ・システムズ レクチャー・ノーツ・イン・コンピュータ・サイエンス、6605巻 2011年 254−257ページ、アンピュリディ他4名(Tools and Algorithms for the Construction and Analysis of Systems Lecture Notes in Computer Science Volume 6605, 2011, pp254-257 S-TaLiRo: A Tool for Temporal Logic Falsification for Hybrid Systems, Yashwanth Annpureddy, Che Liu, Georgios Fainekos, Sriram Sankaranarayanan)Tools and Algorithms for the Construction and Analysis of Systems Lecture Notes in Computer Science, Vol. Analysis of Systems Lecture Notes in Computer Science Volume 6605, 2011, pp254-257 S-TaLiRo: A Tool for Temporal Logic Falsification for Hybrid Systems, Yashwanth Annpureddy, Che Liu, Georgios Fainekos, Sriram Sankaranarayanan) ソフトウェア・テスティング・マニアX 7巻 1ページ (Software Testing ManiaX vol.7 1)「最近出てきたテスト技法」辰巳敬三Software Testing Mania X vol.7 1 page (Software Testing ManiaX vol.7 1) “Recently emerging testing techniques” Keizo Tsuji

上記の如く、プログラムの開発では、不具合現象を検出するためのテストが重要であり、開発の効率化や不具合現象の見逃しの削減を狙って、テスト手法の一つとして、上記の如き「最適化」処理を用いた手法を利用した動的テスト自動生成技術が提案されている。しかしながら、演算処理に、条件分岐処理が含まれ、これにより、結果出力値に離散的な部分と連続的な部分とが混在するプログラムに対して、「最適化」を用いた手法を用いた検査手法を利用すると、失敗することが多く、結果出力値に不具合現象が生ずる場合であっても、そのことを正しく検出することが困難となり、従って、そのプログラムに於いて不具合現象が生ずる入力値又はテストパターンを検出することも困難となる場合がある。   As described above, testing for detecting fault phenomena is important in program development. To optimize development and reduce oversight of fault phenomena, one of the test methods described above is “optimization”. A dynamic test automatic generation technique using a method using processing is proposed. However, the arithmetic processing includes conditional branch processing, which makes it possible to check the program that uses "optimization" for programs in which the result output value contains both discrete and continuous parts. If this method is used, it will often fail, and even if a malfunction occurs in the resulting output value, it will be difficult to detect it correctly. It may also be difficult to detect the test pattern.

より具体的に述べれば、被検査プログラムに於いて条件分岐処理(If文など)が含まれているとき、その被検査プログラムによる演算処理は、条件によって、複数の異なる演算経路のいずれかに沿って実行され、異なる演算経路を経て算定された結果出力値の値域は、互いに離散的に隔離していることが多い。一方、「最適化」による不具合現象の有無の検出処理では、既に触れた如く、或る初期入力値を被検査プログラムへ入力してプログラムを実行して結果出力値を算出し、次いで、その結果出力値が不具合現象に相当する結果出力値の値域に近づくように連続的に入力値を変化させながら、プログラムの実行による結果出力値の算出が繰り返すという処理が実行されることとなる。そうすると、異なる演算経路を経て算定された結果出力値の値域が互いに離散的に隔離している場合には、或る初期入力値を用いて「最適化」処理が開始され、不具合現象に相当する結果出力値の値域に結果出力値を近づける入力値の変更と結果出力値の算出がされるとしても、入力値が、最初に用いた初期入力値からの「最適化」の処理で通過する経路とは、別の経路をも通過するように変更されて、「最適化」の演算処理が実行される保証はない。その場合、最初に用いた初期入力値からの「最適化」の過程で通過する経路以外の演算経路に潜む不具合現象を見逃してしまうおそれがある。   More specifically, when a conditional branch process (such as an If statement) is included in the program to be inspected, the arithmetic processing by the program to be inspected follows any one of a plurality of different arithmetic paths depending on the condition. In many cases, the range of the result output values that are executed through different computation paths are discretely isolated from each other. On the other hand, in the detection process of the presence or absence of the malfunction phenomenon by “optimization”, as already mentioned, a certain initial input value is input to the program to be inspected, the program is executed, and the result output value is calculated. A process of repeatedly calculating the result output value by executing the program is executed while continuously changing the input value so that the output value approaches the range of the result output value corresponding to the malfunction phenomenon. Then, when the ranges of the output values calculated through different calculation paths are discretely separated from each other, an “optimization” process is started using a certain initial input value, which corresponds to a malfunction phenomenon. Even if the input value is changed to bring the result output value closer to the range of the result output value and the result output value is calculated, the path through which the input value passes through the "optimization" process from the initial input value used first Is changed to pass through another route, and there is no guarantee that the “optimization” calculation process is executed. In that case, there is a possibility that a malfunction phenomenon hidden in a calculation path other than the path that passes through in the process of “optimization” from the initial input value used first may be missed.

例えば、図2(A)の例示されている如き、プログラムコードの場合、データフローとしては、図2(B)の如く、3つの経路が存在する。この構造を持つプログラムに於いて、Pが、99.99…%の確率で、Trueとなる状況の場合、経路1を通る演算によって変数aが選択されるので、変数aによる最適化処理(即ち、変数aの値の変化によって発生する不具合現象の有無の検証)は実行されるが、経路2を通る演算によって変数bが選択されることは稀であり、結局、変数bによる最適化処理が実行されず、即ち、経路2を通る演算で変数bの値の変化によって不具合現象が発生するか否かは検知できないこととなる。   For example, in the case of a program code as illustrated in FIG. 2A, there are three paths for data flow as shown in FIG. 2B. In a program having this structure, in the situation where P is True with a probability of 99.99...%, The variable a is selected by the operation through the path 1, so that the optimization process using the variable a (that is, , Verification of the presence or absence of a malfunction phenomenon caused by a change in the value of the variable a) is executed, but the variable b is rarely selected by an operation through the path 2, and eventually the optimization process using the variable b is performed. It is not executed, that is, it cannot be detected whether or not a malfunction phenomenon occurs due to a change in the value of the variable b in the calculation through the path 2.

一方、最適化処理と別の手法の既存の検証ツールのうち、SATソルバーのような、全ての入出力空間の点に対して網羅的な検証を行うツールは、時系列に入出力が為される処理のように、空間点が膨大であり、検証対象空間が広過ぎる場合には、不具合現象の発生する特定の点を検出することは、困難である(特に、費用と時間がかかる。)   On the other hand, among the existing verification tools that are different from optimization processing, tools such as the SAT solver that perform exhaustive verification on all input / output space points are input / output in time series. If the number of spatial points is enormous and the verification target space is too wide as in the processing described above, it is difficult to detect a specific point where the malfunction phenomenon occurs (particularly, it takes cost and time).

かくして、本発明の一つの課題は、被検査プログラムが、条件分岐処理を含み、これにより、複数の演算経路が存在する構造を有し、それらの演算経路の結果出力値の値域が離散的である場合でも、全ての演算経路について、最適化処理による不具合現象など、或る指定された現象(指定現象)の有無の検査ができ、指定現象を発生するテストパターンが検出できる新規なプログラム検査装置を提供することである。   Thus, one problem of the present invention is that the program to be inspected includes a conditional branch process, and thus has a structure in which a plurality of operation paths exist, and the range of output values of these operation paths is discrete. Even in some cases, a new program inspection device that can inspect the presence or absence of a specified phenomenon (designated phenomenon), such as a malfunction phenomenon caused by optimization processing, and detect a test pattern that generates the designated phenomenon for all computation paths Is to provide.

本発明によれば、上記の課題は、プログラムの作動に於ける指定現象の発生の有無を検査する装置であって、前記プログラムの実行に於いて生じ得る演算経路の全てを検出し、前記検出された演算経路の全てを記憶する演算経路記憶手段と、前記記憶された演算経路の全てのうちの一つを選択する演算経路選択手段と、前記選択された一つの演算経路を実行させる入力値の生成を実行する入力生成手段と、前記生成された入力値を初期入力値として用いて前記選択された一つの演算経路に於いて前記プログラムの最適化処理を実行する最適化処理手段と、前記最適化処理の実行により得られた前記プログラムの結果出力値が前記指定現象の発生に相当する前記プログラムの実行により算出される結果出力値の値域である指定現象結果出力値域に包含されるか否かの判定を実行する結果出力値判定手段とを含み、前記最適化処理手段による前記最適化処理の実行により得られた前記プログラムの結果出力値の前記指定現象結果出力値域までの距離が最小となったときに前記結果出力値が前記指定現象結果出力値域に包含されず、且つ、前記記憶された演算経路の全てのうちのまだ選択されていない演算経路が存在するときには、そのうちの一つが前記演算経路選択手段により選択され、前記新たに選択された演算経路を前記選択された一つの演算経路として、前記入力生成手段による前記入力値の生成と、前記最適化処理手段による前記最適化処理と、前記結果出力値判定手段による前記判定とを反復実行する装置によって達成される。   According to the present invention, the above-described problem is an apparatus for inspecting the occurrence of a specified phenomenon in the operation of a program, detecting all the computation paths that can occur in the execution of the program, and detecting the detection Calculation path storage means for storing all of the calculated calculation paths, calculation path selection means for selecting one of all of the stored calculation paths, and an input value for executing the selected one calculation path Input generation means for executing generation of the program; optimization processing means for executing optimization processing of the program in the selected one computation path using the generated input value as an initial input value; and The specified phenomenon result output value range in which the result output value of the program obtained by executing the optimization process is the range of the result output value calculated by executing the program corresponding to the occurrence of the specified phenomenon A result output value determining means for determining whether or not it is included, and up to the specified phenomenon result output value range of the result output value of the program obtained by execution of the optimization process by the optimization processing means When the result output value is not included in the designated phenomenon result output value range when the distance of the distance is minimized, and there is an unselected computation path among all of the stored computation paths, One of them is selected by the calculation path selection means, and the newly selected calculation path is set as the selected one calculation path, the generation of the input value by the input generation means, and the optimization processing means This is achieved by an apparatus that repeatedly executes the optimization processing and the determination by the result output value determination means.

上記の構成に於いて、「指定現象」とは、典型的には、既に触れた如き、ハンチング、値の急変(動作量の急変など)、値の所定の範囲外への逸脱、などの、プログラムの作動に於いて望ましくない不具合現象であるが、本発明の構成に於いては、指定現象が必ずしも不具合現象でなくてもよく、任意に指定される現象であって、プログラムの結果出力値に於いてその指定現象の発生に相当する値域が定義できる現象であってよいことは理解されるべきである。「プログラムの最適化処理」とは、既に述べた如く、プログラムの実行により得られる結果出力値が、指定現象の発生に相当する値域に近づくように、入力値を変化させながら、プログラムの実行による結果出力値の算定を反復して実行する処理である。そして、かかる反復処理は、結果出力値が指定現象の発生に相当する値域に包含されるか、結果出力値の、指定現象の発生に相当する値域までの距離(結果出力値と値域との間のスカラー量)が最小となったときに終了する。また、上記の一連の処理のうち、演算経路選択手段によるプログラムの実行に於いて生じ得る演算経路の全ての検出は、スナップショット、ATGツールといった任意のアルゴリズムを用いて達成可能である。入力生成手段による選択された一つの演算経路を実行させる入力値の生成は、例えば、SATソルバーなどの任意のアルゴリズムを用いて達成可能である。プログラムの最適化処理は、種々の既存のアルゴリズムを用いて達成可能である。   In the above configuration, the “designated phenomenon” typically means hunting, sudden change in value (sudden change in operation amount, etc.), deviation of the value outside a predetermined range, etc., as already mentioned. Although this is an undesirable malfunction in the operation of the program, in the configuration of the present invention, the designation phenomenon does not necessarily have to be a malfunction phenomenon, and is a phenomenon that is arbitrarily designated. It should be understood that the value range corresponding to the occurrence of the specified phenomenon may be a phenomenon that can be defined. As described above, “program optimization processing” is performed by executing a program while changing an input value so that a result output value obtained by executing the program approaches a value range corresponding to occurrence of a specified phenomenon. This is a process of repeatedly calculating the result output value. Then, the iterative process is performed so that the result output value is included in the range corresponding to the occurrence of the specified phenomenon or the distance of the result output value to the range corresponding to the occurrence of the specified phenomenon (between the result output value and the range). Is finished when the (scalar amount) becomes minimum. In addition, detection of all computation paths that can occur in the execution of a program by the computation path selection means in the series of processes described above can be achieved using an arbitrary algorithm such as a snapshot or an ATG tool. Generation of an input value for executing one selected computation path by the input generation unit can be achieved using an arbitrary algorithm such as a SAT solver. The program optimization process can be achieved using various existing algorithms.

上記の本発明の装置の作動に於いては、端的に述べれば、まず、或る検査されるべきプログラムに於いて、生じ得る演算経路の全ての検出が為され、それらの演算経路の各々について、個別に、順々に、最適化処理が実行され、プログラムの最適化処理による指定現象の発生の有無が検査されることとなる。そして、指定現象が不具合現象である場合、一連の処理の実行中に、不具合現象に相当する値域に結果出力値が包含することが検出されれば、その時点で、処理を中断し、かかる結果出力値を与えた入力値が、指定現象を発生するテストパターンとして検出され、プログラムは、修正されるべきものとして判定されてよい。かかる構成によれば、プログラムが、条件分岐処理を含み、複数の演算経路が存在する構造を有し、従って、プログラムの結果出力値の値域が離散的な部分と連続的な部分とを含む場合であっても、全ての複数の演算経路に於ける最適化処理が実行できることとなるので、指定現象又は不具合現象の見逃しが低減されることとなり、例えば、発生する確率の低い演算経路に於いて指定現象又は不具合現象が発生する場合も見逃すことなく検出できる確率が大幅に増大することとなる。   In the operation of the above-described apparatus of the present invention, in short, first, all possible computation paths are detected in a program to be examined, and for each of these computation paths. Individually, the optimization process is executed one after another, and it is checked whether or not the specified phenomenon is generated by the program optimization process. When the specified phenomenon is a malfunction phenomenon, if it is detected that a result output value is included in the range corresponding to the malfunction phenomenon during the execution of a series of processes, the process is interrupted at that point, and the result An input value given an output value may be detected as a test pattern that causes a specified phenomenon, and the program may be determined to be corrected. According to such a configuration, the program includes a conditional branch process and has a structure in which a plurality of operation paths exist, and accordingly, the range of the result output value of the program includes a discrete part and a continuous part. Even so, since the optimization process can be executed in all of the plurality of computation paths, the oversight of the specified phenomenon or malfunction phenomenon is reduced. For example, in the computation path with a low probability of occurrence. Even when a specified phenomenon or a malfunction phenomenon occurs, the probability of detection without missing is greatly increased.

なお、上記の構成に於いて、更に、最適化処理の実行中に選択された演算経路の途中で算出される中間演算値を参照して、選択された演算経路に沿って演算が実行されているか否かを判定する中間演算値監視手段が設けられていてよい。演算経路に沿って演算が実行されているか否かの判定は、例えば、参照された中間演算値が所定の値域内に包含されているか否かを判定することにより達成可能である。かかる構成によれば、最適化処理の途中で、検査されている演算経路が意図されているもの(選択されているもの)であるか否かを監視することができ、もし検査されている演算経路が選択されているものでないことが分かれば、指定現象結果出力値域の変更を行い、選択されている演算経路に沿った演算処理が確実に実行されるように処理の修正を実行することが可能となる。   In the above configuration, further, the calculation is executed along the selected calculation path with reference to the intermediate calculation value calculated in the middle of the calculation path selected during the execution of the optimization process. Intermediate calculation value monitoring means for determining whether or not there is provided may be provided. The determination as to whether or not an operation is being performed along the operation path can be achieved by determining whether or not the referenced intermediate operation value is included in a predetermined value range, for example. According to such a configuration, during the optimization process, it is possible to monitor whether or not the computation path being examined is intended (selected), and if the computation being examined If it is known that the route is not selected, the specified phenomenon result output value range is changed, and the processing correction is performed so that the arithmetic processing along the selected arithmetic route is executed reliably. It becomes possible.

かくして、上記の本発明によれば、被検査プログラムに、結果出力値の値域が離散的に隔離した複数の演算経路に沿った処理が発生可能な構造が有る場合に於いて、結果出力値の値域が離散的に隔離されている部分と連続している部分とが存在していることを考慮し、演算経路毎に、最適化処理を実施することにより、全ての演算経路について、或いは、検証すべき対象空間が広い場合であっても、最適化処理による指定現象又は不具合現象の有無の検査及びそれを発生するテストパターンの検出が可能となる。特に、検査されるプログラムが装置や機械器具の作動のコンピュータ制御のためのプログラムであり、装置や機械器具の作動に離散的な挙動が含まれる場合であっても、指定現象(不具合現象とは限らない。)の検出が効率的に達成できることが期待される。また、本発明の装置は、プログラムの作動に於ける指定現象又は不具合現象の検出とその指定現象又は不具合現象を発生するテストパターンの検出が、人の作業によらず、自動的に実行されるので、プログラムの開発工数の低減、プログラム及び制御品質の更なる向上が期待される。   Thus, according to the present invention described above, when the program to be inspected has a structure capable of generating processing along a plurality of operation paths in which the range of the result output value is discretely separated, the result output value Considering the existence of discretely separated parts and continuous parts, the optimization process is performed for each computation path, or all computation paths are verified. Even when the target space to be processed is wide, it is possible to inspect whether there is a specified phenomenon or malfunction phenomenon by the optimization process and to detect a test pattern that generates the specified phenomenon. In particular, the program to be inspected is a program for computer control of the operation of the device or machine tool, and even if the operation of the device or machine tool includes discrete behavior, the specified phenomenon (the failure phenomenon is It is expected that detection of (but not limited to) can be achieved efficiently. In addition, the apparatus of the present invention automatically executes detection of a specified phenomenon or malfunction phenomenon in the operation of a program and detection of a test pattern that generates the specified phenomenon or malfunction phenomenon regardless of human work. Therefore, reduction of program development man-hours and further improvement of program and control quality are expected.

本発明のその他の目的及び利点は、以下の本発明の好ましい実施形態の説明により明らかになるであろう。   Other objects and advantages of the present invention will become apparent from the following description of preferred embodiments of the present invention.

図1(A)は、本発明によるプログラム検査装置を模式的に表した図であり、図1(B)は、その内部の処理部の構成をブロック図の形式で表した図である。なお、図中、矢印は、情報の流れを示している。FIG. 1 (A) is a diagram schematically showing a program inspection apparatus according to the present invention, and FIG. 1 (B) is a diagram showing the configuration of the internal processing unit in the form of a block diagram. In the figure, arrows indicate the flow of information. 図2(A)は、本発明によるプログラム検査装置により検査されるプログラムのコードの一部の例を示しており、図2(B)は、図2(A)のプログラムコードのデータフローグラフを示している。図2(C)は、図2(A)のプログラムのコードに含まれる複数の演算経路を別々に分解して表したデータフローグラフを示している。FIG. 2A shows an example of a part of a program code to be inspected by the program inspection apparatus according to the present invention, and FIG. 2B shows a data flow graph of the program code in FIG. Show. FIG. 2C shows a data flow graph in which a plurality of operation paths included in the program code of FIG. 図3(A)は、本発明によるプログラム検査装置に於ける最適化処理の流れを説明する図であり、図3(B)は、最適化処理に於いて、最小化されるロバスト値について説明する図である。図3(C)、(D)、(E)は、最適化処理に於ける入力値、出力値、ロバスト値の変化の態様を説明する模式的なグラフ図である。FIG. 3A is a diagram for explaining the flow of optimization processing in the program inspection apparatus according to the present invention, and FIG. 3B is for explaining the robust value minimized in the optimization processing. It is a figure to do. FIGS. 3C, 3D, and 3E are schematic graphs for explaining changes in input values, output values, and robust values in the optimization process. 図4(A)は、本発明によるプログラム検査装置に於ける処理をフローチャートの形式にて表した図であり、図4(B)は、図4(A)の処理が実行される場合の入力値の値域と出力値の値域と演算経路と出力値の軌跡の関係の例をグラフ図の形式にて模式的に表した図である。図中、矢印は、最適化処理に於いて算出される出力値の軌跡を模式的に描いたものであり、●が、初期値に対する出力であり、矢印先端が、最終到達点である。FIG. 4A is a diagram showing the processing in the program inspection apparatus according to the present invention in the form of a flowchart, and FIG. 4B is an input when the processing of FIG. 4A is executed. It is the figure which represented typically the example of the relationship between the range of a value, the range of an output value, a calculation path | route, and the locus | trajectory of an output value in the format of a graph figure. In the figure, the arrow schematically shows the locus of the output value calculated in the optimization process, ● is the output for the initial value, and the tip of the arrow is the final arrival point. 図5(A)は、本発明によるプログラム検査装置の図3(A)の実施形態に於いて実行される最適化処理の一部を改良した処理をフローチャートの形式にて表した図であり、図5(B)は、図5(A)の処理が実行される場合の入力値の値域と出力値の値域と演算経路と出力値の軌跡の関係の例をグラフ図の形式にて模式的に表した図である。図中、矢印は、最適化処理に於いて算出される出力値の軌跡を模式的に描いたものであり、●が、初期値に対する出力であり、矢印先端が、最終到達点である。FIG. 5 (A) is a diagram showing, in the form of a flowchart, a process obtained by improving a part of the optimization process executed in the embodiment of FIG. 3 (A) of the program inspection apparatus according to the present invention. FIG. 5B is a schematic diagram showing an example of the relationship between the input value range, the output value range, the calculation path, and the output value trajectory when the process of FIG. 5A is executed. FIG. In the figure, the arrow schematically shows the locus of the output value calculated in the optimization process, ● is the output for the initial value, and the tip of the arrow is the final arrival point. 図6は、本発明による処理が実行されない場合に於けるプログラム検査装置の最適化処理が実行される際の、入力値の値域と出力値の値域と演算経路と出力値の軌跡の関係の例をグラフ図の形式にて模式的に表した図である。図中、矢印は、最適化処理に於いて算出される出力値の軌跡を模式的に描いたものであり、●が、初期値に対する出力であり、矢印先端が、最終到達点である。FIG. 6 shows an example of the relationship between the input value range, the output value range, the calculation path, and the output value trajectory when the optimization processing of the program checking device is executed when the processing according to the present invention is not executed. Is a diagram schematically showing in the form of a graph. In the figure, the arrow schematically shows the locus of the output value calculated in the optimization process, ● is the output for the initial value, and the tip of the arrow is the final arrival point.

1…コンピュータ本体
2…コンピュータ端末
3…モニター
4…キーボード、マウス(入力装置)
DESCRIPTION OF SYMBOLS 1 ... Computer body 2 ... Computer terminal 3 ... Monitor 4 ... Keyboard, mouse (input device)

装置の概略
本発明によるプログラム検査装置は、この分野で通常使われている形式のコンピュータ装置1に於けるプログラムの作動により実現されてよい(図1(A))。コンピュータ装置1には、通常の態様にて、双方向コモン・バスにより相互に連結されたCPU、記憶装置、入出力装置(I/O)が装備され、記憶装置は、本発明の演算で使用する演算処理を実行する各プログラムを記憶したメモリと、演算中に使用されるワークメモリ及びデータメモリを含んでいる。また、実施者によるコンピュータ装置1への指示及び計算結果その他の情報の表示及び出力は、コンピュータ装置1に接続されたコンピュータ端末装置2を通じて為される。コンピュータ端末装置2には、通常の態様にて、モニター3とキーボード並びにマウスといった入力装置4が設けられ、前記の各プログラムが起動されると、実施者は、前記の各プログラムの手順に従ってモニター3上の表示に従って、入力装置4を用いてコンピュータ装置1に各種の指示及び入力を行うとともに、モニター3上にてコンピュータ装置1からの演算状態及び演算結果等を視覚的に確認することが可能となる。なお、図示していないその他の周辺機器(結果を出力するプリンタ、計算条件及び演算結果情報等を入出力するための記憶装置など)がコンピュータ装置1及びコンピュータ端末装置2に装備されていてよいことは理解されるべきである。コンピュータ装置1を用いて、以下に述べる各種の処理又は演算を実行する際には、通常の態様にて、各種の処理又は演算に必要なプログラムが起動され、実施者は、コンピュータ端末装置2に於いて、プログラムに於いて準備された入力手順に従って、演算に必要なデータ、演算時の計算条件その他の各種設定を入力し、演算が開始される。そして、演算の実行中又は終了後に、演算結果が、適宜、コンピュータ端末装置2を通じて出力可能となる。
Outline of Apparatus The program inspection apparatus according to the present invention may be realized by the operation of a program in the computer apparatus 1 of the type normally used in this field (FIG. 1A). The computer apparatus 1 is equipped with a CPU, a storage device, and an input / output device (I / O) connected to each other by a bidirectional common bus in a normal manner, and the storage device is used in the calculation of the present invention. A memory storing each program for executing the arithmetic processing, and a work memory and a data memory used during the calculation. In addition, the display and output of instructions, calculation results, and other information to the computer device 1 by the practitioner are performed through the computer terminal device 2 connected to the computer device 1. The computer terminal device 2 is provided with a monitor 3 and an input device 4 such as a keyboard and a mouse in a normal manner. When each of the programs is started, the practitioner follows the procedure of each program. According to the above display, it is possible to perform various instructions and inputs to the computer apparatus 1 using the input device 4 and to visually check the calculation state and calculation result from the computer apparatus 1 on the monitor 3. Become. Note that the computer device 1 and the computer terminal device 2 may be equipped with other peripheral devices (not shown) (printer for outputting results, storage device for inputting / outputting calculation conditions and calculation result information, etc.). Should be understood. When various processes or operations described below are executed using the computer apparatus 1, programs necessary for the various processes or calculations are started in a normal manner, and the practitioner can connect the computer terminal apparatus 2 to the computer terminal apparatus 2. Then, in accordance with the input procedure prepared in the program, data necessary for calculation, calculation conditions at the time of calculation, and other various settings are input, and calculation is started. Then, during or after the execution of the calculation, the calculation result can be output through the computer terminal device 2 as appropriate.

本発明によるプログラム検査装置の各処理を実行する構成に於いては、具体的には、図1(B)に示されている如く、検査されるべきプログラム(被検査プログラム)に於いて発生し得る演算経路の全てを検出する演算経路検出部と、検出された演算経路の全てを記憶する演算経路記憶部と、記憶された演算経路のうちの一つを選択する被検査演算経路選択部と、被検査プログラムに於ける発生の有無が判定される現象(指定現象)の目的関数(プログラムの実行による結果出力値の値域を決定する関数)を設定する指定現象目的関数設定部と、選択された演算経路に於いて後に詳細に説明される最適化処理を実行し、その演算経路に於いて指定現象が発生するか否かを判定する最適化処理部とが含まれる。また、最適化処理部に於いては、最適化処理に於いて最初に入力される初期入力テストパターンを生成する初期入力テストパターン生成部と、最適化処理の過程で得られる結果出力値と指定現象の目的関数の定める値域との距離(ロバスト値)を小さくするように修正された入力テストパターンを生成する修正入力テストパターン生成部と、生成されたテストパターンを入力して被検査プログラムを実行するプログラム実行部と、プログラム実行部の結果出力値が指定現象の目的関数の定める値域との距離を決定して結果出力値が指定現象の値域に包含されるか否かを判定する結果出力判定部とが設けられる。また、追加的に、プログラム実行部のプログラムの演算処理の途中の演算値(中間演算値)を参照して、演算処理が選択された演算経路に沿っているか否かを監視する中間演算値監視部が設けられていてもよい(図5の場合)。なお、これらの各処理部は、コンピュータ装置1に於けるプログラムに従った演算処理によって実現されることは理解されるべきである。   In the configuration for executing each process of the program inspection apparatus according to the present invention, specifically, as shown in FIG. 1B, it occurs in the program to be inspected (program to be inspected). A computation path detection unit that detects all of the computation paths to be obtained; a computation path storage unit that stores all of the detected computation paths; and an inspected computation path selection unit that selects one of the stored computation paths; A specified phenomenon objective function setting section for setting an objective function (a function for determining a range of a result output value by executing a program) of a phenomenon (designated phenomenon) for which occurrence / non-occurrence in the program to be inspected is determined. And an optimization processing unit that executes an optimization process, which will be described in detail later, in the calculation path and determines whether or not a specified phenomenon occurs in the calculation path. In the optimization processing unit, an initial input test pattern generation unit that generates an initial input test pattern that is input first in the optimization processing, and a result output value obtained in the course of the optimization processing and designation A modified input test pattern generation unit that generates an input test pattern that is modified to reduce the distance (robust value) from the range defined by the objective function of the phenomenon, and the program to be inspected is executed by inputting the generated test pattern Result output determination that determines whether the result output value is included in the range of the specified phenomenon by determining the distance between the program execution unit to be executed and the range of the result output value of the program execution unit determined by the objective function of the specified phenomenon Are provided. In addition, an intermediate calculation value monitor that monitors whether the calculation process is along the selected calculation path with reference to the calculation value (intermediate calculation value) in the middle of the calculation process of the program of the program execution unit May be provided (in the case of FIG. 5). It should be understood that each of these processing units is realized by arithmetic processing according to a program in the computer apparatus 1.

被検査プログラムの検査処理の構成
「発明の概要」の欄で述べた如く、或るプログラムに於いて、条件分岐処理(If文等)が含まれているとき、その被検査プログラムによる演算処理は、条件に依存して、複数の異なる演算経路のいずれかに沿って実行され、異なる演算経路を経て算定された結果出力値の値域は、互いに離散的に隔離していることが多い。例えば、図2(A)のプログラムコードに例示されている如く、P、Qの状態による条件分岐が含まれていると、図2(B)のデータフローグラフに示されている如く、P、Qの状態によって、プログラムの実行が為され得る経路として、3つの経路、経路1、経路2、経路3が存在する。そして、この場合、経路1、経路2、経路3のそれぞれに沿って為された演算結果、即ち、結果出力の値は、それぞれ、変数a、b、cとなり、変数a、b、cがそれぞれ変化した場合に得られる結果出力値の値域は、通常、互いに離散的に隔離した値域となり得る。
As described in the section “Inventory Summary” of the inspection process of the program to be inspected , when a conditional branch process (If statement etc.) is included in a certain program, the arithmetic processing by the program to be inspected is Depending on the conditions, the range of the result output values that are executed along any one of a plurality of different computation paths and calculated through the different computation paths are often discretely isolated from each other. For example, as shown in the program code of FIG. 2A, if a conditional branch depending on the states of P and Q is included, as shown in the data flow graph of FIG. There are three routes, route 1, route 2, and route 3, as the routes on which the program can be executed depending on the state of Q. In this case, the calculation results performed along each of the route 1, the route 2, and the route 3, that is, the values of the result outputs are the variables a, b, and c, respectively. The range of the resulting output value obtained when it changes can usually be a range of values discretely isolated from each other.

一方、最適化処理によって指定の現象発生の有無の検査及び指定現象を発生させるテストパターンの検出又は生成を行う手法は、典型的には、検査されるべきプログラムの結果出力値の値域が実質的に連続的であることが前提となっており、プログラムの結果出力値の値域が離散的な値域であることは想定されていない。従って、被検査プログラムが、条件分岐処理を含んでいることなどによって、離散的に互いに隔離した結果出力値の値域を有する場合、或る一つの経路から開始された最適化処理だけでは、他の経路から発生する値域に潜む指定現象は、見逃される可能性が高くなる。   On the other hand, the method of inspecting whether or not a specified phenomenon has occurred by the optimization process and detecting or generating a test pattern that generates the specified phenomenon typically has a substantial range of output values of the program to be inspected. It is assumed that the output value range of the program is a discrete value range. Therefore, if the program to be inspected has a range of output values that are discretely separated from each other, for example, by including conditional branch processing, the optimization processing started from a certain path alone will cause other The specified phenomenon lurking in the value range generated from the route is likely to be missed.

この点について、より詳細に説明すると、最適化処理による手法では、まず、図3(A)に説明されているように、検査されるべきプログラムの結果出力値に於ける存在の有無が検査されるべき指定現象、例えば、ハンチング、値の急変(動作量の急変など)、値の所定の範囲外への逸脱、といった不具合現象、が指定され、結果出力値に於ける指定された指定現象に相当する値域が決定される。そして、検査されるべきプログラムへ初期値として入力されるテストパターンが生成され、プログラムの実行(典型的には、コンピュータ・シミュレーションによる)が為され、初期値に対する結果出力値が算定される。かくして算定された結果出力値は、入力テストパターン生成を実行する処理部へフィードバックされ、そこに於いて、算定された結果出力値と指定現象に相当する値域との間のロバスト値(具体的には、それらの間の距離又はスカラー量)が算出される。しかる後、算定されたロバスト値が小さくなるように、入力されるテストパターンの修正が実行され、修正されたテストパターンを用いたプログラムの実行、その結果出力値のフィードバック、ロバスト値の算出、テストパターンの修正の各処理が反復して実行される。   This point will be described in more detail. In the method based on the optimization process, first, as shown in FIG. 3A, the presence / absence in the result output value of the program to be checked is checked. Designated phenomena to be specified, such as hunting, sudden changes in values (such as sudden changes in the amount of movement), deviations of values out of the specified range, etc. are designated, and the designated designated phenomena in the result output value are specified. The corresponding range is determined. Then, a test pattern to be input as an initial value to the program to be inspected is generated, the program is executed (typically by computer simulation), and a result output value for the initial value is calculated. The calculated result output value is fed back to the processing unit for executing the input test pattern generation, where a robust value (specifically, between the calculated result output value and the range corresponding to the specified phenomenon). (Distance between them or scalar quantity) is calculated. After that, the input test pattern is corrected so that the calculated robust value becomes small, the program using the corrected test pattern is executed, the result feedback of the output value, the calculation of the robust value, the test Each pattern correction process is executed repeatedly.

上記の最適化処理に於ける一連の処理によれば、最終的には、ロバスト値が0又はそれ以下となるか最小となるテストパターンの検出又は生成が可能となる。具体的には、例えば、図3(C)〜(E)に例示されている如く、指定現象に相当する出力値が図3(D)の線dの挙動であるプログラムの検査に上記の最適化処理を適用する場合、初めに(この段階では、実線dの挙動を与える図3(C)の実線dの入力値は、未知である。)、任意のテストパターンとして図3(C)の入力aを与えると、最初に図3(D)の線aの挙動が出力され、これにより、図3(E)のロバスト値aが算出される。次いで、ロバスト値が得られた値(aの値)よりも小さくなるようにテストパターンbの生成(テストパターンaの修正)とプログラムへの入力が為され、プログラムの実行により、図3(D)の線bの出力値が得られ、これにより、図3(E)のロバスト値bが算出される。そして、ロバスト値を更に小さくするためのテストパターンの生成と入力、プログラムの実行、ロバスト値の算出の操作が繰り返されると、入力値がb→c→dと修正されるにつれて、図3(D)の線の挙動は、b→c→dと挙動dに近づき、従って、ロバスト値は、更に、b→c→dと変化し、最終的に、ロバスト値は、最小値dとなる。かかる過程に於いて、ロバスト値dが0又はそれ以下となれば、結果出力値である挙動は、指定現象と一致したこととなり、これにより、指定現象の発生の検出と、それを与えるテストパターンの生成が為されたこととなる。そして、ロバスト値の最小値が0より大きい場合には、結果出力値は、指定現象の値域に到達せず、被検査プログラムでは、指定現象は発生しないと判定できることとなる。   According to the series of processes in the above optimization process, it is possible to finally detect or generate a test pattern in which the robust value is 0 or less or becomes the minimum. More specifically, for example, as illustrated in FIGS. 3C to 3E, the above-described optimum for the inspection of a program in which the output value corresponding to the specified phenomenon is the behavior of the line d in FIG. In the case of applying the conversion processing (at this stage, the input value of the solid line d in FIG. 3C which gives the behavior of the solid line d is unknown), as an arbitrary test pattern of FIG. When the input a is given, the behavior of the line a in FIG. 3D is output first, and thereby the robust value a in FIG. 3E is calculated. Next, the test pattern b is generated (correction of the test pattern a) and input to the program so that the robust value is smaller than the obtained value (value of a). ) Of the line b is obtained, and thereby the robust value b of FIG. 3E is calculated. When the test pattern generation and input for further reducing the robust value, the execution of the program, and the calculation of the robust value are repeated, as the input value is corrected from b → c → d, FIG. ) Line approaches b → c → d and behavior d, and therefore the robust value further changes from b → c → d, and finally the robust value becomes the minimum value d. In this process, if the robust value d is 0 or less, the behavior as the result output value coincides with the specified phenomenon, thereby detecting the occurrence of the specified phenomenon and the test pattern for giving it. Is generated. When the minimum robust value is larger than 0, the result output value does not reach the value range of the specified phenomenon, and it can be determined that the specified phenomenon does not occur in the program to be inspected.

上記の最適化処理に於けるロバスト値の最小化の処理に於いては、図3(B)又は図3(E)を参照して理解される如く、基本的には、入力テストパターンを徐々に変更する修正に対して、ロバスト値が連続的に変化する、即ち、結果出力値が連続的に変化することが仮定されている。即ち、結果出力値が離散的に変化する場合は考慮されていないので、被検査プログラムの結果出力値の値域に離散的に隔離した複数に分割された値域が存在している場合、例えば、被検査プログラムに於いて、条件分岐処理が含まれ、複数の演算経路が実行可能である場合、最適化処理では、複数の演算経路のうちのいずれか一つでしか指定現象の存在の探索がなされず、最適化処理を開始した値域の他の値域に指定現象が存在していた場合には、その指定現象の存在は、見逃されることとなる。例えば、図6に例示されている如く、演算経路1〜4を有し、それらの経路の出力値の値域が経路毎に異なっている被検査プログラムに於いて、指定現象として出力値=0となる場合があるか否かを判定しようとする場合に、被検査プログラムに対して、初期入力値として経路1を通る演算を実行させる値を用いて最適化処理を実行すると、指定現象の発生の有無の探索は、経路1による出力値の値域の範囲内のみで実行され、図示の如く、経路2、3の結果出力値の値域に存在する指定現象(出力値=0)及びそれらを与えるテストパターン(入力値の組み合わせ)が検出されない場合がある(図中、最適化処理に於いて算出される出力値の履歴を示す矢印は、出力値=0に到達しない。)。この点に関し、通常、テストパターンを用いた最適化処理は、実行される確率の高い演算経路が選択され、その選択された経路に沿って演算が実行されるので、実行される確率の低い演算経路では、指定現象の発生の有無の探索すら実行されないこととなり得る。   In the process of minimizing the robust value in the above optimization process, basically, as understood with reference to FIG. 3B or FIG. It is assumed that the robust value changes continuously, i.e., the resulting output value changes continuously, for a modification that changes to. That is, since the case where the result output value changes discretely is not taken into consideration, if the range of the result output value of the program to be inspected is divided into a plurality of discretely separated value ranges, for example, In the inspection program, if conditional branch processing is included and a plurality of operation paths can be executed, the optimization process searches for the existence of the specified phenomenon in only one of the plurality of operation paths. First, if a specified phenomenon exists in another value range in which the optimization process is started, the presence of the specified phenomenon is overlooked. For example, as illustrated in FIG. 6, in a program to be inspected that has calculation paths 1 to 4 and the range of output values of these paths is different for each path, the output value = 0 as a specified phenomenon. When the optimization process is executed using a value that causes the program to be inspected to perform an operation through the path 1 as an initial input value when it is attempted to determine whether or not there is a case where the specified phenomenon occurs. The presence / absence search is executed only within the range of the output value range of path 1, and as shown in the figure, the specified phenomenon (output value = 0) existing in the range of the output value of paths 2 and 3 and the test that gives them. A pattern (combination of input values) may not be detected (in the figure, the arrow indicating the history of output values calculated in the optimization process does not reach output value = 0). In this regard, usually, an optimization process using a test pattern selects an operation path with a high probability of being executed, and an operation is executed along the selected path. Therefore, an operation with a low probability of being executed is performed. In the route, even the search for the presence or absence of the specified phenomenon may not be executed.

そこで、本発明に於いては、被検査プログラムが条件分岐処理を含み、結果出力値が連続的に変化する場合と離散的な変化する場合(ハイブリッド構造を有する場合)にも、被検査プログラムで発生し得る指定現象をより確実に検出し、その指定現象を与える入力値(テストパターン)の検出又は生成できるように、プログラム検査の手法が改良される。その具体的な手法に於いては、端的に述べれば、被検査プログラムに於いて、まず、発生し得る演算経路の全ての検出が実行される。そして、指定現象を検出するための最適化処理が、検出された演算経路毎に実行される。例えば、図2(A)、(B)に例示の条件分岐処理を含むプログラムの場合、図2(C)に例示されている如く、まず、発生し得る演算経路の全て、経路1、2、3、が、それぞれ、検出され、記憶される。そして、記憶された演算経路のうちの一つを順々に選択して、例えば、経路1を選択して、その経路に沿って演算を実行させる入力テストパターンの初期値を探索し、その初期値を用いて、最適化処理が実行され、指定現象の発生の有無の探索が為されることとなる。なお、かかる一連の処理は、発生し得る演算経路の全てについて実行されてもよいが、指定現象が不具合現象であり、一つでも見つかれば、被検査プログラムが修正されるべきものとして判定されるというときには、順々に、演算経路一つずつについて、最適化処理を実行する過程で、指定現象が検出されれば、その時点で、被検査プログラムは、修正の必要ありとして判定し、最適化処理による指定現象の発生の有無の探索が終了されてもよい。   Therefore, in the present invention, the program to be inspected includes the conditional branch processing, and the program to be inspected also when the result output value changes continuously and when it changes discretely (when it has a hybrid structure). The program inspection technique is improved so that a specified phenomenon that can occur can be detected more reliably and an input value (test pattern) that gives the specified phenomenon can be detected or generated. In the specific method, in short, in the program to be inspected, all detections of possible computation paths are first executed. Then, an optimization process for detecting the specified phenomenon is executed for each detected computation path. For example, in the case of a program including the conditional branch processing illustrated in FIGS. 2A and 2B, first, as illustrated in FIG. 3 are detected and stored, respectively. Then, one of the stored computation paths is sequentially selected, for example, the path 1 is selected, and an initial value of an input test pattern for executing the computation along the path is searched, and the initial value The optimization process is executed using the value, and the search for the occurrence of the specified phenomenon is performed. Such a series of processing may be executed for all of the computation paths that can occur, but if the specified phenomenon is a malfunction phenomenon, if one is found, it is determined that the program to be inspected should be corrected. In this case, if a specified phenomenon is detected in the process of executing optimization processing for each computation path one by one, the program to be inspected is determined as needing correction at that point and optimized. The search for the occurrence of the specified phenomenon due to the processing may be terminated.

プログラムの検査処理の流れ
図4(A)を参照して、本発明によるプログラムの検査処理の一つの実施形態に於いては、まず、被検査プログラムに於いて発生の有無が検査される指定現象に相当する結果出力値の値域の設定が為される(ステップ10:指定現象目的関数設定部)。かかる指定現象の結果出力値の値域は、典型的には、関数によって定義され、その関数は、本実施形態では、「目的関数」と称される。次いで、被検査プログラムに於いて、発生し得る全ての演算経路の検出が為され、各演算経路を特定する情報、例えば、条件分岐処理の各々に於ける条件のパラメータなど、のデータの組が記憶される(ステップ20:演算経路検出部、演算経路記憶部)。演算経路の検出は、任意の又は既存のATGツールを用いて達成されてよい。なお、各演算経路を特定する情報は、それぞれ、検査プログラムにより画定されたメモリに保存され、かかるメモリは、本実施形態では、「待ち行列」と称される。
With reference to the flow diagram of the inspection processing program 4 (A), it is In one embodiment of the inspection process of the program according to the present invention, first, specified phenomenon occurrence or non-occurrence at the inspection program is tested The range of the result output value corresponding to is set (step 10: designated phenomenon objective function setting unit). The range of the output value as a result of such a specified phenomenon is typically defined by a function, and the function is referred to as an “objective function” in the present embodiment. Next, in the program to be inspected, all possible computation paths are detected, and a set of data such as information specifying each computation path, for example, a condition parameter in each of the conditional branch processes, is obtained. (Step 20: calculation path detection unit, calculation path storage unit). Computational path detection may be accomplished using any or existing ATG tool. Note that information specifying each computation path is stored in a memory defined by the inspection program, and this memory is referred to as a “queue” in the present embodiment.

かくして、被検査プログラムに於ける各演算経路の情報の検出及び記憶が完了すると、待ち行列に記憶された演算経路の群から、一つずつ、演算経路が選択され、最適化処理が実行される。具体的には、まず、待ち行列に最適化処理の実行がされていない演算経路があるか否かが判定され(待ち行列が空か否か?)(ステップ30)、最適化処理の実行がされていない演算経路があるときには、待ち行列から一つの演算経路が、被検査演算経路として選択され(ステップ40:被検査演算経路選択部)、その被検査演算経路を通過する、即ち、その被検査演算経路に沿った演算を実行させる入力値(テストパターン)の探索が実行される(ステップ50:初期入力テストパターン生成部)。このテストパターンの探索は、例えば、任意の又は既存のSATソルバーを用いて達成されてよい。そして、この段階で、被検査演算経路に沿った演算を実行させる入力値が存在しない場合には(ステップ60:初期入力テストパターン生成部)、待ち行列に記憶された別の演算経路に対して、ステップ30〜50が繰り返される。一方、被検査演算経路に沿った演算を実行させる入力値が存在する場合には、その入力値を初期値として、プログラムの実行による最適化処理による指定現象の発生の有無の探索が実行される(ステップ70)。なお、最適化処理では、上記の如く、テストパターンの入力、プログラムの実行と結果出力値の算出(プログラム実行部)、ロバスト値の算定とロバスト値が最小値であるか否かの判定(結果出力判定部)、テストパターンの修正(修正入力テストパターン生成部)が、ロバスト値が最小値になるまで反復して実行される(最適化処理部)。そして、指定現象が検出されなかったときには、その被検査演算経路に於いては、指定現象が発生しなかったと判定され(ステップ80)、待ち行列に残っている最適化処理の実行がされていない別の演算経路について、ステップ30〜80が実行される。一方、指定現象が検出されたときには、そのときのテストパターンが指定現象を発生するテストパターンとして記録される。なお、図示の例では、指定現象が一つでも検出されると、処理を終了するようなっているが、待ち行列に記憶された演算経路が空になるまで、全ての演算経路に於ける指定現象の発生の有無が検査されてもよい。   Thus, when the detection and storage of information about each computation path in the program to be inspected is completed, computation paths are selected one by one from the group of computation paths stored in the queue, and optimization processing is executed. . Specifically, it is first determined whether or not there is a computation path in the queue that has not been subjected to the optimization process (whether or not the queue is empty?) (Step 30). When there is an operation path that has not been processed, one operation path is selected from the queue as the operation path to be inspected (step 40: inspected operation path selection unit), and passes through the inspected operation path. A search for an input value (test pattern) for executing a calculation along the inspection calculation path is executed (step 50: initial input test pattern generation unit). This test pattern search may be accomplished, for example, using any or existing SAT solver. At this stage, if there is no input value for executing the computation along the computation route to be inspected (step 60: initial input test pattern generation unit), another computation route stored in the queue is selected. Steps 30 to 50 are repeated. On the other hand, when there is an input value for executing an operation along the inspection operation path, the input value is used as an initial value, and a search for occurrence of a specified phenomenon by an optimization process by executing a program is executed. (Step 70). In the optimization process, as described above, test pattern input, program execution and result output value calculation (program execution unit), robust value calculation and determination of whether or not the robust value is the minimum value (result) The output determination unit) and the test pattern correction (corrected input test pattern generation unit) are repeatedly executed until the robust value reaches the minimum value (optimization processing unit). If the specified phenomenon is not detected, it is determined that the specified phenomenon has not occurred in the inspected computation path (step 80), and the optimization process remaining in the queue is not executed. Steps 30 to 80 are executed for another calculation path. On the other hand, when a specified phenomenon is detected, the test pattern at that time is recorded as a test pattern that generates the specified phenomenon. In the example shown in the figure, the process is terminated when even one specified phenomenon is detected. However, until all the calculation paths stored in the queue are emptied, all the calculation paths are specified. The presence or absence of the phenomenon may be inspected.

上記の処理によれば、或る一つの演算経路に於いて指定現象が検出されなくても、別の演算経路にて指定現象の発生の有無の探索が実行されることとなる。例えば、図4(B)に例示されている如く、図6に関連して説明された演算経路1〜4を有する被検査プログラムに於ける指定現象(出力値=0)の存在の有無の検査の場合に、初期入力値として経路1を通る演算を実行させる値を用いて最適化処理を実行して指定現象が見つからなくても、経路2、3、4についてもそれぞれ指定現象の発生の有無の探索が実行されることとなるので、経路2、3で到達され得る指定現象が検出できることとなる。(図中、矢印は、最適化処理に於いて算出される出力値の履歴を示している。)   According to the above processing, even if a specified phenomenon is not detected in a certain calculation path, a search for occurrence of the specified phenomenon is executed in another calculation path. For example, as illustrated in FIG. 4B, the presence / absence of the specified phenomenon (output value = 0) in the program to be inspected having the operation paths 1 to 4 described with reference to FIG. 6 is checked. In the case of the above, even if the specified phenomenon is not found by executing the optimization process using the value that executes the operation through the path 1 as the initial input value, the occurrence of the specified phenomenon in each of the paths 2, 3, and 4 Therefore, the designated phenomenon that can be reached by the routes 2 and 3 can be detected. (In the figure, the arrows indicate the history of output values calculated in the optimization process.)

最適化処理の修正例
ところで、図4(B)中の経路4、3の部分を参照して、或る一つの演算経路に於いて最適化処理を実行している場合、条件によっては、演算処理の流れが、別の経路に遷移する場合がある。その場合、仮に、最初の経路(図中、経路4)に於いて指定現象が発生し得るにもかかわらず、ロバスト値が0になる前に、別の経路に遷移してしまうと、最初の経路に於ける指定現象を見逃してしまう場合が起き得る。そこで、図4(A)の最適化処理に於いて、プログラムの演算処理の途中の演算値(中間演算値)を参照して、演算処理が選択された演算経路に沿っているか否かを監視する処理が実行されてもよい。具体的には、図5(A)を参照して、図4(A)のステップ70に於ける最適化処理の開始後(ステップ71)、適時、中間演算値の参照が為され(ステップ73)、中間演算値が現在選択されている演算経路に於いて算出され得る値か否かが判定される(ステップ75:中間演算値監視部)。ここで、具体的には、中間演算値が現在選択されている演算経路に於いて期待される値域にあるとき、実行中の演算が選択されている演算経路を通過していると判定されてよい。そして、実行中の演算が選択されている演算経路を通過していると判定されたときには、そのまま演算が続行される(ステップ77)。
Modification Example of Optimization Process By the way, referring to the parts of paths 4 and 3 in FIG. 4B, when the optimization process is executed in a certain computation path, depending on the conditions, the computation The process flow may transition to another route. In this case, if the specified phenomenon may occur in the first route (route 4 in the figure), but the transition is made to another route before the robust value becomes zero, There may be cases where a specified phenomenon in a route is missed. Therefore, in the optimization process of FIG. 4A, the calculation value (intermediate calculation value) in the middle of the calculation process of the program is referred to and monitoring whether the calculation process is along the selected calculation path or not. The process to perform may be performed. Specifically, referring to FIG. 5A, after starting the optimization process in step 70 of FIG. 4A (step 71), the intermediate calculation value is referred to in a timely manner (step 73). It is determined whether or not the intermediate calculation value is a value that can be calculated in the currently selected calculation path (step 75: intermediate calculation value monitoring unit). Specifically, when the intermediate calculation value is in an expected value range in the currently selected operation path, it is determined that the operation being executed passes through the selected operation path. Good. If it is determined that the operation being executed passes through the selected operation path, the operation is continued as it is (step 77).

一方、実行中の演算が選択されている演算経路を通過していないと判定されたときには、より確実に演算が選択されている演算経路を通過するように、目的関数の変更がなされ(ステップ79)、演算が再開されてよい。目的関数の変更は、例えば、目的関数の与える値域が、最適化処理に於ける初期値により得られる結果出力値に近くづくように、変更するといったことが実行される。かかる目的関数の変更によれば、ロバスト値が最小値に到達するまでの処理に於いて、実行される演算の経路間の遷移が抑制され、その結果、最適化処理が選択演算経路に集中できることとなる。例えば、図5(B)の如く、図6に関連して説明された演算経路1〜4を有する被検査プログラムに於ける指定現象(出力値=0)の存在の有無の検査の場合に、図4(B)の場合に発生した経路4から経路3への遷移が起きる可能性が低減され、経路3、4についても、それぞれ、別々に最適化処理による指定現象の発生の有無の探索が実行されることとなる。   On the other hand, when it is determined that the operation being executed does not pass through the selected operation path, the objective function is changed so that the operation passes through the selected operation path more reliably (step 79). ), The computation may be resumed. For example, the objective function is changed such that the value range given by the objective function is close to the result output value obtained by the initial value in the optimization process. According to the change of the objective function, the transition between the paths of the operations to be executed is suppressed in the process until the robust value reaches the minimum value, and as a result, the optimization process can be concentrated on the selected calculation path. It becomes. For example, as shown in FIG. 5B, in the case of checking whether or not there is a specified phenomenon (output value = 0) in the program to be inspected having the operation paths 1 to 4 described in relation to FIG. The possibility of the transition from the path 4 to the path 3 occurring in the case of FIG. 4B is reduced, and the search for the occurrence of the specified phenomenon by the optimization process is separately performed for the paths 3 and 4 respectively. Will be executed.

かくして、上記の本発明によれば、条件分岐処理を含み、離散的に隔離した複数の結果出力値の値域を有するプログラムについても、網羅的に指定現象の発生の有無の探索とその指定現象を与えるテストパターンの検出又は生成が可能となる。本発明のプログラム検査は、基本的には、コンピュータにより自動的に実行されるので、プログラムの開発工数の低減、プログラム及び制御品質の更なる向上が期待される。なお、典型的には、指定現象として不具合現象が選択されるが、上記の本発明による装置は、不具合現象以外の指定現象の発生の有無の探索にも利用できることは、理解されるべきである。本発明のプログラム検査装置は、装置や機械器具の制御プログラムに於ける不具合現象の有無の検査に有利に利用可能である。   Thus, according to the present invention described above, even for a program that includes conditional branch processing and has a plurality of discretely separated result output value ranges, a comprehensive search for the occurrence of a specified phenomenon and the specified phenomenon are performed. It is possible to detect or generate a given test pattern. Since the program inspection of the present invention is basically automatically executed by a computer, it is expected that the number of development steps of the program will be reduced and the program and control quality will be further improved. Typically, a failure phenomenon is selected as the specified phenomenon, but it should be understood that the above-described apparatus according to the present invention can be used for searching for the occurrence of a specified phenomenon other than the failure phenomenon. . The program inspection apparatus of the present invention can be advantageously used for the inspection of the presence or absence of a malfunction phenomenon in a control program for an apparatus or machine tool.

以上の説明は、本発明の実施の形態に関連してなされているが、当業者にとつて多くの修正及び変更が容易に可能であり、本発明は、上記に例示された実施形態のみに限定されるものではなく、本発明の概念から逸脱することなく種々の装置に適用されることは明らかであろう。   Although the above description has been made in relation to the embodiment of the present invention, many modifications and changes can be easily made by those skilled in the art, and the present invention is limited to the embodiment exemplified above. It will be apparent that the invention is not limited and applies to various devices without departing from the inventive concept.

Claims (1)

プログラムの作動に於ける指定現象の発生の有無を検査する装置であって、
前記プログラムの実行に於いて生じ得る演算経路の全てを検出し、前記検出された演算経路の全てを記憶する演算経路記憶手段と、
前記記憶された演算経路の全てのうちの一つを選択する演算経路選択手段と、
前記選択された一つの演算経路を実行させる入力値の生成を実行する入力生成手段と、
前記生成された入力値を初期入力値として用いて前記選択された一つの演算経路に於いて前記プログラムの最適化処理を実行する最適化処理手段と、
前記最適化処理の実行により得られた前記プログラムの結果出力値が前記指定現象の発生に相当する前記プログラムの実行により算出される結果出力値の値域である指定現象結果出力値域に包含されるか否かの判定を実行する結果出力値判定手段と、
を含み、前記最適化処理手段による前記最適化処理の実行により得られた前記プログラムの結果出力値の前記指定現象結果出力値域までの距離が最小となったときに前記結果出力値が前記指定現象結果出力値域に包含されず、且つ、前記記憶された演算経路の全てのうちのまだ選択されていない演算経路が存在するときには、そのうちの一つが前記演算経路選択手段により選択され、前記新たに選択された演算経路を前記選択された一つの演算経路として用いて、前記入力生成手段による前記入力値の生成と、前記最適化処理手段による前記最適化処理と、前記結果出力値判定手段による前記判定とを反復して実行する装置。
A device for inspecting the occurrence of a specified phenomenon in the operation of a program,
A calculation path storage means for detecting all of the calculation paths that can occur in the execution of the program and storing all of the detected calculation paths;
Calculation path selection means for selecting one of all of the stored calculation paths;
Input generation means for generating an input value for executing the selected one computation path;
Optimization processing means for executing optimization processing of the program in the selected one computation path using the generated input value as an initial input value;
Whether the result output value of the program obtained by executing the optimization process is included in the specified phenomenon result output value range that is the range of the result output value calculated by executing the program corresponding to the occurrence of the specified phenomenon A result output value determination means for determining whether or not,
And the result output value is the specified phenomenon when the distance from the result output value of the program obtained by execution of the optimization process by the optimization processing unit to the specified phenomenon result output value range is minimized. When there is a computation path that is not included in the result output value range and is not yet selected among all of the stored computation paths, one of the computation paths is selected by the computation path selection means, and the newly selected one is selected. The selected computation path is used as the selected computation path, the generation of the input value by the input generation means, the optimization process by the optimization processing means, and the determination by the result output value determination means A device that repeatedly executes
JP2014076549A 2014-04-02 2014-04-02 Computer program checking apparatus Withdrawn JP2015197868A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2014076549A JP2015197868A (en) 2014-04-02 2014-04-02 Computer program checking apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2014076549A JP2015197868A (en) 2014-04-02 2014-04-02 Computer program checking apparatus

Publications (1)

Publication Number Publication Date
JP2015197868A true JP2015197868A (en) 2015-11-09

Family

ID=54547488

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2014076549A Withdrawn JP2015197868A (en) 2014-04-02 2014-04-02 Computer program checking apparatus

Country Status (1)

Country Link
JP (1) JP2015197868A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110221608A (en) * 2019-05-23 2019-09-10 中国银联股份有限公司 A kind of method and device of inspection device
JP6854994B1 (en) * 2020-04-20 2021-04-07 三菱電機株式会社 Operation check support device, operation check support method and operation check support program

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110221608A (en) * 2019-05-23 2019-09-10 中国银联股份有限公司 A kind of method and device of inspection device
CN110221608B (en) * 2019-05-23 2021-10-01 中国银联股份有限公司 Method and device for inspecting equipment
JP6854994B1 (en) * 2020-04-20 2021-04-07 三菱電機株式会社 Operation check support device, operation check support method and operation check support program
WO2021214843A1 (en) * 2020-04-20 2021-10-28 三菱電機株式会社 Operation check assistance device, operation check assistance method, and operation check assistance program

Similar Documents

Publication Publication Date Title
EP2960799A1 (en) Defect localization in software integration tests
Zhou Using coverage information to guide test case selection in adaptive random testing
Paterson et al. An empirical study on the use of defect prediction for test case prioritization
CN109073508B (en) Fault diagnosis during testing of turbine units
JP2016115175A (en) Software test apparatus and software test program
CN109032872B (en) Bayesian network-based equipment fault diagnosis method and system
KR20220037068A (en) Method for diagnosis ship's faults and apparatus thereof
CN114238980B (en) Industrial control equipment vulnerability mining method, system, equipment and storage medium
JP2018055676A (en) Automatic software program repair
US11520966B2 (en) Automated assisted circuit validation
JP2015197868A (en) Computer program checking apparatus
CN107818051B (en) Test case jump analysis method and device and server
JP7190246B2 (en) Software failure prediction device
JP2015197869A (en) Computer program checking apparatus
JP2009134360A (en) Model inspection system, model inspection method, and model inspection program
JP5743663B2 (en) Test support system, test support method, and program
Lawanna Filtering test case selection for increasing the performance of regression testing
Morán et al. Infrastructure-aware functional testing of mapreduce programs
JP6723483B2 (en) Test case generation device, test case generation method, and test case generation program
Durelli et al. Are deletion mutants easier to identify manually?
WO2022196219A1 (en) Program analysis device, program analysis method, and tracing process addition device
JP6680540B2 (en) Process evaluation method and device
Devasena et al. Meta heuristic search technique for dynamic test case generation
WO2023044907A1 (en) Method and device for monitoring equipment health and computer readable storage medium
Namihira et al. Visualization Method to Stimulate Ideas Leading to Failure Mode in Software FMEA

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20160707

A761 Written withdrawal of application

Free format text: JAPANESE INTERMEDIATE CODE: A761

Effective date: 20160912