[CI] rename: per_commit -> registered (#13928)
This commit is contained in:
+28
-17
@@ -11,28 +11,43 @@ HW_MAPPING = {
|
|||||||
"amd": HWBackend.AMD,
|
"amd": HWBackend.AMD,
|
||||||
}
|
}
|
||||||
|
|
||||||
LABEL_MAPPING = {
|
PER_COMMIT_SUITES = {
|
||||||
HWBackend.CPU: ["default"],
|
HWBackend.CPU: ["default"],
|
||||||
HWBackend.AMD: ["stage-a-test-1"],
|
HWBackend.AMD: ["stage-a-test-1"],
|
||||||
HWBackend.CUDA: ["stage-a-test-1"],
|
HWBackend.CUDA: ["stage-a-test-1"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def _filter_tests(
|
def filter_tests(
|
||||||
ci_tests: List[CIRegistry], hw: HWBackend, suite: str
|
ci_tests: List[CIRegistry], hw: HWBackend, suite: str, nightly: bool = False
|
||||||
) -> List[CIRegistry]:
|
) -> List[CIRegistry]:
|
||||||
ci_tests = [t for t in ci_tests if t.backend == hw]
|
ci_tests = [
|
||||||
|
t
|
||||||
|
for t in ci_tests
|
||||||
|
if t.backend == hw and t.suite == suite and t.nightly == nightly
|
||||||
|
]
|
||||||
|
|
||||||
ret = []
|
ret = []
|
||||||
for t in ci_tests:
|
for t in ci_tests:
|
||||||
assert t.suite in LABEL_MAPPING[hw], f"Unknown stage {t.suite} for backend {hw}"
|
if not nightly:
|
||||||
if t.suite == suite:
|
assert (
|
||||||
|
t.suite in PER_COMMIT_SUITES[hw]
|
||||||
|
), f"Unknown stage {t.suite} for backend {hw}"
|
||||||
|
else:
|
||||||
|
raise NotImplementedError("Nightly tests are not implemented yet.")
|
||||||
|
|
||||||
|
if t.disabled is None:
|
||||||
ret.append(t)
|
ret.append(t)
|
||||||
|
print(f"Including test {t.filename}")
|
||||||
|
else:
|
||||||
|
print(f"Skipping disabled test {t.filename} due to: {t.disabled}")
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def run_per_commit(hw: HWBackend, suite: str):
|
def run_a_suite(hw: HWBackend, suite: str, nightly: bool = False):
|
||||||
files = glob.glob("per_commit/**/*.py", recursive=True)
|
files = glob.glob("registered/**/*.py", recursive=True)
|
||||||
ci_tests = _filter_tests(collect_tests(files), hw, suite)
|
ci_tests = filter_tests(collect_tests(files), hw, suite, nightly)
|
||||||
test_files = [TestFile(t.filename, t.est_time) for t in ci_tests]
|
test_files = [TestFile(t.filename, t.est_time) for t in ci_tests]
|
||||||
|
|
||||||
run_unittest_files(
|
run_unittest_files(
|
||||||
@@ -47,19 +62,15 @@ def main():
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--hw",
|
"--hw",
|
||||||
type=str,
|
type=str,
|
||||||
choices=["cpu", "cuda", "amd"],
|
choices=HW_MAPPING.keys(),
|
||||||
required=True,
|
required=True,
|
||||||
help="Hardware backend to run tests on.",
|
help="Hardware backend to run tests on.",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument("--suite", type=str, required=True, help="Test suite to run.")
|
||||||
"--suite",
|
parser.add_argument("--nightly", action="store_true")
|
||||||
type=str,
|
|
||||||
required=True,
|
|
||||||
help="Test suite to run.",
|
|
||||||
)
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
hw = HW_MAPPING[args.hw]
|
hw = HW_MAPPING[args.hw]
|
||||||
run_per_commit(hw, args.suite)
|
run_a_suite(hw, args.suite, args.nightly)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user