run_suite.py 1.03 KB
Newer Older
Lianmin Zheng's avatar
Lianmin Zheng committed
1
2
import argparse
import glob
Lianmin Zheng's avatar
Lianmin Zheng committed
3

Byron Hsu's avatar
Byron Hsu committed
4
from sglang.test.test_utils import TestFile, run_unittest_files
Lianmin Zheng's avatar
Lianmin Zheng committed
5

6
suites = {
7
    "per-commit": [
Lianmin Zheng's avatar
Lianmin Zheng committed
8
        TestFile("test_srt_backend.py"),
9
10
        # Skip this due to some OPENAI_API_KEY issues
        # "test_openai_backend.py",
11
12
        TestFile("test_separate_reasoning.py"),
        TestFile("test_separate_reasoning_execution.py"),
13
    ],
14
15
}

Lianmin Zheng's avatar
Lianmin Zheng committed
16
17
18
19

if __name__ == "__main__":
    arg_parser = argparse.ArgumentParser()
    arg_parser.add_argument(
20
        "--timeout-per-file",
Lianmin Zheng's avatar
Lianmin Zheng committed
21
22
23
24
        type=int,
        default=1000,
        help="The time limit for running one file in seconds.",
    )
25
26
27
28
29
30
31
    arg_parser.add_argument(
        "--suite",
        type=str,
        default=list(suites.keys())[0],
        choices=list(suites.keys()) + ["all"],
        help="The suite to run",
    )
Lianmin Zheng's avatar
Lianmin Zheng committed
32
33
    args = arg_parser.parse_args()

34
35
36
37
    if args.suite == "all":
        files = glob.glob("**/test_*.py", recursive=True)
    else:
        files = suites[args.suite]
Lianmin Zheng's avatar
Lianmin Zheng committed
38

39
40
    exit_code = run_unittest_files(files, args.timeout_per_file)
    exit(exit_code)