A method of coverage calculation based on offline coverage artifact and medium
Patent Information
- Application Number
- CN202610996702.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-06
- Publication Date
- 2026-10-09
AI Technical Summary
然而,随着项目规模扩张,部署形态发生显著演变,编译节点与测试节点分离,以及测试节点跨硬件架构等场景下,测试任务须离线执行,结果仅能以制品方式回传,如何实现在不同平台上进行多点离线测试至关重要
[0009]本发明实施例的技术方案,实时获取并根据待测试的源码版本文件,通过预设的覆盖编译方法,生成当前覆盖率注释文件包;基于测试平台对应的场景描述信息,组合成至少一个测试平台环境来对所述当前覆盖率注释文件包进行测试处理,得到各当前覆盖率数据文件;对所述当前覆盖率注释文件包和各当前覆盖率数据文件进行解析处理,生成目标覆盖率目标目录清单;通过预设的分级覆盖计算方法,结合所述目标覆盖率目标目录清单,分别对每个所述当前覆盖率数据文件进行处理计算,得到目标覆盖率计算结果;将所述目标覆盖率计算结果通过目标测试执行与提交工具,上报反馈至目标测试仪表盘。解决了当前依赖手工作业与缺少跨平台测试,导致流程可重复性差、维护成本高的问题,可以实现多测试平台环境场景进行异构环境离线测试,突破网络与平台限制,降低成本,提高资源利用率。
Smart Images

Figure CN122884832A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of chip data processing technology, and in particular to a method and medium for calculating coverage based on offline overlay products. Background Technology
[0002] In continuous integration scenarios for chip drivers and basic software, code coverage statistics are a core means of quality control. Current mainstream industry solutions are built upon the GNU Compiler Collection (GCC) or the GNU coverage testing toolchain. However, as projects expand and deployment patterns evolve significantly, with compilation and testing nodes separated, and testing nodes spanning different hardware architectures, testing tasks must be executed offline, and results can only be returned as artifacts. Therefore, enabling multi-point offline testing across different platforms is crucial.
[0003] In the process of developing this invention, the inventors discovered the following shortcomings in existing technologies: Currently, the native solutions of the GNU compiler suite only address the relocation problem when the build path and runtime path differ; the test execution and submission tool (CTest) solution is suitable for homogeneous environments with a single build tree, lacking native support for the aggregation process of asynchronous artifacts returned from multiple nodes. While Lcov or gcovr coverage tools can generate rich reports, in cross-node scenarios, they require extensive manual processing, mapping, and merging of external scripts, resulting in insufficient standardization and reproducibility reliant on human experience. Although source code-level coverage solutions possess mature toolchain capabilities, they suffer from compatibility issues with the GCC coverage toolchain ecosystem and existing continuous integration reporting processes, leading to significant migration costs. Remote execution build solutions natively support coverage functionality in remote execution scenarios; however, their integration with the existing network engineering system dominated by the CMake build system is highly complex, hindering widespread deployment. Summary of the Invention
[0004] This invention provides a coverage calculation method and medium based on offline coverage products, enabling offline testing in heterogeneous environments across multiple testing platform scenarios, overcoming network and platform limitations, reducing costs, and improving resource utilization.
[0005] According to one aspect of the present invention, a method for calculating coverage based on offline covering products is provided, comprising: It acquires the source code version file to be tested in real time and generates a current coverage annotation file package using a preset coverage compilation method. Based on the scenario description information corresponding to the test platform, at least one test platform environment is combined to test the current coverage annotation file package and obtain each current coverage data file. The current coverage annotation file package and each current coverage data file are parsed and processed to generate a target coverage target directory list; Using a preset hierarchical coverage calculation method and in conjunction with the target coverage target directory list, each current coverage data file is processed and calculated to obtain the target coverage calculation result; The target coverage calculation results are reported and fed back to the target test dashboard through the target test execution and submission tool.
[0006] According to another aspect of the present invention, a coverage calculation device based on offline covering articles is provided, comprising: The current coverage annotation file package generation module is used to obtain and generate the current coverage annotation file package in real time based on the source code version file to be tested, using a preset coverage compilation method. The current coverage data file determination module is used to combine at least one test platform environment based on the scenario description information corresponding to the test platform to perform test processing on the current coverage annotation file package, and obtain each current coverage data file. The target coverage target directory list generation module is used to parse and process the current coverage annotation file package and each current coverage data file to generate the target coverage target directory list; The target coverage calculation result determination module is used to process and calculate each of the current coverage data files by means of a preset hierarchical coverage calculation method and the target coverage target directory list, so as to obtain the target coverage calculation result. The target coverage calculation result reporting and feedback module is used to report the target coverage calculation result to the target test dashboard through the target test execution and submission tool.
[0007] According to another aspect of the present invention, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the coverage calculation method based on offline overlay articles as described in any embodiment of the present invention.
[0008] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the coverage calculation method based on offline overlay articles as described in any embodiment of the present invention.
[0009] The technical solution of this invention involves acquiring and generating a current coverage annotation file package in real time based on the source code version file to be tested, using a preset coverage compilation method. Based on the scenario description information corresponding to the test platform, at least one test platform environment is combined to test the current coverage annotation file package, resulting in various current coverage data files. The current coverage annotation file package and each current coverage data file are parsed to generate a target coverage target directory list. Using a preset hierarchical coverage calculation method, combined with the target coverage target directory list, each current coverage data file is processed and calculated to obtain the target coverage calculation result. The target coverage calculation result is then reported and fed back to the target test dashboard through a target test execution and submission tool. This solves the problems of poor process repeatability and high maintenance costs caused by reliance on manual operations and lack of cross-platform testing. It enables offline testing in heterogeneous environments across multiple test platform scenarios, overcoming network and platform limitations, reducing costs, and improving resource utilization.
[0010] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0011] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 This is a flowchart of a coverage calculation method based on offline covering products according to Embodiment 1 of the present invention; Figure 2 This is a detailed flowchart of a method for calculating coverage based on offline covering products according to Embodiment 2 of the present invention; Figure 3 This is a schematic diagram of a coverage calculation device based on offline covered products according to Embodiment 3 of the present invention; Figure 4 This is a schematic diagram of the structure of an electronic device provided according to Embodiment 4 of the present invention. Detailed Implementation
[0013] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0014] It should be noted that the terms "target," "current," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0015] It is worth noting that the information collected in the technical solution of this application is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data all comply with the relevant laws, regulations and standards of the relevant countries and regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entry points for users to choose to authorize or refuse; if the user chooses to refuse, the process will proceed to the expert decision-making process.
[0016] Example 1 Figure 1 The flowchart of a coverage calculation method based on offline coverage products is provided in Embodiment 1 of the present invention. This embodiment is applicable to scenarios where the coverage of offline coverage products is calculated through different test environment scenarios. The method can be executed by a coverage calculation device based on offline coverage products, which can be implemented in hardware and / or software.
[0017] Correspondingly, such as Figure 1 As shown, the method includes: S110: Real-time acquisition and generation of current coverage annotation file package based on the source code version file to be tested using a preset coverage compilation method.
[0018] In this embodiment, the source code version file to be tested can be The file, through the overwrite compilation method, performs an overwrite compilation on a unified version of the source code to be tested, which can generate a current coverage comment file corresponding to the target object. (File). Furthermore, by packaging according to directory rules and outputting a package of current coverage comment files, it can be... .
[0019] During this coverage compilation process, it is essential to ensure that the source code version built is consistent with the version executed in subsequent tests; It is versioned and saved as a read-only baseline artifact; and a unified naming convention is adopted with the testing phase to facilitate automatic matching later.
[0020] S120. Based on the scenario description information corresponding to the test platform, combine at least one test platform environment to test the current coverage annotation file package and obtain each current coverage data file.
[0021] The scene description information may include parameters such as operating system parameters, version parameters, and graphics processor parameters, and each of these parameters includes different types of operating system parameters, version type parameters, and graphics processor parameters.
[0022] Optionally, the step of combining the scenario description information corresponding to the test platform into at least one test platform environment to test the current coverage annotation file and obtain the current coverage data file includes: based on the test platform, combining at least one operating system parameter information, version parameter information, and graphics processor parameter information in the scenario description information into at least one test platform environment through a preset test platform combination method; testing the current coverage annotation file through each of the respective test platform environments to obtain each current coverage data file; wherein, the test platform environment performs test processing, generates corresponding test tasks based on the received current coverage annotation files, divides the test tasks into multiple execution nodes for parallel execution, and aggregates and summarizes them according to their respective test names and task numbers after execution is completed.
[0023] Specifically, after the current coverage annotation files are tested and processed through each of the test platform environments, the method further includes: during test processing, setting coverage environment variables to relocate the current output path corresponding to each of the current coverage data files; and after the test operation is completed in each of the test platform environments, performing offline backhaul processing of each of the current coverage data files according to the current output path.
[0024] In this embodiment, multiple test platform environments can be combined using a test platform combination method based on different types of operating system parameter information, version parameter information, and graphics processor parameter information. Each test platform environment can be regarded as a corresponding test node. The current coverage annotation file is tested and processed through each of the test platform environments to obtain the current coverage data files. That is, multiple corresponding test platform environments are generated. document.
[0025] Furthermore, it allows multiple test nodes to run the same version of the test package (i.e., the current coverage comment file) in different test platform environments, setting coverage environment variables at runtime to relocate the current coverage data file (format: The current output path corresponds to the file. Accordingly, after each test operation is completed in each test platform environment, offline backhaul processing of each current coverage data file is performed according to the current output path. For network isolation scenarios, offline backhaul via artifact repository or shared storage is permitted.
[0026] Additionally, the test platform environment performs test processing, generating corresponding test tasks based on the received current coverage annotation file, with each test task outputting a corresponding [test result / output]. The current coverage data file is named accordingly. The test task can be split into multiple execution nodes for parallel execution, ensuring that the coverage collection granularity remains at the task or sub-task level; each parallel task independently produces data with a task identifier. Packages are used to avoid data overwriting caused by concurrent writes to the same directory.
[0027] Furthermore, after the execution is completed, the data is aggregated and summarized according to their respective test names and task numbers. This allows a test task to be fragmented and executed through multiple execution nodes, and then returned in multiple packets and automatically merged on the aggregation side. The aggregation side can aggregate and summarize according to the test name and task number, thus achieving fine-grained collection and centralized aggregation functions.
[0028] S130. Parse and process the current coverage annotation file package and each current coverage data file to generate a target coverage target directory list.
[0029] The target coverage target directory list can include an aggregation summary working directory and a directory list for rebuilding symbolic links, as well as a directory list that matches the coverage annotation file package and each coverage data file.
[0030] Optionally, the step of parsing the current coverage annotation file package and each current coverage data file to generate a target coverage target directory list includes: unpacking the current coverage annotation file package and each current coverage data file to a preset current aggregation summary working directory; obtaining and unifying the unpacked current coverage timestamp marker, and establishing current reconstruction soft links corresponding to the current coverage annotation file package and each current coverage data file in the current aggregation summary working directory according to preset path mapping rules; generating a target coverage target directory list based on the current aggregation summary working directory and the current reconstruction soft links, so as to perform coverage scanning processing on the target coverage target directory list using the target test execution and submission tool.
[0031] In this embodiment, it is first necessary to annotate the current coverage file package ( File package) and each current coverage data file ( Unpacking the data allows you to aggregate the results into the current aggregation working directory. Furthermore, it's necessary to obtain and standardize the current coverage timestamp after unpacking to reduce the probability of parsing failures due to format inconsistencies.
[0032] Accordingly, it is necessary to establish soft links for the current reconstruction in the current aggregation and summary working directory, corresponding to the current coverage annotation file package and each current coverage data file, respectively, through path mapping rules. This includes... soft links and Soft link.
[0033] Furthermore, a target coverage target directory list can be generated based on the current aggregation summary working directory and the current soft link reconstruction, which may include individual sub-lists. ; and the master list This allows for coverage scanning of the target coverage target directory list using the target test execution and submission tool (i.e., the CTest tool), and also enables the transformation of data generated by heterogeneous test nodes into a unified computable view.
[0034] S140. Using a preset hierarchical coverage calculation method and in conjunction with the target coverage target directory list, each of the current coverage data files is processed and calculated to obtain the target coverage calculation result.
[0035] In this embodiment, the hierarchical coverage calculation method allows multiple test tasks to upload their respective data in parallel. The package is collected and unpacked concurrently on the summary side and written to the corresponding directory of the test task, which can realize the function of parallel collection; the main thing is to generate an independent CTest script for each manifest test task, and can execute coverage calculation in parallel to form a localizable result; furthermore, the target coverage calculation result can be determined.
[0036] S150. The target coverage calculation result is reported and fed back to the target test dashboard through the target test execution and submission tool.
[0037] In this embodiment, not only can the function of reporting feedback to the target test dashboard through the target test execution and submission tool be displayed online, but it can also package coverage calculation-related files to achieve offline evidence archiving, which can be used for recalculation and auditing scenarios. Optionally, the step of reporting the target coverage calculation result to the target test dashboard through the target test execution and submission tool includes: obtaining the current test context information; wherein, the current test context information includes the current annotation file, and the current annotation file includes at least one of the following command line information, submission number information, pipeline information, and serial number information; submitting the current context information and the target coverage calculation result in segments through the target test execution and submission tool, and setting a failure retry and retry interval mechanism in case of submission failure, thereby completing the reporting of the current context information and the target coverage calculation result to the target test dashboard for online result display; wherein, after the current context information and the target coverage calculation result, the step further includes: feeding the current context information and the target coverage calculation result back to the target offline evidence archive through the target test execution and submission tool, so as to realize offline recalculation and auditing operations based on the current context information and the target coverage calculation result.
[0038] In this embodiment, the current context information and the target coverage calculation result can be submitted in segments through the target test execution and submission tool. The segmented submission process can include start information, annotation information, or coverage data, etc.
[0039] Secondly, a retry mechanism and retry interval can be set when a submission fails. Specifically, the number of retries and the retry interval can be set. For example, a retry submission can be performed every 1 minute. If the number of retry submissions reaches the preset retry threshold, the retry submission should be stopped, and an error feedback can be sent to the user.
[0040] Furthermore, once the submission is complete, the current context information and the target coverage calculation results will be reported and fed back to the target test dashboard for online result display.
[0041] In addition, after the current context information and the target coverage calculation result are obtained, the target test execution and submission tool can be used to feed the current context information and the target coverage calculation result back to the target offline evidence archive. This enables the same-source traceability based on the current context information and the target coverage calculation result, which is used for offline recalculation and auditing operations, thereby improving traceability and maintainability.
[0042] The technical solution of this invention involves acquiring and generating a current coverage annotation file package in real time based on the source code version file to be tested, using a preset coverage compilation method. Based on the scenario description information corresponding to the test platform, at least one test platform environment is combined to test the current coverage annotation file package, resulting in various current coverage data files. The current coverage annotation file package and each current coverage data file are parsed to generate a target coverage target directory list. Using a preset hierarchical coverage calculation method, combined with the target coverage target directory list, each current coverage data file is processed and calculated to obtain the target coverage calculation result. The target coverage calculation result is then reported and fed back to the target test dashboard through a target test execution and submission tool. This solves the problems of poor process repeatability and high maintenance costs caused by reliance on manual operations and lack of cross-platform testing. It enables offline testing in heterogeneous environments across multiple test platform scenarios, overcoming network and platform limitations, reducing costs, improving resource utilization, and enhancing reliability, traceability, and maintainability.
[0043] Example 2 Figure 2 This invention provides a detailed flowchart of a coverage calculation method based on offline coverage products in Embodiment 2. This embodiment refines the above embodiment by further detailing the process of processing and calculating the target coverage calculation result for each current coverage data file using a preset hierarchical coverage calculation method and in conjunction with the target coverage target directory list.
[0044] S210: Real-time acquisition and generation of current coverage annotation file package based on the source code version file to be tested using a preset coverage compilation method.
[0045] S220. Based on the scenario description information corresponding to the test platform, combine at least one test platform environment to test the current coverage annotation file package and obtain each current coverage data file.
[0046] S230. Parse and process the current coverage annotation file package and each current coverage data file to generate a target coverage target directory list.
[0047] S240. Based on the target coverage target directory list, at least one currently pending directory list test task is determined by sequentially traversing through the preset task pool parallel quantity control strategy.
[0048] In this embodiment, a parallel strategy is adopted, specifically by controlling the number of concurrent tasks through a task pool parallel quantity control strategy. For example, assuming the task pool parallel quantity control strategy pre-sets a quantity of m, it is necessary to determine the current pending test tasks in the target coverage target directory list, which must be the same quantity as m.
[0049] In addition, the task pool parallel quantity control strategy can be combined with file locks to protect the writing of the full directory list, thereby avoiding the problem of concurrent overwriting.
[0050] S250. Using the hierarchical coverage calculation method, generate independent test execution and submission tool scripts for each of the currently pending directory list test tasks, and calculate the individual coverage calculation results for each of the currently pending directory list test tasks based on each of the test execution and submission tool scripts.
[0051] The individual coverage calculation results for each test task are used to locate each currently pending directory list test task.
[0052] S260. After completing the traversal of the target coverage target directory list, generate individual coverage calculation results for each currently pending directory list test task.
[0053] Continuing the previous example, for the above m currently pending directory listing test tasks, independent test execution and submission tool scripts (i.e., CTest scripts) can be generated using a hierarchical coverage calculation method. Coverage calculations can be performed in parallel, yielding individual coverage results for each currently pending directory listing test task. Since the results correspond to the directory listing test tasks, the effect of result localization is achieved.
[0054] Furthermore, it is necessary to sequentially traverse the target coverage target directory list to generate individual coverage calculation results for each currently pending directory list test task, which are single test case coverage results.
[0055] S270. Generate the target coverage calculation result based on the individual coverage calculation results of each test task.
[0056] Optionally, generating the target coverage calculation result based on the individual coverage calculation results of each test task includes: after determining that the target coverage target directory list has been traversed, calculating the coverage of the entire target coverage target directory list to obtain the current full coverage calculation result; and summarizing and generating the target coverage calculation result based on the individual coverage calculation results of each test task and the current full coverage calculation result.
[0057] In this embodiment, it is also necessary to calculate the full coverage result. Specifically, after completing the traversal of the target coverage target directory list, that is, after calculating the coverage results of all single test cases, the coverage of the full target coverage target directory list can be calculated to obtain the current full coverage result.
[0058] Furthermore, based on the individual coverage calculation results for each test task and the current full coverage calculation results, the target coverage calculation result is generated by summarizing them. This not only determines the coverage results corresponding to each individual test case and achieves the localization effect of different results, but also calculates the full coverage calculation results, and then determines and outputs the summarized results, realizing the diversification, localization, and flexibility of coverage calculation, and improving the user experience.
[0059] S280. The target coverage calculation result is reported and fed back to the target test dashboard through the target test execution and submission tool.
[0060] The technical solution of this invention involves acquiring and generating a current coverage annotation file package in real time based on the source code version file to be tested, using a preset coverage compilation method. Based on the scenario description information corresponding to the test platform, at least one test platform environment is combined to test the current coverage annotation file package, resulting in various current coverage data files. The current coverage annotation file package and each current coverage data file are parsed to generate a target coverage target directory list. Using a preset hierarchical coverage calculation method, combined with the target coverage target directory list, each current coverage data file is processed and calculated to obtain the target coverage calculation result. The target coverage calculation result is then reported and fed back to the target test dashboard through a target test execution and submission tool. This solves the problems of poor process repeatability and high maintenance costs caused by reliance on manual operations and lack of cross-platform testing. It enables offline testing in heterogeneous environments across multiple test platform scenarios, overcoming network and platform limitations, reducing costs, improving resource utilization, and achieving diversified, locatable, and flexible coverage calculation.
[0061] Example 3 Figure 3This is a schematic diagram of a coverage calculation device based on offline cover products according to Embodiment 3 of the present invention. The coverage calculation device based on offline cover products provided in this embodiment can be implemented by software and / or hardware, and can be configured in a terminal device or server to implement a coverage calculation method based on offline cover products according to an embodiment of the present invention. Figure 3 As shown, the device includes: a current coverage annotation file package generation module 310, a current coverage data file determination module 320, a target coverage target directory list generation module 330, a target coverage calculation result determination module 340, and a target coverage calculation result reporting and feedback module 350.
[0062] Among them, the current coverage annotation file package generation module 310 is used to obtain and generate the current coverage annotation file package in real time according to the source code version file to be tested through a preset coverage compilation method. The current coverage data file determination module 320 is used to combine at least one test platform environment based on the scenario description information corresponding to the test platform to perform test processing on the current coverage annotation file package, and obtain each current coverage data file. The target coverage target directory list generation module 330 is used to parse and process the current coverage annotation file package and each current coverage data file to generate a target coverage target directory list; The target coverage calculation result determination module 340 is used to process and calculate each of the current coverage data files by means of a preset hierarchical coverage calculation method and the target coverage target directory list, so as to obtain the target coverage calculation result. The target coverage calculation result reporting and feedback module 350 is used to report the target coverage calculation result to the target test dashboard through the target test execution and submission tool.
[0063] The technical solution of this invention involves acquiring and generating a current coverage annotation file package in real time based on the source code version file to be tested, using a preset coverage compilation method. Based on the scenario description information corresponding to the test platform, at least one test platform environment is combined to test the current coverage annotation file package, resulting in various current coverage data files. The current coverage annotation file package and each current coverage data file are parsed to generate a target coverage target directory list. Using a preset hierarchical coverage calculation method, combined with the target coverage target directory list, each current coverage data file is processed and calculated to obtain the target coverage calculation result. The target coverage calculation result is then reported and fed back to the target test dashboard through a target test execution and submission tool. This solves the problems of poor process repeatability and high maintenance costs caused by reliance on manual operations and lack of cross-platform testing. It enables offline testing in heterogeneous environments across multiple test platform scenarios, overcoming network and platform limitations, reducing costs, and improving resource utilization.
[0064] Based on the above embodiments, the current coverage data file determination module 320 can be specifically used to: based on the test platform, according to at least one operating system parameter information, version parameter information, and graphics processor parameter information in the scenario description information, combine them into at least one test platform environment through a preset test platform combination method; perform test processing on the current coverage annotation file through each of the test platform environments to obtain each current coverage data file; wherein, the test platform environment performs test processing, generates corresponding test tasks based on the received current coverage annotation files, divides the test tasks into multiple execution nodes for parallel execution, and aggregates and summarizes them according to their respective test names and task numbers after execution is completed.
[0065] Based on the above embodiments, the current coverage data file determination module 320 can also be specifically used to: after the current coverage annotation file is tested and processed by each of the test platform environments, during the test processing, set a coverage environment variable to relocate the current output path corresponding to each of the current coverage data files; after the test operation is completed in each of the test platform environments, perform offline backhaul processing of each of the current coverage data files according to the current output path.
[0066] Based on the above embodiments, the target coverage target directory list generation module 330 can be specifically used to: unpack the current coverage annotation file package and each current coverage data file, and unpack them to a preset current aggregation summary working directory; obtain and unify the current coverage timestamp marker after unpacking, and establish current reconstruction soft links corresponding to the current coverage annotation file package and each current coverage data file in the current aggregation summary working directory according to preset path mapping rules; generate a target coverage target directory list according to the current aggregation summary working directory and the current reconstruction soft links, so as to realize the coverage scan processing of the target coverage target directory list using the target test execution and submission tool.
[0067] Based on the above embodiments, the target coverage calculation result determination module 340 can be specifically used to: determine at least one currently pending directory list test task by sequentially traversing the target directory list according to the target coverage target directory list and through a preset task pool parallel quantity control strategy; generate independent test execution and submission tool scripts for each of the currently pending directory list test tasks through the hierarchical coverage calculation method, and calculate the individual coverage calculation result of each currently pending directory list test task based on each of the test execution and submission tool scripts; wherein, the individual coverage calculation result of each test task is used to locate each currently pending directory list test task; after determining that the target coverage target directory list has been traversed, generate the individual coverage calculation result of each currently pending directory list test task; and generate the target coverage calculation result based on the individual coverage calculation result of each test task.
[0068] Based on the above embodiments, the target coverage calculation result determination module 340 can be specifically used to: after determining that the target coverage target directory list has been traversed, calculate the coverage of the full target coverage target directory list to obtain the current full coverage calculation result; and generate the target coverage calculation result by summarizing the individual coverage calculation results of each test task and the current full coverage calculation result.
[0069] Based on the above embodiments, the target coverage calculation result reporting and feedback module 350 can be specifically used to: obtain current test context information; wherein, the current test context information includes the current annotation file, and the current annotation file includes at least one of the following command line information, submission number information, pipeline information, and serial number information; submit the current context information and the target coverage calculation result in segments through the target test execution and submission tool, and set a failure retry and retry interval mechanism in case of submission failure, so as to complete the reporting and feedback of the current context information and the target coverage calculation result to the target test dashboard for online result display; wherein, after the current context information and the target coverage calculation result, the module further includes: feeding back the current context information and the target coverage calculation result to the target offline evidence archive through the target test execution and submission tool, so as to realize offline recalculation and auditing operations based on the current context information and the target coverage calculation result.
[0070] The coverage calculation device based on offline covered products provided in the embodiments of the present invention can execute the coverage calculation method based on offline covered products provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the method.
[0071] Example 4 Figure 4 A schematic diagram of an electronic device 10, which can be used to implement Embodiment 4 of the present invention, is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0072] like Figure 4As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0073] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0074] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as coverage calculation methods based on offline overlay artifacts.
[0075] In some embodiments, the coverage calculation method based on offline overlay article can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the coverage calculation method based on offline overlay article described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the coverage calculation method based on offline overlay article by any other suitable means (e.g., by means of firmware).
[0076] The method includes: acquiring the source code version file to be tested in real time and generating a current coverage annotation file package using a preset coverage compilation method; combining at least one test platform environment based on the scenario description information corresponding to the test platform to test the current coverage annotation file package, obtaining each current coverage data file; parsing the current coverage annotation file package and each current coverage data file to generate a target coverage target directory list; processing and calculating each current coverage data file separately using a preset hierarchical coverage calculation method and the target coverage target directory list to obtain the target coverage calculation result; and reporting the target coverage calculation result to the target test dashboard through the target test execution and submission tool.
[0077] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0078] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0079] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0080] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0081] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0082] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0083] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0084] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
[0085] Example 5 Embodiment 5 of the present invention also provides a computer-readable storage medium, wherein the computer-readable instructions, when executed by a computer processor, are used to execute a coverage calculation method based on offline coverage artifacts. The method includes: acquiring in real time and, based on the source code version file to be tested, generating a current coverage annotation file package using a preset coverage compilation method; combining at least one test platform environment based on scenario description information corresponding to the test platform to perform test processing on the current coverage annotation file package, obtaining various current coverage data files; parsing the current coverage annotation file package and each current coverage data file to generate a target coverage target directory list; processing and calculating each current coverage data file separately using a preset hierarchical coverage calculation method, combined with the target coverage target directory list, to obtain a target coverage calculation result; and reporting the target coverage calculation result to the target test dashboard through a target test execution and submission tool.
[0086] Of course, the computer-executable instructions provided in the embodiments of the present invention, which include a computer-readable storage medium, are not limited to the method operations described above, but can also perform related operations in the coverage calculation method based on offline covering articles provided in any embodiment of the present invention.
[0087] Based on the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0088] It is worth noting that in the above embodiments of the coverage calculation method based on offline covering products, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the scope of protection of the present invention.
[0089] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for calculating coverage based on offline covered products, characterized in that, include: It acquires the source code version file to be tested in real time and generates a current coverage annotation file package using a preset coverage compilation method. Based on the scenario description information corresponding to the test platform, at least one test platform environment is combined to test the current coverage annotation file package and obtain each current coverage data file. The current coverage annotation file package and each current coverage data file are parsed and processed to generate a target coverage target directory list; Using a preset hierarchical coverage calculation method and in conjunction with the target coverage target directory list, each current coverage data file is processed and calculated to obtain the target coverage calculation result; The target coverage calculation results are reported and fed back to the target test dashboard through the target test execution and submission tool.
2. The method according to claim 1, characterized in that, The scenario description information corresponding to the test platform is combined into at least one test platform environment to perform test processing on the current coverage annotation file, resulting in a current coverage data file, including: Based on the test platform, at least one test platform environment is formed by combining at least one operating system parameter information, version parameter information, and graphics processor parameter information in the scenario description information through a preset test platform combination method. The current coverage annotation files are tested and processed through each of the test platform environments to obtain the current coverage data files. The test platform environment performs test processing, generates corresponding test tasks based on the received current coverage annotation file, divides the test tasks into multiple execution nodes for parallel execution, and aggregates and summarizes them according to their respective test names and task numbers after execution is completed.
3. The method according to claim 2, characterized in that, After the current coverage annotation file is tested and processed through each of the respective test platform environments, the method further includes: During test processing, a coverage environment variable is set to relocate the current output path corresponding to each of the current coverage data files. After the test operation is completed in each of the test platform environments, the offline return processing of each current coverage data file is performed according to the current output path.
4. The method according to claim 1, characterized in that, The step of parsing and processing the current coverage annotation file package and each current coverage data file to generate a target coverage target directory list includes: Unpack the current coverage annotation file package and each current coverage data file, and unpack them into the preset current aggregation summary working directory; Obtain and unpack the current coverage timestamp marker, and establish current reconstruction soft links corresponding to the current coverage annotation file package and each current coverage data file in the current aggregation summary working directory according to the preset path mapping rules; Based on the current aggregated summary working directory and the current rebuilt soft link, a target coverage target directory list is generated so that the target test execution and submission tool can be used to perform coverage scanning on the target coverage target directory list.
5. The method according to claim 3 or 4, characterized in that, The method involves processing and calculating each current coverage data file using a preset hierarchical coverage calculation method, combined with the target coverage target directory list, to obtain the target coverage calculation result, including: Based on the target coverage target directory list, at least one currently pending directory list test task is determined by sequentially traversing through the preset task pool parallel quantity control strategy. Using the hierarchical coverage calculation method, an independent test execution and submission tool script is generated for each of the current pending directory list test tasks, and the individual coverage calculation result for each current pending directory list test task is calculated based on each of the test execution and submission tool scripts. The individual coverage calculation results of each test task are used to locate each currently pending catalog test task. After completing the traversal of the target coverage target directory list, generate individual coverage calculation results for each test task corresponding to the current pending directory list test task. The target coverage calculation result is generated based on the individual coverage calculation results for each test task.
6. The method according to claim 5, characterized in that, The step of generating the target coverage calculation result based on the individual coverage calculation results of each test task includes: After determining that the target coverage target directory list has been traversed, the coverage of the full target coverage target directory list is calculated to obtain the current full coverage calculation result. The target coverage calculation result is generated by summing the individual coverage calculation results for each test task and the current full coverage calculation results.
7. The method according to claim 6, characterized in that, The step of reporting the target coverage calculation results to the target test dashboard through the target test execution and submission tool includes: Obtain the current test context information; wherein, the current test context information includes the current annotation file, and the current annotation file includes at least one of the following command line information, commit number information, pipeline information and serial number information; The current context information and the target coverage calculation result are submitted in segments through the target test execution and submission tool. A failure retry and retry interval mechanism is set in case of submission failure. The current context information and the target coverage calculation result are reported and fed back to the target test dashboard for online result display. The method further includes, after the current context information and the target coverage calculation result: The target test execution and submission tool feeds back the current context information and the target coverage calculation result to the target offline evidence archive, so as to realize offline recalculation and auditing operations based on the current context information and the target coverage calculation result.
8. A coverage calculation device based on offline covered products, characterized in that, include: The current coverage annotation file package generation module is used to obtain and generate the current coverage annotation file package in real time based on the source code version file to be tested, using a preset coverage compilation method. The current coverage data file determination module is used to combine at least one test platform environment based on the scenario description information corresponding to the test platform to perform test processing on the current coverage annotation file package, and obtain each current coverage data file. The target coverage target directory list generation module is used to parse and process the current coverage annotation file package and each current coverage data file to generate the target coverage target directory list; The target coverage calculation result determination module is used to process and calculate each of the current coverage data files by means of a preset hierarchical coverage calculation method and the target coverage target directory list, so as to obtain the target coverage calculation result. The target coverage calculation result reporting and feedback module is used to report the target coverage calculation result to the target test dashboard through the target test execution and submission tool.
9. An electronic 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, it implements a coverage calculation method based on offline cover products as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute a coverage calculation method based on an offline overlay product as described in any one of claims 1-7.