mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/43890 1. auto-detect `CXX` default compiler type in oss, and `clang` as default compiler type in fbcode (because auto-detecting will say `gcc` is the default compiler on devserver). 2. change `compiler type` from str `"CLANG" "GCC"` to enum type 3. rename function `get_cov_type` to `detect_compiler_type` 4. auto-set the default pytorch folder for users in oss Test Plan: on devserver: ``` buck run :coverage //caffe2/c10: ``` on oss: ``` python oss_coverage.py --run-only=atest ``` Reviewed By: malfet Differential Revision: D23420034 fbshipit-source-id: c0ea88188578bb1343a286f2090eb8a74cdf3982
35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
import time
|
|
|
|
from ..tool import clang_coverage, gcc_coverage
|
|
from ..util.setting import CompilerType, Option, TestList, TestPlatform
|
|
from ..util.utils import check_compiler_type, print_time
|
|
from .init import detect_compiler_type, gcc_export_init
|
|
from .run import clang_run, gcc_run
|
|
|
|
|
|
def get_json_report(test_list: TestList, options: Option):
|
|
start_time = time.time()
|
|
cov_type = detect_compiler_type()
|
|
check_compiler_type(cov_type)
|
|
if cov_type == CompilerType.CLANG:
|
|
# run
|
|
if options.need_run:
|
|
clang_run(test_list)
|
|
# merge && export
|
|
if options.need_merge:
|
|
clang_coverage.merge(test_list, TestPlatform.OSS)
|
|
if options.need_export:
|
|
clang_coverage.export(test_list, TestPlatform.OSS)
|
|
elif cov_type == CompilerType.GCC:
|
|
# run
|
|
if options.need_run:
|
|
gcc_run(test_list)
|
|
# export
|
|
if options.need_export:
|
|
gcc_export_init()
|
|
gcc_coverage.export()
|
|
|
|
print_time(
|
|
"collect coverage for cpp tests take time: ", start_time, summary_time=True
|
|
)
|