DLT log matching method and device
By constructing a regular expression matching pattern through a mapping rule base of predefined semantic identifiers and regular expression fragments, the accuracy and ease of use of dynamic data matching in DLT log time-series verification are solved, and high-precision and reliable matching of DLT log message fields is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NEUSOFT REACH AUTOMOBILE TECH (SHENYANG) CO LTD
- Filing Date
- 2026-03-18
- Publication Date
- 2026-05-12
AI Technical Summary
Existing DLT log time-series verification methods cannot accurately match the dynamic data generated by automotive software operation, resulting in insufficient verification accuracy and reliability. Furthermore, existing tools lack the ability to process dynamic content specific to the automotive field, making it difficult to balance ease of use and matching accuracy.
By employing a mapping rule base of predefined semantic identifiers and regular expression fragments, and constructing regular expression matching patterns through regular expression escaping and ordered concatenation, accurate matching of DLT log message fields is achieved, reducing the operational threshold and adapting to the needs of automated testing of automotive software.
It achieves high accuracy and reliability in DLT log matching, reduces operational difficulty, adapts to the process requirements of automotive software automated testing, and improves the accuracy and ease of use of matching results.
Smart Images

Figure CN122020205A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of automotive software technology, and in particular to a method and device for matching DLT logs. Background Technology
[0002] In the field of automotive electronics technology, automotive software development and testing based on the AUTOSAR architecture has become the industry mainstream. Diagnostic Log and Trace (DLT), as a key data stream that records the runtime behavior, module interaction status, and various operational data of automotive software systems, is an important basis for verifying the correctness of the runtime sequence of automotive software. In various automotive software testing scenarios such as automotive OTA upgrades, ECU flashing, and in-vehicle module communication, it is necessary to verify whether the DLT log stream generated by actual operation conforms to the preset timing to determine whether the operating logic of the automotive software meets the design requirements.
[0003] Currently, a DLT log timing verification method based on expected sequences has emerged in the industry. This method defines expected log entries including application identifier, context identifier, log level, and message field. It uses exact matching for the first three and substring inclusion matching for the message field. It searches for matching entries in the actual DLT log stream in sequence to achieve automated verification. Related execution tools have also been put into use, meeting the basic needs of automated testing.
[0004] In actual automotive software operation, DLT logs often contain dynamically changing data such as process identifiers, timestamps, and sensor values. This significantly limits the existing substring matching methods, preventing testers from writing definitive matching substrings and forcing them to extract static portions. This can lead to overly broad matching ranges, frequent false matches, and a substantial decrease in the accuracy and reliability of verification. Using user-defined regular expressions, on the other hand, presents a high learning and operational barrier, easily resulting in matching failures or performance issues due to coding errors. It also hinders team collaboration. Furthermore, existing tools and general text matching tools lack automotive-specific dynamic content processing capabilities, failing to recognize the semantic types of dynamic data in logs. This makes it difficult to balance ease of use and matching accuracy. Consequently, in DLT log time-series verification scenarios, there is still a lack of a user-friendly, low-barrier-to-entry technical solution that can reliably match the dynamically changing portions of log messages, failing to meet the high precision and ease-of-use requirements of automotive software testing for DLT log verification. Summary of the Invention
[0005] To address the aforementioned issues, this application provides a method and device for matching DLT logs.
[0006] The embodiments of this application disclose the following technical solutions: In a first aspect, embodiments of this application provide a method for matching DLT logs, the method comprising: Receive an expected message string; wherein the expected message string includes at least one predefined semantic identifier, the predefined semantic identifier being an identifier characterizing the dynamic content type in the DLT log; According to a predefined rule base, obtain the regular expression fragment corresponding to each predefined semantic identifier, wherein the rule base is a mapping library between predefined semantic identifiers and regular expression fragments; The static text portion in the expected message string is subjected to regular expression escaping. The escaped static text portion is then concatenated with the regular expression fragment in the original order of the expected message string to construct a regular expression matching pattern. The regular expression matching pattern is used to match the message fields of the actual DLT log to obtain the matching result.
[0007] In one possible implementation, the predefined semantic identifier is an identifier adapted to the dynamic content type of DLT logs in the automotive software testing domain; the predefined semantic identifier includes one or more of process identifiers, date identifiers, timestamp identifiers, hexadecimal number identifiers, integer identifiers, and floating-point number identifiers.
[0008] In one possible implementation, the method further includes: Receive external configuration files; The regular expression fragments corresponding to the predefined semantic identifiers in the rule base can be modified according to the external configuration file, or custom semantic identifiers and corresponding regular expression fragments can be added to the rule base.
[0009] In one possible implementation, the method further includes, before receiving the expected message string: Parse the message fields of the expected DLT log entries and determine whether the message fields include predefined semantic identifiers; If the message field does not include a predefined semantic identifier, then the message field of the actual DLT log is matched by substring inclusion. If the message field includes a predefined semantic identifier, then the expected message string is received.
[0010] In one possible implementation, the method further includes: If the matching result indicates a successful match, then the actual text value that matches each of the predefined semantic identifiers in the message field of the actual DLT log is extracted and the actual text value is output.
[0011] In one possible implementation, after extracting the actual text value from the message field of the actual DLT log that matches each of the predefined semantic identifiers, the method further includes: Based on the preset consistency rules, the consistency of multiple actual text values corresponding to the same predefined semantic identifier in the same DLT log verification session is checked. If there are inconsistent actual text values, the match is deemed to have failed.
[0012] Secondly, embodiments of this application disclose a DLT log matching device, the device comprising: A receiving module is used to receive an expected message string; wherein the expected message string includes at least one predefined semantic identifier, the predefined semantic identifier being an identifier that characterizes the dynamic content type in the DLT log; The acquisition module is used to acquire the regular expression fragment corresponding to each predefined semantic identifier according to a predefined rule base, wherein the rule base is a mapping library between predefined semantic identifiers and regular expression fragments; The construction module is used to perform regular expression escaping on the static text portion in the expected message string, and to concatenate the escaped static text portion with the regular expression fragment in the original order in the expected message string to construct a regular expression matching pattern. The matching module is used to match the message fields of the actual DLT logs using the regular expression matching pattern to obtain the matching results.
[0013] In one possible implementation, the predefined semantic identifier is an identifier adapted to the dynamic content type of DLT logs in the automotive software testing domain; the predefined semantic identifier includes one or more of process identifiers, date identifiers, timestamp identifiers, hexadecimal number identifiers, integer identifiers, and floating-point number identifiers.
[0014] In one possible implementation, the device further includes a modification module, which is used to receive an external configuration file; modify the regular expression fragments corresponding to predefined semantic identifiers in the rule base according to the external configuration file, or add custom semantic identifiers and corresponding regular expression fragments to the rule base.
[0015] In one possible implementation, before receiving the expected message string, the receiving module is further configured to parse the message field of the expected DLT log entry and determine whether the message field includes a predefined semantic identifier; if the message field does not include a predefined semantic identifier, the actual DLT log message field is matched using a substring inclusion method; if the message field includes a predefined semantic identifier, the expected message string is received.
[0016] In one possible implementation, the apparatus further includes an output module, which is configured to extract the actual text value that matches each of the predefined semantic identifiers from the message field of the actual DLT log if the matching result indicates a successful match, and output the actual text value.
[0017] In one possible implementation, after extracting the actual text value from the message field of the actual DLT log that matches each of the predefined semantic identifiers, the apparatus further includes a verification module; The verification module is used to perform consistency verification on multiple actual text values corresponding to the same predefined semantic identifier in the same DLT log verification session according to preset consistency rules; if there are inconsistent actual text values, the matching is determined to fail.
[0018] Thirdly, embodiments of this application disclose a control device including a processor and a memory, wherein the memory is used to store programs, instructions or code, and the processor is used to execute the programs, instructions or code in the memory to perform the DLT log matching method as described in any of the first aspects.
[0019] Fourthly, embodiments of this application disclose a computer-readable storage medium, characterized in that it stores a computer program, which is loaded by a processor to execute the DLT log matching method as described in any of the first aspects.
[0020] This application provides a method and apparatus for matching DLT logs. The method includes: receiving an expected message string including at least one predefined semantic identifier, the predefined semantic identifier being used to characterize the dynamic content type in the DLT log; then, relying on a mapping rule base formed by the predefined semantic identifier and regular expression fragments, obtaining a regular expression fragment corresponding to each predefined semantic identifier; subsequently, performing regular expression escaping on the static text portion in the expected message string, and concatenating the escaped static text portion with the aforementioned regular expression fragment according to the original order in the expected message string, thereby constructing a regular expression matching pattern; finally, using the regular expression matching pattern to match the message fields of the actual DLT log to obtain the corresponding matching result.
[0021] This method uses predefined semantic identifiers to represent dynamic content types in DLT logs, eliminating the need for users to write complex regular expressions. This significantly lowers the operational threshold for DLT log matching, allowing even non-professional testers to easily configure DLT log matching for dynamic content. It automatically converts semantic identifiers into regular expression fragments using a predefined rule base, and combines static text escaping and ordered concatenation to construct regular expression matching patterns, achieving standardized generation of dynamic content matching rules and ensuring accuracy. By matching actual DLT log message fields with the generated custom regular expression matching patterns, it performs precise matching for dynamic content types in DLT logs, effectively avoiding the problems of overly broad matching ranges and mismatches caused by traditional substring matching due to static truncation, thus improving the accuracy and reliability of DLT log message field matching. Furthermore, this method completes the transformation from the expected message string to the matching result through a fixed process, with clear matching logic and standardized steps, enabling automated execution of DLT log matching and adapting to the application needs of automated testing in automotive software. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 A flowchart illustrating a DLT log matching method provided in an embodiment of this application; Figure 2 This is a schematic diagram of the structure of a DLT log matching device provided in an embodiment of this application. Detailed Implementation
[0024] As described earlier, in the field of automotive software testing based on the AUTOSAR architecture, DLT logs are a key basis for verifying the correctness of software runtime sequences. Various automotive software testing scenarios require verifying the timing of actual DLT log streams to determine whether the software's runtime logic meets design requirements. Currently, the industry has adopted a DLT log timing verification method based on expected sequences. By matching the application identifier, context identifier, log level precisely, and message field substring inclusion matching of expected log entries, matching entries are searched sequentially in the actual log stream to achieve automated verification. Related execution tools have also been put into use. However, the DLT log message fields generated by actual automotive software operation often include dynamically changing data such as process identifiers and timestamps. This means that existing substring inclusion matching methods can only extract static parts as matching criteria, which can easily lead to an overly broad matching range, frequent mismatches, and reduced verification accuracy and reliability. However, using custom regular expressions presents a high learning and operational barrier, is prone to matching failures or performance issues, and is not conducive to team collaboration. At the same time, existing tools and general text matching tools lack the ability to process dynamic content specific to the automotive industry, cannot identify the semantic types of dynamic data in logs, and struggle to balance ease of use and matching accuracy. As a result, the current DLT log time-series verification scenario still lacks a user-friendly, low-barrier technical solution that can reliably match the dynamically changing parts of log messages, and cannot meet the high precision and ease of use requirements of automotive software testing for DLT log verification.
[0025] To address this technical problem, embodiments of this application provide a method and apparatus for matching DLT logs. The method includes: receiving an expected message string including at least one predefined semantic identifier, the predefined semantic identifier being used to characterize the dynamic content type in the DLT log; then, relying on a mapping rule base formed by the predefined semantic identifiers and regular expression fragments, obtaining a regular expression fragment corresponding to each predefined semantic identifier; subsequently, performing regular expression escaping on the static text portion of the expected message string, and concatenating the escaped static text portion with the aforementioned regular expression fragment according to the original order in the expected message string, thereby constructing a regular expression matching pattern; finally, using the regular expression matching pattern to match the message fields of the actual DLT log to obtain the corresponding matching result.
[0026] This method uses predefined semantic identifiers to represent dynamic content types in DLT logs, eliminating the need for users to write complex regular expressions. This significantly lowers the operational threshold for DLT log matching, allowing even non-professional testers to easily configure DLT log matching for dynamic content. It automatically converts semantic identifiers into regular expression fragments using a predefined rule base, and combines static text escaping and ordered concatenation to construct regular expression matching patterns, achieving standardized generation of dynamic content matching rules and ensuring accuracy. By matching actual DLT log message fields with the generated custom regular expression matching patterns, it performs precise matching for dynamic content types in DLT logs, effectively avoiding the problems of overly broad matching ranges and mismatches caused by traditional substring matching due to static truncation, thus improving the accuracy and reliability of DLT log message field matching. Furthermore, this method completes the transformation from the expected message string to the matching result through a fixed process, with clear matching logic and standardized steps, enabling automated execution of DLT log matching and adapting to the application needs of automated testing in automotive software.
[0027] The method provided in this application can be applied to various hardware devices throughout the entire automotive software testing process. Any computing hardware capable of file reading, data processing, and regular expression matching can be equipped with this DLT log matching method to conduct related verification work. This includes test workstations and personal computers in automotive R&D, industrial control computers and portable automotive diagnostic tools in production lines, and core hardware such as CI / CD servers in enterprise automated testing systems. During the automotive software R&D and debugging phase, R&D personnel can execute this method through test workstations and personal computers to accurately match DLT log message fields, including dynamic content, adapting to log verification needs in scenarios such as vehicle module development and software function debugging. In automotive parts and vehicle production lines, industrial control computers and portable diagnostic tools can call this method to dynamically match the actual DLT logs generated by processes such as ECU flashing and OTA upgrades, ensuring the accuracy of log verification during production line testing.
[0028] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.
[0029] See Figure 1 , Figure 1This is a flowchart illustrating a DLT log matching method provided in an embodiment of this application. The execution subject of this method can be a server, desktop computer, or other electronic device capable of computation. The following description uses an electronic device as the execution subject, and the method includes: S101: Electronic device receives expected message string.
[0030] The expected message string includes at least one predefined semantic identifier, which is an identifier that characterizes the dynamic content type in the DLT log; The expected message string is a reference text used to match the actual DLT log message fields. It is the string content parsed from the message fields of the DLT log expected file and serves as the core reference for log matching.
[0031] Predefined semantic identifiers are pre-defined identifiers that represent dynamic content types in DLT logs using a fixed syntax. They can be directly embedded in the expected message string to mark dynamic content areas within the string.
[0032] Dynamic content types refer to data types in DLT log message fields that change dynamically as the automotive software actually runs, such as process identifiers, timestamps, and sensor values.
[0033] In one possible implementation, the predefined semantic identifier is an identifier adapted to the dynamic content type of DLT logs in the automotive software testing domain; the predefined semantic identifier includes one or more of the following: process identifier {pid}, date identifier {date}, timestamp identifier {timestamp}, hexadecimal identifier {hex}, integer identifier {int}, and floating-point identifier {float}.
[0034] Among them, the process identifier {pid} is used to match the semantic identifier of dynamic data related to process IDs generated during the operation of automotive software, and can accurately match the numeric dynamic content in the DLT log that represents the unique identifier of the process.
[0035] The date identifier {date} is used as a semantic identifier to match dynamic data of various date formats in the vehicle software operation log, and can adapt to the matching requirements of dynamic date content of different formats in the log.
[0036] The timestamp identifier {timestamp} is a semantic identifier specifically used to match dynamic timestamp data generated during the operation of automotive software. It can accurately match dynamic content of complete timestamp type with time format in logs.
[0037] The hexadecimal identifier {hex} is used to match the semantic identifier of dynamic data presented in hexadecimal form in DLT logs, and can be adapted to match various hexadecimal numerical dynamic content in automotive software.
[0038] The integer identifier {int} is used as a semantic identifier to match dynamic data of integer type in the log, and can accurately match dynamic content of positive and negative integer types generated during the operation of automotive software.
[0039] The floating-point identifier {float} is used as a semantic identifier to match dynamic data of floating-point type in DLT logs, and can be adapted to the matching requirements of dynamic content of numerical type with decimals in automotive software.
[0040] In this embodiment, the electronic device first parses the message field content corresponding to a single expected log entry from the DLT log expectation file used for automotive software testing, and converts it into an expected message string that can be directly processed. This expectation file is pre-written by testers to set the matching criteria for the DLT logs. When writing this expected message string, testers embed predefined semantic identifiers into the positions of the corresponding dynamic content in the string according to a fixed syntax, thereby marking the dynamic content area and the corresponding dynamic content type in the string.
[0041] After parsing and extracting the expected message string, the electronic device receives the string and loads it into local memory. Simultaneously, it performs basic identification on the string's content, confirming that it includes at least one predefined semantic identifier, and that the identifier's syntax and the dynamic content type it represents conform to preset specifications. This ensures that the received expected message string meets the processing requirements of subsequent matching procedures. After receiving the string, the electronic device temporarily stores it, providing foundational data for subsequent steps such as identifier extraction and regular expression matching.
[0042] To further enhance the compatibility and adaptability of this method, enabling it to handle DLT log matching requirements with dynamic content as well as traditional DLT log matching scenarios without dynamic content, this application embodiment adds a judgment step of predefined semantic identifiers before receiving the expected message string, and performs differentiated matching methods based on the judgment result.
[0043] In one possible implementation, the method further includes the following before receiving the expected message string: The electronic device parses the message field of the expected DLT log entry and determines whether the message field includes a predefined semantic identifier. If the message field does not include a predefined semantic identifier, the electronic device matches the message field of the actual DLT log using substring inclusion; if the message field includes a predefined semantic identifier, the electronic device executes step S101 to receive the expected message string.
[0044] In this embodiment of the application, before the electronic device performs the expected message string receiving operation, it first performs a full scan and parsing of the message field of a single expected DLT log entry parsed from the expected DLT log file. This scanning process will accurately identify the text composition of the message field and determine whether it includes predefined semantic identifiers that conform to the preset syntax specifications, thereby distinguishing whether the message field includes dynamic content and providing a basis for subsequent selection of matching methods.
[0045] The electronic device executes different operational logic based on the determination result of the identifier. If the message field of the expected DLT log entry does not contain a predefined semantic identifier, it means that the log entry has no dynamic content matching requirement. The electronic device directly uses the traditional substring inclusion method to match the message field of the actual DLT log, without performing subsequent operations such as regular expression matching pattern construction, and directly completes the matching process for this log entry. If the message field contains a predefined semantic identifier, it means that the log entry needs to match dynamic content. The electronic device continues to execute the original process, converts the message field of the expected DLT log entry into the expected message string and completes the reception, preparing for subsequent rule base query, regular expression matching pattern construction, and other steps.
[0046] The electronic device adaptively switches the matching logic based on the actual content of the expected log entries, which ensures the accuracy of DLT log matching with dynamic content while retaining native support for traditional DLT log matching without dynamic content.
[0047] S102: The electronic device obtains the regular expression fragment corresponding to each of the predefined semantic identifiers according to the predefined rule base.
[0048] The rule base is a pre-configured mapping library in electronic devices used to store the correspondence between predefined semantic identifiers and regular expression fragments. Regular expression fragments are regular expression fragments that correspond one-to-one with predefined semantic identifiers and are specifically used to match corresponding dynamic content types in DLT logs. They can be directly used to construct complete regular expression matching patterns.
[0049] As an example, the correspondence between predefined semantic identifiers and regular expression fragments can be shown in Table 1.
[0050] Table 1. Correspondence between predefined semantic identifiers and regular expression fragments
[0051] In this embodiment, after receiving an expected message string including predefined semantic identifiers, the electronic device scans and parses the string to accurately extract all the predefined semantic identifiers, forming a list of identifiers to be queried, ensuring that no identifiers are missed or incorrectly extracted. After extraction, the electronic device initiates a query request to a locally pre-configured rule base based on the identifier list. The rule base matches each received predefined semantic identifier with its internally stored mapping relationship.
[0052] For each predefined semantic identifier in the list, the electronic device retrieves a unique corresponding regular expression fragment from the rule base. This regular expression fragment is a dedicated matching rule pre-designed for the dynamic content type of the DLT log represented by the identifier, ensuring accurate matching of that type of dynamic data. The electronic device associates and stores all retrieved regular expression fragments with their corresponding predefined semantic identifiers, forming a mapping table between predefined semantic identifiers and regular expression fragments. This ensures accurate matching with the static text portion of the expected message string during subsequent concatenation, preparing the data for constructing the regular expression matching pattern.
[0053] This application embodiment achieves automatic querying and retrieval of identifiers to regular expression fragments through a predefined rule base, eliminating the need for users to manually write regular expressions. This solves the problems of high threshold and error-proneness in traditional regular expression matching, further reducing the operational difficulty of DLT log matching. Simultaneously, the rule base configures a dedicated regular expression fragment for each semantic identifier. This fragment is optimized for specific dynamic content types in DLT logs, ensuring the accuracy of subsequent matching and avoiding the blindness of general regular expression matching, thus laying the foundation for improving the overall accuracy of DLT log matching. Furthermore, the mapping storage method of the rule base makes identifier querying and retrieval efficient and convenient, improving the execution efficiency of this step and thus ensuring the processing speed of the entire DLT log matching method.
[0054] To further enhance the flexibility and scalability of the rule base and enable this method to adapt to the personalized dynamic content matching requirements of DLT logs in different automotive software testing scenarios, this application embodiment also supports receiving external configuration files and modifying or adding to the predefined rule base according to the configuration files.
[0055] In one possible implementation, the method further includes: the electronic device receiving an external configuration file. The electronic device modifies the regular expression fragments corresponding to predefined semantic identifiers in the rule base according to the external configuration file, or adds custom semantic identifiers and corresponding regular expression fragments to the rule base.
[0056] In this embodiment, the electronic device provides an interface for receiving external configuration files, which can receive external configuration files written by users according to actual automotive software testing needs. The external configuration files adopt a standardized, parsable format, clearly defining operation instructions for the rule base and corresponding configuration information. After receiving the external configuration file, the electronic device performs basic validity checks on the file's format and content, confirming that the file has no format errors and that the configuration information conforms to the rule base's modification and extension specifications. This avoids errors in subsequent rule base operations due to invalid configurations. If the check fails, an abnormal configuration file message is displayed; only after the check passes is the file content parsed.
[0057] After parsing the configuration file, the electronic device accurately identifies the operation type, which is divided into two categories: modifying existing predefined semantic identifiers in regular expression fragments and adding custom semantic identifiers and their corresponding regular expression fragments. For modification operations, the electronic device locates the corresponding predefined semantic identifier in the rule base based on the configuration information and replaces its original associated regular expression fragment with the content specified in the configuration file, thus adjusting the existing matching rules. For addition operations, the electronic device adds a mapping relationship between new semantic identifiers and regular expression fragments in the rule base, associating and storing the custom semantic identifiers defined in the configuration file with their corresponding regular expression fragments, thereby expanding the rule base.
[0058] After an electronic device modifies or adds rules to the rule base, it saves and applies the updated rule base. Subsequent queries using regular expression fragments with predefined semantic identifiers will be performed based on the updated rule base. This external configuration method requires no modification to the underlying program of the electronic device; the rule base can be flexibly adjusted simply by writing configuration files. It is convenient to operate and does not affect the overall execution logic of the method, enabling rapid adaptation to the dynamic content matching requirements of DLT logs in different testing scenarios.
[0059] S103: The electronic device performs regular expression escaping on the static text portion of the expected message string, and concatenates the escaped static text portion with the regular expression fragment in the original order of the expected message string to construct a regular expression matching pattern.
[0060] The static text portion refers to the fixed and unchanging text content in the expected message string, excluding predefined semantic identifiers. It is the static description portion of the log message and serves as the basic anchor point for matching actual DLT logs.
[0061] Regular expression escaping refers to the operation of escaping special characters in regular expressions contained in static text to prevent these characters from being misinterpreted as matching rules by the regular expression engine, thus ensuring accurate matching of static text.
[0062] A regular expression matching pattern is a complete regular expression formed by concatenating escaped static text parts with regular expression fragments in their original order. It is the core rule used to match actual DLT log message fields.
[0063] In this embodiment, the electronic device first performs a structured split on the received expected message string. According to the embedding position of the predefined semantic identifier, the string is separated into multiple independent static text parts. At the same time, the order of the static text parts and the predefined semantic identifier in the original string is accurately recorded to form an ordered content splitting sequence, ensuring that the logic of subsequent splicing is consistent with the semantics of the original string and there is no disorder of order.
[0064] After the splitting is complete, the electronic device performs regular expression escaping on each segment of static text, targeting characters such as ".", "...", and "...". Regular expression special characters such as ">", "?", and "\" are uniformly modified by adding escape characters to convert them into ordinary text characters that the regular expression engine can recognize, so as to avoid these characters being misinterpreted as regular expression matching rules and causing deviations in subsequent matching. After processing, the electronic device retrieves the correspondence between predefined semantic identifiers and regular expression fragments previously associated and stored, and replaces each predefined semantic identifier in the split sequence with the corresponding regular expression fragment.
[0065] The electronic device uses the original order of the split sequence as a basis to sequentially concatenate the escaped static text portion with the replaced regular expression fragment to form a complete regular expression, i.e., a regular expression matching pattern. After concatenation, the electronic device performs basic syntax validation on the regular expression matching pattern to confirm that there are no concatenation gaps, syntax errors, or other issues, ensuring that it can be parsed and executed normally by the regular expression engine. After passing the validation, the regular expression matching pattern is temporarily stored to prepare for subsequent matching operations with actual DLT log message fields.
[0066] Step S103 is the core step in constructing the dynamic content matching rules for DLT logs. It connects the retrieval of regular expression fragments with the processing of static text, providing directly executable complete matching rules for subsequent actual log matching. It serves as a crucial bridge connecting the expected message string with the actual log match. By performing regular expression escaping on the static text portion, matching and parsing errors caused by special characters in regular expressions are effectively avoided, ensuring accurate matching of the static description portion of the log message and improving the reliability of the matching rules from a fundamental level.
[0067] Meanwhile, the concatenation is performed according to the original order of the expected message strings, strictly adhering to the semantic logic and text structure of the original strings. This ensures that the constructed regular expression matching pattern can match the actual DLT log content that is consistent with the expected message structure and semantics, avoiding mismatches caused by disordered order. This ensures that the matching of dynamic content always revolves around the semantic anchors of static text, significantly improving matching accuracy. Furthermore, the entire splitting, escaping, and concatenation process requires no manual writing or adjustment of regular expressions, guaranteeing both the efficiency of regular expression matching pattern construction and avoiding errors caused by manual operation, thus adapting to the workflow requirements of automated testing in automotive software.
[0068] S104: The electronic device uses a regular expression matching pattern to match the message fields of the actual DLT log and obtains the matching result.
[0069] The electronic device acquires raw DLT log data generated during the actual operation of the vehicle's software. It then precisely parses the message fields of the actual DLT log to be verified from this raw data, converts them into plain text format compatible with the regular expression matching pattern, and eliminates irrelevant format identifiers and encoding information from the log data to ensure that there are no format incompatibility issues during the matching process. Simultaneously, the electronic device retrieves the previously constructed and syntax-validated regular expression matching pattern and loads it into the built-in regular expression engine, completing all preparations before the matching operation.
[0070] Electronic devices perform formal matching and verification operations through a regular expression engine. The loaded regular expression matching pattern is matched against the parsed actual DLT log message fields using a full regular expression matching. The matching process strictly follows the preset rules of the regular expression matching pattern. The static text part in the actual message field is matched precisely, while the dynamic content part is type-checked to confirm whether the actual dynamic data conforms to the format and type requirements corresponding to the predefined semantic identifier, thereby achieving overall consistency verification of the actual message fields.
[0071] After the matching operation is completed, the electronic device generates the corresponding matching result based on the validation feedback from the regular expression engine. If the text structure and static content of the actual DLT log message field perfectly match the regular expression matching pattern, and the format and type of the dynamic content conform to the requirements of the corresponding predefined semantic identifier, the electronic device directly determines that the match is successful. If the actual message field has any of the following issues: inconsistent static content, mismatched dynamic content format, or inconsistent text structure, the electronic device determines that the match has failed. The electronic device will associate and store the matching result with the corresponding expected message string and the actual DLT log message field, providing a traceable basis for subsequent DLT log time-series verification.
[0072] Electronic devices use regular expression matching to perform full matching of actual message fields, which not only ensures accurate matching of static text parts, but also realizes the type and standardization of dynamic content. This effectively avoids the mismatch and missed match problems caused by the truncation of static parts in traditional substring inclusion matching, improves the accuracy and reliability of DLT log message field matching, and makes the matching results more in line with the high precision requirements of automotive software testing.
[0073] To further explore the data value in the DLT log matching process and provide specific dynamic data support for subsequent problem investigation and operational status analysis in automotive software testing, this application embodiment also adds a step of extracting and outputting the actual text value corresponding to the predefined semantic identifier when the matching result indicates a successful match.
[0074] In one possible implementation, the method further includes: If the matching result indicates a successful match, the electronic device extracts the actual text value that matches each predefined semantic identifier from the message field of the actual DLT log and outputs the actual text value.
[0075] In this embodiment, the electronic device first determines the result of the regular expression matching. When the matching result indicates a successful match, the actual text value extraction process is automatically initiated. Since each regular expression fragment in the previously constructed regular expression matching pattern has a one-to-one mapping relationship with the predefined semantic identifiers in the expected message string, the electronic device can rely on the matching grouping information of the regular expression engine to accurately locate the specific text area in the message field of the actual DLT log that matches each predefined semantic identifier, ensuring that the correspondence between the extracted text value and the identifier is accurate and that there is no misalignment between the value and the identifier.
[0076] The electronic device extracts the corresponding actual text values from the pre-defined text regions. These actual text values are real dynamic data generated during the actual operation of the automotive software, representing the actual presentation of the dynamic content types characterized by predefined semantic identifiers. After extraction, the electronic device associates and temporarily stores each predefined semantic identifier with its corresponding actual text value, forming a clear identifier-actual value mapping table. Simultaneously, it formats the extracted actual text values according to the preset output specifications for automotive software testing, ensuring the readability and standardization of the output content.
[0077] Electronic devices can output actual text values by adapting to the test scenario. These values can be listed separately in the DLT log matching verification report, or displayed in real time on the log matching result display interface. They can also be exported as standardized data files as needed, making it convenient for testers to retrieve and analyze them later.
[0078] To further enhance the rigor of DLT log matching verification, accurately identify abnormal changes in similar dynamic data during the operation of automotive software, and meet the high-precision verification requirements of automotive software testing, this application embodiment also adds a consistency verification step for the actual values of the same identifier in the same verification session after extracting the actual text value. If the verification is inconsistent, the matching failure is re-determined.
[0079] In one possible implementation, after extracting the actual text value from the message field of the actual DLT log that matches each of the predefined semantic identifiers, the method further includes: The electronic device performs consistency checks on multiple actual text values corresponding to the same predefined semantic identifier in the same DLT log verification session, based on preset consistency rules. If inconsistent actual text values are found, the electronic device directly determines that the match has failed.
[0080] In this embodiment, after the electronic device extracts and associates the actual text values corresponding to each predefined semantic identifier, it initiates a consistency verification process. The electronic device retrieves pre-configured consistency rules, which are set based on the needs of automotive software testing. These rules clarify the types of predefined semantic identifiers requiring consistency verification and the specific verification standards within the same DLT log verification session, providing a clear basis for subsequent verification operations. Subsequently, the electronic device categorizes and organizes all data within the current verification session, grouping them according to the type of predefined semantic identifier. It accurately collects all actual text values corresponding to the same predefined semantic identifier in this verification session, ensuring that the collected values are valid data within the same session and under the same identifier, without any erroneous collection across sessions or identifiers.
[0081] The electronic device performs targeted consistency checks on multiple actual text values for each group according to preset consistency rules. The check process strictly follows the standards set in the rules to confirm whether all actual text values corresponding to the same identifier meet the preset consistency requirements. If the check finds inconsistencies among multiple actual text values corresponding to any predefined semantic identifier, it indicates that the dynamic data of this type has undergone unexpected changes during the operation of the automotive software, which does not meet the test verification specifications. The electronic device will directly overturn the previous successful matching judgment for the relevant log entries and re-determine that the matching of these log entries is unsuccessful. If all predefined semantic identifiers that require consistency checks have multiple actual text values that meet the consistency rule requirements, the electronic device will maintain the original successful matching judgment result.
[0082] The electronic device can also record the entire process of this consistency verification, including the predefined semantic identifiers involved in the verification, the verification results of each identifier, and the actual text value of the inconsistency if the verification fails. At the same time, it can associate and store the consistency verification results with the previously extracted actual text value and the original matching results, and output them synchronously. This allows testers to accurately locate the identifiers and specific values of dynamic data consistency anomalies, providing a direct and clear traceability basis for subsequent investigation of data anomalies in the operation of automotive software.
[0083] This application also provides a DLT log matching device, such as... Figure 2 As shown, the device includes: The receiving module 201 is used to receive an expected message string; wherein the expected message string includes at least one predefined semantic identifier, the predefined semantic identifier being an identifier that characterizes the dynamic content type in the DLT log; The acquisition module 202 is used to acquire a regular expression fragment corresponding to each predefined semantic identifier according to a predefined rule base, wherein the rule base is a mapping library between predefined semantic identifiers and regular expression fragments; The construction module 203 is used to perform regular expression escaping on the static text portion in the expected message string, and to concatenate the escaped static text portion with the regular expression fragment in the original order in the expected message string to construct a regular expression matching pattern. The matching module 204 is used to match the message fields of the actual DLT log using the regular expression matching pattern to obtain the matching result.
[0084] In one possible implementation, the predefined semantic identifier is an identifier adapted to the dynamic content type of DLT logs in the automotive software testing domain; the predefined semantic identifier includes one or more of process identifiers, date identifiers, timestamp identifiers, hexadecimal number identifiers, integer identifiers, and floating-point number identifiers.
[0085] In one possible implementation, the device further includes a modification module, which is used to receive an external configuration file; modify the regular expression fragments corresponding to predefined semantic identifiers in the rule base according to the external configuration file, or add custom semantic identifiers and corresponding regular expression fragments to the rule base.
[0086] In one possible implementation, before receiving the expected message string, the receiving module 201 is further configured to parse the message field of the expected DLT log entry and determine whether the message field includes a predefined semantic identifier; if the message field does not include a predefined semantic identifier, the message field of the actual DLT log is matched using a substring inclusion method; if the message field includes a predefined semantic identifier, the expected message string is received.
[0087] In one possible implementation, the apparatus further includes an output module, which is configured to extract the actual text value that matches each of the predefined semantic identifiers from the message field of the actual DLT log if the matching result indicates a successful match, and output the actual text value.
[0088] In one possible implementation, after extracting the actual text value from the message field of the actual DLT log that matches each of the predefined semantic identifiers, the apparatus further includes a verification module; The verification module is used to perform consistency verification on multiple actual text values corresponding to the same predefined semantic identifier in the same DLT log verification session according to preset consistency rules; if there are inconsistent actual text values, the matching is determined to fail.
[0089] This application also provides a control device. The control device may include a memory and a processor. The processor is used to execute the DLT log matching method described in any of the above embodiments. The memory may be random access memory (RAM), flash memory, read-only memory (ROM), non-volatile read-only memory (EPROM), registers, hard disk, removable disk, etc.
[0090] Memory can store computer instructions, which, when executed by the processor, can be used to perform DLT log matching methods. Memory can also store data.
[0091] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape) or a semiconductor medium (e.g., solid-state disk (SSD)).
[0092] This application also provides a readable storage medium for storing the methods provided in the above embodiments. For example, RAM, flash memory, ROM, EPROM, registers, hard disk, removable disk, or any other form of storage medium in the art.
[0093] In the embodiments of this application, the terms "first" and "second" (if they exist) are used only as name identifiers and do not represent the order of first and second.
[0094] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. Regarding the methods disclosed in the embodiments, since they correspond to the product embodiments disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the description of the product embodiments.
[0095] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for matching DLT logs, characterized in that, The method includes: Receive an expected message string; wherein the expected message string includes at least one predefined semantic identifier, the predefined semantic identifier being an identifier characterizing the dynamic content type in the DLT log; According to a predefined rule base, obtain the regular expression fragment corresponding to each predefined semantic identifier, wherein the rule base is a mapping library between predefined semantic identifiers and regular expression fragments; The static text portion in the expected message string is subjected to regular expression escaping. The escaped static text portion is then concatenated with the regular expression fragment in the original order of the expected message string to construct a regular expression matching pattern. The regular expression matching pattern is used to match the message fields of the actual DLT log to obtain the matching result.
2. The method according to claim 1, characterized in that, The predefined semantic identifier is an identifier adapted to the dynamic content type of DLT logs in the field of automotive software testing; the predefined semantic identifier includes one or more of the following: process identifier, date identifier, timestamp identifier, hexadecimal number identifier, integer identifier, and floating-point number identifier.
3. The method according to claim 1, characterized in that, The method further includes: Receive external configuration files; The regular expression fragments corresponding to the predefined semantic identifiers in the rule base can be modified according to the external configuration file, or custom semantic identifiers and corresponding regular expression fragments can be added to the rule base.
4. The method according to claim 1, characterized in that, Before receiving the expected message string, the method further includes: Parse the message fields of the expected DLT log entries and determine whether the message fields include predefined semantic identifiers; If the message field does not include a predefined semantic identifier, then the message field of the actual DLT log is matched by substring inclusion. If the message field includes a predefined semantic identifier, then the expected message string is received.
5. The method according to claim 1, characterized in that, The method further includes: If the matching result indicates a successful match, then the actual text value that matches each of the predefined semantic identifiers in the message field of the actual DLT log is extracted and the actual text value is output.
6. The method according to claim 5, characterized in that, After extracting the actual text value from the message field of the actual DLT log that matches each of the predefined semantic identifiers, the method further includes: Based on the preset consistency rules, the consistency of multiple actual text values corresponding to the same predefined semantic identifier in the same DLT log verification session is checked. If there are inconsistent actual text values, the match is deemed to have failed.
7. A matching device for DLT logs, characterized in that, include: A receiving module is used to receive an expected message string; wherein the expected message string includes at least one predefined semantic identifier, the predefined semantic identifier being an identifier that characterizes the dynamic content type in the DLT log; The acquisition module is used to acquire the regular expression fragment corresponding to each predefined semantic identifier according to a predefined rule base, wherein the rule base is a mapping library between predefined semantic identifiers and regular expression fragments; The construction module is used to perform regular expression escaping on the static text portion in the expected message string, and to concatenate the escaped static text portion with the regular expression fragment in the original order in the expected message string to construct a regular expression matching pattern. The matching module is used to match the message fields of the actual DLT logs using the regular expression matching pattern to obtain the matching results.
8. The apparatus according to claim 7, characterized in that, The predefined semantic identifier is an identifier adapted to the dynamic content type of DLT logs in the field of automotive software testing; the predefined semantic identifier includes one or more of the following: process identifier, date identifier, timestamp identifier, hexadecimal number identifier, integer identifier, and floating-point number identifier.
9. A control device, characterized in that, It includes a processor and a memory, the memory being used to store programs, instructions, or code, and the processor being used to execute the programs, instructions, or code in the memory to perform the DLT log matching method as described in any one of claims 1-6.
10. A computer-readable storage medium, characterized in that, The system contains a computer program that is loaded by a processor to execute the DLT log matching method as described in any one of claims 1-6.