Skip to content
This repository was archived by the owner on Sep 4, 2025. It is now read-only.

Commit 5c44d84

Browse files
committed
add smoke/unit tests scripts
1 parent 40ae5b9 commit 5c44d84

File tree

2 files changed

+116
-0
lines changed

2 files changed

+116
-0
lines changed

extras/smoke-test.sh

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/bash
2+
set -uxo pipefail
3+
4+
# we will need to download test models off HF hub
5+
unset HF_HUB_OFFLINE
6+
7+
export HTTP_PORT=8080
8+
export GRPC_PORT=8033
9+
10+
11+
function wait_for(){
12+
trap "" ERR # we don't care about errors in this function
13+
14+
name=$1
15+
shift
16+
command=$@
17+
18+
max_retries=10
19+
until $command ; do
20+
echo "Waiting for $name to be up (retries_left=$max_retries)..."
21+
sleep 30
22+
max_retries=$((max_retries-1))
23+
if [[ max_retries -le 0 ]]; then
24+
echo "Timed out waiting for $name server" >&2
25+
exit 1
26+
fi
27+
done
28+
}
29+
30+
# stop the server on any errors
31+
trap 'kill -9 $server_pid && exit 1' ERR
32+
33+
# spin up the OpenAPI server in the background
34+
python -m vllm.entrypoints.openai.api_server --port $HTTP_PORT &
35+
server_pid=$!
36+
server_url="http://localhost:$HTTP_PORT"
37+
38+
wait_for "http server" curl --verbose --connect-timeout 1 --fail-with-body --no-progress-meter "${server_url}/health"
39+
40+
curl -v --no-progress-meter --fail-with-body \
41+
"${server_url}/v1/models" | python -m json.tool || \
42+
43+
curl -v --no-progress-meter --fail-with-body \
44+
--header "Content-Type: application/json" \
45+
--data '{
46+
"prompt": "A red fedora symbolizes ",
47+
"model": "facebook/opt-125m"
48+
}' \
49+
"${server_url}/v1/completions" | python -m json.tool
50+
51+
echo "OpenAI API success" && kill -9 $server_pid
52+
53+
54+
# spin up the grpc server in the background
55+
python -m vllm_tgis_adapter --grpc-port $GRPC_PORT &
56+
server_pid=$!
57+
server_url="localhost:$GRPC_PORT"
58+
59+
# get grpcurl
60+
curl --no-progress-meter --location --output /tmp/grpcurl.tar.gz \
61+
https://github.com/fullstorydev/grpcurl/releases/download/v1.9.1/grpcurl_1.9.1_linux_x86_64.tar.gz
62+
tar -xf /tmp/grpcurl.tar.gz --directory /tmp
63+
64+
wait_for "grpc_server" grpc_healthcheck # healthcheck is part of vllm_tgis_adapter
65+
66+
/tmp/grpcurl -v \
67+
-plaintext \
68+
-use-reflection \
69+
-d '{ "requests": [{"text": "A red fedora symbolizes "}]}' \
70+
"$server_url" \
71+
fmaas.GenerationService/Generate
72+
73+
echo "GRPC API success" && kill -9 $server_pid

extras/unit-tests.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
# partially copied from from .buildkite/test-pipeline.yml
3+
4+
cd tests || exit 1
5+
6+
# we will need to download test models off HF hub
7+
unset HF_HUB_OFFLINE
8+
9+
# basic correctness
10+
pytest -v -s test_regression.py
11+
pytest -v -s async_engine
12+
VLLM_ATTENTION_BACKEND=XFORMERS pytest -v -s basic_correctness/test_basic_correctness.py
13+
VLLM_ATTENTION_BACKEND=FLASH_ATTN pytest -v -s basic_correctness/test_basic_correctness.py
14+
VLLM_ATTENTION_BACKEND=XFORMERS pytest -v -s basic_correctness/test_chunked_prefill.py
15+
VLLM_ATTENTION_BACKEND=FLASH_ATTN pytest -v -s basic_correctness/test_chunked_prefill.py
16+
VLLM_TEST_ENABLE_ARTIFICIAL_PREEMPT=1 pytest -v -s basic_correctness/test_preemption.py
17+
18+
# core
19+
pytest -v -s core
20+
21+
# note: distributed tests are disabled
22+
23+
# engine tests
24+
pytest -v -s engine tokenization test_sequence.py test_config.py test_logger.py
25+
# entrypoint
26+
pytest -v -s entrypoints -m openai
27+
28+
#inputs (note: multimodal tests are skipped)
29+
pytest -v -s test_inputs.py
30+
31+
#models
32+
pytest -v -s models -m \"not vlm\"
33+
34+
# misc
35+
pytest -v -s prefix_caching
36+
pytest -v -s samplers
37+
pytest -v -s test_logits_processor.py
38+
pytest -v -s models -m \"not vlm\"
39+
pytest -v -s worker
40+
VLLM_ATTENTION_BACKEND=XFORMERS pytest -v -s spec_decode
41+
# pytest -v -s tensorizer_loader # disabled: requires libsodium
42+
pytest -v -s metrics
43+
pytest -v -s quantization

0 commit comments

Comments
 (0)