Skip to content

Improve coverage support#2221

Merged
borisbat merged 6 commits intoGaijinEntertainment:masterfrom
aleksisch:feature/tests-with-coverage
Mar 10, 2026
Merged

Improve coverage support#2221
borisbat merged 6 commits intoGaijinEntertainment:masterfrom
aleksisch:feature/tests-with-coverage

Conversation

@aleksisch
Copy link
Contributor

@aleksisch aleksisch commented Mar 5, 2026

Add per file per function lines and branches coverage. Two outputs are supported, short format:

Coverage Summary
==============================================
File            Hits      Missed    Coverage
----------------------------------------------
main.das        3         1         75%
  main          3         1         75%
----------------------------------------------
TOTAL           3         1         75%

And lcov format:

TN:
SF:main.das
FN:6,main
FNDA:1,main
FNF:1
FNH:1
BRDA:8,0,0,1
BRDA:8,0,1,-
BRF:2
BRH:1
DA:11,0
DA:9,1
DA:8,1
DA:7,1
end_of_record

LCOV can be displayed in browser or somewhere else, using lcov utility. Or it can be parsed back and printed as a summary by utils/dascov/main.das.

@aleksisch aleksisch force-pushed the feature/tests-with-coverage branch 7 times, most recently from b7ff540 to 88507e9 Compare March 8, 2026 09:54
@aleksisch aleksisch changed the title WIP: improve coverage support Improve coverage support Mar 8, 2026
@aleksisch aleksisch force-pushed the feature/tests-with-coverage branch 8 times, most recently from 636f374 to 0adb588 Compare March 9, 2026 15:33
@aleksisch aleksisch changed the title Improve coverage support WIP: Improve coverage support Mar 9, 2026
@aleksisch aleksisch force-pushed the feature/tests-with-coverage branch from 0adb588 to 937152e Compare March 9, 2026 23:27
@aleksisch aleksisch changed the title WIP: Improve coverage support Improve coverage support Mar 9, 2026
@aleksisch aleksisch force-pushed the feature/tests-with-coverage branch 4 times, most recently from c5a0ba0 to 6a86ef4 Compare March 10, 2026 10:43
Return error if any file is failed to compile in aot batch.
Unify extra modules so it is not required to patch
compileDaScript to add new dependency anymore.
Add branches and functions to coverage macro.

Now coverage can be run using:
`./bin/daslang utils/dascov/main.das -- <your arguments>`
Add coverage measurements to tests. Also add them to CI.
Add parsing of lcov file to obtain summary coverage.
This tests was AI generated using coverage information.

1. Run all tests `./bin/daslang dastest/dastest.das -- --cov-path c.lcov --test tests/
2. Get summary `./bin/daslang utils/dascov/main.das -- c.lcov --exclude tests`
3. Ask your favorite AI to write tests for uncovered files
@aleksisch aleksisch force-pushed the feature/tests-with-coverage branch from 6a86ef4 to cad1107 Compare March 10, 2026 12:38
@borisbat borisbat merged commit 059526e into GaijinEntertainment:master Mar 10, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants