[go: up one dir, main page]

CN115470104B - A simulation software testing method based on equivalent module mutation - Google Patents

A simulation software testing method based on equivalent module mutation Download PDF

Info

Publication number
CN115470104B
CN115470104B CN202210983410.7A CN202210983410A CN115470104B CN 115470104 B CN115470104 B CN 115470104B CN 202210983410 A CN202210983410 A CN 202210983410A CN 115470104 B CN115470104 B CN 115470104B
Authority
CN
China
Prior art keywords
program
variant
equivalent
simulation software
test case
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210983410.7A
Other languages
Chinese (zh)
Other versions
CN115470104A (en
Inventor
郭世凯
徐志豪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Dalian Maritime University
Original Assignee
Dalian Maritime University
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 Dalian Maritime University filed Critical Dalian Maritime University
Priority to CN202210983410.7A priority Critical patent/CN115470104B/en
Publication of CN115470104A publication Critical patent/CN115470104A/en
Application granted granted Critical
Publication of CN115470104B publication Critical patent/CN115470104B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a simulation software testing method based on equivalent mode variation, which comprises the steps of carrying out availability check on a generated test case, judging whether the test case is normally compiled, collecting variable values and time delays of the test case according to path coverage, generating a graphical preprocessing result graph according to the ratio of normal compiling, inserting two branch selection fragments into each test case, filling non-executed branches of the two branch selection fragments to generate a new variant program, screening out a variant program with high complexity in the new variant by adopting a Markov chain Monte Carlo method as an equivalent variant, and comparing differences between an original test program and the equivalent variant by adopting an equivalent mode input method so as to find defects of simulation software. According to the method, a plurality of effective simulation software bugs are tested, stability of the simulation verification tool is maintained to a certain extent, and the simulation verification tool is more reliable.

Description

Simulation software testing method based on equivalent mode variation
Technical Field
The invention relates to the field of software testing, in particular to a simulation software testing method based on equivalent mode variation.
Background
In digital circuit design, register-transfer level (RTL, english: register-TRANSFER LEVEL) is an abstract model of synchronous digital circuits, which is used in hardware description languages such as Verilog and VHDL to create high-level descriptions of actual circuits. In modern digital designs, designs on the register transfer level are the most typical workflow.
The simulation software is used as a tool for verifying the transmission level codes of the register, and the waveform chart output by the simulation software can help a developer to know the operation effect of the whole model in an intuitive description. This way the sender can locate possible flaws in the abstract model at a smaller cost. Therefore, it is important to ensure the reliability and stability of the simulation software.
The current test method for simulation software mainly uses cases of fuzzy test to generate class test, wherein the class test is typically VERISMITH. It generates random Verilog code based on AST fuzzy generation mode and applies it to the test of comprehensive tool or simulation software.
In the fields of chip design and high-end manufacturing, high requirements are placed on the stability and correctness of development tools. The existing test technology has two defects, firstly, the test tool cannot ensure the stability of the test tool, and the Verilog code generated based on AST has certain unavailability. This also results in the problem of false positives for defects found in the tool. Secondly, verilog codes generated based on AST are insufficient in diversity, the realized functions are single, and the space for exploring defects by tools is limited.
Disclosure of Invention
According to the problems existing in the prior art, the invention discloses a simulation software testing method based on equivalent mode variation, which specifically comprises the following steps:
Carrying out availability check on the generated test case, judging whether the test case is normally compiled or not, collecting variable values and time delays of the test case according to path coverage, and generating a graphical preprocessing result diagram according to the normal compiling ratio;
inserting two branch selection fragments into each test case;
filling non-executing branches of the two branch selection fragments to generate a new variant program;
screening out a variant program with high complexity in the new variants by adopting a Markov chain Monte Carlo method to serve as an equivalent variant;
the method adopts an equivalent mode input method to compare the differences between the original test program and the equivalent variants, thereby finding out the defects of the simulation software.
The test case generation tool VERISIMTH is adopted to generate test cases, the generated test cases are put into a test case pool and subjected to static standardization check, the test cases are compiled one by using simulation software so as to check the usability of the test cases, and the variable values of the test cases are stored in a table of a maintenance case pool.
When inserting the binary selection code segment, obtaining all variable values of the variable information table in the preprocessing process of the test case, randomly selecting a program point, selecting a variable according to the variable information of the variable information table, generating a discriminant which is far greater than the variable, synthesizing binary conditional statements with contradictory predicates according to the discriminant, inserting the synthesized binary conditional statements at the selected program point, and placing the code segment after the original program point in an execution branch.
When a new variant program is generated, firstly, generating a filling sentence, filling the filling sentence in a non-execution branch, carrying out static grammar check on the filling sentence, judging whether the filling sentence meets the grammar requirement, exporting codes meeting the grammar requirement as a new variant file, deleting codes not meeting the grammar requirement, and re-executing the two-branch sentence insertion program.
When the equivalent variant is obtained, constructing a state transition matrix by using the program distance between the new variant and the original test case, inputting the state transition matrix as a parameter into a selection program, obtaining the acceptance probability according to the result calculated by the selection program, judging whether the acceptance probability is greater than 1, accepting the variant if the acceptance probability is greater than 1, and if the acceptance probability is greater than 1, continuing to generate the new variant, simplifying the time sequence for updating the acceptance variant and saving the time sequence as the equivalent variant program.
Compiling operation and checking an equivalent variant program, if the compiling operation has errors, writing error information into a bug table, if no errors occur, compiling the program and generating a waveform diagram, comparing the generated waveform diagram with the waveform diagram compiled by the original test case, if differences are generated, writing difference information into the bug table, and if no differences are generated, ending the test process.
By adopting the technical scheme, the simulation software testing method based on the equivalent mode variation provided by the invention adopts the Markov Monte Carlo method to carry out variant program screening, so that the complexity of the generated equivalent variants is higher, a plurality of effective simulation software bug are tested according to the method, the stability of a simulation verification tool is maintained to a certain extent, the simulation verification tool is more reliable, and the usability of the generated variants is ensured by the variant method inserted with the two-branch condition selection statement, so that the success rate of the variants is higher.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings may be obtained according to the drawings without inventive effort to those skilled in the art.
FIG. 1 is a flow chart of the method of the present invention
Detailed Description
In order to make the technical scheme and advantages of the present invention more clear, the technical scheme in the embodiment of the present invention is clearly and completely described below with reference to the accompanying drawings in the embodiment of the present invention:
The simulation software testing method based on the equivalent mode variation shown in fig. 1 specifically comprises the following steps:
s1 pretreatment stage
S11, generating test cases by adopting a test case generation tool VERISIMTH
S12, placing the generated test cases into a test case pool, and carrying out static standardization check before preprocessing
S13, starting preprocessing of the test program, and compiling the test cases one by using simulation software to check the usability of the test cases
S14, detecting whether the model can be compiled normally, if so, putting the model into a test pool, otherwise, deleting the use case and printing out errors
S15, collecting variable values and time delays of test cases according to path coverage
S16, storing the collected variable information into a table of a maintenance use case pool, and generating a graphical preprocessing result graph according to the rate of compiling normally
S17, finishing preprocessing and transferring to a test case mutation stage
S2, inserting a binary branch selection code segment into each test case, wherein the steps are as follows:
S21, acquiring values of all variables of the variable information table in the preprocessing process of the test case
S22, randomly selecting a program point
S23, randomly selecting a variable according to the variable information of the variable information table
S24, generating discriminant which is far larger than the variable
S25, synthesizing two branch conditional sentences with contradictory predicates according to the discriminant
S26, inserting the synthesized two-branch conditional statement at the selected program point
S27, placing the code segment after the original program point in an execution branch
S3, filling non-execution branches of the two-branch conditional statement, wherein the specific steps are as follows:
S31, filling pretreatment sampling program
S32, generating a filling sentence by using a use case generating tool
S33, filling the filling sentence in the non-execution branch
S34, executing static grammar check on the filling sentence to judge whether the grammar requirement is met
S35, exporting codes meeting grammar requirements into a new variant file, deleting codes not meeting grammar requirements and re-executing a two-branch statement inserting program
S4 Another innovation of our procedure is in the variant selection process.
The Markov chain Monte Carlo method is selected as a sampling selection strategy, and the variant with higher acceptance complexity is selected according to the defined variant distance, so that the stability and the robustness of the whole program are ensured, and the whole program is more stable in the execution time sequence. The method comprises the following specific steps:
s41, constructing a state transition matrix by using the program distance between the new variant and the original test case.
S42, inputting the state transition matrix as a parameter into the selection program
S43, obtaining the acceptance probability according to the result calculated by the selection program
S44, if the judging acceptance probability is larger than 1, accepting the variant, otherwise, continuing to generate a new variant to judge
S45, simplifying the time sequence of updating the receiving variant and saving the time sequence as an equivalent variant program
And S5, filling is completed through the steps. Next enter save test cases and report test procedure.
The invention uses a new technology named Equivalent Mode Input (EMI) test. This is a new development of differential testing of process language compilers. The idea is to systematically mutate a source program, whose output should be equivalent as long as its semantics remain equivalent for a given input data. As a special case, if some variables of the successful simulation model are not compiled, or the signal data after the simulation of the variables are compared with the original program variable simulation data, a comparison error is generated. These errors are not due to human factors and are a problem of the compiler itself. Thus we can say that this is the occurrence of a bug by the compiler. Differential testing with equivalent mode input can then effectively discover compiler problems that are easily ignored. The method comprises the following steps of
S51, compiling operation and checking equivalent variant program
S52, if the compiling operation has errors, writing error information into the bug table
S53, if there is no compiling error, compiling the program and generating a waveform diagram
S54, comparing the generated waveform diagram with the waveform diagram compiled by the original test case
S55, if the difference is generated, writing the difference information into the bug list
S56, if not, ending the comparison procedure
The foregoing is only a preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art, who is within the scope of the present invention, should make equivalent substitutions or modifications according to the technical scheme of the present invention and the inventive concept thereof, and should be covered by the scope of the present invention.

Claims (5)

1.一种基于等价模变异的仿真软件测试方法,其特征在于包括:1. A simulation software testing method based on equivalent module variation, characterized by comprising: 对生成的测试用例进行可用性检查,并判断测试用例是否正常编译,根据路径覆盖收集测试用例的变量数值和时延,根据正常编译的比率生成图形化的预处理结果图;Perform usability checks on the generated test cases and determine whether the test cases are compiled normally. Collect the variable values and delays of the test cases based on path coverage, and generate a graphical preprocessing result diagram based on the normal compilation ratio. 对每一个测试用例插入二分支选择片段;Insert a binary selection snippet for each test case; 填充二分支选择片段的不执行分支生成新的变体程序;Filling the unexecuted branches of the two-branch selection fragment generates a new variant program; 采用马尔可夫链蒙特卡罗法筛选出新变体中复杂度高的变体程序作为等效变体;The Markov Chain Monte Carlo method is used to screen out the variant programs with high complexity among the new variants as equivalent variants; 采用等效模输入方法比较原始测试程序与等效变体之间的区别,从而发现仿真软件存在的缺陷;The equivalent model input method is used to compare the differences between the original test program and the equivalent variant, so as to find the defects in the simulation software; 插入二分选择代码片段时:获取测试用例在预处理过程中变量信息表的所有变量值,随机选定一个程序点,根据变量信息表的变量信息选定一个变量,生成大于该变量的判别式,根据判别式合成具有矛盾谓词的二分支条件语句,在选定的程序点处插入合成的二分支条件语句,将原始程序点之后的代码段置于执行分支中。When inserting a binary selection code snippet: obtain all variable values of the variable information table of the test case during preprocessing, randomly select a program point, select a variable based on the variable information in the variable information table, generate a discriminant greater than the variable, synthesize a two-branch conditional statement with contradictory predicates based on the discriminant, insert the synthesized two-branch conditional statement at the selected program point, and place the code segment after the original program point in the execution branch. 2.根据权利要求1所述的基于等价模变异的仿真软件测试方法,其特征在于:采用测试用例生成工具VeriSimth生成测试用例,将生成的测试用例放入测试用例池并进行静态规范化检查,使用仿真软件逐个编译测试用例从而检查测试用例的可用性,将测试用例的变量数值保存到维护用例池的表中。2. The simulation software testing method based on equivalent module variation according to claim 1 is characterized in that: a test case generation tool VeriSimth is used to generate test cases, the generated test cases are placed into a test case pool and static normalization checks are performed, the test cases are compiled one by one using simulation software to check the availability of the test cases, and the variable values of the test cases are saved in a table that maintains the test case pool. 3.根据权利要求1所述的基于等价模变异的仿真软件测试方法,其特征在于:在生成新的变体程序时:首先生成填充语句,将填充语句填充在不执行分支中,对填充语句进行静态语法检查,判断是否符合语法要求,将符合语法要求的代码导出作为新变体文件,删除不符合语法要求的代码并重新执行二分支语句插入程序。3. The simulation software testing method based on equivalent module variation according to claim 1 is characterized in that: when generating a new variant program: first generate a fill statement, fill the fill statement in the non-executed branch, perform a static syntax check on the fill statement to determine whether it meets the syntax requirements, export the code that meets the syntax requirements as a new variant file, delete the code that does not meet the syntax requirements and re-execute the two-branch statement insertion program. 4.根据权利要求3所述的基于等价模变异的仿真软件测试方法,其特征在于:在获取等效变体时:使用新变体与原始测试用例之间的程序距离构造状态转移矩阵,将状态转移矩阵作为参数输入至选择程序中,根据选择程序计算出的结果得到接受概率,判别接受概率是否大于1,如果是则接受该变体,如果否则继续生成新的变体,简化更新接受变体的时序,并保存为等价变体程序。4. The simulation software testing method based on equivalent module variation according to claim 3 is characterized in that: when obtaining an equivalent variant: a state transfer matrix is constructed using the program distance between the new variant and the original test case, the state transfer matrix is input as a parameter into a selection program, and the acceptance probability is obtained according to the result calculated by the selection program, and it is determined whether the acceptance probability is greater than 1. If so, the variant is accepted, otherwise new variants are continued to be generated, the timing of updating the accepted variants is simplified, and saved as an equivalent variant program. 5.根据权利要求4所述的基于等价模变异的仿真软件测试方法,其特征在于:编译运行并检查等价变体程序,如果编译运行出现错误,则将错误信息写入bug表中,如果没有出现错误,则编译该程序并生成波形图,将生成的波形图与原始测试用例编译后的波形图进行比较,如果产生差异,则将差异信息写入bug表中,如果不产生差异则结束测试过程。5. The simulation software testing method based on equivalent module variation according to claim 4 is characterized in that: the equivalent variant program is compiled, run and checked; if an error occurs during the compilation and running, the error information is written into a bug table; if no error occurs, the program is compiled and a waveform diagram is generated; the generated waveform diagram is compared with the waveform diagram compiled from the original test case; if a difference occurs, the difference information is written into the bug table; if no difference occurs, the test process is terminated.
CN202210983410.7A 2022-08-16 2022-08-16 A simulation software testing method based on equivalent module mutation Active CN115470104B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210983410.7A CN115470104B (en) 2022-08-16 2022-08-16 A simulation software testing method based on equivalent module mutation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210983410.7A CN115470104B (en) 2022-08-16 2022-08-16 A simulation software testing method based on equivalent module mutation

Publications (2)

Publication Number Publication Date
CN115470104A CN115470104A (en) 2022-12-13
CN115470104B true CN115470104B (en) 2025-06-24

Family

ID=84367780

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210983410.7A Active CN115470104B (en) 2022-08-16 2022-08-16 A simulation software testing method based on equivalent module mutation

Country Status (1)

Country Link
CN (1) CN115470104B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116340145B (en) * 2023-02-16 2025-07-25 大连海事大学 Simulation software testing method based on sleep area variation

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113010427A (en) * 2021-03-22 2021-06-22 大连理工大学 Advanced comprehensive tool defect detection method based on equivalent modulus test

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113010427A (en) * 2021-03-22 2021-06-22 大连理工大学 Advanced comprehensive tool defect detection method based on equivalent modulus test

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Finding Deep Compiler Bugs via Guided Stochastic Program Mutation;Vu Le等;ACM;20151231;全文 *

Also Published As

Publication number Publication date
CN115470104A (en) 2022-12-13

Similar Documents

Publication Publication Date Title
Cummins et al. Compiler fuzzing through deep learning
CN117009231B (en) Highly reliable unit test automatic generation method and device based on conversational large language model
Zhang et al. How effective are they? exploring large language model based fuzz driver generation
Falke et al. The bounded model checker LLBMC
US20030125920A1 (en) LSI design verification apparatus, LSI design verification method, and LSI design verification program
CN118503125A (en) Automatic unit test generation method and device based on thought chain prompt
CN114186524B (en) Wafer detection data processing method and computer readable storage medium
Lin et al. Concolic testing of SystemC designs
JP2021111389A (en) Improvement in parsability of code snippet
US10839124B1 (en) Interactive compilation of software to a hardware language to satisfy formal verification constraints
CN115470104B (en) A simulation software testing method based on equivalent module mutation
US20070061641A1 (en) Apparatus and method for generating test driver
US7539977B1 (en) Automatic bug isolation in computer programming languages
CN114791878B (en) Simulink software testing method based on controllable assertion mutation
CN118468771A (en) Chip problem locating method, device and related equipment
CN116340145B (en) Simulation software testing method based on sleep area variation
CN113849814B (en) A configurable system vulnerability reproduction system and reproduction method
KR20240041017A (en) Method and apparatus for selecting the optimal test case for software regression testing
Shen et al. Optimization-Aware Test Generation for Deep Learning Compilers
KR100777103B1 (en) Test Driver Generation Device and Method
CN119883860B (en) An intelligent detection method for QEMU component digital models
CN112148608B (en) Mobile terminal automated software testing method based on control function labeling
Huang et al. False-Positive Bug Reports in Deep Learning Compilers: Stages, Root Causes, and Mitigation
CN120216370A (en) A debugger testing method based on large language model
Robinson Rotten Green Tests in Google Test

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant