An automated testing method and system for software fault injection
By using automated testing methods and systems, flexible control of software fault injection and automatic calculation of response time are achieved, solving the problems of insufficient flexibility and low efficiency in existing technologies, and improving testing efficiency and transparency.
Patent Information
- Application Number
- CN202211661035.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-23
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2042-12-23
AI Technical Summary
Existing software fault injection techniques suffer from insufficient flexibility and low efficiency. The fault injection process is fixed during compilation, while runtime fault injection requires manual triggering and has low efficiency in response time testing.
An automated testing method is adopted. Fault injection commands are configured on the PC, CAN messages are sent using communication equipment, the chip receives and executes the fault injection, the oscilloscope times the response time, and the power supply automatically restarts, realizing flexible control of fault injection and automatic calculation of response time.
It achieves flexible, controllable, and automated fault injection, improves testing efficiency, saves time and manpower costs, and makes the process transparent and traceable.
Smart Images

Figure CN116185830B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of fault injection, in particular to a software fault injection automatic test method and system. BACKGROUND
[0002] Automobile chips are the core components of automobiles, and whether the automobile chips are reliable directly determines the stability and safety of the automobile during driving and affects the safety of the driver. Therefore, the reliability standards of automotive-grade chips are higher than those of general consumer-grade chips. For automobile chips working in complex and harsh environments such as high temperature and strong electromagnetic interference, how to ensure their stable operation becomes a key problem. Effective testing before these systems and devices are formally put into use is an important link to verify their reliability, and different technical faults usually need to be simulated and introduced into the target system to be tested to verify the self-protection and self-recovery capabilities of the system. As a test method for verifying the fault tolerance of systems and devices, fault injection is an important technical approach to ensure the reliability of equipment, which can accelerate the process of system failure and failure, thereby saving testing time and cost, and is an important technical means for reliability evaluation.
[0003] Software fault injection is a more advanced fault injection technology, which has the advantages of being less affected by factors such as chip packaging, circuit board integration, signal type, and change speed. Generally, it is injected through software compilation or software runtime. Compile-time fault injection refers to injecting software faults into program source code to simulate software and hardware faults of the system under test before the program of the system under test is loaded and executed. This method requires modifying the software source code of the system under test, and when the program executes to the modified code part, the fault will be triggered. Runtime fault injection refers to injecting faults into the system under test after the software of the system under test is running. Runtime fault injection technology requires certain triggering conditions, and only when the conditions are met, the fault injection can be executed.
[0004] Based on the compilation, the fault injection is implemented in the code, so the fault injection process is fixed and not flexible. Although runtime fault injection can be triggered by external conditions, it needs to be manually triggered one by one according to the conditions during testing, and after the fault injection is successful, the fault response time needs to be tested manually by the tester, so the fault injection implementation efficiency is low. SUMMARY
[0005] In order to overcome the shortcomings of the prior art, the present application aims to provide a software fault injection automatic test method and system, which can realize flexible and controllable fault injection and calculate the response time of fault injection at the same time, thereby improving the test efficiency.
[0006] The present application adopts the following technical solutions:
[0007] An automatic testing method of software fault injection, characterized in that it comprises the following steps:
[0008] S1: a user configures faults on a PC end and issues a fault injection command;
[0009] S2: the fault injection command is sent to a chip under test in the form of a communication message;
[0010] S3: the chip under test enters an interrupt receiving mode, parses the communication message, and executes fault injection;
[0011] S4: a GPIO port starts timing of a fault injection response time, and a PC end collects fault injection process and result data;
[0012] S5: after the fault injection is completed, a power supply restarts a system reset.
[0013] Further, the step 1 specifically comprises:
[0014] S11: a user selects a fault type to be injected, a fault injection time, and a fault injection frequency on a fault injection software interface of a PC end, completes fault configuration, can simultaneously configure multiple fault injections, and completes fault injection of different types;
[0015] S12: a fault injection software assembles information of fault configuration into a message according to a defined protocol, and issues a fault injection command.
[0016] Further, the fault injection command in the step 2 is sent to the chip under test in the form of a CAN message through a communication device.
[0017] Further, the step 4 specifically comprises:
[0018] S41: when the fault injection is started, the chip under test flips a GPIO output pin state as a fault injection start time, and flips a fault output pin state as a fault output time;
[0019] S42: a time between the GPIO output pin state change time point and the fault output pin state change time point is the fault injection response time;
[0020] S43: a fault injection software of the PC end displays whether each fault injection result is successful, the fault injection response time, and the number of successful fault injections.
[0021] Further, the step 5 further comprises: when the fault injection causes an exception, the PC end controls a power supply reset and re-uploading; and when the fault injection is completed, the PC end controls the power supply to restart the system reset.
[0022] The application also provides another technical solution.
[0023] An automatic system for software fault injection is used to implement the above technical solution, wherein the automatic system comprises a PC terminal, a communication device, a target board under test, a power supply and an oscilloscope,
[0024] Further, the PC terminal, the communication device and the target board under test are sequentially connected and can interact with each other, the target board under test is used to install a chip under test, and the power supply, the target board under test and the oscilloscope are sequentially connected, and the PC terminal is further connected with the power supply and the oscilloscope.
[0025] Preferably, the communication device adopts a CAN communication interface or an ETH communication interface or a Uart communication interface, which is used to send fault injection information configured in the form of a message from the PC terminal to the target board under test.
[0026] Further, the PC terminal is provided with fault injection software used to issue a fault injection instruction, the fault injection software comprises a fault configuration module, a fault statistics module and a fault display module, the fault configuration module is used to configure the type, time and number of fault injection, the fault statistics module is used to statistically collect the response time, the number of successes and whether the success of the fault injection process, and the fault display module is used to display the process data and results of the fault injection, after a user completes fault configuration on the fault injection software, specific fault configuration information will be assembled into a CAN message according to a defined protocol, and then sent to the chip under test through the communication device to execute fault injection, and the fault display module will display related data and results of this fault injection after each fault injection is completed.
[0027] Further, the oscilloscope is connected to the PC terminal through a USB interface, the oscilloscope is provided with two channels, the target board under test is connected with the oscilloscope through the two channels, the two channels are respectively connected with a GPIO output pin and an FSP fault output pin, and the PC terminal reads the time interval between the two channels through the oscilloscope and records it as a fault injection response time, that is, when fault injection starts, the chip under test takes the state of the GPIO output pin as a fault injection start time and takes the state of the fault output pin as a fault output time, and the time interval between the two times is recorded as a fault injection response time, which will be finally statistically collected and displayed on the fault injection display module.
[0028] Further, the power supply is a programmable digital power supply and is connected to the PC terminal through a USB interface, the PC terminal can automatically control power-on and power-off of the power supply, realize power-on of the entire system after fault injection, reset the entire system, and realize automatic control.
[0029] The application has at least the following beneficial effects:
[0030] 1. The software fault injection automatic test method provided by the application, by configuring the attributes of the fault category, injection times, time, etc. on the fault injection software, the fault information is directly converted into a message and sent to the tested chip after being configured, so that the whole fault injection process is flexible, and the automatic test of multiple fault injections is realized by configuration;
[0031] 2. The software fault injection automatic test method provided by the application, by connecting the oscilloscope with the tested chip, setting the GPIO port to time the response time of the fault injection, the problem of low efficiency caused by manual testing of the fault response time is solved;
[0032] 3. The software fault injection automatic test method and system provided by the application, the process data and results of the fault injection can be counted and finally displayed on the PC end, so that the whole process is transparent and traceable;
[0033] 4. The software fault injection automatic test method and system provided by the application, by controlling the programmable digital power supply through the PC end, the power-on and power-off of the power supply are automatically controlled to automatically reset the system, realize the automatic operation of the fault injection, and save time and labor cost. BRIEF DESCRIPTION OF DRAWINGS
[0034] Figure 1 The flow chart of the software fault injection automatic test method provided by the application;
[0035] Figure 2 The structural schematic diagram of the software fault injection automatic system provided by the application. DETAILED DESCRIPTION
[0036] In order to make the purpose, technical scheme and advantages of the embodiments of the application clearer, the technical scheme in the embodiments of the application will be described clearly and completely below with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are part of the embodiments of the application, rather than all the embodiments of the application. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the application.
[0037] Embodiment one
[0038] Combined with Figure 1 the drawings, the application discloses a software fault injection automatic test method, which specifically operates according to the following steps:
[0039] S1: the user selects the fault category to be injected, the time of fault injection and the number of fault injection on the PC end fault injection software interface, completes the fault configuration, and can simultaneously configure multiple fault injections to complete different types of fault injection; the fault injection software assembles the fault configuration information into a message according to the defined protocol, and issues a fault injection command.
[0040] S2: the fault injection command is sent to the measured chip in the form of a CAN message through a communication device;
[0041] S3: the measured chip enters the receiving interrupt, parses the communication message in the receiving interrupt program, injects the corresponding fault according to the message information, and executes the fault injection;
[0042] S41: when starting fault injection, the measured chip outputs the state of the GPIO pin as the fault injection start time and the state of the fault output pin as the fault output time;
[0043] S42: the PC end reads the interval of the two times and records it as the fault injection response time;
[0044] S43: the fault injection software of the PC end displays whether the fault injection result of each time is successful, the response time of the fault injection, and the number of successful fault injections.
[0045] S5: when the fault injection causes an exception, the PC end control system resets and restarts; when the fault injection is completed, the PC end control power supply resets the system to facilitate the start of a new round of fault injection.
[0046] The whole process can realize full automation of fault injection, improve the test efficiency, and also can calculate the response time of fault injection.
[0047] Embodiment two
[0048] In combination Figure 2 As shown in the figure, the application further discloses an automatic system for software fault injection, which comprises a PC end, a CAN communication device, a measured target board, a programmable digital power supply and an oscilloscope, and is used to implement the automatic test method for software fault injection disclosed in embodiment one.
[0049] In the system, the PC end, the CAN communication device and the measured target board are connected in sequence, and information can be interacted among the three; the programmable digital power supply, the measured target board and the oscilloscope are connected in sequence, and the PC end is further connected with the programmable digital power supply and the oscilloscope.
[0050] The PC end is provided with a fault injection software for issuing a fault injection instruction, wherein the fault injection software comprises a fault configuration module, a fault statistics module and a fault display module; the fault configuration module is used for configuring the type, time and number of fault injection; the fault statistics module is used for statistically collecting the response time, number of success and success of the fault injection process; and the fault display module is used for displaying the process data and result of the fault injection.
[0051] After the user completes the fault information configuration on the fault injection software, the specific fault configuration information is assembled into a CAN message according to a defined protocol, and is sent to the measured chip through a CAN communication device to execute fault injection; after each fault injection is completed, the fault display module displays the related data and result of the fault injection.
[0052] The CAN communication device has a CAN communication interface, which is used for receiving the CAN message assembled by the fault injection software, and sending the message to the measured target board.
[0053] The measured chip is installed on the measured target board, and after receiving the CAN message, enters a receiving interrupt, parses the CAN message in the receiving interrupt program, and starts to execute fault injection according to the message configuration after the parsing, and triggers the fault.
[0054] The oscilloscope is connected to the PC end through a USB interface, and is provided with two channels, one of which is connected to a GPIO output pin and the other of which is connected to an FSP fault output pin; the measured target board is connected to the oscilloscope through the two channels; when the measured chip starts fault injection, the measured chip flips the state of the GPIO output pin as the fault injection start time, and flips the state of the fault output pin as the fault output time; the PC end reads the time interval of the two channels as the response time of the fault injection, and displays the response time in the fault display module.
[0055] The programmable digital power supply is connected to the PC end through a USB interface; when an exception is caused during the fault injection process, the PC end controls the programmable digital power supply to power off and then power on; when the fault injection is completed, the PC end controls the programmable digital power supply to restart the system and reset, and waits for the system to configure a new fault to execute a new round of fault injection.
[0056] In actual operation, the power supply is started, the worker configures the fault information, and then issues the fault injection instruction, the configured fault information is sent to the measured chip installed on the target board in the form of CAN message through the intermediate CAN communication equipment, the measured chip starts to analyze the message in the received interrupt, executes the fault injection after the analysis is completed, the time interval of the state change of the two channels in the oscilloscope connected with the measured chip is the response time of this fault injection, the fault injection software of the PC end counts the related data of this fault injection and displays it in the fault display module, realizes the visualization of the data, and after the fault injection is completed, the programmable digital power supply resets the whole system, and then a new round of fault injection can be started.
[0057] The above is only an embodiment of the present application, and does not limit the patent range of the present application, and any equivalent structure or equivalent flow transformation using the content of the specification and drawings, or direct or indirect application in other related technical fields, are also included in the patent protection range of the present application.
Claims
1. A method of automated testing of software fault injection, characterized in that, It comprises the following steps: S1: the user configures the fault on the PC end and issues a fault injection command; S2: the fault injection command is sent to the measured chip in the form of a communication message; S3: the measured chip enters the receiving interrupt, parses the communication message, and executes the fault injection; S4: the GPIO port starts timing the fault injection response time, and the PC end collects the fault injection process and result data; S41: when the fault injection starts, the measured chip flips the GPIO output pin state as the fault injection start time and the fault output pin state as the fault output time; S42: the time interval between the GPIO output pin state change time point and the fault output pin state change time point is the fault injection response time; S43: the fault injection software displays whether each fault injection result is successful, the fault injection response time, and the number of successful fault injections; S5: after the fault injection is completed, the power supply restarts the system reset.
2. The automated software fault injection testing method of claim 1, wherein, The step S1 specifically comprises: S11: the user selects the fault category to be injected, the fault injection time, and the fault injection number on the fault injection software interface of the PC end, completes the fault configuration, and can simultaneously configure multiple fault injections; S12: the configured fault information is assembled into a message according to the defined protocol, and the command is issued.
3. The automated software fault injection testing method of claim 2, wherein, The fault injection command in S2 is sent to the measured chip in the form of a CAN message through a communication device.
4. The automated software fault injection testing method of claim 3, wherein, The step S5 further comprises: when the fault injection causes an exception, the PC end controls the power supply to reset and re-power on; and when the fault injection is completed, the PC end controls the power supply to restart the system reset.
5. An automated system for software fault injection for performing the automated test method for software fault injection according to any one of claims 1 to 4, characterized in that The automatic system comprises a PC end, a communication device, and a measured target board connected in sequence and capable of information interaction, the measured target board is installed with a measured chip and connected with a power supply and an oscilloscope, and the PC end is connected with the oscilloscope and the power supply.
6. The automated system for software fault injection of claim 5, wherein, The communication device adopts a CAN communication interface or an ETH communication interface or a Uart communication interface.
7. The automated system for software fault injection of claim 5, wherein, The PC end is provided with a fault injection software for issuing a fault injection instruction, the fault injection software comprises a fault configuration module, a fault statistics module, and a fault display module, the fault configuration module is used for configuring the category, time, and number of fault injections, the fault statistics module is used for statistically collecting the response time, successful number, and success or failure of the fault injection process, and the fault display module is used for displaying the process data and result of the fault injection.
8. The automated system for software fault injection of claim 7, wherein, The oscilloscope is connected to the PC end through a USB interface, the oscilloscope is provided with two channels, the measured target board is connected with the oscilloscope through the two channels, the two channels are respectively connected with a GPIO output pin and an FSP fault output pin, and the PC end reads the time interval between the two channels through the oscilloscope and records it as the fault injection response time.
9. The automated system for software fault injection of claim 8, wherein, The power supply is a programmable digital power supply and is connected to the PC end through a USB interface, and the PC end can automatically control the power-on and power-off of the power supply.
Citation Information
Patent Citations
Fault injection device and method
CN115494763A