Periodic synchronization fault injection method
By defining the global variable information of the fault type and parsing the memory address using soft-modulation protocols, the fault injection point is calculated, and the problem of synchronous fault injection of multiple systems is solved, automated testing is realized, and testing efficiency and quality is improved.
Patent Information
- Application Number
- CN202311455735.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-03
- Publication Date
- 2024-12-03
AI Technical Summary
It is difficult to perform fault injection and fault injection tests synchronously within a cycle. Traditional methods are complex and inefficient, so automated testing cannot be achieved.
By defining the global variable information of the fault type, using the soft-modulation protocol to parse the memory address to obtain the system's current period number, calculate the fault injection point, and synchronously execute the fault injection program on multiple systems to detect the injection results, and realize automated testing.
It improves the working efficiency of fault injection testing, ensures that multiple systems complete fault injection simultaneously within cycles, improves test quality and efficiency, and realizes automated test of fault injection.
Smart Images

Figure CN119065955A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of fault injection testing, in particular to a periodic synchronous fault injection method. Background Art
[0002] Fault injection is an important practice in software engineering and system development. It can help development teams discover and fix potential problems and improve system stability and reliability. By simulating and testing the behavior of the system under abnormal conditions, the design and implementation of the system can be improved to ensure that the system can run robustly in the face of unexpected situations. A complete and efficient fault injection method is essential. The traditional static fault injection method requires modifying the source code and recompiling and burning the loading software for each fault injection. The operation is complex and inefficient, and the performance requirements of computer hardware equipment are extremely high. The dynamic fault injection method requires manual operation, and there is a time difference and cannot guarantee the same cycle fault injection.
[0003] Chinese patent, publication number: CN116302730A, publication date: June 23, 2023, discloses a fault injection method and device, the method comprising: using a graphical identifier to represent each fault activity item; wherein each fault activity item has three graphical identifiers of normal, running and abnormal states; according to a preset operation, the graphical identifiers corresponding to the selected multiple fault activity items are combined into a fault sequence; and the fault sequence is executed to achieve fault injection. However, the invention mainly implements a method for completing fault injection by setting a graphical identifier sequence of fault activities, and cannot achieve multiple main control board platform subsystems to synchronously implement fault injection within a cycle and perform automated testing of fault injection. Summary of the invention
[0004] The purpose of the present invention is to solve the problem in the prior art that it is difficult for multiple main control single board platform subsystems to synchronously perform fault injection and fault injection testing within a cycle; a method for periodic synchronous fault injection is designed, by defining global variable information of the fault type, using a soft adjustment protocol to parse the memory address of the global variable information to obtain the current cycle number of the system, and calculating the fault injection point according to the current cycle number. Multiple systems synchronously execute the fault injection program at the fault injection point and detect whether the fault injection is successful; the problem that it is difficult for multiple main control single board platform subsystems to synchronously perform fault injection and fault injection testing within a cycle is overcome, and the work efficiency of the fault injection test is improved.
[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is: a periodic synchronous fault injection method, comprising the following steps: S1. Establish a fault injection test case library according to the test requirements, classify the fault injection test cases in the fault test case library according to the fault injection method and test function requirements, and define fault injection global variable information according to the fault type; S2, allocates memory addresses for storing fault injection global variables; S3, parsing the memory address of the fault injection global variable, and obtaining parameter information of the fault injection global variable through the memory reading function of the software adjustment protocol; S4. Calculate the start fault injection cycle number according to the parameter information and determine the fault injection point; S5. According to the injection point, periodic synchronous fault injection is performed on multiple main control board platform subsystems, and the fault injection results are automatically detected.
[0006] In the present invention, by defining global variable information of the fault type, using the soft tuning protocol to parse the memory address of the global variable information to obtain the current cycle number of the system, and calculating the fault injection point according to the current cycle number, multiple systems can synchronously execute the fault injection program at the fault injection point and detect whether the fault injection is successful, thereby realizing multi-system periodic synchronous fault injection.
[0007] Preferably, the fault injection global variable information includes: the start fault injection cycle number, the number of fault injection cycles, the number of discarded radar messages, and the number of modified radar messages; the fault injection node can be accurately located through the defined fault injection global variable information, and whether the fault injection is successful can be judged based on the message information, wherein the start fault injection cycle number is used to record the fault injection execution result, thereby realizing the automated testing of fault injection.
[0008] Preferably, the soft tuning protocol includes a passive end and an active end, the active end is connected to the communication interface provided by the test tool to the outside, and the passive end exchanges data with each main control board platform subsystem. The soft tuning protocol provides memory reading, memory writing and function interface calling functions for the test tool and the main control board platform subsystem through the passive end and the active end respectively; the computer platform adds the call of the first function interface of the soft tuning protocol in the startup initialization function, and adds the call of the second function interface of the soft tuning protocol in the periodic operation function.
[0009] In the present invention, the main control board platform subsystem memory can be read and written simultaneously through the soft adjustment protocol, which is convenient for parsing the computer ELF file to obtain the memory address of the fault injection global variable, thereby obtaining the parameter information required for calculating the start fault injection cycle number, and using the write memory function of the soft adjustment protocol to realize the fault injection.
[0010] Preferably, S3 comprises the following steps: S31, using the software adjustment protocol to establish a connection between the test tool and multiple main control board platform subsystems; S32, the test tool parses the computer software ELF file to obtain all fault injection global variable names and corresponding memory addresses; S33. According to the global variable name corresponding to the current cycle number, query and match the memory address of the global variable.
[0011] In the present invention, the test tool parses the ELF format file to obtain the memory address of the global variable, which provides a data source for calculating the start fault injection cycle number.
[0012] Preferably, the test tool and each main control board platform subsystem use data from the same ELF file.
[0013] In this solution, by operating the same ELF format file and obtaining the same cycle number, the accuracy of the calculation of the start fault injection cycle number and the correctness of the obtained memory address are guaranteed, ensuring that each main control board platform subsystem completes the fault injection synchronously within the cycle.
[0014] Preferably, S4 comprises the following steps: S41, obtaining the current running cycle number of the first main control board platform subsystem through the software adjustment protocol memory reading function; S42, setting the communication delay time, and then calculating the start fault injection cycle number according to the communication delay time, the cycle operation length and the cycle number of the first main control board platform subsystem currently running, to determine the fault injection cycle.
[0015] Preferably, the starting fault injection cycle number includes the following calculation process: Where N is the starting fault injection cycle number, M is the current cycle number, T is the communication delay time, and C is the cycle length.
[0016] In the present invention, the time difference of the operation of each main control board platform subsystem is balanced by involving the communication delay and the cycle length in the calculation of the start fault injection cycle number.
[0017] Preferably, S5 comprises the following steps: S51, determining whether the fault injection condition is met, if so, executing step S52; S52, the test tool receives the input fault injection information according to the start fault injection cycle number, determines the type of injected fault, and matches the memory address of the fault injection global variable; S53, encapsulating the start fault injection cycle number and the fault injection information to obtain a fault message, and simultaneously writing the fault message to the memory addresses of corresponding fault injection global variables in multiple main control board platform subsystems through the soft adjustment protocol memory write function; S54, multiple main control board platform subsystems periodically and synchronously parse the fault message, execute the fault injection program, and output the fault injection execution log; S55, multiple main control board platform subsystems periodically check the fault execution status and the fault injection execution log to determine the fault injection execution result; S56. Analyze and determine the execution result of the fault injection use case according to the fault injection execution result; if there is a main control board subsystem that has not executed the fault injection cycle, and the number of fault injection cycles of the system is 0, then execute step S53; to realize automated fault injection use case testing.
[0018] In the present invention, fault information is written into the memory address of the global variable of each main control board platform subsystem through the soft adjustment protocol write memory function, thereby realizing fault injection; at the same time, the fault injection result is judged by checking the fault injection execution log, and the corresponding strategy is executed according to the fault injection result, thereby realizing the automated test of fault injection.
[0019] Preferably, the step S51 comprises the following steps: If the current cycle number is greater than or equal to the start fault injection cycle number, and the current cycle number is less than the sum of the radar message start fault injection cycle number and the radar message fault injection cycle number, it means that the fault injection condition is met; by comparing the current cycle number with the start fault injection cycle number and the radar message fault injection cycle number, it is determined whether the fault needs to be injected, thereby improving the accuracy of fault injection on the main control board platform subsystem and the memory resource utilization of global variables.
[0020] Preferably, the testing tool performs automated testing of other fault injection test cases in the fault injection test case library in sequence based on the received user input data; the testing tool determines the type of fault that needs to be injected based on the manually input information, completes the fault injection by itself, and automatically monitors whether the injection is completed, thereby improving the fault injection efficiency and testing efficiency and saving the cost of manual testing.
[0021] Beneficial effects of the present invention: 1. The present invention obtains the global variable information of fault injection through the analysis of the system platform file by software coordination, calculates the starting fault injection cycle number, and provides reliability data support for each main control board platform subsystem to synchronously run the fault injection program in the same cycle; 2. The present invention checks the fault injection state periodically after executing the fault injection program, judges the fault injection result, realizes the test requirements of periodic synchronous fault injection, and improves the test quality and efficiency; 3. The present invention achieves the purpose of automated fault injection testing by obtaining the current cycle number, calculating the start fault injection cycle number, obtaining the memory address of the fault injection global variable, packaging the fault write memory message and sending the fault message to multiple main control board platform subsystem operations. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Other features, objects and advantages of the present invention will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings. The drawings are only for the purpose of illustrating preferred embodiments and are not to be considered as limiting the present invention. Also, the same reference symbols are used throughout the drawings to represent the same parts.
[0023] Figure 1 The present invention is a flow chart of a method for periodic synchronous fault injection. DETAILED DESCRIPTION
[0024] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific implementation method described herein is only an optimal embodiment of the present invention, which is only used to explain the present invention and does not limit the scope of protection of the present invention. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0025] Example 1: Figure 1 As shown, a method for periodic synchronous fault injection includes steps S1-S5, wherein:
[0026] S1. Establish a fault injection test case library according to the test requirements, classify the fault injection test cases in the fault test case library according to the fault injection method and test function requirements, and define the fault injection global variable information according to the fault type.
[0027] S2. The computer platform software system allocates a memory address for storing the fault injection global variable.
[0028] S3. Analyze the memory address of the global variable of fault injection, and obtain the parameter information of the global variable of fault injection through the memory reading function of the software adjustment protocol, including: S31, using the software adjustment protocol to establish a connection between the test tool and multiple main control board platform subsystems; S32, the test tool parses the ELF file of the computer software to obtain the names of all fault injection global variables and their corresponding memory addresses; S33. According to the global variable name corresponding to the current platform system operation cycle number, query and match the memory address of the global variable.
[0029] S4. Calculate the start fault injection cycle number according to the parameter information of the fault injection global variable and determine the fault injection point: S41. Obtain the current running cycle number of the first main control board platform subsystem through the soft adjustment protocol memory reading function; S42, setting the communication delay time, and then calculating the start fault injection cycle number according to the communication delay time, the cycle operation length and the cycle number currently running of the first main control board platform subsystem, and determining the fault injection cycle. The start fault injection cycle number includes the following calculation process: Where N is the starting fault injection cycle number, M is the current cycle number, T is the communication delay time, and C is the cycle length.
[0030] S5. Perform periodic synchronous fault injection on multiple main control board platform subsystems according to the fault injection point, and automatically detect the fault injection results, including: S51: Determine whether the fault injection condition is met. If so, execute step S52, including: If the current cycle number is greater than or equal to the start fault injection cycle number, and the current cycle number is less than the sum of the radar message start fault injection cycle number and the radar message fault injection cycle number, it means that the fault injection condition is met; S52, the test tool receives the input fault injection information according to the start fault injection cycle number, determines the type of injected fault, and then matches the memory address of the fault injection global variable; S53, encapsulating the start fault injection cycle number and the fault injection information to obtain a fault message, and simultaneously writing the fault message to the memory addresses of the corresponding fault injection global variables in the multiple main control board platform subsystems through the soft adjustment protocol write memory function; S54, multiple main control board platform subsystems periodically and synchronously parse fault messages, execute fault injection programs, and output fault injection execution logs; S55, multiple main control board platform subsystems periodically check the fault execution status and the execution log of the fault injection, and determine the execution result of the fault injection; S56. Analyze and determine the execution result of the fault injection use case according to the fault injection execution result; if there is a main control board subsystem that has not executed the fault injection cycle, and the number of fault injection cycles of the system is 0, continue to run from step S53; thereby realizing automated testing of the fault injection use case.
[0031] The purpose of automated fault injection testing is achieved by obtaining the current cycle number, calculating the start fault injection cycle number, obtaining the memory address of the global variable for fault injection, assembling the fault write memory message and sending the fault message to multiple main control board platform subsystems. The software ELF format file parsed by the test tool and the main control board platform subsystem use the same file to ensure the correctness of the obtained global variable memory address.
[0032] Specifically, the fault injection global variable information includes: the start fault injection cycle number, the number of fault injection cycles, the number of discarded radar messages, and the number of modified radar messages; through the defined fault injection global variable information, the fault injection node can be accurately located, and the fault injection result can be judged according to the global variable information, among which the start fault injection cycle number is used to record the fault injection inspection result, thereby realizing the automated testing of fault injection.
[0033] Specifically, the soft-tuning protocol includes a passive end and an active end. The active end is connected to the communication interface provided by the test tool to the outside, and the passive end exchanges data with each main control board platform subsystem. The soft-tuning protocol provides the test tool and the main control board platform subsystem with read memory, write memory and function interface calling functions through the passive end and the active end respectively; the computer platform adds the call of the first function interface of the soft-tuning protocol module in the startup initialization function, and adds the call of the second function interface of the soft-tuning protocol module in the periodic operation function.
[0034] Furthermore, the first function interface and the second function interface of the soft-tuning protocol module are respectively the initialization function interface and the periodic operation function interface; start Debug and end Debug conditional compilation are respectively added before and after the called function to control the use of this function only in the Debug version, avoiding other unnecessary versions from using this function, and improving the program execution rate.
[0035] Specifically, the testing tool sequentially performs automated testing of other fault injection test cases in the fault injection test case library based on the received user input data; wherein the fault injection information input by the user needs to be organized according to the definition of the corresponding global variable type.
[0036] The above specific embodiments are preferred embodiments of the present invention, and are not intended to limit the specific implementation scope of the present invention. The scope of the present invention includes but is not limited to the present specific embodiments. All equivalent changes made in accordance with the shape, structure, and method of the present invention are within the protection scope of the present invention.
Claims
1. A method for periodic synchronous fault injection, Features: The following steps are involved: S1. Establish a fault injection test case library according to the test requirements, classify the fault injection test cases in the fault test case library according to the fault injection method and test function requirements, and define fault injection global variable information according to the fault type; S2, allocates memory addresses for storing fault injection global variables; S3, parsing the memory address of the fault injection global variable, and obtaining parameter information of the fault injection global variable through the memory reading function of the software adjustment protocol; S4, calculating the start fault injection cycle number according to the fault injection global variable parameter information, and determining the fault injection point; S5. According to the fault injection point, periodic synchronous fault injection is performed on multiple main control board platform subsystems, and the fault injection results are automatically detected.
2. The periodic synchronous fault injection method according to claim 1, Features: The fault injection global variable information includes: the start fault injection cycle number, the number of fault injection cycles, the number of discarded radar messages, and the number of modified radar messages.
3. The periodic synchronous fault injection method according to claim 1, Features: The soft tuning protocol includes a passive end and an active end. The active end is connected to the communication interface provided by the test tool to the outside, and the passive end exchanges data with each main control board platform subsystem. The soft tuning protocol provides memory reading, memory writing and function interface calling functions for the test tool and the main control board platform subsystem through the passive end and the active end respectively; the computer platform adds the call of the first function interface of the soft tuning protocol in the startup initialization function, and adds the call of the second function interface of the soft tuning protocol in the periodic operation function.
4. The periodic synchronous fault injection method according to claim 1, Features: The S3 comprises the following steps: S31, using the software adjustment protocol to establish a connection between the test tool and multiple main control board platform subsystems; S32, the test tool parses the computer software ELF file to obtain all fault injection global variable names and corresponding memory addresses; S33. According to the global variable name corresponding to the current cycle number, query and match the memory address of the global variable.
5. The periodic synchronous fault injection method according to claim 4, Features: The test tool and each main control board platform subsystem use data from the same ELF file.
6. The periodic synchronous fault injection method according to claim 1, Features: The S4 comprises the following steps: S41, obtaining the current running cycle number of the first main control board platform subsystem through the software adjustment protocol memory reading function; S42, setting the communication delay time, and then calculating the start fault injection cycle number according to the communication delay time, the cycle operation length and the cycle number of the first main control board platform subsystem currently running, to determine the fault injection cycle.
7. The periodic synchronous fault injection method according to claim 6, Features: The starting fault injection cycle number includes the following calculation process: Where N is the starting fault injection cycle number, M is the current cycle number, T is the communication delay time, and C is the cycle length.
8. The method for periodic synchronous fault injection according to claim 1 or 6, Features: The S5 comprises the following steps: S51, determining whether the fault injection condition is met, if so, executing step S52; S52, the test tool receives the input fault injection information according to the start fault injection cycle number, determines the type of injected fault, and matches the memory address of the fault injection global variable; S53, encapsulating the start fault injection cycle number and the fault injection information to obtain a fault message, and simultaneously writing the fault message to the memory addresses of corresponding fault injection global variables in multiple main control board platform subsystems through the soft adjustment protocol memory write function; S54, multiple main control board platform subsystems periodically and synchronously parse the fault message, execute the fault injection program, and output the fault injection execution log; S55, multiple main control board platform subsystems periodically check the fault execution status and the fault injection execution log to determine the fault injection execution result; S56, analyzing and determining the execution result of the fault injection use case according to the fault injection execution result; If there is a main control board subsystem that has not executed the fault injection cycle, the number of fault injection cycles of the system is 0, and step S53 is executed; To achieve automated fault injection use case testing.
9. The periodic synchronous fault injection method according to claim 8, Features: The step S51 comprises the following steps: if the current cycle number is greater than or equal to the start fault injection cycle number, and the current cycle number is less than the sum of the radar message start fault injection cycle number and the radar message fault injection cycle number, it means that the fault injection condition is met.
10. The method for periodic synchronous fault injection according to any one of claims 1 to 8, Features: It also includes that the testing tool sequentially performs automated testing of other fault injection test cases in the fault injection test case library according to the received user input data.
