Method for testing electronic components and communication device

By sending and analyzing the sequence of request messages, the program execution sequence of the ECU is tested, which solves the problem of insufficient diagnostic test depth of the UDS protocol and improves the test depth and reliability of the Internet of Vehicles function.

CN118740667APending Publication Date: 2024-10-01YINWANG INTELLIGENT TECHNOLOGIES CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310364259.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-31
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

In automotive electronic control units (ECUs), diagnostic tests based on the UDS protocol are difficult to in-depth and cannot effectively detect program execution problems, which affects the implementation and maintenance of the Internet of Vehicles function.

Method used

By sending a specific request message sequence to electronic components, receiving response messages to determine the program execution sequence, and saving and mutating the request message sequence to test the impact of the program execution sequence on the ECU, improve test depth and accuracy.

Benefits of technology

The depth of testing of the ECU program execution sequence is improved, more execution problems are discovered, and the reliability and maintenance efficiency of the Internet of Vehicles function are enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118740667A_ABST
    Figure CN118740667A_ABST
Patent Text Reader

Abstract

The invention discloses a method for testing an electronic component and a communication device, which can be used for testing a UDS protocol. The method comprises the following steps: sending a first request message sequence comprising at least two request messages to an electronic component, wherein the first request message sequence is at least used for representing a program execution sequence of the electronic component; receiving a first response message from the electronic component, wherein the first response message is used for responding to the last request message in the first request message sequence; when the first response message is a positive response message, the first request message sequence is stored, and the stored first request message sequence is used for generating a second request message sequence; when the first response message is a negative response message and indicates that the data field included in the last request message is wrong, storing the first request message sequence; otherwise, discarding the first request message sequence. By adopting the embodiment of the invention, the influence of the program execution sequence on the electronic component can be tested, so that the test depth can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of communication technology, and in particular to a method for testing electronic components and a communication device. Background Art

[0002] The unified diagnostic services (UDS) protocol is a standardized standard for diagnostic services in the automotive field. The UDS protocol is an application layer protocol that can be implemented on both the controller area network (CAN) bus and Ethernet. The UDS protocol can provide a basic framework for diagnostic services. OEMs and component suppliers can choose to implement some of the diagnostic services or customize some private diagnostic services based on actual conditions. Therefore, diagnosis based on the UDS protocol can also be called enhanced diagnosis. Diagnosis based on the UDS protocol can facilitate the development of electronic components such as electronic control units (ECUs), and can also facilitate after-sales maintenance and the realization of vehicle networking functions.

[0003] ECU can also be called the car's driving computer, which is used to control the driving status of the car and realize its various functions. For example, ECU can use various sensors and bus data collection and exchange to determine the vehicle status and driver's intentions. With the rapid development of Internet of Vehicles technology, the programs on ECU are becoming more and more numerous and complex. When testing the UDS protocol in ECU, how to improve the depth of the test is currently a hot topic of research. Summary of the invention

[0004] The embodiments of the present application provide a method and a communication device for testing electronic components, which can improve the depth of testing and facilitate the discovery of more program execution problems.

[0005] In a first aspect, an embodiment of the present application provides a method for testing an electronic component, which may include: sending a first request message sequence to the electronic component, the first request message sequence including at least two request messages, the first request message sequence being at least used to characterize the order in which the electronic component executes a program; receiving a first response message from the electronic component, the first response message being used to respond to the last request message in the first request message sequence; when the first response message is an affirmative response message, saving the first request message sequence, the saved first request message sequence being used to generate a second request message sequence, the second request message sequence being a message sequence obtained by adding a request message after the first request message sequence.

[0006] It can be seen that a first request message sequence is sent to the electronic component, which is at least used to characterize the order in which the electronic component executes the program, and whether to save the first request message sequence is determined by receiving a first response message that is used to respond to the last request message in the first request message sequence. When the first response message is an affirmative response message, saving the first request message sequence can be understood as the electronic component can correctly process all request messages included in the first request message sequence (that is, the request messages in the first request message sequence can all correctly access the corresponding services in the electronic component), and the electronic component can correctly execute the program corresponding to the service in the order in which it is characterized, thereby testing the impact of the program execution order on the electronic component, thereby increasing the depth of the test and facilitating the discovery of more program execution problems.

[0007] Optionally, the electronic component may be an ECU, or an electronic device integrating at least one ECU, or other electronic device to be tested that adopts the UDS protocol.

[0008] Optionally, when saving the first request message sequence, the first request message sequence may be saved in a request message sequence pool, so that each request message sequence can be managed through the request message sequence pool.

[0009] Optionally, the method provided in the first aspect may be applied to a test device, and may be executed by the test device, or by a module in the test device, such as a chip, a chip system, or a processor in the test device.

[0010] In a possible implementation, when the first response message is a negative response message, and the negative response message indicates that the data field included in the last request message is wrong, the first request message sequence is saved. The first response message is a negative response message, and the negative response message indicates that the data field included in the last request message is wrong. It can be understood that the electronic component cannot correctly process the last request message, and when the electronic component executes the program corresponding to the last service (i.e., the service requested to be accessed by the last request message), it cannot execute according to the last request message or the data field included in the last request message. For the first request message sequence in this method, the value of the data field included in the last request message may correctly access the corresponding service in the electronic component after being changed, and then the first request message sequence can be saved to test the impact of changing the value of the data field on the execution of the program, which can further improve the depth of the test.

[0011] Optionally, when saving the first request message sequence, the first request message sequence may be saved in a request message sequence pool, so that each request message sequence can be managed through the request message sequence pool.

[0012] In another possible implementation, when the first response message is a negative response message, and the negative response message indicates that the identifier field included in the last request message is wrong, the first request message sequence is discarded. Discarding the first request message sequence can be understood as not saving the first request message sequence. The first response message is a negative response message, and the negative response message indicates that the identifier field included in the last request message is wrong, which can be understood as the electronic component cannot correctly process the last request message, and the last service (i.e., the service requested to be accessed by the last request message) does not exist or the program corresponding to the last service cannot be executed after executing the program corresponding to the second-to-last service (i.e., the service requested to be accessed by the second-to-last request message).

[0013] In a possible implementation, when the first response message is an affirmative response message, the first identifier indicated by the identifier field included in the first response message is the sum of the first identifier indicated by the identifier field included in the last request message and the parameter value.

[0014] Alternatively, when the first response message is a negative response message, the first identifier indicated by the identifier field included in the first response message is a negative identifier, and the second identifier indicated by the identifier field included in the first response message is the same as the first identifier indicated by the identifier field included in the last request message.

[0015] It can be seen that the identifier field included in the first response message is used to determine whether the first response message is used to respond to the last request message in the first request message sequence, so as to determine whether to save the first request message sequence based on the first response message.

[0016] In a possible implementation, when sending the first request message sequence to the electronic component, the request messages in the first request message sequence may be sent to the electronic component according to the arrangement order corresponding to the request messages in the first request message sequence. That is, according to the arrangement order corresponding to the request messages in the first request message sequence, the request messages in the first request message sequence are sent to the electronic component one by one, so that the electronic component can execute the corresponding service in sequence according to the arrangement order, thereby testing the influence of the program execution order on the electronic component.

[0017] In a possible implementation, before sending the first request message sequence to the electronic component, the first request message sequence is determined based on the saved fourth request message sequence and the generated first request message. The fourth request message sequence is used to characterize at least one order in which the electronic component executes the program, and the first request message sequence is used to characterize at least another order in which the electronic component executes the program. That is, a request message is added to the fourth request message sequence to test the effect of the program execution sequence on the electronic component, thereby dynamically testing the effect of the program execution sequence on the electronic component.

[0018] Optionally, the generated first request message is spliced ​​after the saved fourth request message sequence to obtain the first request message sequence. That is, the last request message in the first request message sequence is the generated first request message, so as to detect whether the request message sequence after splicing the first request message can correctly access the corresponding service in the electronic component.

[0019] In a possible implementation, the fourth request message sequence is a request message sequence in a request message sequence pool, that is, the request message sequence pool stores the fourth request message sequence. Moreover, the request messages included in the fourth request message sequence all correspond to positive response messages. That is, after sending the fourth request message sequence, a corresponding positive response message can be received for each request message in the fourth request message sequence.

[0020] In a possible implementation manner, a request message sequence (for example, a fifth request message sequence) included in the request message sequence pool satisfies at least one of the following:

[0021] (1) The request messages included in the fifth request message sequence all correspond to positive response messages, that is, there is a corresponding positive response message for each request message in the fifth request message sequence. The fifth request message sequence can be spliced ​​with the newly generated request message to generate and send a new request message sequence, and whether to save the new request message sequence is determined according to the last response message to the new request message sequence.

[0022] (2) The last request message in the fifth request message sequence corresponds to a negative response message, and the negative response message indicates that the data field included in the last request message in the fifth request message sequence is wrong, and the request messages in the fifth request message sequence except the last request message all correspond to positive response messages. In other words, the last response message in the response messages corresponding to the fifth request message sequence is a negative response message, and the negative response message indicates that the data field included in the last request message in the fifth request message sequence is wrong. The value of the data field included in the last request message in the fifth request message sequence can be changed, and after the change, the corresponding service in the electronic component may be correctly accessed, so as to test the impact of changing the value of the data field on program execution, which can further improve the depth of the test.

[0023] In a possible implementation, for a request message sequence pool, a sixth request message sequence may be selected from the request message sequence pool, and the number of mutations of the sixth request message sequence is less than the average number of mutations corresponding to the request message sequence pool; the value of the data field included in the request message in the sixth request message sequence is changed to obtain a first mutation request message sequence, and the first mutation request message sequence is sent to the electronic component. Thus, the influence of changing the value of the data field on program execution can be tested, and the depth of the test can be further improved.

[0024] In a possible implementation, a second variation request message sequence is sent to the electronic component, the second variation request message sequence includes a portion of the request message sequence in the sixth request message sequence and a portion of the request messages in the seventh request message sequence, and the seventh request message sequence is any request message sequence in the request message sequence pool. That is, the second variation request message sequence can be obtained by splicing a portion of the request message sequence in the sixth request message sequence with a portion of the request message in the seventh request message sequence. The second variation request message sequence is sent to the electronic component to determine whether to save the second variation request message sequence.

[0025] In one possible implementation, after sending a second variation request message sequence to the electronic component, M second response messages are received from the electronic component, and the M second response messages are used to respond to all request messages in the second variation request message sequence, and M is an integer greater than or equal to 2; when the first M-1 second response messages among the M second response messages are all affirmative response messages, the second variation request message sequence is saved in a request message sequence pool to increase the diversity of request message sequences in the request message sequence pool.

[0026] In a possible implementation, when the first M-1 second response messages among the M second response messages include negative response messages, the second variation request message sequence is discarded.

[0027] In a possible implementation, for a request message sequence pool, it includes an eighth request message sequence, the eighth request message sequence includes K consecutive first subsequences, and when the identifiers indicated by the identifier fields included in the K first subsequences are all the same, the eighth request message sequence is updated to a ninth request message sequence, and the ninth request message sequence is a message sequence obtained by deleting K-1 first subsequences from the eighth request message sequence. Among them, the first subsequence includes at least one request message, and K is an integer greater than or equal to 2. For a request message sequence in a request message sequence pool, if it includes multiple consecutive first subsequences, and the identifiers indicated by the identifier fields included in the multiple first subsequences are all the same, one first subsequence can be retained and the other first subsequences can be deleted to update the request message sequence, thereby updating the request message sequence pool.

[0028] In one possible implementation, for a request message sequence pool, which includes an eighth request message sequence and a ninth request message sequence, when the identifier indicated by the identifier field of the eighth request message sequence is exactly the same as the identifier indicated by the identifier field of the ninth request message sequence, the eighth request message sequence or the ninth request message sequence is deleted from the request message sequence pool to update the request message sequence pool and reduce duplicate request message sequences.

[0029] In a second aspect, the present application provides a communication device, which includes a module or unit for executing the method described in the first aspect.

[0030] In one possible design, the communication device includes:

[0031] A communication unit, configured to send a first request message sequence to an electronic component, the first request message sequence including at least two request messages, the first request message sequence at least being used to characterize the order in which the electronic component executes a program; and receive a first response message from the electronic component, the first response message being used to respond to the last request message in the first request message sequence;

[0032] The processing unit is used to save the first request message sequence when the first response message is an affirmative response message, the first request message sequence is used to generate the second request message sequence, and the second request message sequence is a message sequence obtained after adding a request message after the first request message sequence.

[0033] In a possible implementation, the processing unit is further configured to save the first request message sequence when the first response message is a negative response message and the negative response message indicates that a data field included in the last request message is erroneous.

[0034] In a possible implementation, the processing unit is further configured to discard the first request message sequence when the first response message is a negative response message and the negative response message indicates that an identifier field included in the last request message is incorrect.

[0035] In a possible implementation, when the first response message is a positive response message, the first identifier indicated by the identifier field included in the first response message is the sum of the first identifier indicated by the identifier field included in the last request message and the reference value; or,

[0036] When the first response message is a negative response message, the first identifier indicated by the identifier field included in the first response message is a negative identifier, and the second identifier indicated by the identifier field included in the first response message is the same as the first identifier indicated by the identifier field included in the last request message.

[0037] In a possible implementation, when the communication unit is used to send the first request message sequence to the electronic component, it is specifically used to send the request messages in the first request message sequence to the electronic component according to the arrangement order corresponding to the request messages in the first request message sequence.

[0038] In a possible implementation manner, the processing unit is further configured to determine the first request message sequence according to the saved fourth request message sequence and the generated first request message.

[0039] In a possible implementation manner, the fourth request message sequence is a request message sequence in a request message sequence pool, and the request messages included in the fourth request message sequence all correspond to positive response messages.

[0040] In a possible implementation manner, the fifth request message sequence included in the request message sequence pool satisfies at least one of the following:

[0041] The request messages included in the fifth request message sequence all correspond to positive response messages;

[0042] The last request message in the fifth request message sequence corresponds to a negative response message, and the negative response message indicates that the data field included in the last request message in the fifth request message sequence is wrong; all request messages in the fifth request message sequence except the last request message correspond to positive response messages.

[0043] In a possible implementation, the processing unit is further configured to select a sixth request message sequence from the request message sequence pool, wherein the number of mutations of the sixth request message sequence is less than the average number of mutations corresponding to the request message sequence pool; and change the value of a data field included in the request message in the sixth request message sequence to obtain a first mutation request message sequence;

[0044] The communication unit is further used to send a first mutation request message sequence to the electronic component.

[0045] In one possible implementation, the communication unit is also used to send a second variant request message sequence to the electronic component, the second variant request message sequence including some request messages in the sixth request message sequence and some request messages in the seventh request message sequence; the seventh request message sequence is any request message sequence in the request message sequence pool.

[0046] In a possible implementation, the communication unit is further used to receive M second response messages from the electronic component, where the M second response messages are used to respond to all request messages in the second variant request message sequence; M is an integer greater than or equal to 2;

[0047] The processing unit is further configured to save the second variant request message sequence in a request message sequence pool when the first M-1 second response messages among the M second response messages are all affirmative response messages.

[0048] In a possible implementation manner, the processing unit is further configured to discard the second variation request message sequence when the first M-1 second response messages among the M second response messages include negative response messages.

[0049] In one possible implementation, the request message sequence pool includes an eighth request message sequence, the eighth request message sequence includes K consecutive first subsequences, and the processing unit is further used to update the eighth request message sequence to a ninth request message sequence when the identifiers indicated by the identifier fields included in the K first subsequences are all the same, and the ninth request message sequence is a message sequence obtained by deleting K-1 first subsequences from the eighth request message sequence; wherein the first subsequence includes at least one request message; and K is an integer greater than or equal to 2.

[0050] In one possible implementation, the request message sequence pool includes an eighth request message sequence, the eighth request message sequence includes a first subsequence and a second subsequence, and the processing unit is further used to update the eighth request message sequence to a ninth request message sequence when the identifier indicated by the identifier field included in the first subsequence is the same as the identifier indicated by the identifier field included in the second subsequence, and the ninth request message sequence is a message sequence obtained after deleting the first subsequence or the second subsequence from the eighth request message sequence; wherein the first subsequence is continuous with the second subsequence, the first subsequence and the second subsequence include at least one request message, and the number of request messages included in the second subsequence is the same as the number of request messages included in the first subsequence.

[0051] In one possible implementation, the request message sequence pool includes an eighth request message sequence and a ninth request message sequence, and the processing unit is further used to delete the eighth request message sequence or the ninth request message sequence from the request message sequence pool when the identifier indicated by the identifier field of the eighth request message sequence is exactly the same as the identifier indicated by the identifier field of the ninth request message sequence.

[0052] Regarding the technical effects brought about by the second aspect and any possible implementation method, reference may be made to the introduction of the technical effects corresponding to the first aspect and the corresponding implementation method.

[0053] In a third aspect, an embodiment of the present application provides a communication device, including a processor. The processor is coupled to a memory and can be used to execute instructions in the memory to implement the method of the first aspect and any possible implementation method. Optionally, the communication device also includes a memory. Optionally, the communication device also includes a communication interface, and the processor is coupled to the communication interface.

[0054] In a fourth aspect, an embodiment of the present application provides a communication device, comprising: a logic circuit and a communication interface. The communication interface is used to receive information or send information; the logic circuit is used to receive information or send information through the communication interface, so that the communication device performs the method of the first aspect and any possible implementation method.

[0055] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, which is used to store a computer program (also referred to as code, or instructions); when the computer program runs on a computer, the method of the above-mentioned first aspect and any possible implementation method is implemented.

[0056] In the sixth aspect, an embodiment of the present application provides a computer program product, which includes: a computer program (also referred to as code, or instructions); when the computer program is executed, it enables the computer to execute the method of the above-mentioned first aspect and any possible implementation method.

[0057] In a seventh aspect, an embodiment of the present application provides a chip, the chip including a processor, the processor being used to execute instructions, when the processor executes the instructions, the chip executes the method of the first aspect and any possible implementation method. Optionally, the chip also includes a communication interface, the communication interface being used to receive information or send information.

[0058] In an eighth aspect, an embodiment of the present application provides a testing device, which includes at least one communication device as described in the second aspect, or the communication device as described in the third aspect, or the communication device as described in the fourth aspect, or the chip as described in the seventh aspect.

[0059] In a ninth aspect, an embodiment of the present application provides a system, comprising a testing device and at least one electronic component.

[0060] In addition, in the process of executing the method described in the first aspect and any possible implementation method, the process of sending information and / or receiving information in the above method can be understood as the process of outputting information by the processor, and / or the process of receiving input information by the processor. When outputting information, the processor can output the information to the transceiver (or communication interface, or sending module) so that it can be transmitted by the transceiver. After the information is output by the processor, it may also need to be processed in other ways before it reaches the transceiver. Similarly, when the processor receives input information, the transceiver (or communication interface, or sending module) receives the information and inputs it into the processor. Furthermore, after the transceiver receives the information, the information may need to be processed in other ways before it is input into the processor. Optionally, the information can be, for example, a message.

[0061] Based on the above principle, for example, the sending information mentioned in the above method can be understood as the processor outputting information. For another example, the receiving information can be understood as the processor receiving input information.

[0062] Optionally, for the operations of transmitting, sending and receiving involved in the processor, if there is no special explanation, or if they do not conflict with their actual functions or internal logic in the relevant descriptions, they can be more generally understood as operations such as processor output, reception and input.

[0063] Optionally, in the process of executing the method described in the first aspect and any possible implementation method, the processor may be a processor specifically used to execute these methods, or a processor that executes these methods by executing computer instructions in a memory, such as a general-purpose processor. The memory may be a non-transitory memory, such as a read-only memory (ROM), which may be integrated with the processor on the same chip or may be separately arranged on different chips. The embodiment of the present application does not limit the type of memory and the arrangement of the memory and the processor.

[0064] In a possible implementation manner, the at least one memory is located outside the device.

[0065] In yet another possible implementation, the at least one memory is located within the device.

[0066] In another possible implementation, part of the at least one memory is located inside the device, and another part of the memory is located outside the device.

[0067] In the embodiment of the present application, the processor and the memory may also be integrated into one device, that is, the processor and the memory may also be integrated together.

[0068] In an embodiment of the present application, by determining whether to save the request message sequence through the received response message for responding to the last request message in the request message sequence, the impact of the program execution order on the electronic components can be tested, thereby increasing the depth of the test and facilitating the discovery of more program execution problems. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] Figure 1 This is an example diagram of the message transmission between the test equipment and the ECU;

[0070] Figure 2 This is an example diagram of a scenario for testing the UDS protocol;

[0071] Figure 3 is a schematic diagram of a possible communication system provided by an embodiment of the present application;

[0072] Figure 4 is a flow chart of a method for testing electronic components provided in an embodiment of the present application;

[0073] Figure 5 is a flow chart of another method for testing electronic components provided by an embodiment of the present application;

[0074] Figure 6 It is a structural schematic diagram of a test device provided in an embodiment of the present application;

[0075] Figure 7 is a structural diagram of a communication device provided in an embodiment of the present application;

[0076] Figure 8 is a structural diagram of another communication device provided in an embodiment of the present application;

[0077] Fig. 9 It is a schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION

[0078] In the present application, words such as "first" and "first" are used to distinguish identical or similar items with substantially the same functions and effects. Those skilled in the art will appreciate that words such as "first" and "first" do not limit the quantity and execution order, and words such as "first" and "first" do not necessarily limit differences. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent three situations: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previously associated objects are in an "or" relationship.

[0079] It should be understood that in this application, "at least one" means one or more; "plurality" means two or more. In addition, "equal to" in this application can be used in conjunction with "greater than" or "less than". When "equal to" is used in conjunction with "greater than", the technical solution of "greater than" is adopted; when "equal to" is used in conjunction with "less than", the technical solution of "less than" is adopted.

[0080] The following is an explanation of the relevant names or terms involved in this application to facilitate understanding by those skilled in the art.

[0081] 1. UDS protocol

[0082] (1) Definition of UDS protocol

[0083] The UDS protocol is an application layer protocol (i.e., ISO 14229-1 protocol) that can quickly and accurately determine the fault and cause of a vehicle or a controller, thereby providing a reliable basis for maintenance. The UDS protocol defines 6 types of functions and 26 services, namely:

[0084] 1) Diagnostic and communication management function, which may include 10 services, whose service identifiers (SID) may be 0x10, 0x11, 0x27, 0x28, 0x3E, 0x83, 0x84, 0x85 and 0x86 respectively. Among them, 0x10 is used to identify the diagnostic session control (DiagnosticSessionControl) service, 0x11 is used to identify the ECU reset (ECUReset) service, 0x27 is used to identify the security access (SecurityAccess) service, 0x28 is used to identify the communication control (CommunicationControl) service, 0x3E is used to identify the standby handshake (TesterPresent) service, 0x83 is used to identify the access time parameter (AccessTimingParameter) service, 0x84 is used to identify the secure data transmission (SecuredDataTransmission) service, 0x85 is used to identify the control diagnostic error code (diagnostic troublecode, DTC) setting (ControlDTCSetting) service, and 0x86 is used to identify the event response (ResponseOnEvent) service.

[0085] 2) Data transmission function, which may include 7 services, whose SIDs may be 0x22, 0x23, 0x24, 0x2A, 0x2C, 0x2E and 0x3D respectively. Among them, 0x22 is used to identify the service of reading data by ID (ReadDataByIdentifier), 0x23 is used to identify the service of reading memory by address (ReadMemoryByAddress), 0x24 is used to identify the service of reading proportional data by ID (ReadScalingDataByIdentifier), 0x2A is used to identify the service of reading data by periodic ID (ReadDataByPeriodicIdentifier), 0x2C is used to identify the service of dynamically defining data identifier (DynamicallyDefineDataIdentifier), 0x2E is used to identify the service of writing data by ID (WriteDataByIdentifier), and 0x3D is used to identify the service of writing memory by address (WriteMemoryByAddress).

[0086] 3) Storage data transmission function, which may include two services, whose SIDs may be 0x14 and 0x19 respectively. Among them, 0x14 is used to identify the Clear Diagnostic Information service, and 0x19 is used to identify the Read DTC Setting service.

[0087] 4) Input / output control function, which may include one service, and its SID may be 0x2F, where 0x2F is used to identify the input / output control (InputOutputControlByIdentifier) ​​service.

[0088] 5) Routine function, which may include one service, and its SID may be 0x31. 0x31 is used to identify the routine control (RoutineControl) service.

[0089] 6) Upload and download control function, which may include 5 services, whose SIDs may be 0x34, 0x35, 0x36, 0x37 and 0x38 respectively. Among them, 0x34 is used to identify the request download (RequestDownload) service, 0x35 is used to identify the request upload (RequestUpload) service, 0x36 is used to identify the transfer data (TransferData) service, 0x37 is used to identify the request exit transfer (RequestTransferExit) service, and 0x38 is used to identify the request file transfer (RequestFileTransfer) service.

[0090] The contents of the above 26 services can be found in the specific definitions of the UDS protocol and will not be repeated here.

[0091] (2) UDS protocol message format

[0092] The UDS protocol is an interactive diagnostic protocol that performs diagnosis in the form of a question-and-answer session between the test device and the ECU. In the UDS protocol, the message sent by the test device to the ECU is called a request message, and the message fed back by the ECU to the test device in response to the request message is called a response message. In other words, a response message is used to respond to the request message corresponding to the response message.

[0093] For example, see Figure 1 The diagram shows an example of the message transmission between the test equipment and the ECU. Figure 1 Two request messages and three response messages are shown. The two request messages are request message 1 and request message 2, and the three response messages are positive response message, negative response message and suspension response message.

[0094] Among them, request message 1 includes a SID field, a sub-function identifier (SFID) and a Data field. Among them, the SID field is used to indicate the SID, which is used to identify the service; the SFID field is used to indicate the SFID, which is used to identify the sub-function; and the Data field is used to indicate the specific data content. Request message 2 includes a SID field, a data identifier (DID) field and a Data field. Among them, the SID field is used to indicate the SID, which is used to identify the service; the DID field is used to indicate the DID, which is used to identify the data; and the Data field is used to indicate the specific data content. In the case where the service supports sub-functions, the format of the request message can be referred to request message 1, and the SFID in request message 1 is used to indicate the sub-functions supported by the service. In the case where the service does not support sub-functions, the format of the request message can be referred to request message 2, and the DID in request message 2 is used to indicate the data ID supported by the service.

[0095] Exemplarily, the SID in request message 1 is 0x31, which is used to identify the routine control service. The routine control service supports sub-functions, so request message 1 can be composed of 0x31, a one-byte SFID field, and a Data field. The Data field may have specific data content or may not have specific data content. Optionally, request message 1 may also include a two-byte routine identifier (RID), which is located between the SFID field and the Data field. The SID in request message 2 is 0x2F, which is used to identify the input and output control service. The input and output control service does not support sub-functions, so request message 2 may be composed of 0x2F, a two-byte DID field, and a Data field. The Data field can indicate the specific data content of the input and output. Optionally, request message 2 may also include a one-byte input and output control parameter, which is located between the DID field and the Data field.

[0096] The affirmative response message indicates that the ECU can correctly process its corresponding request message, that is, the request message corresponding to the affirmative response message can correctly access the corresponding service in the ECU. The affirmative response message includes a SID field, an SFID field, and a Data field. Among them, the SID field indicates the sum of the SID in the corresponding request message and 0x40, that is, the value indicated by the SID field is the SID+0x40 in the corresponding request message. In other words, the value indicated by the SID field included in the affirmative response message is the sum of the value of the SID indicated by the SID field included in the request message corresponding to the affirmative response message and 0x40.

[0097] Exemplarily, the SID in the request message 1 is 0x31. If the ECU can correctly process the routine control service, the ECU can feed back a positive response message to the test equipment. The SID field included in the positive response message indicates 0x31+0x40, and the SFID field indicates SFID, which is the same as the SFID in the request message 1. The data content indicated by the Data field included in the positive response message can be the same as or different from the data content indicated by the Data field included in the request message 1.

[0098] The negative response message indicates that the ECU cannot correctly process the corresponding request message, that is, the request message corresponding to the negative response message cannot correctly access the corresponding service in the ECU. The negative response message includes 0x7F, SID field and negative response code (NRC) field. The SID indicated by the SID field is the same as the SID indicated by the SID field included in the corresponding request message (that is, the SID in the negative response message is the same as the SID in the corresponding request message). The NRC field can indicate the reason why the ECU cannot correctly process the request message corresponding to the negative response message, such as indicating that there is an error in the Data field included in the request message, or indicating that there is an error in the SID field, SFID field or DID field included in the request message. Indicates that there is an error in the Data field included in the request message, that is, the specific data content is wrong, resulting in the ECU being unable to correctly process the request message. For example, for the write data service, the ECU cannot write the data content in the request message, then the NRC in the negative response message can indicate that there is an error in the Data field included in the request message. Indicates that there is an error in the SID field, SFID field, or DID field included in the request message, that is, the SID, SFID, or DID is wrong, causing the ECU to be unable to correctly process the request message. Indicates that there is an error in the SID field, SFID field, or DID field included in the request message, which can be understood as the service requested by the request message does not exist or the program corresponding to the service accessed by the request message cannot be executed. For example, the service indicated by the SID in request message 1 is a service other than the above 26 services.

[0099] Optionally, NRC may occupy one byte, and when the value of the byte is the first value, it indicates that there is an error in the Data field included in the request message corresponding to the negative response message; when the value of the byte is the second value, it indicates that there is an error in the SID field included in the request message corresponding to the negative response message; when the value of the byte is the third value, it indicates that there is an error in the SFID field included in the request message corresponding to the negative response message; when the value of the byte is the fourth value, it indicates that there is an error in the DID field included in the request message corresponding to the negative response message. None of the first value to the fourth value is 0x78.

[0100] The suspend response message indicates that the ECU is processing the corresponding request message, that is, the ECU is executing the program corresponding to the service requested by the request message and has not yet finished. The suspend response message includes 0x7F, SID field and 0x78.

[0101] It can be understood that, for a response message, if the value indicated by the SID field it includes is equal to the sum of the SID value in the corresponding request message and 0x40, then the response message is a positive response message used to respond to its corresponding request message; if it includes 0x7F and NRC fields, then the response message is a negative response message used to respond to its corresponding request message; if it includes 0x7F and 0x78, then the response message is a suspended response message used to respond to its corresponding request message.

[0102] (3) Addressing mode of UDS protocol

[0103] The addressing mode of the UDS protocol can be divided into physical addressing and functional addressing. Among them, physical addressing refers to the addressing mode that accesses according to different physical addresses, but physical addressing is used to access a single ECU. Physical addressing can be understood as point-to-point addressing or one-to-one addressing. Functional addressing refers to the addressing mode that accesses according to different functions, and can access at least one ECU. Functional addressing can be understood as broadcast addressing or one-to-many addressing.

[0104] (4) Status of UDS protocol

[0105] When using the UDS protocol for diagnosis, the ECU supports default sessions, programming sessions, and extended sessions. When the ECU is powered on, the ECU enters the default session. Non-default sessions can be divided into programming sessions and extended sessions. For different sessions, the ECU has different permissions. In the default session, the ECU has the least permissions; in the extended session, the ECU has the most permissions. For example, for the ECU in the default session, it does not have permissions such as writing memory; while for the ECU in the extended session, it has permissions such as writing memory. Writing memory, for example, writing memory by address, writing memory by address means writing data to the ECU's memory by address, or it can also be understood as writing data to the memory corresponding to the address. The default session can also be described as the default mode or the default session mode, etc., the programming session can also be described as the programming mode or the programming session mode, etc., and the extended session can also be described as the extended mode or the extended session mode, etc.

[0106] The UDS protocol defines 26 services, which can correspond to at least one of the three sessions mentioned above. That is to say, for a certain service, the ECU can correctly process the service under at least one session, that is, execute the program corresponding to the service. The UDS protocol requires the ECU to enter the specified session before it can access the specified service and execute the specified program. Different request messages sent by the test equipment can trigger the ECU to enter different sessions. For example, there are request messages A, B and C, and there is another request message D for accessing a certain service. At this time, assuming that the program corresponding to request message D can only be correctly executed in the session corresponding to request message C, then the test equipment needs to send a request message sequence consisting of request message C and request message D, while the request message sequence consisting of request message A and request message D, and the request message sequence consisting of request message B and request message D, cannot correctly access the service corresponding to request message D. And in the actual use scenario, the programming session can only be entered after entering the extended session, and the service corresponding to the programming session can only be accessed after entering the programming session.

[0107] In summary, the order of execution request messages indicates the state of program execution, and a state of program execution is a state of the UDS protocol.

[0108] 2. Fuzz Testing

[0109] Fuzz testing is a method of discovering software vulnerabilities by providing unexpected inputs to the target system and monitoring abnormal results. Fuzz testing based on the UDS protocol refers to monitoring abnormal results of the ECU by sending request messages to the ECU, thereby discovering program execution problems in the ECU. The request message in the embodiment of the present application refers to the UDS protocol request message, and the response message refers to the UDS protocol response message.

[0110] The following is an introduction to the application scenarios and system architecture of the embodiments of the present application.

[0111] The embodiments of the present application can be applied to the scenario of testing the UDS protocol, such as the scenario of testing the UDS protocol adopted by the ECU in the vehicle. It can be understood that in the embodiments of the present application, the implementation of testing, detection, diagnosis, monitoring, etc. has similar steps, so "testing" can be replaced by "diagnosis", "monitoring" or "detection", etc.

[0112] For example, the scenario of testing the UDS protocol can be found in Figure 2 shown. Figure 2 In the embodiment, the test device and the ECU in the vehicle can establish a communication connection through a CAN bus or Ethernet, etc. The embodiment of the present application does not limit the communication connection method between the test device and the ECU, for example, it can also be a K line or L line connection method. Figure 2 Taking an ECU as an example, the ECU may be any one of multiple ECUs on a vehicle (the multiple ECUs may be connected via a CAN bus or other connection methods), or may be an ECU on a vehicle that integrates multiple ECU functions.

[0113] Those skilled in the art should understand that Figure 2 The scenario shown is only one exemplary scenario to which the solution of the present application can be applied. Figure 2 In addition to the scenarios shown, the solutions provided in the embodiments of the present application can also be applied to any other suitable application scenarios, such as but not limited to home, office, exhibition hall, production and other scenarios.

[0114] For example, see Figure 3 , is a schematic diagram of a possible communication system provided in an embodiment of the present application, wherein the communication system includes a test device 301 and an electronic component 302. Figure 3 The number and form of the testing equipment and electronic components shown are for illustrative purposes only and do not constitute a limitation on the embodiments of the present application. For example, one testing equipment can be used to test multiple electronic components.

[0115] The test device 301 is used to test the electronic component 302, for example, to test the UDS protocol of the electronic component 302. The test device can also be described as a tester, a diagnostic instrument, a test terminal, a test computer or a test electronic device. The electronic component can be any ECU on the vehicle, or an electronic device integrating at least one ECU, or a chip or a microcomputer integrating an ECU. The electronic component can be described as an ECU, a device to be tested, an electronic device to be tested, an electronic component to be tested or a device to be tested. The addressing mode of the test device 301 and the electronic component 302 can be physical addressing or functional addressing.

[0116] The embodiment of the present application is described by taking a test device testing the UDS protocol in an electronic component as an example. The embodiment of a test device testing the UDS protocol in multiple electronic components can be expanded based on the embodiment of a test device testing the UDS protocol in one electronic component.

[0117] Given that the 26 services defined by the UDS protocol can be combined to obtain multiple program execution states, and the access order between different services will also affect the execution of the program. For example, in the default session, after executing the program corresponding to SID 0x22, the program corresponding to SID 0x2E cannot be executed. In order to test the impact of the access order between different services on program execution, the embodiments of the present application provide a method and a communication device for testing electronic components, which can implement the testing of the UDS protocol in electronic components.

[0118] The following is based on Figure 3 The communication system shown is used to introduce in detail the method for testing electronic components provided in an embodiment of the present application.

[0119] See also Figure 4 , is a flow chart of a method for testing an electronic component provided in an embodiment of the present application, the method may include but is not limited to the following steps:

[0120] 401, the test device sends a first request message sequence to the electronic component. Correspondingly, the electronic component receives the first request message sequence from the test device. The first request message sequence includes at least two request messages, and the first request message sequence is at least used to characterize the order in which the electronic component executes the program.

[0121] Optionally, the test device may send the first request message sequence to the electronic component via a CAN bus, Ethernet or other communication methods.

[0122] Among them, the first request message sequence includes at least two request messages, that is, it includes multiple request messages. The request messages included in the first request message sequence have a certain arrangement order. When the test device sends the first request message sequence to the electronic component, the request messages in the first request message sequence are sent to the electronic component according to the arrangement order corresponding to the request messages included in the first request message sequence. In other words, the request messages in the first request message sequence are sent to the electronic component one by one according to the arrangement order corresponding to the request messages in the first request message sequence. The arrangement order corresponding to at least two request messages refers to the order in which at least two request messages are arranged in the request message sequence. The arrangement order corresponding to at least two request messages can indicate the position of each request message in the request message sequence. For example, the first request message sequence includes three request messages, request message A is ranked first, request message B is ranked second, and request message C is ranked third, then the arrangement order of the three request messages can be expressed as request message A-request message B-request message C, then the test device first sends request message A to the electronic component, then sends request message B, and then sends request message C. For another example, another request message includes three request messages, request message A is ranked first, request message C is ranked second, and request message B is ranked third, then the arrangement order of the three request messages can be expressed as request message A-request message C-request message B, then the test device first sends request message A to the electronic component, then sends request message C, and then sends request message B.

[0123] For example, taking the application of UDS protocol as an example, the first request message sequence includes 3 request messages, the SID in the first request message is 0x22, the SID in the second request message is 0x2E, and the SID in the third request message is 0x2F. Then the test device first sends a request message with SID 0x22 to the electronic component, then sends a request message with SID 0x2E, and then sends a request message with SID 0x2F.

[0124] The arrangement order corresponding to the request messages included in the request message sequence can also be described as the arrangement order corresponding to the request messages in the request message sequence. It can be understood that the arrangement order corresponding to all request messages included in the request message sequence. A request message can be spliced ​​after an existing request message sequence. For example, the arrangement order corresponding to the request messages included in the request message sequence 1 can be expressed as request message A-request message B, and request message C can be spliced ​​after the request message sequence 1, then request message sequence 2 can be obtained, and the arrangement order corresponding to the request messages included in the request message sequence 2 can be expressed as request message A-request message B-request message C. By superimposing a request message after the existing request message sequence, another request message sequence can be obtained.

[0125] In an embodiment of the present application, a request message sequence is used to describe multiple request messages that can be sent at one time. For example, request message A, request message B, and request message C can be packaged into a request message sequence and sent to an electronic component at one time. In practical applications, the concept of request message sequence may not exist, or other names may be used to describe multiple request messages that can be sent at one time. The sending interval between two connected request messages in these multiple request messages is short. Multiple request messages that can be sent at one time can also be understood as multiple request messages that can be sent continuously.

[0126] Optionally, a request message sequence is used to describe multiple request messages that can be sent in sequence at one time, and in sequence means in accordance with the arrangement order corresponding to the request messages included in the request message sequence. A request message is used to request access to a service, and accordingly, when the electronic component receives the request message, it can execute the program corresponding to the service. The first request message sequence includes at least two request messages, and these at least two request messages have a certain arrangement order, so the first request message sequence can be used to characterize the order in which the electronic component executes the program. Specifically, the arrangement order corresponding to the request messages included in the first request message sequence can be used to characterize the order in which the electronic component executes the program. Optionally, the first request message sequence can also be used to characterize the execution content when the electronic component executes the program, such as the data content written when executing the program corresponding to the 0x2E service. Specifically, the data field included in each request message in the first request message sequence can be used to characterize the execution content when the electronic component executes the program.

[0127] In one implementation, before the test device sends the first request message sequence to the electronic component, the test device determines the first request message sequence according to the saved fourth request message sequence and the generated first request message. Among them, the first request message is a request message randomly generated by the test device. For example, the test device randomly generates a first request message whose format meets the standard specification based on the standard specification of the UDS protocol. Exemplarily, the test device can generate one request message at a time. The fourth request message sequence can be a request message sequence saved in the request message sequence pool. The fourth request message sequence can include one or more request messages. If the fourth request message sequence includes a request message, the request message corresponds to a positive response message, that is, after the test device sends the request message to the electronic component, the response message sent by the electronic component to the test device is a positive response message. If the fourth request message includes multiple request messages, each of the multiple request messages corresponds to a positive response message. The positive response message will be described in detail below.

[0128] Among them, the request message sequence pool can be used to describe the storage space for storing the request message sequence. It can be understood that the concept of request message sequence pool may not exist in actual applications, or other names may be used to describe the storage space for storing the request message sequence, such as request message sequence library, request message sequence storage space, etc.

[0129] Optionally, the test device splices the first request message after the fourth request message sequence to obtain the first request message sequence. For example, the fourth request message sequence includes request message A and request message B, and the arrangement order corresponding to the two request messages can be expressed as request message A-request message B, and the first request message is request message C, then the arrangement order corresponding to the request messages included in the first request message sequence can be expressed as request message A-request message B-request message C.

[0130] For example, when the UDS protocol is applied, each time the test device generates a request message, the request message is concatenated after the saved request message sequence to obtain a new request message sequence. The request messages included in the saved request message sequence all correspond to positive response messages.

[0131] In an embodiment of the present application, the request message may include an identifier field and a data field. The identifier field may be used to indicate at least two identifiers related to the request message, and the data field may be used to indicate the load carried by the request message. For example, taking the UDS protocol as an example, the identifier field, i.e., the field before the Data field, may be used to indicate the SID and SFID, or to indicate the SID and DID; the data field, i.e., the Data field, may be used to indicate specific data content.

[0132] 402, the electronic component sends a first response message to the test device. Correspondingly, the test device receives the first response message from the electronic component. The first response message is used to respond to the last request message in the first request message sequence.

[0133] Since the test device sends the first request message sequence to the electronic component according to the arrangement order corresponding to the request messages included in the first request message sequence, the electronic component can feedback a response message for responding to a request message in the first request message sequence to the test device, until a response message for responding to the last request message in the first request message sequence is fed back to the test device. For example, the arrangement order corresponding to the request messages included in the first request message sequence can be expressed as request message A-request message B-request message C, then when the electronic component receives request message A, it feeds back response message A to the test device; then when it receives request message B, it feeds back response message B to the test device; then when it receives request message C, it feeds back response message C to the test device.

[0134] When the test device receives at least two response messages for the first request message sequence (the specific number of at least two response messages is the same as the number of request messages included in the first request message), the at least two response messages can be parsed to obtain the fields included in each response message and the values ​​of the fields. According to the fields included in the response message and the values ​​of the fields, it can be determined whether the response message is a positive response message, a negative response message, or a hang-up response message. The embodiment of the present application does not consider the hang-up response message for the time being.

[0135] Exemplarily, taking the UDS protocol as an example, response message 1 is used to respond to request message 1, and request message 1 includes a SID field (indicating 0x22), a DID field (indicating 0xF186), and a Data field, indicating a request for a read data service to read the current diagnostic session data identifier. If response message 1 includes a SID field, a DID field, and a Data field, and the value of the SID field is 0x62, and the DID field indicates 0xF186, then it can be determined that response message 1 is a positive response message. If response message 1 includes 0x7F, a SID field (indicating 0x22), and an NRC field, then it can be determined that response message 1 is a negative response message.

[0136] In an embodiment of the present application, a response message used to respond to the last request message in the first request message sequence is described as a first response message. Taking the UDS protocol as an example, if the value indicated by the SID field included in a response message is SID (the SID indicated by the SID field included in the last request message) + 0x40, and the value indicated by the SFID field included is the same as the value indicated by the SFID field included in the last request message, or the value indicated by the DID field included is the same as the value indicated by the DID field included in the last request message, then the response message is the first response message. If the value indicated by the SID field included in a response message is the same as the value of the SID field included in the last request message + 0x40, then the response message is the first response message.

[0137] Furthermore, the test device can determine whether the first response message is a positive response message or a negative response message based on the analysis result of the first response message. Taking the UDS protocol as an example, if the value indicated by the SID field included in the first response message is SID (the SID indicated by the SID field included in the last request message) + 0x40, then the first response message is a positive response message; if the first response message includes 0x7F, the SID field and the NRC field, and the value indicated by the SID field is the same as the value of the SID field included in the last request message, then the first response message is a negative response message. Optionally, if the first response message includes the NRC field, then the first response message is a negative response message.

[0138] That is to say, when the first response message is a positive response message, the first identifier indicated by the identifier field included in the first response message is the sum of the first identifier indicated by the identifier field included in the last request message and the reference value. For example, the value indicated by the SID field included in the first response message is SID+0x40 indicated by the SID field included in the last request message. When the first response message is a negative response message, the first identifier indicated by the identifier field included in the first response message is a negative identifier (for example, 0x7F), and the second identifier (SID) indicated by the identifier field included in the first response message is the same as the first identifier (SID) indicated by the identifier field included in the last request message.

[0139] 403a, when the first response message is a positive response message, save the first request message sequence. The first request message sequence is used to generate a second request message sequence, and the second request message sequence is a message sequence obtained by adding a request message after the first request message sequence.

[0140] When the first response message is an affirmative response message, the test device can save the first request message sequence. Since the first request message sequence is a request message sequence obtained by splicing the first request message after the fourth request message sequence, and the request messages included in the fourth request message sequence all correspond to affirmative response messages, then when the first response message is an affirmative response message, it can be understood that the electronic component can correctly process all request messages included in the first request message sequence (that is, the request messages in the first request message sequence can correctly access the corresponding services in the electronic component), and the electronic component can correctly execute the program corresponding to the service in the order represented by it. Furthermore, the test device can save the first request message sequence. Optionally, the test device can save the first request message sequence in a request message sequence pool. The saved first request message sequence can be used to generate a second request message sequence, and the second request message sequence can be used to characterize another order in which the electronic component executes the program. The second request message sequence is a message sequence obtained after adding a request message after the first request message sequence.

[0141] The test device may add (or concatenate) the randomly generated request message after the first request message sequence to obtain a second request message sequence. For example, the order of the request messages included in the first request message sequence may be expressed as request message A-request message B-request message C, and the generated request message is assumed to be request message D, then the order of the request messages included in the second request message sequence may be expressed as request message A-request message B-request message C-request message D.

[0142] It is understandable that when the test device generates the first request message, it splices the first request message after the fourth request message sequence, so as to obtain the first request message sequence, and sends the first request message sequence to the electronic component. The electronic component feeds back at least two response messages to the test device for the first request message sequence. The test device parses at least two response messages, and saves the first request message sequence when it is determined that the first response message is a positive response message. The saved first request message sequence or a subsequence of the first request message sequence can be used for splicing with the subsequently generated request message to obtain the second request message sequence. The test device can send the second request message sequence to the electronic component to determine whether to save the second request message sequence. By repeating in this way, the influence of multiple program execution sequences on electronic components can be tested, the depth of the test can be improved, and it is conducive to discovering more program execution problems.

[0143] Optionally, the second request message sequence is a message sequence obtained by adding a request message after the third request message sequence, and the third request message sequence is a subsequence of the first request message sequence. For example, the arrangement order corresponding to the request messages included in the first request message sequence can be expressed as request message A-request message B-request message C, and request message A-request message B can represent the arrangement order corresponding to the request messages included in a subsequence of the first request message sequence. The generated request message is assumed to be request message D, then the arrangement order corresponding to the request messages included in the second request message sequence can be expressed as request message A-request message B-request message D.

[0144] 403b, when the first response message is a negative response message, and the negative response message indicates that the data field included in the last request message in the first request message sequence is wrong, the test device can save the first request message sequence. Taking the UDS protocol as an example, the first response message includes an NRC field, and the value of the NRC field indicates that there is an error in the Data field included in the last request message. Optionally, the test device can save the first request message sequence in a request message sequence pool.

[0145] The first response message is a negative response message, and the negative response message indicates that the data field included in the last request message is wrong. It can be understood that the electronic component cannot correctly process the last request message, and when the electronic component executes the program corresponding to the last service (i.e., the service requested by the last request message to access), it cannot execute according to the last request message or the data field included in the last request message. It can be understood that the electronic component can execute the corresponding programs in sequence according to the execution order represented by the first request message sequence, but when executing the last program, it cannot execute according to the last request message or the data field included in the last request message. For the first request message sequence, the value of the data field included in its last request message may correctly access the corresponding service in the electronic component after being changed, and then the first request message sequence can be saved to test the impact of changing the value of the data field on the execution of the program, which can further improve the depth of the test.

[0146] 403c, when the first response message is a negative response message, and the negative response message indicates that the identifier field included in the last request message in the first request message sequence is wrong, the test device may discard the first request message sequence. Taking the UDS protocol as an example, the first response message includes an NRC field, and the value of the NRC field indicates that there is an error in the SID field, SFID field, or DID field included in the last request message.

[0147] Discarding the first request message sequence can be understood as not saving the first request message sequence. The first response message is a negative response message, and the negative response message indicates that the identifier field included in the last request message is wrong, which can be understood as the electronic component cannot correctly process the last request message, and the last service (i.e., the service requested to be accessed by the last request message) does not exist or the program corresponding to the last service cannot be executed after executing the program corresponding to the second-to-last service (i.e., the service requested to be accessed by the second-to-last request message).

[0148] exist Figure 4 In the illustrated embodiment, the test device sends a first request message sequence to the electronic component, which is at least used to characterize the order in which the electronic component executes the program, and determines whether to save the first request message sequence by receiving a first response message for responding to the last request message in the first request message sequence. When the first response message is an affirmative response message, the first request message sequence is saved, and the saved first request message sequence can be used to generate a second request message sequence. When the first response message is a negative response message and indicates that the data field included in the last request message is wrong, the first request message sequence is saved. When the first response message is a negative response message and indicates that the identifier field included in the last request message is wrong, the first request message sequence is discarded. In this way, the influence of the program execution order on the electronic component can be tested, and the depth of the test can be improved, which is conducive to discovering more program execution problems.

[0149] For the first test, the test device generates a second request message and sends the second request message to the electronic component. The electronic component can feed back a third response message to the test device in response to the second request message. When the test device receives the third response message, it parses the third response message and determines whether the third response message is a positive response message or a negative response message according to the parsing result.

[0150] If the third response message is a positive response message, the test device saves the second request message. The saved second request message can be used to splice with the regenerated request message to obtain a new request message sequence, and the request message sequence is sent to the electronic component to determine whether to save the new request message sequence.

[0151] If the third response message is a negative response message, and the negative response message indicates that the data field included in the second request message is wrong, the test device saves the second request message. The value of the data field included in the second request message can be changed, and after the change, the corresponding service in the electronic component may be correctly accessed.

[0152] If the third response message is a negative response message, and the negative response message indicates that the identifier field included in the second request message is incorrect, the test device discards the second request message.

[0153] It is understandable that the embodiment of the present application can test the impact of request sequence transformation on program execution by dynamically constructing a request message sequence during the fuzzy test process, which is conducive to discovering more program execution problems. Taking the UDS protocol as an example, the current test focuses on the impact of data mutation on program execution, while the embodiment of the present application transforms the request message sequence by superimposing request messages on the request message sequence to test the impact of program execution order on electronic components, which is conducive to discovering more program execution problems.

[0154] The request message sequence (for example, the fifth request message sequence) in the request message sequence pool involved in the embodiment of the present application satisfies at least one of the following:

[0155] (1) The request messages included in the fifth request message sequence all correspond to positive response messages, that is, there is a corresponding positive response message for each request message in the fifth request message sequence. The fifth request message sequence can be spliced ​​with the newly generated request message to generate and send a new request message sequence, and whether to save the new request message sequence is determined according to the last response message to the new request message sequence.

[0156] (2) The last request message in the fifth request message sequence corresponds to a negative response message, and the negative response message indicates that the data field included in the last request message in the fifth request message sequence is wrong, and the request messages in the fifth request message sequence except the last request message all correspond to positive response messages. In other words, the last response message in the response messages corresponding to the fifth request message sequence is a negative response message, and the negative response message indicates that the data field included in the last request message in the fifth request message sequence is wrong. The value of the data field included in the last request message in the fifth request message sequence can be changed, and after the change, the corresponding service in the electronic component may be correctly accessed, so as to test the impact of changing the value of the data field on program execution, which can further improve the depth of the test.

[0157] The fifth request message sequence is any request message sequence in the request message sequence pool. Optionally, the fifth request message sequence that satisfies (1) can be called a mature sequence; the fifth request message sequence that satisfies (2) can be called an immature sequence. That is, the request message sequence pool can include two types of message sequences, one is a mature sequence and the other is an immature sequence. The mature sequence and the immature sequence can have different storage spaces in the request message sequence pool, or have different sequence identifiers.

[0158] In an embodiment of the present application, the test device may mutate the request message sequence in the request message sequence pool. Mutating the request message sequence can be understood as changing the request message sequence. The mutation in the embodiment of the present application may include mutations within the request message sequence and mutations between request message sequences. Mutations within the request message sequence refer to changing the value of the data field included in one or more request messages in the request message sequence, such as changing the value of the data field by bit flipping, integer addition and subtraction, byte replacement, etc. Mutations between request message sequences refer to splicing part of the request messages in one request message sequence with part of the request messages in another request message sequence to obtain a new request message sequence.

[0159] Optionally, the test device can use a fuzz testing tool (such as AFL (American Fuzzy Lop)) to mutate the request message sequence. AFL's mutation methods can be divided into destruction (havoc) mutation methods and splicing (splice) mutation methods. The havoc mutation method is a random combination of deterministic mutation methods, such as bit flipping, integer addition and subtraction, byte replacement, etc.; the splice mutation method is to cut and splice two different files to form a new file.

[0160] See also Figure 5 , is a flow chart of another method for testing electronic components provided by an embodiment of the present application, which can be independent of Figure 4 The embodiment shown can also be used with Figure 4 The embodiments shown are combined. Figure 5 The method shown may include, but is not limited to, the following steps:

[0161] 501. The test device selects a sixth request message sequence from a request message sequence pool, wherein the number of mutations of the sixth request message sequence is less than the average number of mutations corresponding to the request message sequence pool.

[0162] The test device traverses the request message sequence pool and records the number of mutations of each request message sequence. According to the number of mutations of each request message sequence, the average number of mutations of all request message sequences can be calculated, that is, the average number of mutations corresponding to the request message sequence pool. The test device selects a request message sequence whose number of mutations is less than the average number of mutations from the request message sequence pool, which is referred to as the sixth request message sequence in the embodiment of the present application. The sixth request message sequence can be any request message sequence whose number of mutations is less than the average number of mutations.

[0163] 502. The testing device changes the value of the data field included in the request message in the sixth request message sequence to obtain a first variant request message sequence.

[0164] The test device changes the value of the data field included in the request message in the sixth request message sequence, that is, the test device mutates the data field included in the request message in the sixth request message sequence. The test device can change the value of the data field by performing operations such as bit flipping, integer addition and subtraction, and byte replacement on the value of the data field. In the UDS protocol, the value of the Data field included in the request message is changed.

[0165] In one implementation, the testing device changes the value of the data field included in all request messages in the sixth request message sequence, that is, changes the value of the data field included in each request message in the sixth request message sequence.

[0166] Optionally, the test device changes the values ​​of the data fields included in the request messages in the sixth request message sequence in sequence according to the arrangement order corresponding to the request messages in the sixth request message sequence. For example, the arrangement order corresponding to the request messages included in the sixth request message sequence can be expressed as request message A-request message B-request message C, then the value of the data field included in request message A is changed first, then the value of the data field included in request message B is changed, and then the value of the data field included in request message A is changed.

[0167] In another implementation, the test device changes the value of the data field included in one request message in the sixth request message sequence each time. For example, the arrangement order of the request messages included in the sixth request message sequence can be expressed as request message A-request message B-request message C, then the value of the data field included in request message A is changed for the first time, and the changed request message sequence is sent to the electronic component to test the impact of changing the value of the data field on program execution; the value of the data field included in request message B is changed for the second time, and the changed request message sequence is sent to the electronic component to test the impact of changing the value of the data field on program execution; the value of the data field included in request message C is changed for the third time, and the changed request message sequence is sent to the electronic component to test the impact of changing the value of the data field on program execution.

[0168] After the test equipment completes the change and test of the value of the data field included in a request message, it restores the value of the data field included in the request message, that is, changes the value of the data included in the request message to the initial value. For example, taking the UDS protocol as an example, the initial value of the Data field included in request message 1 is 0x01, and the value of the Data field is changed to 0x10. After the change, the value of the Data field is changed to the initial value 0x01. The changed request message is restored to ensure that when the next request message is changed, the previous request message can correctly access the corresponding service. For example, the arrangement order of the request messages included in the sixth request message sequence can be expressed as request message A-request message B-request message C. After changing the value of the data field included in request message A, request message A is restored to ensure that when request message B is changed, request message A can correctly access the corresponding service; after changing the value of the data field included in request message B, request message B is restored to ensure that when request message C is changed, both request message A and request message B can correctly access the corresponding services.

[0169] It should be noted that step 502 changes the value of the data field included in the request message, but does not change the value of the identifier field included in the request message.

[0170] 503, the test device sends a first mutation request message sequence to the electronic component. Correspondingly, the electronic component receives the first mutation request message sequence from the test device.

[0171] The test device sends a first mutation request message sequence to the electronic component to test the impact of changing the value of the data field on program execution, which can further improve the depth of the test.

[0172] exist Figure 5 In the illustrated embodiment, by changing the value of the data field included in the request message in the sixth request message sequence, the impact of changing the value of the data field on program execution can be tested, which can further improve the depth of the test.

[0173] Figure 5 In the illustrated embodiment, the sixth request message sequence in the request message sequence pool is mutated. Optionally, after step 403a, that is, after determining to save the first request message sequence, the first request message sequence may also be mutated, and the mutated first request message sequence is sent to the electronic component to test the effect of changing the value of the data field on program execution. The method for mutating the first request message sequence can refer to the method for mutating the sixth request message sequence, which will not be repeated here.

[0174] As an optional embodiment, the test device sends a second variation request message sequence to the electronic component, the second variation request message sequence includes a portion of the request message sequence in the sixth request message sequence and a portion of the request messages in the seventh request message sequence, and the seventh request message sequence is any request message sequence in the request message sequence pool. That is, the second variation request message sequence can be obtained by splicing a portion of the request message sequence in the sixth request message sequence with a portion of the request message in the seventh request message sequence (which may correspond to the splice variation method). The second variation request message sequence is sent to the electronic component to determine whether to save the second variation request message sequence.

[0175] It is understandable that the test device traverses the request message sequence pool, randomly selects two request message sequences, splices part of the request messages in the two request message sequences to obtain a variant request message sequence, and sends the variant request message sequence to the electronic component to determine whether to save the variant request message sequence. Optionally, the test device may splice part of the request messages in the first request message sequence with part of the request messages in any request message sequence in the request message sequence pool to obtain a variant request message sequence, and send the variant request message sequence to the electronic component.

[0176] After sending the second variation request message sequence to the electronic component, M second response messages are received from the electronic component, the M second response messages are used to respond to all request messages in the second variation request message sequence, and M is an integer greater than or equal to 2; when the first M-1 second response messages in the M second response messages are all positive response messages, the second variation request message sequence is saved in the request message sequence pool to increase the diversity of the request message sequence in the request message sequence pool. When the first M-1 second response messages in the M second response messages include a negative response message, the second variation request message sequence is discarded. In other words, as long as the first M-1 second response messages include a negative response message, the second variation request message sequence is discarded.

[0177] As an optional embodiment, the test device may delete and reorganize the repeated subsequences included in the request message sequence. The test device traverses the request message sequence pool and records the value of the identifier field included in each request message sequence.

[0178] In one implementation, the request message sequence pool includes an eighth request message sequence, and the eighth request message sequence includes K consecutive first subsequences. When the identifiers indicated by the identifier fields included in the K first subsequences are all the same, the test device can update the eighth request message sequence to a ninth request message sequence, and the ninth request message sequence is a message sequence obtained after deleting K-1 first subsequences from the eighth request message sequence. As for these K-1 first subsequences, they can be the first K-1 first subsequences, or the last K-1 first subsequences, or the randomly selected K-1 first subsequences, which are not limited in the embodiment of the present application. Among them, the first subsequence includes at least one request message, and K is an integer greater than or equal to 2. For a request message sequence in the request message sequence pool, if it includes multiple consecutive first subsequences, and the identifiers indicated by the identifier fields included in the multiple first subsequences are all the same, one first subsequence can be retained, and the other first subsequences can be deleted to update the request message sequence, thereby updating the request message sequence pool.

[0179] Exemplarily, the arrangement order of the request messages included in the eighth request message sequence can be expressed as request message A (SID is 0x10)-request message B (SID is 0x22)-request message C (SID is 0x2E)-request message D (SID is 0x22)-request message E (SID is 0x2E)-request message E (SID is 0x22)-request message F (SID is 0x2E)-request message G (0x2C). If there are 3 subsequences with the same SID, the eighth request message sequence can be updated to the ninth request message sequence. The arrangement order of the request messages included in the ninth request message sequence can be expressed as request message A (SID is 0x10)-request message B (SID is 0x22)-request message C (SID is 0x2E)--request message G (0x2C).

[0180] Optionally, the test device may determine whether there is a repeated subsequence in the first request message sequence. If there is a repeated first subsequence, one first subsequence is retained and other first subsequences are deleted to update the first request message sequence.

[0181] Exemplarily, the arrangement order of the request messages included in the eighth request message sequence can be expressed as request message A (SID is 0x10)-request message B (SID is 0x22)-request message C (SID is 0x2E)-request message D (SID is 0x22)-request message E (SID is 0x2E)-request message F (0x2C), and there are two subsequences with the same SID, then the eighth request message sequence can be updated to the ninth Request message sequence, the arrangement order of the request messages included in the ninth request message sequence can be expressed as request message A (SID is 0x10)-request message B (SID is 0x22)-request message C (SID is 0x2E)-request message F (0x2C), or request message A (SID is 0x10)-request message D (SID is 0x22)-request message E (SID is 0x2E)-request message F (0x2C).

[0182] In another implementation, the request message sequence pool includes an eighth request message sequence and a ninth request message sequence. When the identifier indicated by the identifier field of the eighth request message sequence is exactly the same as the identifier indicated by the identifier field of the ninth request message sequence, the eighth request message sequence or the ninth request message sequence is deleted from the request message sequence pool to update the request message sequence pool and reduce duplicate request message sequences.

[0183] Exemplarily, the arrangement order of the request messages included in the eighth request message sequence can be expressed as request message A (SID is 0x10)-request message B (SID is 0x22)-request message C (SID is 0x2E), and the arrangement order of the request messages included in the ninth request message sequence can be expressed as request message A (SID is 0x10)-request message B (SID is 0x22)-request message C (SID is 0x2E), then the test device can delete the eighth request message sequence or the ninth request message sequence.

[0184] Optionally, the test device may determine whether there is a request message sequence with the same identifier as the first request message sequence in the request message sequence pool, and if so, delete the first request message sequence or the request message sequence with the same identifier as the first request message sequence.

[0185] The above describes in detail the method provided in the embodiments of the present application. The following provides a device for implementing any method in the embodiments of the present application. For example, a device is provided including a unit (or means) for implementing each step performed by a node in any of the above methods.

[0186] See also Figure 6 , is a schematic diagram of the structure of a test device provided in an embodiment of the present application. Figure 6As shown, the test device 60 may include a request message generation module 601 , a packet sending module 602 , a request message sequence pool 603 , a mutation module 604 , a monitoring module 605 and a status detection module 606 .

[0187] The request message generation module 601 is used to generate a first request message. The test device splices the first request message with the fourth request message sequence in the request message sequence pool to obtain a first request message sequence, and transmits the first request message sequence to the packet sending module 602.

[0188] The packet sending module 602 is used to send a first request message sequence to the electronic component through the communication connection between the test device and the electronic component.

[0189] The monitoring module 605 is used to receive the response message fed back by the electronic component, and feed the response message back to the status detection module 606. Optionally, the monitoring module 605 is also used to monitor the abnormality of the electronic component.

[0190] The state detection module 606 is used to parse the response message, and determine whether to save the first request message sequence in the request message sequence pool 603 according to the parsing result of the first response message. When the first response message is a positive response message, the first request message sequence is saved in the request message sequence pool 603. When the first response message is a negative response message, and the negative response message indicates that the data field included in the last request message in the first request message sequence is wrong, the first request message sequence is saved in the request message sequence pool 603. When the first response message is a negative response message, and the negative response message indicates that the identifier field included in the last request message in the first request message sequence is wrong, the first request message sequence is discarded.

[0191] The mutation module 604 is used to mutate the request message sequence in the request message sequence pool, or mutate the first request message sequence, and pass the mutated request message sequence to the packet sending module 602, and the packet sending module 602 sends the mutated request message sequence to the electronic component.

[0192] Figure 6 The modules shown are for illustrative purposes only, and actual applications may include fewer or more modules.

[0193] See also Figure 7 , is a schematic diagram of the structure of a communication device provided in an embodiment of the present application. Figure 7 As shown, the communication device 70 may include a communication unit 701 and a processing unit 702. The communication unit 701 and the processing unit 702 may be software, hardware, or a combination of software and hardware.

[0194] The communication unit 701 can implement a sending function and / or a receiving function, and the communication unit 701 can also be described as a transceiver unit, an acquisition unit, or a sending unit. The communication unit 701 can also be a unit that integrates an acquisition unit and a sending unit, wherein the acquisition unit is used to implement a receiving function, and the sending unit is used to implement a sending function. Optionally, the communication unit 701 can be used to receive information sent by other devices, and can also be used to send information to other devices.

[0195] In a possible design, the communication device 70 may correspond to the test device in the above method embodiment, such as the communication device 70 may be a test device or a chip in the test device. The communication device 70 may include a unit for executing the operations performed by the test device in the above method embodiment, and each unit in the communication device 70 is respectively for implementing the operations performed by the test device in the above method embodiment. The description of each unit is as follows:

[0196] The communication unit 701 is used to send a first request message sequence to the electronic component, the first request message sequence includes at least two request messages, and the first request message sequence is at least used to characterize the order in which the electronic component executes the program; receive a first response message from the electronic component, and the first response message is used to respond to the last request message in the first request message sequence;

[0197] The processing unit 702 is used to save a first request message sequence when the first response message is an affirmative response message, the first request message sequence is used to generate a second request message sequence, and the second request message sequence is a message sequence obtained by adding a request message after the first request message sequence.

[0198] According to the embodiment of the present application, Figure 7 Each unit in the device shown can be separately or all merged into one or several other units to constitute, or some (some) units therein can also be split into multiple smaller units in function to constitute, which can achieve the same operation without affecting the realization of the technical effect of the embodiment of the present application. The above-mentioned units are divided based on logical functions. In practical applications, the function of a unit can also be realized by multiple units, or the function of multiple units is realized by one unit. In other embodiments of the present application, other units can also be included based on nodes. In practical applications, these functions can also be assisted by other units to be realized, and can be realized by the collaboration of multiple units.

[0199] It should be noted that the implementation of each unit can also refer to the above Figure 4 , Figure 5 The corresponding description of the method embodiment shown.

[0200] exist Figure 7In the described communication device 70, the influence of the program execution sequence on the electronic components can be tested, thereby improving the depth of the test and facilitating the discovery of more program execution problems.

[0201] See also Figure 8 , Figure 8 A schematic diagram of the structure of a communication device provided in an embodiment of the present application.

[0202] It should be understood that Figure 8 The communication device 80 shown is only an example. The communication device of the embodiment of the present application may also include other components, or include Figure 8 components similar in function to the components in the Figure 8 All parts in.

[0203] The communication device 80 includes a communication interface 801 and at least one processor 802 .

[0204] The communication device 80 may correspond to a test device. The communication interface 801 is used to send and receive information, and at least one processor 802 executes program instructions, so that the communication device 80 implements the corresponding process of the method executed by the test device in the above method embodiment.

[0205] In one possible design, the communication device 80 may correspond to the above Figure 4 and Figure 5 The test device in the method embodiment shown, such as the communication device 80, can be a test device or a chip in the test device. The communication device 80 can include components for performing the operations performed by the test device in the above method embodiment, and the components in the communication device 80 are respectively for implementing the operations performed by the test device in the above method embodiment, and can be specifically referred to above. Figure 4 , Figure 5 The corresponding description of the first node of the method embodiment shown.

[0206] For the case where the communication device may be a chip or a chip system, see Fig. 9 Schematic diagram of the chip structure shown.

[0207] like Fig. 9 As shown, the chip 90 includes a processor 901 and an interface 902. The number of the processors 901 may be one or more, and the number of the interfaces 902 may be multiple. It should be noted that the functions corresponding to the processor 901 and the interface 902 may be implemented by hardware design, software design, or a combination of hardware and software, which is not limited here.

[0208] Optionally, the chip 90 may further include a memory 903, and the memory 903 is used to store necessary program instructions and data.

[0209] In the present application, the processor 901 may be used to call the implementation program of the communication method provided in one or more embodiments of the present application in the test device from the memory 903, and execute the instructions contained in the program. The interface 902 may be used to output the execution result of the processor 901. In the present application, the interface 902 may be specifically used to output various messages or information of the processor 901.

[0210] For the communication method provided by one or more embodiments of the present application, please refer to the aforementioned Figure 4 , Figure 5 The various embodiments shown will not be described in detail here.

[0211] The processor in the embodiment of the present application may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0212] The memory in the embodiment of the present application is used to provide storage space, and the storage space can store data such as operating system and computer program. The memory includes but is not limited to random access memory (RAM), read-only memory (ROM), erasable programmable read only memory (EPROM), or portable read only memory (compact disc read-only memory, CD-ROM).

[0213] According to the method provided in the embodiment of the present application, the embodiment of the present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed on one or more processors, the above-mentioned Figure 4 , Figure 5 The method shown.

[0214] According to the method provided in the embodiment of the present application, the embodiment of the present application also provides a computer program product, the above-mentioned computer program product includes a computer program, when the above-mentioned computer program is run on a processor, it can implement the above-mentioned Figure 4 , Figure 5 The method shown.

[0215] An embodiment of the present application provides a testing device, which includes at least one communication device 70 or communication device 80 or chip 90 as described above.

[0216] An embodiment of the present application also provides a processing device, including a processor and an interface; the processor is used to execute the method in any of the above method embodiments.

[0217] It should be understood that the above-mentioned processing device can be a chip. For example, the processing device can be a field programmable gate array (FPGA), a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processing circuit (DSP), a microcontroller unit (MCU), a programmable logic device (PLD) or other integrated chips. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor to be executed, or the hardware and software modules in the decoding processor are combined to be executed. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.

[0218] It can be understood that the memory in the embodiments of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM (DR RAM). It should be noted that the memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0219] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a high-density digital video disc (DVD)), or a semiconductor medium (eg, a solid state disc (SSD)).

[0220] The units in the above-mentioned various device embodiments completely correspond to the electronic devices in the method embodiments, and the corresponding modules or units perform the corresponding steps. For example, the communication unit (transceiver) performs the steps of receiving or sending in the method embodiment, and other steps except sending and receiving can be performed by the processing unit (processor). The functions of the specific units can refer to the corresponding method embodiments. Among them, the processor can be one or more.

[0221] It is understandable that in the embodiments of the present application, the electronic device can perform some or all of the steps in the embodiments of the present application, and these steps or operations are only examples. The embodiments of the present application can also perform other operations or variations of various operations. In addition, the various steps can be performed in different orders presented in the embodiments of the present application, and it is possible that not all operations in the embodiments of the present application need to be performed.

[0222] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0223] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0224] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0225] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0226] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0227] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories ROM, random access memories RAM, magnetic disks or optical disks.

[0228] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.

Claims

1. A method for testing an electronic component, characterized in that: include: Sending a first request message sequence to an electronic component, wherein the first request message sequence includes at least two request messages, and the first request message sequence is at least used to characterize the order in which the electronic component executes a program; receiving a first response message from the electronic component, wherein the first response message is used to respond to the last request message in the first request message sequence; When the first response message is an affirmative response message, the first request message sequence is saved, the first request message sequence is used to generate a second request message sequence, and the second request message sequence is a message sequence obtained by adding a request message after the first request message sequence.

2. The method according to claim 1, characterized in that The method further comprises: When the first response message is a negative response message, and the negative response message indicates that a data field included in the last request message is incorrect, the first request message sequence is saved.

3. The method according to claim 1 or 2, characterized in that: The method further includes: when the first response message is a negative response message and the negative response message indicates that an identifier field included in the last request message is incorrect, discarding the first request message sequence.

4. The method according to any one of claims 1 to 3, characterized in that: When the first response message is the affirmative response message, the first identifier indicated by the identifier field included in the first response message is the sum of the first identifier indicated by the identifier field included in the last request message and the reference value; or, When the first response message is a negative response message, the first identifier indicated by the identifier field included in the first response message is a negative identifier, and the second identifier indicated by the identifier field included in the first response message is the same as the first identifier indicated by the identifier field included in the last request message.

5. The method according to any one of claims 1 to 4, characterized in that: The sending the first request message sequence to the electronic component comprises: The request messages in the first request message sequence are sent to the electronic component according to the arrangement order corresponding to the request messages in the first request message sequence.

6. The method according to any one of claims 1 to 5, characterized in that: Before sending the first request message sequence to the electronic component, the method further includes: A first request message sequence is determined according to the saved fourth request message sequence and the generated first request message.

7. The method according to claim 6, characterized in that The fourth request message sequence is a request message sequence in a request message sequence pool; the request messages included in the fourth request message sequence all correspond to positive response messages.

8. The method according to claim 7, characterized in that The fifth request message sequence included in the request message sequence pool satisfies at least one of the following: The request messages included in the fifth request message sequence all correspond to positive response messages; The last request message in the fifth request message sequence corresponds to a negative response message, and the negative response message indicates that the data field included in the last request message in the fifth request message sequence is wrong; the request messages in the fifth request message sequence except the last request message all correspond to positive response messages.

9. The method according to claim 8, characterized in that The method further comprises: Selecting a sixth request message sequence from the request message sequence pool, where the number of mutations of the sixth request message sequence is less than the average number of mutations corresponding to the request message sequence pool; Changing the value of the data field included in the request message in the sixth request message sequence to obtain a first variant request message sequence; The first mutation request message sequence is sent to the electronic component.

10. The method according to claim 9, characterized in that The method further comprises: A second variation request message sequence is sent to the electronic component, wherein the second variation request message sequence includes some request messages in the sixth request message sequence and some request messages in the seventh request message sequence; the seventh request message sequence is any request message sequence in the request message sequence pool.

11. The method according to claim 10, characterized in that The method further comprises: receiving M second response messages from the electronic component, the M second response messages being used to respond to all request messages in the second variation request message sequence; M being an integer greater than or equal to 2; When the first M-1 second response messages among the M second response messages are all affirmative response messages, the second variant request message sequence is stored in the request message sequence pool.

12. The method according to claim 11, characterized in that The method further comprises: When the first M-1 second response messages among the M second response messages include negative response messages, the second variation request message sequence is discarded.

13. The method according to claim 8, characterized in that The method further comprises: The request message sequence pool includes an eighth request message sequence, the eighth request message sequence includes K consecutive first subsequences, and when the identifiers indicated by the identifier fields included in the K first subsequences are all the same, the eighth request message sequence is updated to a ninth request message sequence, and the ninth request message sequence is a message sequence obtained by deleting K-1 first subsequences from the eighth request message sequence; The first subsequence includes at least one request message; K is an integer greater than or equal to 2.

14. The method according to claim 8, characterized in that The method further comprises: The request message sequence pool includes an eighth request message sequence and a ninth request message sequence. When the identifier indicated by the identifier field of the eighth request message sequence is exactly the same as the identifier indicated by the identifier field of the ninth request message sequence, the eighth request message sequence or the ninth request message sequence is deleted from the request message sequence pool.

15. A communication device, characterized in that: The communication device comprises a communication unit and a processing unit; The communication unit is used to send a first request message sequence to the electronic component, wherein the first request message sequence includes at least two request messages, and the first request message sequence is at least used to characterize the order in which the electronic component executes the program; receiving a first response message from the electronic component, wherein the first response message is used to respond to the last request message in the first request message sequence; The processing unit is used to save the first request message sequence when the first response message is an affirmative response message, the first request message sequence is used to generate a second request message sequence, and the second request message sequence is a message sequence obtained after adding a request message after the first request message sequence.

16. A communication device, characterized in that: include: processor; When the processor calls the computer program or instruction in the memory, the method according to any one of claims 1 to 14 is executed.

17. A communication device, characterized in that: include: Logic circuits and communication interfaces; The communication interface is used to receive information or send information; The logic circuit is used to receive information or send information through the communication interface, so that the method according to any one of claims 1 to 14 is executed.

18. A testing device, characterized in that: The test equipment includes the communication device according to claim 15, or the test equipment is a device for implementing the method according to any one of claims 1-14.

19. A computer-readable storage medium, characterized in that: include: The computer-readable storage medium is used to store instructions or computer programs; when the instructions or the computer program are executed, the method according to any one of claims 1 to 14 is implemented.

20. A computer program product, characterized in that include: instructions or computer programs; When the instructions or the computer program are executed, the method according to any one of claims 1 to 14 is implemented.