Test case execution optimization method and device, computer equipment and storage medium

By compiling and grouping test cases, using snapshot files and internal high-speed memory to optimize the execution order of test cases, the problem of high time and resource consumption in system-level simulation is solved, and efficient test case execution and labor reduction are achieved.

CN119065978APending Publication Date: 2024-12-03SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411175733.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-26
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

In modern chip design, the number of test cases required for system-level simulation is large, resulting in high time cost and computing resource consumption. In addition, the compilation and simulation of test cases by manual control requires a lot of manpower investment, which is prone to operation or configuration problems and extends the verification cycle .

Method used

By compiling multiple preset test cases, generating code files, and recursively grouping and sorting according to the same number of lines of code, determining the execution order, using snapshot files to achieve incremental operation, avoiding repeated multiple runs of code, and writing the code directly Enter the internal high-speed memory to reduce the reading and handling process from the external nonvolatile memory.

Benefits of technology

It reduces the running time and computing resource consumption of system-level test cases, reduces manpower investment, improves testing efficiency, and reduces invalid operation caused by configuration errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119065978A_ABST
    Figure CN119065978A_ABST
Patent Text Reader

Abstract

The invention relates to a test case execution optimization method and device, computer equipment and a storage medium. The method comprises the steps that a plurality of preset test cases are compiled, and code files of the test cases are generated; comparing the code files of the test case in pairs to obtain the same code line number of the initial stage of the code files; performing recursive grouping on the test cases based on the same code line number, and determining an execution sequence of the test cases according to a grouping result; determining a target test case according to the execution sequence, obtaining a snapshot file corresponding to the target test case, starting to run the target test case from the simulation time corresponding to the snapshot file, and writing a code file of the test case into an internal high-speed memory. By means of the method, repeated operation of repeated codes in a simulation platform can be avoided, and then the total operation time is shortened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of automated testing technology, and in particular to a test case execution optimization method, device, computer equipment and storage medium. Background Art

[0002] In modern chip design, ARM cores have become the mainstream choice for embedded processor chip development due to their high performance and low power consumption. After the integration of various chip modules, system-level simulation is required to verify the communication and coordination between modules and whether the chip as a whole meets the design specifications. System-level simulation verifies the performance of the chip in the actual working environment by running a series of test cases. These test cases usually contain specific code sequences to simulate the behavior of the chip in different application scenarios.

[0003] Due to the large number of modules involved and the complex corresponding functions, there are many system-level verification test cases. In addition, due to the large number of modules and the large amount of code, and the code snippets are executed one by one, the simulation time of system-level simulation is greatly increased compared to module-level simulation. If each test case is run independently one by one, the time cost and computing resources consumed are considerable. In addition, manually controlling the compilation and simulation of test cases requires a lot of manpower investment, and is prone to operation or configuration problems, which not only increases the cost of verification, but may also lead to an extension of the verification cycle.

[0004] Therefore, there is an urgent need for a test case execution optimization method that can reduce the time cost and computing resource consumption on the basis of completing all test cases, and reduce the workload of verification personnel through a certain automation process. Summary of the invention

[0005] Based on this, it is necessary to provide a test case execution optimization method, device, computer equipment and storage medium that can improve test efficiency in response to the above technical problems.

[0006] In one aspect, a test case execution optimization method is provided, the method comprising:

[0007] Compile multiple preset test cases to generate code files for the test cases;

[0008] Compare the code files of the test cases in pairs to obtain the number of identical code lines between the code files in the initial stage;

[0009] Recursively grouping the test cases based on the same number of code lines, and determining the execution order of the test cases according to the grouping result;

[0010] Determine the target test case according to the execution order, obtain the snapshot file corresponding to the target test case, run the target test case from the simulation time corresponding to the snapshot file, and write the code file of the test case into the internal high-speed memory.

[0011] In one embodiment, the method further includes: recursively grouping the test cases based on the same number of code lines, and determining the execution order of the test cases according to the grouping result, including:

[0012] Recursively grouping the test cases according to the same number of code lines, and dividing the test cases into a plurality of test case sets step by step, wherein each of the test case sets includes at least one test case;

[0013] Constructing a test case set generation tree according to the recursive relationship between the test case sets;

[0014] The test case set generation tree is traversed based on a depth-first search method to determine the execution order of the test cases.

[0015] In one embodiment, recursively grouping the test cases according to the same number of code lines to divide the test cases into multiple test case sets level by level includes:

[0016] Using the preset multiple test cases as an initial test case set;

[0017] Select a first test case, and obtain a first test case set from the initial test case set that has the least number of identical code lines with the first test case as an adjacent group, and the first test case and other test cases form a second test case set as an identical group, wherein the least number of identical code lines is denoted as k i_j , i is the number of layers in the test case set, j is the index within the layer;

[0018] Determine whether the first test case set meets the grouping condition;

[0019] Select a second test case from the first test case set if the first test case set has at least k identical lines of code with the second test case. i_j test cases, it is determined that the first test case set meets the grouping condition;

[0020] Further grouping the first test case set, dividing the test cases that meet the grouping condition into a new test case set, until the new test case set obtained by the division does not meet the grouping condition;

[0021] Determine whether the multiple test case sets divided from the initial test case set meet the recursive condition;

[0022] If so, the test case set that meets the recursive condition is recursively grouped until the test case set does not meet the recursive condition.

[0023] In one embodiment, the determining whether the multiple test case sets divided from the initial test case set meet the recursive condition includes:

[0024] Obtain the number of test cases in the test case set and the number of identical code lines between any two of the test cases;

[0025] If the number of the test cases is less than or equal to two, or the number of identical code lines between the test cases is the same, it is determined that the test case set does not meet the recursive condition, and the test case set is divided into multiple single test case sets according to the number of test cases;

[0026] If the number of the test cases is greater than two, and the number of identical code lines between the test cases is different, it is determined that the test case set meets the recursive condition.

[0027] In one embodiment, traversing the test case set generation tree based on a depth-first search method to determine the execution order of the test cases includes:

[0028] Traversing the test case set generation tree based on a depth-first search method, wherein the nodes in the test case set generation tree correspond one-to-one to the test case sets obtained by grouping, the initial test case set is a root node, and the single test case set is a leaf node;

[0029] Prioritize the path with more nodes to access each node in the test case set generation tree level by level;

[0030] In response to the presence of multiple candidate leaf nodes, the leaf node with the largest number of code lines is preferentially selected;

[0031] If the code lines of the multiple candidate leaf nodes are the same, randomly select one from the candidate leaf nodes;

[0032] The execution order of the test cases is determined according to the traversal results.

[0033] In one embodiment, in response to executing the test case in the execution order, obtaining a snapshot file corresponding to the test case and running the test case from the simulation time corresponding to the snapshot file includes:

[0034] For all nodes in the test case set generation tree from the root node to the leaf node, a simulation platform snapshot is stored at the end of the same code to form a snapshot file;

[0035] In response to executing the test case corresponding to the current leaf node, determining a target node that has snapshot files stored in all nodes on the path from the root node to the current leaf node and is closest to the current leaf node;

[0036] The snapshot file of the target node is loaded, and the test case is run starting from the simulation time corresponding to the snapshot file.

[0037] In one embodiment, storing the code file of the test case into an internal high-speed memory includes:

[0038] Changing the code loading address in the scatter-loading file to the starting address of the code file stored in the internal high-speed memory, and allocating space for the code file in the internal high-speed memory;

[0039] Add an absolute address jump instruction in the startup file to make the program pointer jump to the space allocated for the code file in the internal high-speed memory;

[0040] According to the data storage logic in the high-speed memory, the code files are written into the internal high-speed memory in sequence.

[0041] On the other hand, a test case execution optimization device is provided, the device comprising:

[0042] A generation module, used to compile a plurality of preset test cases and generate code files for the test cases;

[0043] An acquisition module, used for comparing the code files of the test cases in pairs to obtain the number of identical code lines between the code files in the initial stage;

[0044] A sorting module, used for recursively grouping the test cases based on the same number of code lines, and determining the execution order of the test cases according to the grouping result;

[0045] The execution module is used to determine the target test case according to the execution order, obtain the snapshot file corresponding to the target test case and run the target test case from the simulation time corresponding to the snapshot file, and write the code file of the test case into the internal high-speed memory.

[0046] In another aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:

[0047] Compile multiple preset test cases to generate code files for the test cases;

[0048] Compare the code files of the test cases in pairs to obtain the number of identical code lines between the code files in the initial stage;

[0049] Recursively grouping the test cases based on the same number of code lines, and determining the execution order of the test cases according to the grouping result;

[0050] Determine the target test case according to the execution order, obtain the snapshot file corresponding to the target test case, run the target test case from the simulation time corresponding to the snapshot file, and write the code file of the test case into the internal high-speed memory.

[0051] In another aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0052] Compile multiple preset test cases to generate code files for the test cases;

[0053] Compare the code files of the test cases in pairs to obtain the number of identical code lines between the code files in the initial stage;

[0054] Recursively grouping the test cases based on the same number of code lines, and determining the execution order of the test cases according to the grouping result;

[0055] Determine the target test case according to the execution order, obtain the snapshot file corresponding to the target test case, run the target test case from the simulation time corresponding to the snapshot file, and write the code file of the test case into the internal high-speed memory.

[0056] The above-mentioned test case execution optimization method, device, computer equipment and storage medium, based on the characteristic that the system-level test cases have the same operations in the initial stage of the code, compare the compiled code files of the test cases in pairs, sort the test cases based on the same number of code lines, and combine the snapshot technology of the simulation platform to realize the incremental operation mechanism, thereby avoiding multiple operations of repeated code in the simulation platform, and then reducing the overall operation time; at the same time, the code is stored in the internal high-speed memory through backdoor writing, and the code can be directly read from the internal high-speed memory when the code is running, avoiding the process of reading the code from the external non-volatile memory and the code transfer from the external non-volatile memory to the internal high-speed memory when the code is running, thereby greatly reducing the test case running time; and the automated test case running script can reduce manpower consumption and invalid operation caused by configuration errors. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 A schematic diagram of a flow chart of a test case execution optimization method in an embodiment;

[0058] Figure 2 A schematic diagram of a process for automatically running a test case in an embodiment;

[0059] Figure 3 A schematic diagram of a flow chart of a recursive grouping method for test cases in an embodiment;

[0060] Figure 4 A schematic diagram of a flow chart of a method for writing into an internal high-speed memory in one embodiment;

[0061] Figure 5 A structural block diagram of a test case execution optimization device in an embodiment;

[0062] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0063] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0064] In one embodiment, Figure 1 and Figure 2 As shown, a test case execution optimization method is provided, comprising the following steps:

[0065] Step S1, compile multiple preset test cases to generate code files of the test cases.

[0066] It should be noted that after the integration of the modules of the processor chip, system-level simulation is required to verify the communication and coordination between the modules and whether the chip as a whole meets the design indicators. The processor chip implements different functions by running different code sequences, so each test case is to verify one or more specific functions of the chip. For large chips, there are many test cases and simulation parameters. It is undoubtedly time-consuming and labor-intensive to execute the test cases one by one manually, and it is prone to configuration errors. Therefore, this embodiment designs a corresponding automatic execution script to reduce manpower input.

[0067] Specifically, the test case list, public compilation options, and test case private compilation option list are initialized, and then the test case and the corresponding private compilation option are selected from the test case list, and the test case is compiled using the dedicated software in combination with the public compilation option to form the corresponding code file. Further, it is determined whether all test case compilations are completed. If so, the compilation process is completed; if not, it returns to continue compiling the next test case.

[0068] Step S2, comparing the code files of the test cases in pairs to obtain the number of identical code lines between the code files in the initial stage.

[0069] It should be noted that due to the large number of modules involved, the large amount of RTL code, and the long time consumed by system-level simulation, if each test case is run independently throughout the entire process, the time and computing resources consumed are very large. As for test cases, many test cases are the same in the initial operation, such as chip initialization and peripheral configuration, so the running records of the test cases that have been run and the commonalities between the test cases can be used to directly skip the same initial stage and start running from a corresponding time node when running the test cases later, thus reducing the running time on the basis of ensuring the simulation time.

[0070] Specifically, the compiled code files of all test cases are compared in pairs, and the number of identical code lines between each code file and any other code file in the initial stage is counted. The number of identical code lines in the initial stage refers to comparing all compiled code files in pairs starting from the first executable code until the first different executable code is found. Then the number of identical code lines between the code files corresponding to the two test cases is the number of identical executable code lines before that.

[0071] Step S3, recursively grouping the test cases based on the same number of code lines, and determining the execution order of the test cases according to the grouping result.

[0072] In one possible implementation manner, the specific steps of recursively grouping the test cases based on the same number of code lines and determining the execution order of the test cases according to the grouping results include: recursively grouping the test cases according to the same number of code lines, dividing the test cases into multiple test case sets step by step, wherein each of the test case sets includes at least one test case; constructing a test case set generation tree based on the recursive relationship between each of the test case sets; and traversing the test case set generation tree based on a depth-first search method to determine the execution order of the test cases.

[0073] Each functional module has multiple test cases, which are used to verify different aspects of the functional modules. The initialization process before the test function is the same, and once the initialization is completed, the test cases will test different sub-functions, so the test cases used to test sub-functions will have more identical codes. This embodiment groups the test cases according to the number of identical lines of code between each other, which actually groups all test cases according to the functional modules to which they belong, and further groups them according to the sub-functions they test, so that the test cases of the same functional module will share more identical lines of code in the initial stage, which is convenient for subsequent loading of the corresponding snapshot files through the incremental operation mechanism to avoid executing repeated code.

[0074] Based on the above steps, considering that system-level test cases have the same operations in the initial stage of the code, recursive grouping of test cases according to the same number of code lines can effectively classify test cases with similar functions into the same group, and build a test case set generation tree. The running order of test cases is optimized based on the depth-first search method to minimize the running of duplicate code on the simulation platform and improve test efficiency.

[0075] In one possible implementation, the specific steps of recursively grouping the test cases according to the number of identical code lines and dividing the test cases into multiple test case sets step by step include: taking the preset multiple test cases as an initial test case set; selecting a first test case, and obtaining a first test case set from the initial test case set that has the least number of identical code lines with the first test case as an adjacent group, and the first test case and other test cases form a second test case set as an identical group, wherein the least number of identical code lines is recorded as k i_j , i is the number of layers of the test case set, j is the index within the layer; determine whether the first test case set meets the grouping condition; select a second test case in the first test case set, if the first test case set has at least k identical code lines with the second test case i_j test cases, then determine that the first test case set meets the grouping condition; further group the first test case set, and divide the test cases that meet the grouping condition into new test case sets until the new test case sets obtained by division do not meet the grouping condition; determine whether the multiple test case sets obtained by division from the initial test case set meet the recursive condition; if so, recursively group the test case sets that meet the recursive condition until the test case sets do not meet the recursive condition.

[0076] For example, Figure 3 As shown, C represents the test case set, L represents a single test case, i represents the number of layers in the test case set, and j represents the index within the layer. All test cases constitute the initial test case set C 0_0 , select any test case (i.e., the first test case), obtain the number of identical code lines between the first test case and other test cases, divide the test cases with the least identical code lines as the first test case into adjacent groups, and obtain the first test case set C 1_1 , the first test case and other test cases in the initial test case set constitute the second test case set C 1_2 , as the same group. In the adjacent group C 1_1 Choose any test case (i.e. the second test case) from the above, ignoring the previous grouping results. If the adjacent group C 1_1The minimum number of lines of code that are identical to the second test case is also k i_j test cases, the test cases that meet the conditions are taken as the new test case set C 1_3 , that is, the new adjacent group. After that, it is still necessary to determine whether the new adjacent group needs to be further divided until the minimum number of identical code lines in the new adjacent group is not k i_j The effect achieved at this time is that the number of identical lines of code in the same group is greater than k i_j , while C 1_1 , C 1_2 and C 1_3 The number of common lines of code between the three groups is k i_j After this division is completed, the multiple test case groups generated this time are recursively grouped again. Each node in the test case set generation tree actually corresponds to the same group in the above recursive grouping process. The number of test cases in the node is the number of test cases in the same group, which is also the number of leaf nodes after the node division is completed.

[0077] Preferably, if the minimum number of identical code lines with the first test case among all test cases is 0, the initial test case set is directly divided into 2 groups, the ones with the same number of code lines of 0 are divided into adjacent groups, the first test case and the remaining test cases are divided into the same group, and the same group is not further divided.

[0078] Based on the above steps, the test cases are divided level by level according to the same number of lines of code through recursive grouping, and a test case set generation tree is constructed to optimize the test process and complete the test tasks faster. Especially in large projects, this grouping method can significantly improve the speed of the overall test process, and the test case set after recursive grouping is organized into a hierarchical structure, which is easier to manage and maintain, and is convenient for tracking and updating.

[0079] In one possible implementation, the specific steps of determining whether the multiple test case sets divided from the initial test case set meet the recursive condition include: obtaining the number of test cases in the test case set and the number of identical code lines between the test cases; if the number of test cases is less than or equal to two, or the number of identical code lines between the test cases is the same, determining that the test case set does not meet the recursive condition, and dividing the test case set into multiple single test case sets according to the number of test cases; if the number of test cases is greater than two, and the number of identical code lines between the test cases is different, determining that the test case set meets the recursive condition.

[0080] Specifically, the grouped test case set C 1_1 , C 1_2 and C 1_3As a new test case set, when there is a difference in the number of identical lines of code between two test cases in the new test case set, the test case set is divided again according to the above steps. Otherwise, the test case set is no longer divided according to the above process, but the node containing multiple test cases is divided into sub-nodes containing only one test case, that is, Figure 3 The terminal nodes in are all leaf nodes.

[0081] According to the above grouping steps, the parent test case set is divided into multiple sub-test case sets. The number of identical code lines of all test cases in this test case set is k. i_j , such as the second test case set C 1_2 The number of identical lines of code for all test cases in 1_2 The sub-test case sets obtained by division do not have the same code except the same code of the parent test case set, such as C 2_4 and C 2_5 The number of identical lines of code between 1_2 , and the minimum number of identical lines of code between test cases in the child test case set is greater than the number of identical lines of code in the parent test case set, such as C 2_4 Two test cases in L 3_1 and L 3_2 The number of identical lines of code between 2_4 .

[0082] Based on the above steps, the initial test case set is divided into independent test cases through recursive grouping, and the test cases in the group closer to the leaf node have more identical lines of code, so as to more efficiently utilize simulation resources and snapshot technology, avoid repeated code running multiple times in the simulation platform, and then reduce the overall running time.

[0083] In one possible implementation, the specific steps of traversing the test case set generation tree based on the depth-first search method to determine the execution order of the test cases include: traversing the test case set generation tree based on the depth-first search method, wherein the nodes in the test case set generation tree correspond one-to-one to the test case sets obtained by grouping, the initial test case set is the root node, and the single test case set is the leaf node; preferentially selecting a path with a larger number of nodes to access each node in the test case set generation tree level by level; in response to the existence of multiple candidate leaf nodes, preferentially selecting a leaf node with the largest number of code lines; if the multiple candidate leaf nodes have the same number of code lines, randomly selecting one from the candidate leaf nodes; and determining the execution order of the test cases according to the traversal results.

[0084] For example, Figure 3 As shown, the priority traversal path for generating the tree for the test case set is C 0_0 , C 1_2 , C2_5 , C 3_3 , for the candidate leaf node L 4_1 , L 4_2 , L 4_3 , select the leaf node with the most lines of code. If the lines of code are the same, select one randomly. Then return and select path C 0_0 , C 1_2 , C 2_5 , C 3_4 , and so on, to determine the execution order of the test cases.

[0085] Based on the above steps, when sorting test cases, they are grouped according to the same number of code lines and organized in a tree structure. For each non-leaf node, the number of leaf nodes connected to it is used as the breadth-direction search priority factor. Based on the depth search method, the test case generation tree is traversed to determine the test cases to be executed, so that the execution order of each test case can be determined.

[0086] Step S4, determining the target test case according to the execution order, obtaining the snapshot file corresponding to the target test case and running the target test case from the simulation time corresponding to the snapshot file, and writing the code file of the test case into the internal high-speed memory.

[0087] It should be noted that considering that system-level test cases all require chip initialization operations in the initial stage of the code, and for the corresponding test cases with different parameters of a certain function, the operations performed in the initial stage of this function are also the same. This allows for the entire simulation platform to be snapshotted at the end of the same code when running one of the two test cases with the same initial part of the code to record all running states and form a snapshot file. When running another test case, the snapshot file is directly loaded and started from the simulation time corresponding to the snapshot file. This incremental running mechanism avoids multiple runs of repeated code in the simulation platform, thereby reducing the overall running time and the resources consumed by snapshot storage. At the same time, through the snapshot trigger mechanism, the simulation platform snapshot is triggered according to the end position of the same code between test cases to minimize the running of repeated code.

[0088] In one possible implementation mode, in response to executing the test case in accordance with the execution order, the specific steps of obtaining the snapshot file corresponding to the test case and running the test case from the simulation time corresponding to the snapshot file include: for all nodes in the test case set generation tree from the root node to the leaf node, storing a simulation platform snapshot at the end of the same code to form a snapshot file; in response to executing the test case corresponding to the current leaf node, determining a target node in which the snapshot file is stored and which is closest to the current leaf node among all nodes in the path from the root node to the current leaf node; loading the snapshot file of the target node, and running the test case from the simulation time corresponding to the snapshot file.

[0089] Specifically, during the execution of the test case, when it is detected that the code with the same number of code lines as the corresponding node is read from the internal high-speed memory, the simulation platform snapshot storage is executed to store snapshots of all nodes from the root node to the current leaf node. It should be noted that the system snapshot is not taken when the last identical code is executed here, mainly considering that the processor cores are all pipelined and multiple codes will be pre-fetched in advance. If a system snapshot is taken during execution, since multiple codes containing the last identical code and after have been read, and these multiple codes after are the codes of the previous test case, this will cause the actual executed code to be inconsistent with the test case code being executed, and then an error will occur. Then when executing the next test case, determine the node that has a snapshot file and is closest to the current leaf node, load the snapshot file of this node, and then load the corresponding code file into the high-speed memory, and then start running from the simulation time corresponding to the snapshot file.

[0090] For example, when the test case execution order is L 4_1 , L 4_2 , L 4_3 When running L 4_1 The test cases of leaf nodes need to store C 0_0 , C 1_2 , C 2_5 , C 3_4 A snapshot of the node, and then executes the next test case L 4_2 When you can obtain and load C 3_4 The snapshot file of the node, because the snapshot file here is executed with L 4_2 Therefore, after loading the snapshot file, you can skip the same code in the initial stage and start running directly from the simulation time corresponding to the snapshot file.

[0091] Based on the above steps, when the simulation platform detects the code corresponding to the same number of code lines as the parent node of the loaded test case, a system snapshot of the simulation platform is taken and saved. When running the next test case, the snapshot file is directly loaded to achieve incremental running of the test case and maximize the effect of incremental running by sorting the test cases.

[0092] Preferably, before running the first test case, a temporary storage space and a permanent storage space are opened, wherein the temporary storage space is used to store the code file corresponding to the current test case, and the permanent storage space is used to store the snapshot information of each node;

[0093] In response to executing the test case in the execution order, releasing the code file of the previous test case in the temporary storage space, reading the snapshot file corresponding to the current test case from the permanent storage space, and adding the snapshot file to the temporary storage space;

[0094] Adding code files in the current test case that are different from the snapshot file to the temporary storage space;

[0095] Running the test case starting from the corresponding simulation time based on the snapshot file;

[0096] If all test cases under a node are executed, the snapshot file of this node stored in the permanent storage space is deleted to reduce the consumption of storage resources.

[0097] In one possible implementation mode, the specific steps of storing the code file of the test case in the internal high-speed memory through backdoor writing include: changing the code loading address in the scattered loading file to the starting address of the code file stored in the internal high-speed memory, and allocating space for the code file in the internal high-speed memory; adding an absolute address jump instruction in the startup file to make the program pointer jump to the space allocated for the code file in the internal high-speed memory; and writing the code file into the internal high-speed memory in sequence according to the data storage logic in the high-speed memory.

[0098] It should be noted that in normal system-level simulation, the code used as a test case is stored in an external non-volatile memory such as FLASH and EEPROM. Before the code is run, it is necessary to read the code from the external non-volatile memory. There are two subsequent code execution methods, one is direct execution, and the other is to read all the codes and store them in a high-speed memory (such as DDR or SRAM), and then read the codes one by one from the high-speed memory for execution. The former does not require additional storage and read all the codes, and can execute the code immediately, but the non-volatile memory has a slow reading speed, and the code reading time is significantly higher than the execution time, resulting in low overall operating efficiency. The latter reads the code from the high-speed memory, and with the use of a pipeline mechanism, the code reading time can be ignored, and the overall operating efficiency is high, but all the codes need to be moved from the non-volatile memory to the high-speed memory at the beginning, which will consume a lot of running time, even several times the test case running time, and the overall efficiency is even lower than the former. Therefore, in this embodiment, the code is stored in the internal high-speed memory by backdoor writing at the beginning of the simulation environment operation. This process does not consume simulation time, does not require code transfer, and can directly read the code from the internal high-speed memory when the code is running, which can greatly reduce the running time.

[0099] Specifically, SRAM is used as an internal high-speed memory as an example for explanation, which includes content modifications in three aspects: scattered loading files, startup files and simulation platform.

[0100] The scatter loading file is a configuration file used to describe the layout of the program in memory. In order to control the ARM core to load code from SRAM, the load address needs to be set to the SRAM start address, and a storage area is allocated for the code in SRAM. The storage area capacity must be greater than the code file byte length. If the SRAM start address is 0x1000000 and the code byte length is 0x10100, the starting part of the scatter loading file is as follows, the load address is set to 0x1000000 (LOAD0x1000000), and the code storage area is 0x20000 (RW_DATA 0x10020000):

[0101]

[0102] The startup file (startup.S) is an assembly file, located at the front end of the code file, and controls the code running process. After the chip is powered on, the code is read and executed from the internally set starting address. This starting address is usually the starting address of the external non-volatile memory. If there is no jump instruction with an absolute address, even if the code loading location is specified in the scatter loading file, the code will always be loaded from this external non-volatile memory. In order to avoid this problem, a jump instruction involving an absolute address (such as the BR instruction) is added to the starting position of the startup file to jump to the starting position of the original startup file. When the ARM kernel starts, this jump instruction is first executed, and the instruction is loaded from the corresponding address for execution. The address at this time is the address in the internal high-speed memory. When the instruction is loaded subsequently, whether it is the execution of the next instruction, a relative jump or an absolute jump, the loading address is in the high-speed memory address interval configured for the code file in the scatter loading file, so that the code is loaded from the high-speed memory.

[0103] In the simulation platform, the code needs to be loaded into the internal high-speed memory at the initial stage of operation. Here, according to the data storage logic in the high-speed memory, the code file content generated by the compilation software needs to be written into the high-speed memory in sequence according to the rules. Exemplarily, the system function $readmemh is used to read the code file into the temporary storage area code_mem, and then the data in code_mem is placed in the storage unit of the internal high-speed memory according to the length of the high-speed memory storage unit and the distribution of each bit. For example, a certain SRAM storage unit is 64 bits long and stores 8 bytes, but the storage is not 8 bytes stored in sequence, but 8 bytes are stored in sequence at the 0th, 1st, ..., 7th bit. At this time, it is necessary to take out 8 consecutive bytes from code_mem and store them in the 64-bit SRAM storage unit according to this rule, and then take out the next consecutive 8 bytes and store them in the next 64-bit SRAM storage unit, and so on, until all the data in code_mem is stored in SRAM, such as Figure 4 shown.

[0104] Based on the above steps, by configuring the scattered loading file and adding the jump instruction with the absolute address in the startup file, it can be ensured that the processor loads and executes the code directly from the internal high-speed memory at startup, thereby avoiding the process of reading the code from the external non-volatile memory and the code transfer from the external non-volatile memory to the internal high-speed memory, thereby improving the system startup speed and operation efficiency.

[0105] It should be understood that although Figure 1-2The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1-2 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0106] In one embodiment, Figure 5 As shown, a test case execution optimization device is provided, including: a generation module, an acquisition module, a sorting module and an execution module, wherein:

[0107] A generation module, used to compile a plurality of preset test cases and generate code files for the test cases;

[0108] An acquisition module, used for comparing the code files of the test cases in pairs to obtain the number of identical code lines between the code files in the initial stage;

[0109] A sorting module, used for recursively grouping the test cases based on the same number of code lines, and determining the execution order of the test cases according to the grouping result;

[0110] The execution module is used to determine the target test case according to the execution order, obtain the snapshot file corresponding to the target test case and run the target test case from the simulation time corresponding to the snapshot file, and write the code file of the test case into the internal high-speed memory.

[0111] In one embodiment, the sorting module is also used to recursively group the test cases according to the same number of code lines, and divide the test cases into multiple test case sets step by step, wherein each of the test case sets includes at least one test case; construct a test case set generation tree according to the recursive relationship between the test case sets; and traverse the test case set generation tree based on a depth-first search method to determine the execution order of the test cases.

[0112] In one embodiment, the sorting module is further used to use the preset multiple test cases as an initial test case set; select a first test case, and obtain a first test case set with the least number of identical code lines as the first test case from the initial test case set as an adjacent group, and the first test case and other test cases form a second test case set as an identical group, wherein the least number of identical code lines is recorded as ki_j , i is the number of layers of the test case set, j is the index within the layer; determine whether the first test case set meets the grouping condition; select a second test case in the first test case set, if the first test case set has at least k identical code lines with the second test case i_j test cases, then determine that the first test case set meets the grouping condition; further group the first test case set, and divide the test cases that meet the grouping condition into new test case sets until the new test case sets obtained by division do not meet the grouping condition; determine whether the multiple test case sets obtained by division from the initial test case set meet the recursive condition; if so, recursively group the test case sets that meet the recursive condition until the test case sets do not meet the recursive condition.

[0113] In one embodiment, the sorting module is also used to obtain the number of test cases in the test case set and the number of identical lines of code between the test cases; if the number of test cases is less than or equal to two, or the number of identical lines of code between the test cases is the same, it is determined that the test case set does not meet the recursive condition, and the test case set is divided into multiple single test case sets according to the number of test cases; if the number of test cases is greater than two, and the number of identical lines of code between the test cases is different, it is determined that the test case set meets the recursive condition.

[0114] In one embodiment, the sorting module is also used to traverse the test case set generation tree based on a depth-first search method, wherein the nodes in the test case set generation tree correspond one-to-one to the test case sets obtained by grouping, the initial test case set is the root node, and the single test case set is the leaf node; preferentially select paths with a larger number of nodes to access each node in the test case set generation tree level by level; in response to the existence of multiple candidate leaf nodes, preferentially select the leaf node with the largest number of code lines; if the multiple candidate leaf nodes have the same number of code lines, randomly select one from the candidate leaf nodes; and determine the execution order of the test cases according to the traversal results.

[0115] In one embodiment, the execution module is also used to perform simulation platform snapshot storage at the end of the same code for all nodes in the test case set generation tree from the root node to the leaf node to form a snapshot file; in response to executing the test case corresponding to the current leaf node, determine the target node that has the snapshot file stored in all nodes in the path from the root node to the current leaf node and is closest to the current leaf node; load the snapshot file of the target node, and run the test case from the simulation time corresponding to the snapshot file.

[0116] In one embodiment, the execution module is also used to change the code loading address in the scattered loading file to the starting address of the code file stored in the internal high-speed memory, and allocate space for the code file in the internal high-speed memory; add an absolute address jump instruction in the startup file to make the program pointer jump to the space allocated for the code file in the internal high-speed memory; and write the code file into the internal high-speed memory in sequence according to the data storage logic in the high-speed memory.

[0117] For the specific definition of the test case execution optimization device, please refer to the definition of the test case execution optimization method above, which will not be repeated here. Each module in the above-mentioned test case execution optimization device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0118] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store code files and snapshot file data of test cases. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a test case execution optimization method is implemented.

[0119] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0120] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:

[0121] Compile multiple preset test cases to generate code files for the test cases;

[0122] Compare the code files of the test cases in pairs to obtain the number of identical code lines between the code files in the initial stage;

[0123] Recursively grouping the test cases based on the same number of code lines, and determining the execution order of the test cases according to the grouping result;

[0124] Determine the target test case according to the execution order, obtain the snapshot file corresponding to the target test case, run the target test case from the simulation time corresponding to the snapshot file, and write the code file of the test case into the internal high-speed memory.

[0125] In one embodiment, when the processor executes the computer program, the following steps are also implemented: recursively grouping the test cases according to the same number of code lines, dividing the test cases into multiple test case sets step by step, wherein each of the test case sets includes at least one test case; constructing a test case set generation tree according to the recursive relationship between the test case sets; and traversing the test case set generation tree based on a depth-first search method to determine the execution order of the test cases.

[0126] In one embodiment, when the processor executes the computer program, the following steps are further implemented: using the preset multiple test cases as an initial test case set; selecting a first test case, and obtaining a first test case set having the least number of identical code lines with the first test case from the initial test case set as an adjacent group, and the first test case and other test cases constitute a second test case set as an identical group, wherein the least number of identical code lines is recorded as k. i_j , i is the number of layers of the test case set, j is the index within the layer; determine whether the first test case set meets the grouping condition; select a second test case in the first test case set, if the first test case set has at least k identical code lines with the second test case i_j test cases, then determine that the first test case set meets the grouping condition; further group the first test case set, and divide the test cases that meet the grouping condition into new test case sets until the new test case sets obtained by division do not meet the grouping condition; determine whether the multiple test case sets obtained by division from the initial test case set meet the recursive condition; if so, recursively group the test case sets that meet the recursive condition until the test case sets do not meet the recursive condition.

[0127] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining the number of test cases in the test case set and the number of identical code lines between the test cases; if the number of test cases is less than or equal to two, or the number of identical code lines between the test cases is the same, determining that the test case set does not meet the recursive condition, and dividing the test case set into multiple single test case sets according to the number of test cases; if the number of test cases is greater than two, and the number of identical code lines between the test cases is different, determining that the test case set meets the recursive condition.

[0128] In one embodiment, when the processor executes the computer program, the following steps are also implemented: traversing the test case set generation tree based on a depth-first search method, wherein the nodes in the test case set generation tree correspond one-to-one to the test case sets obtained by grouping, the initial test case set is the root node, and the single test case set is the leaf node; preferentially selecting a path with a larger number of nodes to access each node in the test case set generation tree level by level; in response to the existence of multiple candidate leaf nodes, preferentially selecting a leaf node with the largest number of code lines; if the multiple candidate leaf nodes have the same number of code lines, randomly selecting one from the candidate leaf nodes; and determining the execution order of the test cases according to the traversal results.

[0129] In one embodiment, when the processor executes the computer program, the following steps are also implemented: for all nodes in the test case set generation tree from the root node to the leaf node, a simulation platform snapshot is stored at the end of the same code to form a snapshot file; in response to executing the test case corresponding to the current leaf node, a target node that has a snapshot file stored in all nodes in the path from the root node to the current leaf node and is closest to the current leaf node is determined; the snapshot file of the target node is loaded, and the test case is run from the simulation time corresponding to the snapshot file.

[0130] In one embodiment, when the processor executes the computer program, the following steps are also implemented: the code loading address in the scattered loading file is changed to the starting address of the code file stored in the internal high-speed memory, and space is allocated for the code file in the internal high-speed memory; an absolute address jump instruction is added to the startup file to make the program pointer jump to the space allocated for the code file in the internal high-speed memory; and the code file is written into the internal high-speed memory in sequence according to the data storage logic in the high-speed memory.

[0131] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0132] Compile multiple preset test cases to generate code files for the test cases;

[0133] Compare the code files of the test cases in pairs to obtain the number of identical code lines between the code files in the initial stage;

[0134] Recursively grouping the test cases based on the same number of code lines, and determining the execution order of the test cases according to the grouping result;

[0135] Determine the target test case according to the execution order, obtain the snapshot file corresponding to the target test case, run the target test case from the simulation time corresponding to the snapshot file, and write the code file of the test case into the internal high-speed memory.

[0136] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: recursively grouping the test cases according to the same number of code lines, dividing the test cases into multiple test case sets step by step, wherein each of the test case sets includes at least one test case; constructing a test case set generation tree according to the recursive relationship between the test case sets; and traversing the test case set generation tree based on a depth-first search method to determine the execution order of the test cases.

[0137] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: taking the preset multiple test cases as an initial test case set; selecting a first test case, and obtaining a first test case set having the least number of identical code lines with the first test case from the initial test case set as an adjacent group, and the first test case and other test cases constitute a second test case set as an identical group, wherein the least number of identical code lines is recorded as k. i_j , i is the number of layers of the test case set, j is the index within the layer; determine whether the first test case set meets the grouping condition; select a second test case in the first test case set, if the first test case set has at least k identical code lines with the second test case i_j test cases, then determine that the first test case set meets the grouping condition; further group the first test case set, and divide the test cases that meet the grouping condition into new test case sets until the new test case sets obtained by division do not meet the grouping condition; determine whether the multiple test case sets obtained by division from the initial test case set meet the recursive condition; if so, recursively group the test case sets that meet the recursive condition until the test case sets do not meet the recursive condition.

[0138] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining the number of test cases in the test case set and the number of identical code lines between the test cases; if the number of test cases is less than or equal to two, or the number of identical code lines between the test cases is the same, determining that the test case set does not meet the recursive condition, and dividing the test case set into multiple single test case sets according to the number of test cases; if the number of test cases is greater than two, and the number of identical code lines between the test cases is different, determining that the test case set meets the recursive condition.

[0139] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: traversing the test case set generation tree based on a depth-first search method, wherein the nodes in the test case set generation tree correspond one-to-one to the test case sets obtained by grouping, the initial test case set is the root node, and the single test case set is the leaf node; preferentially selecting a path with a larger number of nodes to access each node in the test case set generation tree level by level; in response to the existence of multiple candidate leaf nodes, preferentially selecting a leaf node with the largest number of code lines; if the multiple candidate leaf nodes have the same number of code lines, randomly selecting one from the candidate leaf nodes; and determining the execution order of the test cases according to the traversal results.

[0140] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: for all nodes in the test case set generation tree from the root node to the leaf node, a simulation platform snapshot is stored at the end of the same code to form a snapshot file; in response to executing the test case corresponding to the current leaf node, a target node is determined that has a snapshot file stored in all nodes in the path from the root node to the current leaf node and is closest to the current leaf node; the snapshot file of the target node is loaded, and the test case is run from the simulation time corresponding to the snapshot file.

[0141] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: the code loading address in the scattered loading file is changed to the starting address of the code file stored in the internal high-speed memory, and space is allocated for the code file in the internal high-speed memory; an absolute address jump instruction is added to the startup file to make the program pointer jump to the space allocated for the code file in the internal high-speed memory; and the code file is written into the internal high-speed memory in sequence according to the data storage logic in the high-speed memory.

[0142] In one embodiment, a computer product is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0143] Compile multiple preset test cases to generate code files for the test cases;

[0144] Compare the code files of the test cases in pairs to obtain the number of identical code lines between the code files in the initial stage;

[0145] Recursively grouping the test cases based on the same number of code lines, and determining the execution order of the test cases according to the grouping result;

[0146] Determine the target test case according to the execution order, obtain the snapshot file corresponding to the target test case, run the target test case from the simulation time corresponding to the snapshot file, and write the code file of the test case into the internal high-speed memory.

[0147] In one embodiment, when the processor executes the computer program, the following steps are also implemented: recursively grouping the test cases according to the same number of code lines, dividing the test cases into multiple test case sets step by step, wherein each of the test case sets includes at least one test case; constructing a test case set generation tree according to the recursive relationship between the test case sets; and traversing the test case set generation tree based on a depth-first search method to determine the execution order of the test cases.

[0148] In one embodiment, when the processor executes the computer program, the following steps are further implemented: using the preset multiple test cases as an initial test case set; selecting a first test case, and obtaining a first test case set having the least number of identical code lines with the first test case from the initial test case set as an adjacent group, and the first test case and other test cases constitute a second test case set as an identical group, wherein the least number of identical code lines is recorded as k. i_j , i is the number of layers of the test case set, j is the index within the layer; determine whether the first test case set meets the grouping condition; select a second test case in the first test case set, if the first test case set has at least k identical code lines with the second test case i_j test cases, then determine that the first test case set meets the grouping condition; further group the first test case set, and divide the test cases that meet the grouping condition into new test case sets until the new test case sets obtained by division do not meet the grouping condition; determine whether the multiple test case sets obtained by division from the initial test case set meet the recursive condition; if so, recursively group the test case sets that meet the recursive condition until the test case sets do not meet the recursive condition.

[0149] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining the number of test cases in the test case set and the number of identical code lines between the test cases; if the number of test cases is less than or equal to two, or the number of identical code lines between the test cases is the same, determining that the test case set does not meet the recursive condition, and dividing the test case set into multiple single test case sets according to the number of test cases; if the number of test cases is greater than two, and the number of identical code lines between the test cases is different, determining that the test case set meets the recursive condition.

[0150] In one embodiment, when the processor executes the computer program, the following steps are also implemented: traversing the test case set generation tree based on a depth-first search method, wherein the nodes in the test case set generation tree correspond one-to-one to the test case sets obtained by grouping, the initial test case set is the root node, and the single test case set is the leaf node; preferentially selecting a path with a larger number of nodes to access each node in the test case set generation tree level by level; in response to the existence of multiple candidate leaf nodes, preferentially selecting a leaf node with the largest number of code lines; if the multiple candidate leaf nodes have the same number of code lines, randomly selecting one from the candidate leaf nodes; and determining the execution order of the test cases according to the traversal results.

[0151] In one embodiment, when the processor executes the computer program, the following steps are also implemented: for all nodes in the test case set generation tree from the root node to the leaf node, a simulation platform snapshot is stored at the end of the same code to form a snapshot file; in response to executing the test case corresponding to the current leaf node, a target node that has a snapshot file stored in all nodes in the path from the root node to the current leaf node and is closest to the current leaf node is determined; the snapshot file of the target node is loaded, and the test case is run from the simulation time corresponding to the snapshot file.

[0152] In one embodiment, when the processor executes the computer program, the following steps are also implemented: the code loading address in the scattered loading file is changed to the starting address of the code file stored in the internal high-speed memory, and space is allocated for the code file in the internal high-speed memory; an absolute address jump instruction is added to the startup file to make the program pointer jump to the space allocated for the code file in the internal high-speed memory; and the code file is written into the internal high-speed memory in sequence according to the data storage logic in the high-speed memory.

[0153] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0154] Compile multiple preset test cases to generate code files for the test cases;

[0155] Compare the code files of the test cases in pairs to obtain the number of identical code lines between the code files in the initial stage;

[0156] Recursively grouping the test cases based on the same number of code lines, and determining the execution order of the test cases according to the grouping result;

[0157] Determine the target test case according to the execution order, obtain the snapshot file corresponding to the target test case, run the target test case from the simulation time corresponding to the snapshot file, and write the code file of the test case into the internal high-speed memory.

[0158] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: recursively grouping the test cases according to the same number of code lines, dividing the test cases into multiple test case sets step by step, wherein each of the test case sets includes at least one test case; constructing a test case set generation tree according to the recursive relationship between the test case sets; and traversing the test case set generation tree based on a depth-first search method to determine the execution order of the test cases.

[0159] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: taking the preset multiple test cases as an initial test case set; selecting a first test case, and obtaining a first test case set having the least number of identical code lines with the first test case from the initial test case set as an adjacent group, and the first test case and other test cases constitute a second test case set as an identical group, wherein the least number of identical code lines is recorded as k. i_j , i is the number of layers of the test case set, j is the index within the layer; determine whether the first test case set meets the grouping condition; select a second test case in the first test case set, if the first test case set has at least k identical code lines with the second test case i_j test cases, then determine that the first test case set meets the grouping condition; further group the first test case set, and divide the test cases that meet the grouping condition into new test case sets until the new test case sets obtained by division do not meet the grouping condition; determine whether the multiple test case sets obtained by division from the initial test case set meet the recursive condition; if so, recursively group the test case sets that meet the recursive condition until the test case sets do not meet the recursive condition.

[0160] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining the number of test cases in the test case set and the number of identical code lines between the test cases; if the number of test cases is less than or equal to two, or the number of identical code lines between the test cases is the same, determining that the test case set does not meet the recursive condition, and dividing the test case set into multiple single test case sets according to the number of test cases; if the number of test cases is greater than two, and the number of identical code lines between the test cases is different, determining that the test case set meets the recursive condition.

[0161] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: traversing the test case set generation tree based on a depth-first search method, wherein the nodes in the test case set generation tree correspond one-to-one to the test case sets obtained by grouping, the initial test case set is the root node, and the single test case set is the leaf node; preferentially selecting a path with a larger number of nodes to access each node in the test case set generation tree level by level; in response to the existence of multiple candidate leaf nodes, preferentially selecting a leaf node with the largest number of code lines; if the multiple candidate leaf nodes have the same number of code lines, randomly selecting one from the candidate leaf nodes; and determining the execution order of the test cases according to the traversal results.

[0162] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: for all nodes in the test case set generation tree from the root node to the leaf node, a simulation platform snapshot is stored at the end of the same code to form a snapshot file; in response to executing the test case corresponding to the current leaf node, a target node is determined that has a snapshot file stored in all nodes in the path from the root node to the current leaf node and is closest to the current leaf node; the snapshot file of the target node is loaded, and the test case is run from the simulation time corresponding to the snapshot file.

[0163] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: the code loading address in the scattered loading file is changed to the starting address of the code file stored in the internal high-speed memory, and space is allocated for the code file in the internal high-speed memory; an absolute address jump instruction is added to the startup file to make the program pointer jump to the space allocated for the code file in the internal high-speed memory; and the code file is written into the internal high-speed memory in sequence according to the data storage logic in the high-speed memory.

[0164] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0165] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0166] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A test case execution optimization method, characterized in that: include: Compile multiple preset test cases to generate code files for the test cases; Compare the code files of the test cases in pairs to obtain the number of identical code lines between the code files in the initial stage; Recursively grouping the test cases based on the same number of code lines, and determining the execution order of the test cases according to the grouping result; Determine the target test case according to the execution order, obtain the snapshot file corresponding to the target test case, run the target test case from the simulation time corresponding to the snapshot file, and write the code file of the test case into the internal high-speed memory.

2. The test case execution optimization method according to claim 1, characterized in that: The recursively grouping the test cases based on the same number of code lines, and determining the execution order of the test cases according to the grouping result, comprises: Recursively grouping the test cases according to the same number of code lines, and dividing the test cases into a plurality of test case sets step by step, wherein each of the test case sets includes at least one test case; Constructing a test case set generation tree according to the recursive relationship between the test case sets; The test case set generation tree is traversed based on a depth-first search method to determine the execution order of the test cases.

3. The test case execution optimization method according to claim 2, characterized in that: The recursive grouping of the test cases according to the same number of code lines, and dividing the test cases into multiple test case sets level by level, includes: Using the preset multiple test cases as an initial test case set; Select a first test case, and obtain a first test case set from the initial test case set that has the least number of identical code lines with the first test case as an adjacent group, and the first test case and other test cases form a second test case set as an identical group, wherein the least number of identical code lines is denoted as k i_j , i is the number of layers in the test case set, j is the index within the layer; Determine whether the first test case set meets the grouping condition; Select a second test case from the first test case set if the first test case set has at least k identical lines of code with the second test case. i_j test cases, it is determined that the first test case set meets the grouping condition; Further grouping the first test case set, dividing the test cases that meet the grouping condition into a new test case set, until the new test case set obtained by the division does not meet the grouping condition; Determine whether the multiple test case sets divided from the initial test case set meet the recursive condition; If so, the test case set that meets the recursive condition is recursively grouped until the test case set does not meet the recursive condition.

4. The test case execution optimization method according to claim 3, characterized in that: The determining whether the multiple test case sets divided from the initial test case set meet the recursive condition includes: Obtain the number of test cases in the test case set and the number of identical code lines between any two of the test cases; If the number of the test cases is less than or equal to two, or the number of identical code lines between the test cases is the same, it is determined that the test case set does not meet the recursive condition, and the test case set is divided into multiple single test case sets according to the number of test cases; If the number of the test cases is greater than two, and the number of identical code lines between the test cases is different, it is determined that the test case set meets the recursive condition.

5. The test case execution optimization method according to claim 4, characterized in that: The step of traversing the test case set generation tree based on a depth-first search method to determine the execution order of the test cases includes: Traversing the test case set generation tree based on a depth-first search method, wherein the nodes in the test case set generation tree correspond one-to-one to the test case sets obtained by grouping, the initial test case set is a root node, and the single test case set is a leaf node; Prioritize the path with more nodes to access each node in the test case set generation tree level by level; In response to the presence of multiple candidate leaf nodes, the leaf node with the largest number of code lines is preferentially selected; If the code lines of the multiple candidate leaf nodes are the same, randomly select one from the candidate leaf nodes; The execution order of the test cases is determined according to the traversal results.

6. The test case execution optimization method according to any one of claims 2 to 5, characterized in that: In response to executing the test case in the execution order, obtaining a snapshot file corresponding to the test case and running the test case from the simulation time corresponding to the snapshot file includes: For all nodes in the test case set generation tree from the root node to the leaf node, a simulation platform snapshot is stored at the end of the same code to form a snapshot file; In response to executing the test case corresponding to the current leaf node, determining a target node that has snapshot files stored in all nodes on the path from the root node to the current leaf node and is closest to the current leaf node; The snapshot file of the target node is loaded, and the test case is run starting from the simulation time corresponding to the snapshot file.

7. The test case execution optimization method according to claim 1, characterized in that: The step of storing the code file of the test case into an internal high-speed memory comprises: Changing the code loading address in the scatter-loading file to the starting address of the code file stored in the internal high-speed memory, and allocating space for the code file in the internal high-speed memory; Add an absolute address jump instruction in the startup file to make the program pointer jump to the space allocated for the code file in the internal high-speed memory; According to the data storage logic in the high-speed memory, the code files are written into the internal high-speed memory in sequence.

8. A system-level simulation device, characterized in that: The device comprises: A generation module, used to compile a plurality of preset test cases and generate code files for the test cases; An acquisition module, used for comparing the code files of the test cases in pairs to obtain the number of identical code lines between the code files in the initial stage; A sorting module, used for recursively grouping the test cases based on the same number of code lines, and determining the execution order of the test cases according to the grouping result; An execution module is used to determine the target test case according to the execution order, obtain the snapshot file corresponding to the target test case and run the target test case from the simulation time corresponding to the snapshot file, and write the code file of the test case into the internal high-speed memory.

9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.