Integrated environment-oriented source code structure coverage rate acquisition and storage method and system
By employing instrumentation and automated scripting techniques in aero-engine control software, the problem of automating the collection and storage of source code structure coverage in an integrated environment was solved, thereby improving testing efficiency and accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA AERONAUTICAL CONTROL SYST RES INST
- Filing Date
- 2025-12-02
- Publication Date
- 2026-04-21
AI Technical Summary
In a hardware and software integrated environment, existing technologies struggle to efficiently and automatically collect and store the source code structure coverage of aero-engine control software, and manual analysis is time-consuming, labor-intensive, and prone to errors.
The instrumentation technique is used to transmit coverage information via serial communication. Combined with automated scripts and the VectorCast tool, the coverage instrumentation, collection, and storage of source code are automated, and a coverage report is generated.
It enables automated collection and storage of source code structure coverage, improving testing efficiency, shortening the testing cycle, and enhancing the sufficiency and accuracy of testing.
Smart Images

Figure CN121901095A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of aero-engine control software, and in particular to a method and system for acquiring and storing source code structure coverage for integrated environments. Background Technology
[0002] As a core component of an aircraft, the safety of the aircraft engine directly impacts flight safety. In the airworthiness standard DO-178C, section 6.4.4, structural coverage analysis involves two steps: requirements-based coverage analysis and structural coverage analysis. The first step analyzes test cases related to software requirements to determine if the selected test cases meet specific criteria. The second step determines that the requirements-based test procedures check the code structure against applicable coverage criteria. As highly safety-critical software, aircraft engine control software requires coverage analysis to check its code structure. If the applicable coverage is not met, additional activities should be implemented to address the issue.
[0003] Structural coverage analysis identifies which code structures (including interfaces between components) are not checked by requirements-based test procedures. Requirements-based test cases may not be able to fully check the code structure (including interfaces), therefore, structural coverage analysis is often performed on the source code and additional verification is generated to ensure the adequacy and accuracy of the tests.
[0004] Unlike unit testing, integrated hardware and software environments are characterized by high complexity and high cost. Structure coverage collection requires coordinated hardware and software testing and may involve real physical hardware or complex simulation environments. Furthermore, structure coverage collection in integrated hardware and software environments encounters problems such as spatial and temporal dilation and how to communicate and store coverage information. Relying entirely on manual analysis of source code structure coverage is not only time-consuming and labor-intensive but also prone to errors. Therefore, it is necessary to design a method that not only supports the collection of source code structure coverage but also automates batch processing to complete the collection and storage of structure coverage. Summary of the Invention
[0005] Purpose of the invention: The purpose of this invention is to provide a method and system for collecting and storing source code structure coverage for integrated environments.
[0006] Technical solution: The source code structure coverage acquisition and storage method for integrated environments described in this invention includes the following steps:
[0007] S1. Instrument the source code to support the output of VectorCast-related coverage information via serial communication.
[0008] S2. Perform coverage instrumentation on the source code after instrumentation;
[0009] S3. Copy the C file containing the collection coverage that comes with the VectorCast tool to the source code, compile the source code, and load the generated bin file into the controller;
[0010] S4. Run the program's automated script to collect coverage information;
[0011] S5. Use the VectorCast tool to load the txt file and generate a coverage report.
[0012] Furthermore, step S1 includes using the VectorCast tool to perform coverage instrumentation on the instrumented source code.
[0013] Further, step S2 includes:
[0014] S21. Create a working directory;
[0015] S22. Create a VectorCast project;
[0016] S23. Select the "C / C++" compilation option, set the project name and environment name, and load the source files;
[0017] S24. Perform coverage instrumentation on the source code.
[0018] Furthermore, step S3 includes downloading the compiled code to the controller, configuring the script information for automated execution after the program is powered on, including the encapsulated keywords and the path for storing the results.
[0019] Further, step S4 includes:
[0020] S41. The program powers on and enters normal operating mode;
[0021] S42, Encapsulation keywords;
[0022] S43. Run the automation script and save the coverage information.
[0023] Further, step S5 includes:
[0024] S51. Load the coverage result files in txt format generated in step 4 into the VectorCast tool in batches;
[0025] S52. Select the corresponding coverage file, view the coverage information, and perform analysis of statement coverage, decision coverage, and MCDC coverage;
[0026] S53, Export Coverage Report.
[0027] The source code structure coverage acquisition and storage system for integrated environments described in this invention includes:
[0028] The instrumentation module is used to perform coverage instrumentation on software code. It supports transmitting VectorCast-related coverage information via serial communication and using the VectorCast tool to perform coverage instrumentation on the source code after instrumentation.
[0029] The configuration module is used to download the compiled code to the controller and configure the script information for automated execution.
[0030] The export module is used to batch load the generated txt format coverage result files using the VectorCast tool and export the coverage report.
[0031] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages:
[0032] This invention supports the output of source code coverage information via serial communication, supports the automated collection and storage of code structure coverage for the entire project, supports batch import of automatically saved results, and performs analysis of statement coverage, decision coverage, and MCDC coverage. It can also generate and export coverage reports, saving testers time in collecting structural coverage of software code, improving the efficiency of software testing, shortening the entire software testing cycle, and improving the sufficiency and accuracy of testing. Attached Figure Description
[0033] Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation
[0034] The technical solution of the present invention will be further described below with reference to the accompanying drawings.
[0035] This invention provides a method for collecting and storing source code structure coverage for integrated environments, such as... Figure 1 As shown, it includes the following steps:
[0036] 1. Source code instrumentation outputs communication coverage information.
[0037] The software code undergoes coverage instrumentation, supporting the output of VectorCast-related coverage information via serial communication. The VectorCast tool is then used to perform coverage instrumentation on the instrumented source code. The instrumented code is then copied to the project to be compiled, and the project is compiled to ensure it runs correctly.
[0038] 2. Integrate with automated testing to achieve automatic saving of results.
[0039] The compiled code is downloaded to the controller. After the program is powered on, the script information for automated execution is configured, including encapsulated keywords and the path for storing results. After automated execution, the coverage information is automatically saved as a txt coverage file.
[0040] 3. Use VectorCast tool to export coverage analysis reports.
[0041] The generated txt format coverage result files can be batch loaded using the VectorCast tool to view coverage information, perform statement coverage, decision coverage, and MCDC coverage analysis, and export coverage reports.
[0042] The specific implementation steps of this invention include:
[0043] S1. Instrument the source code and support the output of VectorCast-related coverage information via serial communication.
[0044] Instrument the relevant function files.
[0045] S2. Perform coverage instrumentation on the instrumented source code.
[0046] S21. Create a working directory;
[0047] S22. Create a VectorCast project;
[0048] S23. Select the "C / C++" compilation option, set the project name and environment name, and load the source files;
[0049] S24. Perform coverage instrumentation on the source code.
[0050] S3. Copy the C file containing the collection coverage information that comes with VectorCast to the source code, compile the source code, and load the generated bin file into the controller.
[0051] S4. Run the automated script to collect coverage information.
[0052] S41. The program powers on and enters normal operating mode;
[0053] S42, Encapsulation keywords;
[0054] S43. Run the automation script and save the coverage information.
[0055] S5. Use the VectorCast tool to load the txt file and generate a coverage report.
[0056] S51. Load the coverage result files in txt format generated in step 4 into the VectorCast tool in batches;
[0057] S52. Select the corresponding coverage file, view the coverage information, and perform analysis of statement coverage, decision coverage, and MCDC coverage;
[0058] S53, Export Coverage Report.
[0059] The source code structure coverage acquisition and storage system for integrated environments described in this invention includes:
[0060] The instrumentation module is used to perform coverage instrumentation on software code. It supports transmitting VectorCast-related coverage information via serial communication and using the VectorCast tool to perform coverage instrumentation on the source code after instrumentation.
[0061] The configuration module is used to download the compiled code to the controller and configure the script information for automated execution.
[0062] The export module is used to batch load the generated txt format coverage result files using the VectorCast tool and export the coverage report.
Claims
1. A method for collecting and storing source code structure coverage for integrated environments, characterized in that, Includes the following steps: S1. Instrument the source code to support the output of VectorCast-related coverage information via serial communication. S2. Perform coverage instrumentation on the source code after instrumentation; S3. Copy the C file containing the collection coverage that comes with the VectorCast tool to the source code, compile the source code, and load the generated bin file into the controller; S4. Run the program's automated script to collect coverage information; S5. Use the VectorCast tool to load the txt file and generate a coverage report.
2. The method for collecting and storing source code structure coverage for integrated environments according to claim 1, characterized in that, Step S1 includes using the VectorCast tool to perform coverage instrumentation on the instrumented source code.
3. The method for collecting and storing source code structure coverage for integrated environments according to claim 1, characterized in that, Step S2 includes: S21. Create a working directory; S22. Create a VectorCast project; S23. Select the "C / C++" compilation option, set the project name and environment name, and load the source files; S24. Perform coverage instrumentation on the source code.
4. The method for collecting and storing source code structure coverage for integrated environments according to claim 1, characterized in that, Step S3 includes downloading the compiled code to the controller, configuring the script information for automated execution after the program is powered on, including the encapsulated keywords and the path for storing the results.
5. The method for collecting and storing source code structure coverage for integrated environments according to claim 1, characterized in that, Step S4 includes: S41. The program powers on and enters normal operating mode; S42, Encapsulation keywords; S43. Run the automation script and save the coverage information.
6. The method for collecting and storing source code structure coverage for integrated environments according to claim 1, characterized in that, Step S5 includes: S51. Load the coverage result files in txt format generated in step 4 into the VectorCast tool in batches; S52. Select the corresponding coverage file, view the coverage information, and perform analysis of statement coverage, decision coverage, and MCDC coverage; S53, Export Coverage Report.
7. A source code structure coverage acquisition and storage system for integrated environments, characterized in that, include: The instrumentation module is used to perform coverage instrumentation on software code. It supports transmitting VectorCast-related coverage information via serial communication and using the VectorCast tool to perform coverage instrumentation on the source code after instrumentation. The configuration module is used to download the compiled code to the controller and configure the script information for automated execution. The export module is used to batch load the generated txt format coverage result files using the VectorCast tool and export the coverage report.