pytorch/tools/code_coverage/package/oss/run.py
yujunzhao@devvm229.ftw0.facebook.com 0564d7a652 Land code coverage tool for OSS (#43778)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/43778

Move code_coverage_tool from experimental folder to caffe2/tools folder.

Delete `TODO` and fb-related code.

Test Plan: Test locally

Reviewed By: malfet

Differential Revision: D23399983

fbshipit-source-id: 92316fd3cc88409d087d2dc6ed0be674155b3762
2020-08-28 13:56:15 -07:00

30 lines
1019 B
Python

import os
import time
from ..tool import clang_coverage, gcc_coverage
from ..util.setting import TestList, TestPlatform
from ..util.utils import get_raw_profiles_folder, print_time
from .utils import get_oss_binary_file
def clang_run(tests: TestList) -> None:
start_time = time.time()
for test in tests:
# raw_file
raw_file = os.path.join(get_raw_profiles_folder(), test.name + ".profraw")
# binary file
binary_file = get_oss_binary_file(test.name, test.test_type)
clang_coverage.run_target(
binary_file, raw_file, test.test_type, TestPlatform.OSS
)
print_time("running binaries takes time: ", start_time, summary_time=True)
def gcc_run(tests: TestList) -> None:
start_time = time.time()
for test in tests:
# binary file
binary_file = get_oss_binary_file(test.name, test.test_type)
gcc_coverage.run_target(binary_file, test.test_type)
print_time("run binaries takes time: ", start_time, summary_time=True)