run_suite.py 2.47 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
        "test_radix_attention.py",
9
        "models/test_embedding_models.py",
Mingyi's avatar
Mingyi committed
10
        "models/test_generation_models.py",
11
        "models/test_lora.py",
12
        "models/test_reward_models.py",
13
        "sampling/penaltylib",
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_json_constrained.py",
19
        "test_large_max_new_tokens.py",
Ying Sheng's avatar
Ying Sheng committed
20
        "test_openai_server.py",
Lianmin Zheng's avatar
Lianmin Zheng committed
21
        "test_overlap_schedule.py",
22
        "test_pytorch_sampling_backend.py",
23
        "test_retract_decode.py",
24
        "test_server_args.py",
25
        "test_skip_tokenizer_init.py",
26
        "test_srt_engine.py",
27
        "test_srt_endpoint.py",
28
        "test_torch_compile.py",
29
        "test_torchao.py",
Lianmin Zheng's avatar
Lianmin Zheng committed
30
        "test_triton_attn_backend.py",
31
        "test_update_weights.py",
32
        "test_vision_openai_server.py",
33
    ],
34
35
36
    "sampling/penaltylib": glob.glob(
        "sampling/penaltylib/**/test_*.py", recursive=True
    ),
37
38
}

39
40
41
42
43
44
45
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)
46

Mingyi's avatar
Mingyi committed
47

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

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

82
83
    files = files[args.range_begin : args.range_end]

84
85
    print("The running tests are ", files)

86
87
    exit_code = run_unittest_files(files, args.timeout_per_file)
    exit(exit_code)