run_suite.py 2.62 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
        "test_chunked_prefill.py",
Shuo Yang's avatar
Shuo Yang committed
14
        "test_double_sparsity.py",
15
        "test_embedding_openai_server.py",
16
        "test_eval_accuracy_mini.py",
17
        "test_json_constrained.py",
18
        "test_large_max_new_tokens.py",
Lianmin Zheng's avatar
Lianmin Zheng committed
19
        "test_metrics.py",
20
21
        "test_no_chunked_prefill.py",
        "test_no_overlap_scheduler.py",
Ying Sheng's avatar
Ying Sheng committed
22
        "test_openai_server.py",
23
        "test_pytorch_sampling_backend.py",
24
        "test_radix_attention.py",
25
        "test_retract_decode.py",
26
        "test_server_args.py",
27
        "test_skip_tokenizer_init.py",
28
        "test_srt_engine.py",
29
        "test_srt_endpoint.py",
30
        "test_torch_compile.py",
31
        "test_torch_compile_moe.py",
32
        "test_torchao.py",
Ke Bao's avatar
Ke Bao committed
33
34
        "test_triton_attention_kernels.py",
        "test_triton_attention_backend.py",
35
        "test_update_weights.py",
36
        "test_vision_openai_server.py",
37
    ],
38
39
40
    "sampling/penaltylib": glob.glob(
        "sampling/penaltylib/**/test_*.py", recursive=True
    ),
41
42
}

43
44
45
46
47
48
49
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)
50

Mingyi's avatar
Mingyi committed
51

52
53
54
55
56
if __name__ == "__main__":
    arg_parser = argparse.ArgumentParser()
    arg_parser.add_argument(
        "--timeout-per-file",
        type=int,
57
        default=2000,
58
59
60
61
62
63
64
65
66
        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",
    )
67
68
69
70
71
72
73
74
75
76
77
78
    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.",
    )
79
80
81
82
83
84
85
    args = arg_parser.parse_args()

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

86
87
    files = files[args.range_begin : args.range_end]

88
89
    print("The running tests are ", files)

90
91
    exit_code = run_unittest_files(files, args.timeout_per_file)
    exit(exit_code)