CN108205490B - Software watchdog test method and device - Google Patents
Software watchdog test method and device Download PDFInfo
- Publication number
- CN108205490B CN108205490B CN201611179878.1A CN201611179878A CN108205490B CN 108205490 B CN108205490 B CN 108205490B CN 201611179878 A CN201611179878 A CN 201611179878A CN 108205490 B CN108205490 B CN 108205490B
- Authority
- CN
- China
- Prior art keywords
- dog
- feeding
- sequence
- program
- fault
- 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
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
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 software watchdog testing method and a software watchdog testing device, wherein the method comprises the following steps: acquiring a simulation main program; inserting corresponding dog feeding serial numbers into a plurality of program statements of the simulation main program in sequence; modifying a program statement with a dog feeding sequence number to generate a simulation main program with a dog feeding sequence fault; compiling and executing a simulation main program with a feeding dog sequence fault so as to test the software watchdog; and when the software watchdog executes the reset operation, determining that the function of the software watchdog is normal. The method comprises the steps of sequentially inserting corresponding dog feeding serial numbers into a plurality of program statements of a simulation main program, modifying the program statements with the dog feeding serial numbers to generate a dog feeding sequence fault simulation main program, compiling and executing the simulation main program, testing the software watchdog by utilizing various sequence faults, and testing whether the software watchdog can be correctly protected, so that the monitoring function of the software watchdog is more comprehensive and accurate.
Description
Technical Field
The invention relates to the technical field of software, in particular to a software watchdog testing method and device.
Background
Watchdog technology is a program monitoring technology, and is a protection mechanism adopted to prevent program faults from generating erroneous outputs. The watchdog may be divided into a software watchdog and a hardware watchdog. When the software watchdog is tested, the most common method is to adopt a code simulation mode to simulate the running-off condition of a program. For example: adding while (1) codes in a monitored function, leading the program execution while (1) to be trapped in a dead loop, and being incapable of feeding a dog normally, testing the reset condition of the watchdog, and if the reset condition is correct, indicating that the software watchdog is normal in function; if the software watchdog function cannot be correctly realized, the software watchdog function fails to pass the test.
However, the above method can only test the protection function of the software watchdog to the program run-off situation, and for the case that the program is not executed according to the specified execution sequence, it is impossible to determine whether the software watchdog can protect normally by using the existing test method.
Disclosure of Invention
The present invention is directed to solving, at least to some extent, one of the technical problems in the related art. Therefore, a first objective of the present invention is to provide a method for testing a software watchdog, in which corresponding dog feeding serial numbers are sequentially inserted into a plurality of program statements of a simulation main program, and the program statements with the dog feeding serial numbers are modified, so as to generate a dog feeding sequence fault simulation main program, and the simulation main program is compiled and executed, so as to test the software watchdog by using a plurality of sequence faults, and test whether the software watchdog can be correctly protected, thereby enabling the monitoring function of the software watchdog to be more comprehensive and accurate.
The second purpose of the invention is to provide a software watchdog testing device.
In order to achieve the above object, an embodiment of a first aspect of the present invention provides a software watchdog testing method, including: acquiring a simulation main program; inserting corresponding dog feeding serial numbers into a plurality of program statements of the simulation main program in sequence; modifying a program statement with a dog feeding sequence number to generate a simulation main program with a dog feeding sequence fault; compiling and executing a simulation main program with a feeding dog sequence fault so as to test the software watchdog; and when the software watchdog executes the reset operation, determining that the function of the software watchdog is normal.
According to the software watchdog testing method, the corresponding dog feeding serial numbers are sequentially inserted into the program statements of the simulation main program, the program statements with the dog feeding serial numbers are modified, the simulation main program of the dog feeding sequence faults is generated, the simulation main program is compiled and executed, the software watchdog is tested by utilizing the multiple sequence faults, whether the software watchdog can be correctly protected is tested, and therefore the monitoring function of the software watchdog is more comprehensive and accurate.
In order to achieve the above object, a second embodiment of the present invention provides a software watchdog testing apparatus, including: the acquisition module is used for acquiring a simulation main program; the insertion module is used for sequentially inserting corresponding dog feeding serial numbers into a plurality of program statements of the simulation main program; the modification module is used for modifying the program statements with the dog feeding sequence numbers to generate a simulation main program with dog feeding sequence faults; the test module is used for compiling and executing a simulation main program with a feeding dog sequence fault so as to test the software watchdog; and the determining module is used for determining that the software watchdog is normal in function when the software watchdog executes the reset operation.
According to the software watchdog testing device, the corresponding dog feeding serial numbers are sequentially inserted into the program statements of the simulation main program, the program statements with the dog feeding serial numbers are modified, so that the simulation main program of the dog feeding sequence faults is generated, the simulation main program is compiled and executed, the software watchdog is tested by utilizing various sequence faults, whether the software watchdog can be correctly protected is tested, and therefore the monitoring function of the software watchdog is more comprehensive and accurate.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
FIG. 1 is a flow diagram of a software watchdog testing method according to one embodiment of the present invention;
FIG. 2 is a flow diagram of a method of a software watchdog monitor according to one embodiment of the present invention;
fig. 3 is a schematic structural diagram of a software watchdog testing device according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative and intended to be illustrative of the invention and are not to be construed as limiting the invention.
The software watchdog test method and apparatus of the embodiments of the present invention are described below with reference to the accompanying drawings.
The embodiment of the invention provides a software watchdog testing method, which comprises the following steps: acquiring a simulation main program; inserting corresponding dog feeding serial numbers into a plurality of program statements of the simulation main program in sequence; modifying a program statement with a dog feeding sequence number to generate a simulation main program with a dog feeding sequence fault; compiling and executing a simulation main program with a feeding dog sequence fault so as to test the software watchdog; and when the software watchdog executes the reset operation, determining that the function of the software watchdog is normal.
Fig. 1 is a flow chart of a software watchdog testing method according to one embodiment of the present invention.
As shown in fig. 1, the software watchdog testing method includes:
s101, acquiring a simulation main program.
The simulation main program is a program statement which can realize a certain function. And after inserting a software watchdog into the program statement of the simulation main program, executing the simulation main program. Whether the software watchdog can correctly protect the software watchdog can be tested by methods of disturbing the sequence of program statements in the simulation main program and the like.
In one embodiment of the invention, a simulated main program may be obtained.
And S102, inserting corresponding dog feeding serial numbers into a plurality of program statements simulating the main program in sequence.
After the simulation main program is obtained, a plurality of program statements are selected from the simulation main program, and corresponding dog feeding serial numbers are sequentially inserted to indicate that corresponding dog feeding signals are sent when the corresponding program statements are executed. For example, the simulation main program has twenty program words, and the first, third, fifth, and other odd program words may be sequentially inserted with the feeding dog numbers Num (1), Num (2), Num (3), Num (4), Num (5), Num (6), Num (7), Num (8), Num (9), and Num (10).
Wherein, a plurality of program statements with the insertion of the feeding dog serial number can be selected according to actual needs.
S103, modifying the program statement with the dog feeding sequence number to generate a simulation main program with dog feeding sequence faults.
After inserting corresponding dog feeding serial numbers in a plurality of program statements of the simulation main program in sequence, modifying the program statements with the dog feeding serial numbers, such as deleting the program statements, reversing the sequence of the program statements, and the like, and generating the simulation main program with the dog feeding sequence fault.
Wherein, the dog feeding means that a signal is sent out when the simulation main program is executed to a program statement with a dog feeding sequence number. This signal may be referred to as a feed dog signal.
It can be understood that the number of the feeding dog corresponds to the number of the feeding dog signals. For example, the program words simulating the main program have dog numbers Num (1), Num (2), Num (3), Num (4), Num (5), Num (6), Num (7), Num (8), Num (9) and Num (10) inserted therein, and when the program words having the dog numbers are sequentially executed, corresponding dog signals are generated, which can be expressed as drv _ Num (1), drv _ Num (2), drv _ Num (3), drv _ Num (4), drv _ Num (5), drv _ Num (6), drv _ Num (7), drv _ Num (8), drv _ Num (9) and drv _ Num (10). If the program statement inserted with the feeding dog serial number is deleted, the corresponding feeding dog signal is not generated.
The following describes in detail a method for generating a fault with a dog feeding sequence by modifying a program statement with a dog feeding sequence number by using a specific example. Specific examples are as follows:
example one: one or more program statements with the dog feeding serial numbers can be selected from the program statements with the dog feeding serial numbers for deletion, and when the deleted program statements are executed, the corresponding dog feeding signals cannot be sent out due to the fact that the program statements are deleted, so that the dog feeding signals are lost, namely, the fault of the dog feeding signal loss is generated. For example, a program statement having a dog run number Num (2) is deleted, and when the program statement is executed, the program statement is deleted, and therefore the dog run signal drv _ Num (2) cannot be issued, and the dog run signal drv _ Num (2) is lost, and a loss fault of the dog run signal drv _ Num (2) is generated.
Example two: at least two program statements can be selected from the program statements with the dog feeding serial numbers, and the dog feeding serial numbers of the program statements are modified into consistent dog feeding serial numbers so as to generate the dog feeding signal repetition fault. For example, two program statements are selected from the program statements with the dog feeding numbers, the two program statements are respectively a first program statement and a third program statement in the simulation main program, the dog feeding numbers are respectively Num (1) and Num (2), the dog feeding number Num (2) of the third program statement is modified into Num (1), and the dog feeding number of the third program statement is consistent with the dog feeding number of the first program statement. When the first program statement is executed, the feeding dog signal drv _ Num (1) is sent out, and because the feeding dog serial numbers of the two program statements are the same and are Num (1), when the third program statement is executed, the feeding dog signal drv _ Num (1) is also sent out, so that the feeding dog signal drv _ Num (1) is repeated, and the feeding dog signal repetition fault is generated.
Example three: the order of two or more program statements with feed dog sequence numbers may be reversed to generate a feed dog signal order fault. For example, the positions of the program statement having the feeding dog number Num (1) and the program statement having the feeding dog number Num (4) are reversed. Since the program statement is inverted, the program statement with the feed dog signal Num (4) is executed first, and the program statement with the feed dog signal Num (1) is executed later. Therefore, the dog feeding signal drv _ Num (4) is sent first, and then the dog feeding signal drv _ Num (1) is sent, so that the sending sequence of the dog feeding signal drv _ Num (1) and the dog feeding signal drv _ Num (4) is wrong, and a fault of wrong sequence of the dog feeding signal is generated.
Example four: alternatively, a program statement having consecutive dog feeding signals may be selected from among the program statements having the dog feeding sequence numbers, and a dog feeding sequence number may be added to a certain program statement between the program statements having consecutive dog feeding signals. For example, one feeding dog sequence number, for example, Num (11), may be added to a program statement between a program statement having a feeding dog sequence number Num (2) and a program statement having a feeding dog sequence number Num (3), and when the program is executed to this portion, the feeding dog signal issuance order is drv _ Num (2), drv _ Num (11), and drv _ Num (3) in this order, so that the issuance order of the feeding dog signals drv _ Num (2) and drv _ Num (3) is not continuous, and a feeding dog signal order error fault is generated.
Example five: the feed dog sequence number of the program statement with the last feed dog sequence number at the sorting position can be modified beyond the maximum upper limit of the feed dog sequence number. For example, in the simulation main program, the last dog feeding sequence number at the sorting position is Num (9), and the dog feeding sequence number Num (9) is modified to a dog feeding sequence number larger than Num (9), such as Num (10) or Num (11), so that the dog feeding signal issued when the program statement is executed is not consecutive in sequence with the previous dog feeding signal, thereby generating a dog feeding signal fault.
It can be understood that the program statement with the feed dog serial number can be modified by one or more methods to generate diversified faults, so as to comprehensively test the function of the software watchdog.
And S104, compiling and executing the simulation main program with the feeding dog sequence fault so as to test the software watchdog.
And compiling the simulation main program after the program statement with the dog feeding sequence number is modified. And after compiling is finished, executing a simulation main program with the feeding dog sequence fault so as to test the software watchdog through the simulation main program with the feeding dog sequence fault.
For example, the simulation main program is compiled and run after the dog feeding serial number Num (3) is modified into the dog feeding serial number Num (1), and the simulation main program sends out two identical dog feeding signals drv _ Num (1) in the running process, that is, a repeated fault of the dog feeding signals is generated. And testing the software watchdog by using the repeated faults of the feeding dog signals to test whether the repeated faults of the feeding dog signals can be identified.
And S105, when the software watchdog executes the reset operation, determining that the function of the software watchdog is normal.
In the process of executing the simulation main program with the feeding dog sequence fault, if the software watchdog executes the reset operation, the function of the software watchdog can be determined to be normal, and the due protection effect is achieved.
And if the simulation main program can be continuously executed and is not reset, the software watchdog can not correctly identify the fault and does not play a protection role.
According to the software watchdog testing method, the corresponding dog feeding serial numbers are sequentially inserted into the program statements of the simulation main program, the program statements with the dog feeding serial numbers are modified, the simulation main program of the dog feeding sequence faults is generated, the simulation main program is compiled and executed, the software watchdog is tested by utilizing the multiple sequence faults, whether the software watchdog can be correctly protected is tested, and therefore the monitoring function of the software watchdog is more comprehensive and accurate.
After the software watchdog is tested by the method, if the software watchdog is normal in function, the software watchdog can be used for monitoring the program to be monitored. A method of a software watchdog monitor is described below in conjunction with fig. 2.
As shown in fig. 2, the method of the software watchdog monitoring program may include:
s201, a feeding dog number is inserted into a main program to be monitored.
For example, a user may want to monitor the running of a main program with a software watchdog. Specifically, a plurality of program statements are selected from a main program to be monitored, and a dog feeding number is sequentially inserted. Take the example of inserting 5 feeding dog serial numbers Num (1), Num (2), Num (3), Num (4) and Num (5) in the main program in sequence.
S202, executing the main program.
And compiling and executing the main program after inserting the dog feeding serial number into the main program.
S203, judging whether the sequence of the sent dog feeding signals is correct or not.
In the process of executing the main program, when a program statement with a dog feeding sequence number is executed, a dog feeding signal is sent out. The software watchdog judges the sequence of the sent dog feeding signals, judges whether the sequence of the dog feeding signals is correct or not, namely judges whether the main program is executed according to a specified sequence or not.
And S204, the software watchdog executes reset operation.
If the sequence of the dog feeding signals sent out in the process of executing the main program is not drv _ Num (1), drv _ Num (2), drv _ Num (3), drv _ Num (4) and drv _ Num (5), namely the sequence of the dog feeding signals does not correspond to the dog feeding sequence number, the software watchdog executes the reset operation.
S205, the main program continues to execute.
If the software watchdog monitors that the sequence of the sent dog feeding signals corresponds to the dog feeding sequence number, namely the main program is executed according to the specified sequence, the main program continues to be executed.
The software watchdog testing device according to the embodiment of the present invention is described below with reference to fig. 3. Fig. 3 is a schematic structural diagram of a software watchdog testing device according to an embodiment of the present invention.
As shown in fig. 3, the software watchdog testing apparatus may include: an acquisition module 310, an insertion module 320, a modification module 330, a testing module 340, and a determination module 350.
The obtaining module 310 is configured to obtain a simulation main program.
The inserting module 320 is configured to sequentially insert corresponding dog feeding sequence numbers into a plurality of program statements simulating a main program.
After obtaining the simulation main program, the inserting module 320 selects a plurality of program statements from the simulation main program and sequentially inserts corresponding dog feeding serial numbers to indicate that corresponding dog feeding signals are sent when the corresponding program statements are executed. For example, the simulation main program has twenty program words, and the first, third, and fifth program words may be sequentially inserted with the dog feeding numbers Num (1), Num (2), Num (3), Num (4), Num (5), Num (6), Num (7), Num (8), Num (9), and Num (10).
Wherein, a plurality of program statements with the insertion of the feeding dog serial number can be selected according to actual needs.
The modification module 330 is used for modifying the program statements with the feeding dog sequence numbers to generate a simulated main program with a feeding dog sequence fault.
Modification module 330 is to delete one or more of the program statements having a feed dog sequence number to generate a feed dog signal miss fault.
The modification module 330 is configured to modify the dog feeding sequence numbers corresponding to at least two program statements having the dog feeding sequence numbers to be consistent, so as to generate a dog feeding signal repetition fault.
The modification module 330 is configured to reverse the order of at least two program statements having a feed dog sequence number to generate a feed dog signal order error fault.
The modification module 330 is configured to add a dog feeding sequence number to a certain program statement between two consecutive program statements having the dog feeding sequence number to generate a dog feeding signal sequence error fault.
The modifying module 330 is configured to modify the dog feeding sequence number of the program statement with the dog feeding sequence number at the last sorting position beyond the maximum upper limit of the dog feeding sequence number to generate a dog feeding signal fault.
After inserting the corresponding dog feeding sequence numbers into the program statements of the simulation main program in sequence, the modification module 330 modifies the program statements with the dog feeding sequence numbers, such as deleting the program statements, reversing the sequence of the program statements, and so on, to generate the simulation main program with the dog feeding sequence fault.
Wherein, the dog feeding means that a signal is sent out when the simulation main program is executed to a program statement with a dog feeding sequence number. This signal may be referred to as a feed dog signal.
It can be understood that the number of the feeding dog corresponds to the number of the feeding dog signals. For example, the program words simulating the main program have dog numbers Num (1), Num (2), Num (3), Num (4), Num (5), Num (6), Num (7), Num (8), Num (9) and Num (10) inserted therein, and when the program words having the dog numbers are sequentially executed, corresponding dog signals are generated, which can be expressed as drv _ Num (1), drv _ Num (2), drv _ Num (3), drv _ Num (4), drv _ Num (5), drv _ Num (6), drv _ Num (7), drv _ Num (8), drv _ Num (9) and drv _ Num (10). If the program statement inserted with the feeding dog serial number is deleted, the corresponding feeding dog signal is not generated.
The following describes in detail how the modification module 330 modifies the program statement with the feed dog sequence number to generate a fault with the feed dog sequence. Specific examples are as follows:
example one: the modifying module 330 may be configured to select one or more program statements with dog feeding sequence numbers from the program statements with dog feeding sequence numbers to delete the program statements, and when the deleted program statements are executed, because the program statements are deleted and cannot send out corresponding dog feeding signals, a dog feeding signal is missing, that is, a dog feeding signal missing fault is generated. For example, a program statement having a dog run number Num (2) is deleted, and when the program statement is executed, the program statement is deleted, and therefore the dog run signal drv _ Num (2) cannot be issued, and the dog run signal drv _ Num (2) is lost, and a loss fault of the dog run signal drv _ Num (2) is generated.
Example two: the modification module 330 may be configured to select at least two program statements from the program statements having the feed dog serial numbers, and modify the feed dog serial numbers of the at least two program statements into consistent feed dog serial numbers to generate a feed dog signal repetition fault. For example, two program statements are selected from the program statements with the dog feeding numbers, the two program statements are respectively a first program statement and a third program statement in the simulation main program, the dog feeding numbers are respectively Num (1) and Num (2), the dog feeding number Num (2) of the third program statement is modified into Num (1), and the dog feeding number of the third program statement is consistent with the dog feeding number of the first program statement. When the first program statement is executed, the feeding dog signal drv _ Num (1) is sent out, and because the feeding dog serial numbers of the two program statements are the same and are Num (1), when the third program statement is executed, the feeding dog signal drv _ Num (1) is also sent out, so that the feeding dog signal drv _ Num (1) is repeated, and the feeding dog signal repetition fault is generated.
Example three: modification module 330 may be used to reverse the order of two or more program statements having a feed dog sequence number to generate a feed dog signal sequence fault. For example, the positions of the program statement having the feeding dog number Num (1) and the program statement having the feeding dog number Num (4) are reversed. Since the program statement is inverted, the program statement with the feed dog signal Num (4) is executed first, and the program statement with the feed dog signal Num (1) is executed later. Therefore, the dog feeding signal drv _ Num (4) is sent first, and then the dog feeding signal drv _ Num (1) is sent, so that the sending sequence of the dog feeding signal drv _ Num (1) and the dog feeding signal drv _ Num (4) is wrong, and a fault of wrong sequence of the dog feeding signal is generated.
Example four: the modification module 330 is also configured to select a program statement with consecutive dog feeding signals from the program statements with the dog feeding sequence numbers, and add a dog feeding sequence number to a program statement between the consecutive program statements with the dog feeding signals. For example, one feeding dog sequence number, for example, Num (11), may be added to a program statement between a program statement having a feeding dog sequence number Num (2) and a program statement having a feeding dog sequence number Num (3), and when the program is executed to this portion, the feeding dog signal issuance order is drv _ Num (2), drv _ Num (11), and drv _ Num (3) in this order, so that the issuance order of the feeding dog signals drv _ Num (2) and drv _ Num (3) is not continuous, and a feeding dog signal order error fault is generated.
Example five: the modification module 330 may be further configured to modify the feed dog sequence number of the program statement with the feed dog sequence number positioned last in the sorting position beyond the maximum upper limit of the feed dog sequence number. For example, in the simulation main program, the last dog feeding sequence number at the sorting position is Num (9), and the dog feeding sequence number Num (9) is modified to a dog feeding sequence number larger than Num (9), such as Num (10) or Num (11), so that the dog feeding signal issued when the program statement is executed is not consecutive in sequence with the previous dog feeding signal, thereby generating a dog feeding signal fault.
The test module 340 is used for compiling and executing a simulation main program with a feeding dog sequence fault so as to test the software watchdog.
After the program statements with the feed dog sequence numbers have been modified, the test module 340 compiles the simulation main program. And after compiling is finished, executing a simulation main program with the feeding dog sequence fault so as to test the software watchdog through the simulation main program with the feeding dog sequence fault.
For example, the simulation main program is compiled and run after the dog feeding serial number Num (3) is modified into the dog feeding serial number Num (1), and the simulation main program sends out two identical dog feeding signals drv _ Num (1) in the running process, that is, a repeated fault of the dog feeding signals is generated. And testing the software watchdog by using the repeated faults of the feeding dog signals to test whether the repeated faults of the feeding dog signals can be identified.
The determining module 350 is configured to determine that the software watchdog is functioning normally when the software watchdog performs a reset operation.
In the process of executing the simulated main program with the feeding dog sequence fault, if the software watchdog performs the reset operation, the determining module 350 may determine that the software watchdog functions normally, and the software watchdog plays a due role in protection.
And if the simulation main program can be continuously executed and is not reset, the software watchdog can not correctly identify the fault and does not play a protection role.
It should be noted that the foregoing explanation of the embodiment of the software watchdog testing method is also applicable to the software watchdog testing apparatus of the embodiment, and is not repeated herein.
In summary, in the software watchdog testing apparatus according to the embodiment of the present invention, the corresponding dog feeding sequence numbers are sequentially inserted into the plurality of program statements of the simulation main program, and the program statements with the dog feeding sequence numbers are modified, so as to generate the dog feeding sequence fault simulation main program, and the simulation main program is compiled and executed, so that the software watchdog is tested by using multiple sequence faults, and whether the software watchdog can be correctly protected is tested, thereby enabling the monitoring function of the software watchdog to be more comprehensive and accurate.
In the description of this specification, reference is made to the terms: reference to "one embodiment," "some embodiments," "an example," "a specific example," or "some examples" or the like means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.
Claims (12)
1. A software watchdog test method is characterized by comprising the following steps:
acquiring a simulation main program;
inserting corresponding dog feeding serial numbers into a plurality of program statements of the simulation main program in sequence, wherein the dog feeding serial numbers indicate that corresponding dog feeding signals are sent when the program statements with the dog feeding serial numbers are executed;
modifying the program statements with the dog feeding sequence numbers to generate a simulation main program with dog feeding sequence faults;
compiling and executing the simulated main program with the feeding dog sequence fault to test the software watchdog, wherein the method comprises the following steps: when a program statement with a dog feeding serial number is executed by the software watchdog, sending a dog feeding signal, judging whether the sequence of the sent dog feeding signal is correct or not, and when the sequence of the dog feeding signal does not correspond to the dog feeding serial number, executing reset operation by the software watchdog, wherein the dog feeding signal corresponds to the dog feeding serial number one by one;
and when the software watchdog executes the reset operation, determining that the function of the software watchdog is normal.
2. The method of claim 1, wherein modifying the program statement having the feed dog sequence number to generate a simulated main program having a feed dog sequence fault comprises:
deleting one or more program statements with the feed dog sequence number to generate a feed dog signal missing fault.
3. The method of claim 1, wherein modifying the program statement having the feed dog sequence number to generate a simulated main program having a feed dog sequence fault comprises:
and modifying the corresponding dog feeding sequence numbers of at least two program statements with the dog feeding sequence numbers to be consistent so as to generate a dog feeding signal repetition fault.
4. The method of claim 1, wherein modifying the program statement having the feed dog sequence number to generate a simulated main program having a feed dog sequence fault comprises:
and reversing the sequence of at least two program statements with the feeding dog sequence numbers to generate a feeding dog signal sequence error fault.
5. The method of claim 1, wherein modifying the program statement having the feed dog sequence number to generate a simulated main program having a feed dog sequence fault comprises:
and adding a dog feeding sequence number to a certain program statement between two consecutive program statements with the dog feeding sequence number to generate a dog feeding signal sequence error fault.
6. The method of claim 1, wherein modifying the program statement having the feed dog sequence number to generate a simulated main program having a feed dog sequence fault comprises:
and modifying the feeding dog sequence number of the program statement with the feeding dog sequence number at the last sequencing position beyond the maximum upper limit of the feeding dog sequence number to generate a feeding dog signal fault.
7. A software watchdog testing arrangement, comprising:
the acquisition module is used for acquiring a simulation main program;
the insertion module is used for sequentially inserting corresponding dog feeding serial numbers in a plurality of program statements of the simulation main program, wherein the dog feeding serial numbers indicate that corresponding dog feeding signals are sent when the program statements with the dog feeding serial numbers are executed;
the modification module is used for modifying the program statements with the dog feeding sequence numbers to generate a simulation main program with dog feeding sequence faults;
the test module is used for compiling and executing the simulation main program with the fault of the dog feeding sequence so as to test the software watchdog, and is also used for sending a dog feeding signal when a program statement with the dog feeding sequence number is executed by the software watchdog, and judging whether the sequence of the sent dog feeding signal is correct or not according to the sequence of the sent dog feeding signal, wherein the dog feeding signal and the dog feeding sequence number are in one-to-one correspondence;
the determining module is used for determining that the software watchdog has normal functions when the software watchdog executes reset operation, and the determining module is also used for executing reset operation when the sequence of the dog feeding signals does not correspond to the dog feeding sequence numbers.
8. The apparatus of claim 7, wherein the modification module is to:
deleting one or more program statements with the feed dog sequence number to generate a feed dog signal missing fault.
9. The apparatus of claim 7, wherein the modification module is to:
and modifying the corresponding dog feeding sequence numbers of at least two program statements with the dog feeding sequence numbers to be consistent so as to generate a dog feeding signal repetition fault.
10. The apparatus of claim 7, wherein the modification module is to:
and reversing the sequence of at least two program statements with the feeding dog sequence numbers to generate a feeding dog signal sequence error fault.
11. The apparatus of claim 7, wherein the modification module is to:
and adding a dog feeding sequence number to a certain program statement between two consecutive program statements with the dog feeding sequence number to generate a dog feeding signal sequence error fault.
12. The apparatus of claim 7, wherein the modification module is to:
and modifying the feeding dog sequence number of the program statement with the feeding dog sequence number at the last sequencing position beyond the maximum upper limit of the feeding dog sequence number to generate a feeding dog signal fault.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611179878.1A CN108205490B (en) | 2016-12-19 | 2016-12-19 | Software watchdog test method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611179878.1A CN108205490B (en) | 2016-12-19 | 2016-12-19 | Software watchdog test method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108205490A CN108205490A (en) | 2018-06-26 |
CN108205490B true CN108205490B (en) | 2021-05-14 |
Family
ID=62603076
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201611179878.1A Active CN108205490B (en) | 2016-12-19 | 2016-12-19 | Software watchdog test method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108205490B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110162421B (en) * | 2019-04-28 | 2020-11-10 | 北京航空航天大学 | Embedded software watchdog test method and device containing interrupt function |
Family Cites Families (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7069543B2 (en) * | 2002-09-11 | 2006-06-27 | Sun Microsystems, Inc | Methods and systems for software watchdog support |
CN1323500C (en) * | 2003-11-05 | 2007-06-27 | 中兴通讯股份有限公司 | Function testing method and system for hardware watchdog |
CN101794244A (en) * | 2010-03-18 | 2010-08-04 | 上海乐毅信息科技有限公司 | Multi-thread watch dog monitoring method |
CN102629232B (en) * | 2012-01-09 | 2014-03-26 | 北京航空航天大学 | Software reliability verifying and testing method with test validity introduced |
CN102880523B (en) * | 2012-10-10 | 2015-03-11 | 北京和利时系统工程有限公司 | Watchdog circuit and failure monitoring method for same |
WO2016020815A1 (en) * | 2014-08-04 | 2016-02-11 | Yogitech S.P.A. | Method of executing programs in an electronic system for applications with functional safety comprising a plurality of processors, corresponding system and computer program product |
CN104572472B (en) * | 2015-01-28 | 2018-03-06 | 中国农业银行股份有限公司 | A kind of program execution order diagnostic method and system |
-
2016
- 2016-12-19 CN CN201611179878.1A patent/CN108205490B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN108205490A (en) | 2018-06-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Weyuker et al. | Using developer information as a factor for fault prediction | |
CN111651366B (en) | SDK test method, device, equipment and storage medium | |
CN104657247A (en) | System and method for realizing universal type fault injection based on JTAG (Joint Test Action Group) debug mode | |
US10936474B2 (en) | Software test program generation | |
CN105205006A (en) | Multi-platform universal test method, device and system | |
CN110580226A (en) | object code coverage rate testing method, system and medium for operating system level program | |
US20180024833A1 (en) | Processor testing | |
Laguna et al. | Probabilistic diagnosis of performance faults in large-scale parallel applications | |
CN102567164A (en) | Instruction set batch testing device and method for processor | |
CN102831058B (en) | Testing method and testing device | |
CN103389939A (en) | Detection method and detection system for controlled heap allocation bug | |
CN107329889B (en) | Method for automatically testing C compiler | |
Zhao et al. | The game of twenty questions: Do you know where to log? | |
CN108205490B (en) | Software watchdog test method and device | |
US20100313187A1 (en) | Method and system for detecting infeasible paths | |
CN112698974A (en) | Fault injection test method, device and storage medium | |
Barbosa et al. | Verification and validation of (real time) COTS products using fault injection techniques | |
US7774668B2 (en) | System and method for detecting non-reproducible pseudo-random test cases | |
US6845440B2 (en) | System for preventing memory usage conflicts when generating and merging computer architecture test cases | |
CN108628637B (en) | Apparatus and method for processing data | |
KR102042996B1 (en) | Method and apparatus for measuring code coverage not by using probes and computer readable recording medium having program the same | |
CN108845945A (en) | Using test optimization method and device | |
US20050071820A1 (en) | Using a debugging framework to enforce best practices in program development | |
El-Fakih et al. | On code coverage of extended FSM based test suites: An initial assessment | |
CN103365775B (en) | Based on the unit test method that internal state checks |
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 |