run_suite.py 1.76 KB
Newer Older
1
2
import argparse
import glob
3
import multiprocessing as mp
4
5
6
7
8

from sglang.test.test_utils import run_unittest_files

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

28
29
30
31
32
33
34
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)
35
36
37
38
39
40

if __name__ == "__main__":
    arg_parser = argparse.ArgumentParser()
    arg_parser.add_argument(
        "--timeout-per-file",
        type=int,
41
        default=2000,
42
43
44
45
46
47
48
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",
    )
    args = arg_parser.parse_args()

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

58
59
60
61
62
    try:
        mp.set_start_method("spawn")
    except RuntimeError:
        pass

63
64
    exit_code = run_unittest_files(files, args.timeout_per_file)
    exit(exit_code)