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/43800 1. Move fbcode related coverage code to fb/ folder and add TARGETS so that we can use buck run to run the tool and solved the import probelm. 2. Write `README.md` to give users guidance about the tool Test Plan: On devserver: ``` buck run //caffe2/fb/code_coverage/tool:coverage -- //caffe2/c10: ``` More examples in README.md Reviewed By: malfet Differential Revision: D23404988 fbshipit-source-id: 4942cd0e0fb7bd28a5e884d9835b93f00adb7b92
24 lines
639 B
Python
24 lines
639 B
Python
import subprocess
|
|
|
|
from ..util.setting import TestPlatform
|
|
from ..util.utils import print_error
|
|
|
|
|
|
def run_cpp_test(binary_file: str) -> None:
|
|
# cpp test binary
|
|
try:
|
|
subprocess.check_call(binary_file)
|
|
except subprocess.CalledProcessError:
|
|
print_error(f"Binary failed to run: {binary_file}")
|
|
|
|
|
|
def get_tool_path_by_platform(platform: TestPlatform):
|
|
if platform == TestPlatform.FBCODE:
|
|
from caffe2.fb.code_coverage.tool.package.fbcode.utils import get_llvm_tool_path
|
|
|
|
return get_llvm_tool_path()
|
|
else:
|
|
from ..oss.utils import get_llvm_tool_path
|
|
|
|
return get_llvm_tool_path()
|