Search

CN-122020204-A - Time sequence verification method and device for automobile software test log

CN122020204ACN 122020204 ACN122020204 ACN 122020204ACN-122020204-A

Abstract

The application discloses a time sequence verification method and device for an automobile software test log. The method comprises the steps of firstly obtaining an expected log file and an actual log file, wherein the expected log file comprises a plurality of expected log entries which are arranged in sequence, each entry is provided with a plurality of structured fields, the actual log file comprises a plurality of actual log entries which are recorded in sequence, each entry is provided with a structured field which corresponds to the expected log entries one by one, then sequentially aiming at each expected log entry, starting from the current position to be matched of the actual log file, searching the actual log entries which meet a preset matching rule, updating the position to be matched of the actual log file to be the next one and continuously matching the next expected log entry if the searching is successful, continuously searching in the subsequent entries of the actual log file if the searching is failed until the actual log file is traversed, and finally judging whether the actual log file passes or fails verification according to whether all the entries of the expected log file are matched according to the preset time sequence.

Inventors

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

Assignees

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

Dates

Publication Date
20260512
Application Date
20260318

Claims (10)

  1. 1. A method for timing verification of an automotive software test log, the method comprising: The method comprises the steps of obtaining an expected log file and an actual log file, wherein the expected log file comprises a plurality of expected log entries which are arranged in sequence, and the expected log entries comprise a plurality of structured fields; for each expected log entry in the expected log file in sequence, starting from the current position to be matched of the actual log file, searching for an actual log entry meeting a preset matching rule with the current expected log entry; If the searching is successful, updating the position to be matched of the actual log file into the next actual log entry of the actual log file, and continuously matching the next expected log entry in the expected log file; If all the expected log entries in the expected log file are matched according to a preset time sequence, judging that the actual log file passes verification; and if one or more expected log entries do not find the actual log entries meeting the preset matching rule, judging that the verification of the actual log file fails.
  2. 2. The method of claim 1, wherein the locating an actual log entry that satisfies a preset matching rule with the current expected log entry comprises: the method further includes performing an identical match of the intended log entry with a first partially structured field of the actual log entry and performing an included match of the intended log entry with a second partially structured field of the actual log entry.
  3. 3. The method of claim 1, wherein the plurality of structured fields comprises an application identification field for identifying a log source, a context identification field for identifying a log context, a log rank field for indicating a log severity, and a log content field for recording log content.
  4. 4. The method of claim 1, wherein the locating an actual log entry that satisfies a preset matching rule with the current expected log entry comprises: Starting from the current position to be matched, sequentially carrying out matching judgment on each actual log entry in the actual log file and the current expected log entry; if the matching judgment is successful, the searching is successful; If the matching judgment fails, continuing to carry out the matching judgment on the next actual log entry until the actual log file is traversed.
  5. 5. The method according to claim 1, wherein the method further comprises: in the matching process, checking whether the actual log entries in the actual log file meet preset error judgment conditions or not in parallel; if the actual log entry meeting the error judging condition exists, the matching process is terminated in advance, and the actual log file verification failure is judged.
  6. 6. The method of claim 5, wherein the checking whether the actual log entry satisfies a preset error determination condition comprises: acquiring an application identification field, a context identification field and a log grade field of the actual log entry; Judging whether the log grade field of the actual log entry belongs to an error log grade set specified in the error judgment condition; If the log level field belongs to the error log level set, judging whether the application identification field of the actual log entry belongs to the application identification set when the application identification set of the error judgment condition is not empty, and whether the context identification field of the actual log entry belongs to the context identification set when the context identification set of the error judgment condition is not empty; And if the log grade field belongs to the error log grade set, the application identification field belongs to the application identification set and the context identification field belongs to the context identification set, judging that the actual log entry meets the error judgment condition.
  7. 7. The method of claim 1, wherein the obtaining the expected log file and the actual log file comprises: Receiving an expected log file path and an actual log file path which are transmitted through command line parameters; And acquiring the expected log file according to the expected log file path, and acquiring the actual log file according to the actual log file path.
  8. 8. A timing verification apparatus for an automotive software test log, the apparatus comprising: The system comprises an acquisition module, a storage module and a storage module, wherein the acquisition module is used for acquiring an expected log file and an actual log file, the expected log file comprises a plurality of expected log entries which are arranged in sequence, and the expected log entries comprise a plurality of structured fields; The system comprises a matching module, a verification module, a judgment module and a verification module, wherein the matching module is used for sequentially searching for an actual log entry which meets a preset matching rule with the current expected log entry from the current to-be-matched position of the actual log file for each expected log entry in the expected log file, updating the to-be-matched position of the actual log file to be the next actual log entry of the actual log file if the searching is successful, continuing to match the next expected log entry in the expected log file, continuing to search for the next actual log entry in the actual log file if the searching fails, until the actual log file is traversed, judging that the actual log file passes verification if all the expected log entries in the expected log file are matched according to a preset time sequence, and judging that the actual log file fails verification if one or more expected log entries do not find the actual log entry meeting the preset matching rule.
  9. 9. A control device comprising a processor and a memory, the memory storing a program, instructions or code, the processor being configured to execute the program, instructions or code in the memory to perform the time series verification method of the automotive software test log according to any one of claims 1 to 7.
  10. 10. A computer-readable storage medium, characterized in that a computer program is stored, which is loaded by a processor to execute the time-series verification method of the automobile software test log according to any one of claims 1 to 7.

Description

Time sequence verification method and device for automobile software test log Technical Field The application relates to the technical field of automobile software testing, in particular to a time sequence verification method and time sequence verification equipment for an automobile software test log. Background In the technical field of automobile electronics, automobile software research and development and testing based on an AUTOSAR architecture become industry mainstream, diagnosis log and tracking (Diagnostic Log and Trace, DLT) are core mechanisms for recording automobile software running states, module interaction and error information, and verification of whether actually running DLT log streams accord with preset business processes or state machine time sequences is an important link in an automobile software testing scene. Currently, time sequence verification of DLT logs in the industry mainly depends on manual checking and auxiliary analysis of universal text tools, and in the prior art, only patents or tools with universal text sequence matching ideas exist, and no special verification tool designed for the characteristics of the DLT logs of automobiles exists. The method comprises the steps of manually checking massive log files, screening key event sequences through experience by a tester, and analyzing log contents with the aid of grep, diff, awk and other scripts by a universal text tool to try to complete time sequence verification. The manual verification mode is extremely low in efficiency, key information is easy to miss due to subjective judgment deviation or vision omission, the requirements of automatic testing and continuous integration of automobile software cannot be met, general text tools such as grep and diff are not designed for DLT log verification, inherent functional defects exist, multidimensional structural information of the DLT log cannot be processed, key log events appearing in sequence are difficult to accurately match, and the professional requirements of automobile software testing cannot be met. Disclosure of Invention Based on the problems, the application provides a time sequence verification method and equipment for an automobile software test log. The embodiment of the application discloses the following technical scheme: In a first aspect, an embodiment of the present application provides a time sequence verification method for an automobile software test log, where the method includes: The method comprises the steps of obtaining an expected log file and an actual log file, wherein the expected log file comprises a plurality of expected log entries which are arranged in sequence, and the expected log entries comprise a plurality of structured fields; for each expected log entry in the expected log file in sequence, starting from the current position to be matched of the actual log file, searching for an actual log entry meeting a preset matching rule with the current expected log entry; If the searching is successful, updating the position to be matched of the actual log file into the next actual log entry of the actual log file, and continuously matching the next expected log entry in the expected log file; If all the expected log entries in the expected log file are matched according to a preset time sequence, judging that the actual log file passes verification; and if one or more expected log entries do not find the actual log entries meeting the preset matching rule, judging that the verification of the actual log file fails. In one possible implementation manner, the searching for the actual log entry that meets the preset matching rule with the current expected log entry includes: the method further includes performing an identical match of the intended log entry with a first partially structured field of the actual log entry and performing an included match of the intended log entry with a second partially structured field of the actual log entry. In one possible implementation, the plurality of structured fields includes an application identification field for identifying a log source, a context identification field for identifying a log context, a log rank field for indicating a log severity, and a log content field for recording log content. In one possible implementation manner, the searching for the actual log entry that meets the preset matching rule with the current expected log entry includes: Starting from the current position to be matched, sequentially carrying out matching judgment on each actual log entry in the actual log file and the current expected log entry; if the matching judgment is successful, the searching is successful; If the matching judgment fails, continuing to carry out the matching judgment on the next actual log entry until the actual log file is traversed. In one possible implementation, the method further includes: in the matching process, checking whether the actual log entries in the actual log file meet preset err