Search

CN-122020205-A - DLT log matching method and device

CN122020205ACN 122020205 ACN122020205 ACN 122020205ACN-122020205-A

Abstract

The application discloses a DLT log matching method and equipment. The method comprises the steps of receiving expected message character strings comprising at least one predefined semantic identifier, wherein the predefined semantic identifier is used for representing dynamic content types in a DLT log, obtaining regular expression fragments corresponding to each predefined semantic identifier by means of a mapping rule base formed by the predefined semantic identifier and the regular expression fragments, performing regular escape processing on static text parts in the expected message character strings, splicing the static text parts after escape with the regular expression fragments according to an original sequence in the expected message character strings, so that a regular matching pattern is constructed, and finally matching message fields of an actual DLT log by using the regular matching pattern to obtain corresponding matching results.

Inventors

  • QI ZHI
  • LI BING
  • HE TAO
  • CAO FENGTAO

Assignees

  • 东软睿驰汽车技术(沈阳)有限公司

Dates

Publication Date
20260512
Application Date
20260318

Claims (10)

  1. 1. A method of matching DLT logs, the method comprising: receiving an expected message string, wherein the expected message string comprises at least one predefined semantic identifier, the predefined semantic identifier being an identifier that characterizes a dynamic content type in a DLT log; Acquiring regular expression fragments corresponding to each predefined semantic identifier according to a predefined rule base, wherein the rule base is a mapping base of the predefined semantic identifiers and the regular expression fragments; Performing regular escape processing on the static text part in the expected message character string, and splicing the static text part after escape with the regular expression segment according to the original sequence in the expected message character string to construct a regular matching pattern; And matching the message field of the actual DLT log by using the regular matching pattern to obtain a matching result.
  2. 2. The method of claim 1, wherein the predefined semantic identifier is an identifier of a DLT log dynamic content type that is adapted to the automotive software testing domain, the predefined semantic identifier comprising information for one or more of a process identification, a date identification, a timestamp identification, a hexadecimal identification, an integer identification, and a floating point number identification.
  3. 3. The method according to claim 1, wherein the method further comprises: Receiving an external configuration file; Modifying regular expression fragments corresponding to the predefined semantic identifiers in the rule base according to the external configuration file, or newly adding the custom semantic identifiers and the corresponding regular expression fragments in the rule base.
  4. 4. The method of claim 1, wherein prior to receiving the intended message string, the method further comprises: Analyzing a message field of an expected DLT log entry, and judging whether the message field comprises a predefined semantic identifier or not; if the message field does not comprise the predefined semantic identifier, adopting a substring comprising mode to match the message field of the actual DLT log; If the message field includes a predefined semantic identifier, the intended message string is received.
  5. 5. The method according to claim 1, wherein the method further comprises: And if the matching result represents successful matching, extracting an actual text value matched with each predefined semantic identifier in a message field of the actual DLT log, and outputting the actual text value.
  6. 6. The method of claim 5, wherein after extracting the actual text value in the message field of the actual DLT log that matches each of the predefined semantic identifiers, the method further comprises: According to a preset consistency rule, carrying out consistency check on a plurality of actual text values corresponding to the same predefined semantic identifier in the same DLT log verification session; If the inconsistent actual text values exist, judging that the matching fails.
  7. 7. A DLT log matching apparatus, comprising: The receiving module is used for receiving an expected message character string, wherein the expected message character string comprises at least one predefined semantic identifier, and the predefined semantic identifier is an identifier for representing the dynamic content type in the DLT log; the acquisition module is used for acquiring regular expression fragments corresponding to each predefined semantic identifier according to a predefined rule base, wherein the rule base is a mapping base of the predefined semantic identifiers and the regular expression fragments; The construction module is used for carrying out regular escape processing on the static text part in the expected message character string, splicing the static text part after escape with the regular expression segment according to the original sequence in the expected message character string, and constructing a regular matching pattern; And the matching module is used for matching the message field of the actual DLT log by using the regular matching mode to obtain a matching result.
  8. 8. The apparatus of claim 7, wherein the predefined semantic identifier is an identifier of a DLT log dynamic content type that is adapted to an automotive software testing domain, the predefined semantic identifier comprising information for one or more of a process identification, a date identification, a timestamp identification, a hexadecimal identification, an integer identification, and a floating point number identification.
  9. 9. A control device comprising a processor and a memory, the memory for storing a program, instructions or code, the processor for executing the program, instructions or code in the memory to perform the method of matching DLT logs according to any of claims 1 to 6.
  10. 10. A computer readable storage medium, characterized in that a computer program is stored, which computer program is loaded by a processor to perform the matching method of DLT logs according to any of claims 1-6.

Description

DLT log matching method and device Technical Field The application relates to the technical field of automobile software, in particular to a DLT log matching method and equipment. Background In the technical field of automobile electronics, automobile software research and development and testing based on an AUTOSAR architecture become mainstream in industry, diagnosis logs and tracking (Diagnostic Log and Trace, DLT) are used as key data streams for recording the running behaviors of an automobile software system, the interaction state of modules and various running data, are important bases for verifying the correctness of running time sequences of the automobile software, and in various automobile software testing scenes such as automobile OTA upgrading, ECU (electronic control unit) refreshing, on-board module communication and the like, whether the running logic of the automobile software meets design requirements is judged by verifying whether the DLT log streams generated by actual running meet preset time sequences. Currently, a DLT log time sequence verification method based on an expected sequence has appeared in the industry, the method comprises the steps of defining an expected log entry comprising an application identifier, a context identifier, a log grade and a message field, adopting accurate matching for the former three, adopting a substring comprising matching mode for the message field, and searching matching entries in sequence in an actual DLT log stream to realize automatic verification, and relevant execution tools have also been put into application, so that the basic requirement of automatic test is met. In a DLT log generated by running actual automobile software, a message field often comprises dynamic change data such as a process identifier, a time stamp, a sensor value and the like, so that the matching mode of the existing substring is obviously limited, a tester cannot write and determine the matching substring, only a static part can be intercepted, the matching range is easily widened, mismatching frequently occurs, and the accuracy and reliability of verification are greatly reduced. The method of adopting the user-defined regular expression has higher learning and operation thresholds, is easy to cause matching failure or performance problem due to writing errors, is not beneficial to team cooperation, and meanwhile, the existing tool and the general text matching tool lack the exclusive dynamic content processing capability in the automobile field, cannot identify the semantic type of dynamic data in the log, and are difficult to consider the operation usability and matching accuracy, so that the DLT log time sequence verification scene is not provided with a technical scheme which is friendly to users, has low threshold and can reliably match with the dynamic change part of the log information, and the requirements of automobile software test on high precision and high usability of DLT log verification cannot be met. Disclosure of Invention Based on the problems, the application provides a DLT log matching method and equipment. The embodiment of the application discloses the following technical scheme: In a first aspect, an embodiment of the present application provides a method for matching DLT logs, where the method includes: receiving an expected message string, wherein the expected message string comprises at least one predefined semantic identifier, the predefined semantic identifier being an identifier that characterizes a dynamic content type in a DLT log; Acquiring regular expression fragments corresponding to each predefined semantic identifier according to a predefined rule base, wherein the rule base is a mapping base of the predefined semantic identifiers and the regular expression fragments; Performing regular escape processing on the static text part in the expected message character string, and splicing the static text part after escape with the regular expression segment according to the original sequence in the expected message character string to construct a regular matching pattern; And matching the message field of the actual DLT log by using the regular matching pattern to obtain a matching result. In one possible implementation, the predefined semantic identifier is an identifier of a DLT log dynamic content type adapted to the automotive software testing domain, and the predefined semantic identifier includes one or more of a process identifier, a date identifier, a timestamp identifier, a hexadecimal number identifier, an integer identifier, and a floating point number identifier. In one possible implementation, the method further includes: Receiving an external configuration file; Modifying regular expression fragments corresponding to the predefined semantic identifiers in the rule base according to the external configuration file, or newly adding the custom semantic identifiers and the corresponding regular expression fragments in the rule b