xref: /aosp_15_r20/external/pytorch/tools/code_coverage/package/util/setting.py (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1from __future__ import annotations
2
3import os
4from enum import Enum
5from typing import Dict, List, Set
6
7
8# <project folder>
9HOME_DIR = os.environ["HOME"]
10TOOLS_FOLDER = os.path.join(
11    os.path.dirname(os.path.realpath(__file__)), os.path.pardir, os.path.pardir
12)
13
14
15# <profile folder>
16PROFILE_DIR = os.path.join(TOOLS_FOLDER, "profile")
17JSON_FOLDER_BASE_DIR = os.path.join(PROFILE_DIR, "json")
18MERGED_FOLDER_BASE_DIR = os.path.join(PROFILE_DIR, "merged")
19SUMMARY_FOLDER_DIR = os.path.join(PROFILE_DIR, "summary")
20
21# <log path>
22LOG_DIR = os.path.join(PROFILE_DIR, "log")
23
24
25# test type, DO NOT change the name, it should be consistent with [buck query --output-attribute] result
26class TestType(Enum):
27    CPP: str = "cxx_test"
28    PY: str = "python_test"
29
30
31class Test:
32    name: str
33    target_pattern: str
34    test_set: str  # like __aten__
35    test_type: TestType
36
37    def __init__(
38        self, name: str, target_pattern: str, test_set: str, test_type: TestType
39    ) -> None:
40        self.name = name
41        self.target_pattern = target_pattern
42        self.test_set = test_set
43        self.test_type = test_type
44
45
46TestList = List[Test]
47TestStatusType = Dict[str, Set[str]]
48
49
50# option
51class Option:
52    need_build: bool = False
53    need_run: bool = False
54    need_merge: bool = False
55    need_export: bool = False
56    need_summary: bool = False
57    need_pytest: bool = False
58
59
60# test platform
61class TestPlatform(Enum):
62    FBCODE: str = "fbcode"
63    OSS: str = "oss"
64
65
66# compiler type
67class CompilerType(Enum):
68    CLANG: str = "clang"
69    GCC: str = "gcc"
70