run_suite.py 2.26 KB
Newer Older
1
2
3
4
5
6
7
import argparse
import glob

from sglang.test.test_utils import run_unittest_files

suites = {
    "minimal": [
8
        "models/test_embedding_models.py",
Mingyi's avatar
Mingyi committed
9
        "models/test_generation_models.py",
10
        # "models/test_lora.py",
11
        "models/test_reward_models.py",
12
        "sampling/penaltylib",
13
14
        "test_chunked_prefill.py",
        "test_embedding_openai_server.py",
15
        "test_eval_accuracy_mini.py",
16
        "test_json_constrained.py",
17
        "test_large_max_new_tokens.py",
Ying Sheng's avatar
Ying Sheng committed
18
        "test_openai_server.py",
19
20
        "test_pytorch_sampling_backend.py",
        "test_server_args.py",
21
        "test_skip_tokenizer_init.py",
22
        "test_srt_endpoint.py",
23
        "test_torch_compile.py",
24
        "test_torchao.py",
Lianmin Zheng's avatar
Lianmin Zheng committed
25
        "test_triton_attn_backend.py",
26
        "test_update_weights.py",
27
        "test_vision_openai_server.py",
28
    ],
29
30
31
    "sampling/penaltylib": glob.glob(
        "sampling/penaltylib/**/test_*.py", recursive=True
    ),
32
33
}

34
35
36
37
38
39
40
for target_suite_name, target_tests in suites.items():
    for suite_name, tests in suites.items():
        if suite_name == target_suite_name:
            continue
        if target_suite_name in tests:
            tests.remove(target_suite_name)
            tests.extend(target_tests)
41

Mingyi's avatar
Mingyi committed
42

43
44
45
46
47
if __name__ == "__main__":
    arg_parser = argparse.ArgumentParser()
    arg_parser.add_argument(
        "--timeout-per-file",
        type=int,
48
        default=2000,
49
50
51
52
53
54
55
56
57
        help="The time limit for running one file in seconds.",
    )
    arg_parser.add_argument(
        "--suite",
        type=str,
        default=list(suites.keys())[0],
        choices=list(suites.keys()) + ["all"],
        help="The suite to run",
    )
58
59
60
61
62
63
64
65
66
67
68
69
    arg_parser.add_argument(
        "--range-begin",
        type=int,
        default=0,
        help="The begin index of the range of the files to run.",
    )
    arg_parser.add_argument(
        "--range-end",
        type=int,
        default=None,
        help="The end index of the range of the files to run.",
    )
70
71
72
73
74
75
76
    args = arg_parser.parse_args()

    if args.suite == "all":
        files = glob.glob("**/test_*.py", recursive=True)
    else:
        files = suites[args.suite]

77
78
    files = files[args.range_begin : args.range_end]

79
80
    exit_code = run_unittest_files(files, args.timeout_per_file)
    exit(exit_code)