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

from sglang.test.test_utils import run_unittest_files

suites = {
7
    "per-commit": [
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
        "test_abort.py",
14
        "test_chunked_prefill.py",
Shuo Yang's avatar
Shuo Yang committed
15
        "test_double_sparsity.py",
16
        "test_embedding_openai_server.py",
17
        "test_eval_accuracy_mini.py",
18
        "test_get_weights_by_name.py",
19
        "test_gguf.py",
Rin Intachuen's avatar
Rin Intachuen committed
20
        "test_input_embeddings.py",
21
        "test_json_constrained.py",
22
        "test_large_max_new_tokens.py",
Lianmin Zheng's avatar
Lianmin Zheng committed
23
        "test_metrics.py",
24
25
        "test_no_chunked_prefill.py",
        "test_no_overlap_scheduler.py",
Ying Sheng's avatar
Ying Sheng committed
26
        "test_openai_server.py",
27
        "test_pytorch_sampling_backend.py",
28
        "test_radix_attention.py",
29
        "test_retract_decode.py",
30
        "test_server_args.py",
Lianmin Zheng's avatar
Lianmin Zheng committed
31
        "test_session_control.py",
32
        "test_skip_tokenizer_init.py",
33
        "test_srt_engine.py",
34
        "test_srt_endpoint.py",
35
        "test_torch_compile.py",
36
        "test_torch_compile_moe.py",
37
38
        # Temporarily disable this because it requires PyTorch >= 2.5
        # "test_torch_native_attention_backend.py",
39
        "test_torchao.py",
Ke Bao's avatar
Ke Bao committed
40
41
        "test_triton_attention_kernels.py",
        "test_triton_attention_backend.py",
42
        "test_update_weights_from_disk.py",
43
        "test_vision_chunked_prefill.py",
44
        "test_vision_openai_server.py",
45
        "test_session_control.py",
46
    ],
47
48
49
50
    "nightly": [
        "test_nightly_gsm8k_eval.py",
        "test_nightly_human_eval.py",
    ],
51
52
53
    "sampling/penaltylib": glob.glob(
        "sampling/penaltylib/**/test_*.py", recursive=True
    ),
54
55
}

56
# Expand suite
57
58
59
60
61
62
63
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)
64

Mingyi's avatar
Mingyi committed
65

66
67
68
69
70
if __name__ == "__main__":
    arg_parser = argparse.ArgumentParser()
    arg_parser.add_argument(
        "--timeout-per-file",
        type=int,
71
        default=2000,
72
73
74
75
76
77
78
79
80
        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",
    )
81
82
83
84
85
86
87
88
89
90
91
92
    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.",
    )
93
94
95
96
97
98
99
    args = arg_parser.parse_args()

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

100
101
    files = files[args.range_begin : args.range_end]

Lianmin Zheng's avatar
Lianmin Zheng committed
102
    print(f"{args=}")
103
104
    print("The running tests are ", files)

105
106
    exit_code = run_unittest_files(files, args.timeout_per_file)
    exit(exit_code)