mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-23 06:34:55 +08:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/44568 By `lcov`, we can generate beautiful html. It's better than current file report and line report. Therefore in oss gcc, remove `export` code and `file/line level report` code, only use the html report. But in clang, since such tool is not available, we will still use file-report and line-report generated by ourself. Test Plan: Test in docker ubuntu machine. ## Mesurement 1. After running `atest`, it takes about 15 mins to collect code coverage and genrate the report. ``` # gcc code coverage python oss_coverage.py --run-only=atest ``` ## Presentation **The html result looks like:** *Top Level:* {F328330856} *File Level:* {F328336709} Reviewed By: malfet Differential Revision: D23550784 fbshipit-source-id: 1fff050e7f7d1cc8e86a6a200fd8db04b47f5f3e
25 lines
749 B
Python
25 lines
749 B
Python
#!/usr/bin/env python
|
|
import time
|
|
|
|
from package.oss.cov_json import get_json_report
|
|
from package.oss.init import initialization
|
|
from package.tool.summarize_jsons import summarize_jsons
|
|
from package.util.setting import TestPlatform
|
|
from package.util.utils import print_time
|
|
|
|
|
|
def report_coverage() -> None:
|
|
start_time = time.time()
|
|
(options, test_list, interested_folders) = initialization()
|
|
# run cpp tests
|
|
get_json_report(test_list, options)
|
|
# collect coverage data from json profiles
|
|
if options.need_summary:
|
|
summarize_jsons(test_list, interested_folders, [""], TestPlatform.OSS)
|
|
# print program running time
|
|
print_time("Program Total Time: ", start_time)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
report_coverage()
|