feat(test): add ut-summary.json generation for test results and coverage - #317
Conversation
|
Warning
详情 {
"export": {
"tests/test-prj-running.sh": {
"b": [
"export builddir=build",
"export reportdir=build-ut",
"export scriptdir=\"$(cd \"$(dirname \"$0\")\" && pwd)\"",
"export projectdir=\"$(cd \"${scriptdir}/..\" && pwd)\""
]
}
}
} |
|
TAG Bot TAG: 6.5.59 |
Reviewer's GuideThis PR introduces a Python helper to aggregate gtest XML and lcov coverage into a single ut-summary.json, and wires it into the existing test-prj-running.sh flow while adjusting environment handling and preserving the test exit status, plus a minor project version bump. Sequence diagram for updated test-prj-running.sh and gen-ut-summary.py flowsequenceDiagram
actor Developer
participant test_prj_running_sh as tests/test-prj-running.sh
participant gtest as gtest
participant lcov as lcov
participant gen_ut_summary_py as tests/gen-ut-summary.py
participant ut_summary_json as build-ut/ut-summary.json
Developer->>test_prj_running_sh: tests/test-prj-running.sh
test_prj_running_sh->>test_prj_running_sh: export_projectdir_builddir_reportdir
test_prj_running_sh->>test_prj_running_sh: set_+e
test_prj_running_sh->>gtest: run_gtest_tests
gtest-->>test_prj_running_sh: gtest_XML_reports
test_prj_running_sh->>lcov: lcov --summary
lcov-->>test_prj_running_sh: lcov_summary_output
test_prj_running_sh->>gen_ut_summary_py: tests/gen-ut-summary.py
gen_ut_summary_py->>gen_ut_summary_py: parse_gtest_XML_and_lcov_summary
gen_ut_summary_py->>ut_summary_json: generate_ut-summary.json
gen_ut_summary_py-->>test_prj_running_sh: summary_generation_complete
test_prj_running_sh-->>Developer: propagate_test_exit_code
Flow diagram for ut-summary.json generation from gtest and lcovflowchart LR
A[test_prj_running_sh] --> B[gtest XML reports]
A --> C[lcov --summary output]
B --> D[gen_ut_summary_py]
C --> D[gen_ut_summary_py]
D --> E[build-ut/ut-summary.json]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
- Add gen-ut-summary.py: standalone script to parse gtest XML and lcov coverage data, output structured JSON (test_cases/line_coverage/function_coverage) - Update test-prj-running.sh: export env vars, set +e for test running, call gen-ut-summary.py, propagate test exit code
9593524 to
42cdd2f
Compare
|
Warning
详情 {
"export": {
"tests/test-prj-running.sh": {
"b": [
"export builddir=build",
"export reportdir=build-ut",
"export scriptdir=\"$(cd \"$(dirname \"$0\")\" && pwd)\"",
"export projectdir=\"$(cd \"${scriptdir}/..\" && pwd)\""
]
}
}
} |
deepin pr auto review★ 总体评分:75分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 diff --git a/tests/test-prj-running.sh b/tests/test-prj-running.sh
--- a/tests/test-prj-running.sh
+++ b/tests/test-prj-running.sh
@@ -78,6 +78,6 @@
# 生成摘要 JSON
echo "==> Generating summary JSON: ${report_path}/ut-summary.json"
-python3 "${scriptdir}/gen-ut-summary.py"
+python3 "${scriptdir}/gen-ut-summary.py" || true
exit $test_exit_code |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos, lzwind The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Summary
tests/gen-ut-summary.py: standalone script to parse gtest XML reports and lcov coverage data, generating a structuredut-summary.jsontests/test-prj-running.sh: export env vars,set +efor test running, callgen-ut-summary.py, propagate test exit codeOutput format
Running
test-prj-running.shnow generatesbuild-ut/ut-summary.json:{ "test_cases": { "total": 0, "passed": 0, "failed": 0 }, "line_coverage": { "total": 0, "passed": 0, "failed": 0, "coverage": "0.00%" }, "function_coverage": { "total": 0, "passed": 0, "failed": 0, "coverage": "0.00%" } }Test plan
Summary by Sourcery
Generate a unified unit-test summary JSON from gtest XML reports and lcov coverage data and integrate it into the existing test/coverage workflow.
New Features:
Enhancements: