CN115470104B - A simulation software testing method based on equivalent module mutation - Google Patents
A simulation software testing method based on equivalent module mutation Download PDFInfo
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3692—Test 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
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)
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)
| 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)
| 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 |
-
2022
- 2022-08-16 CN CN202210983410.7A patent/CN115470104B/en active Active
Patent Citations (1)
| 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)
| 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 |