Skip to content

Add ci case #3355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions test/ci_use/EB_Lite/test_EB_Lite_serving.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import os
import re
import signal
import socket
import subprocess
Expand Down Expand Up @@ -939,3 +940,42 @@ def test_streaming_completion_with_bad_words(openai_client, capsys):
assert hasattr(chunk.choices[0], "text")
output_1.append(chunk.choices[0].text)
assert output_0 not in output_1


def test_profile_reset_block_num():
"""测试profile reset_block_num功能,与baseline diff不能超过5%"""
log_file = "./log/config.log"
baseline = 6408

if not os.path.exists(log_file):
pytest.fail(f"Log file not found: {log_file}")

with open(log_file, "r") as f:
log_lines = f.readlines()

target_line = None
for line in log_lines:
if "Reset block num" in line:
target_line = line.strip()
break

if target_line is None:
pytest.fail("日志中没有Reset block num信息")

match = re.search(r"total_block_num:(\d+)", target_line)
if not match:
pytest.fail(f"Failed to extract total_block_num from line: {target_line}")

try:
actual_value = int(match.group(1))
except ValueError:
pytest.fail(f"Invalid number format: {match.group(1)}")

lower_bound = baseline * (1 - 0.05)
upper_bound = baseline * (1 + 0.05)
print(f"Reset total_block_num: {actual_value}. baseline: {baseline}")

assert lower_bound <= actual_value <= upper_bound, (
f"Reset total_block_num {actual_value} 与 baseline {baseline} diff需要在5%以内"
f"Allowed range: [{lower_bound:.1f}, {upper_bound:.1f}]"
)
40 changes: 40 additions & 0 deletions test/ci_use/EB_Lite_mtp/test_EB_Lite_serving_mtp.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import json
import os
import re
import signal
import socket
import subprocess
Expand Down Expand Up @@ -344,3 +345,42 @@ def test_streaming(openai_client, capsys):
for chunk in response:
output.append(chunk.choices[0].text)
assert len(output) > 0


def test_profile_reset_block_num():
"""测试profile reset_block_num功能,与baseline diff不能超过5%"""
log_file = "./log/config.log"
baseline = 6058

if not os.path.exists(log_file):
pytest.fail(f"Log file not found: {log_file}")

with open(log_file, "r") as f:
log_lines = f.readlines()

target_line = None
for line in log_lines:
if "Reset block num" in line:
target_line = line.strip()
break

if target_line is None:
pytest.fail("日志中没有Reset block num信息")

match = re.search(r"total_block_num:(\d+)", target_line)
if not match:
pytest.fail(f"Failed to extract total_block_num from line: {target_line}")

try:
actual_value = int(match.group(1))
except ValueError:
pytest.fail(f"Invalid number format: {match.group(1)}")

lower_bound = baseline * (1 - 0.05)
upper_bound = baseline * (1 + 0.05)
print(f"Reset total_block_num: {actual_value}. baseline: {baseline}")

assert lower_bound <= actual_value <= upper_bound, (
f"Reset total_block_num {actual_value} 与 baseline {baseline} diff需要在5%以内"
f"Allowed range: [{lower_bound:.1f}, {upper_bound:.1f}]"
)
40 changes: 40 additions & 0 deletions test/ci_use/EB_VL_Lite/test_EB_VL_Lite_serving.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import json
import os
import re
import signal
import socket
import subprocess
Expand Down Expand Up @@ -535,3 +536,42 @@ def test_chat_with_thinking(openai_client, capsys):
total_tokens += len(delta_message.completion_token_ids)
assert completion_tokens + reasoning_tokens == total_tokens
assert reasoning_tokens <= reasoning_max_tokens


def test_profile_reset_block_num():
"""测试profile reset_block_num功能,与baseline diff不能超过5%"""
log_file = "./log/config.log"
baseline = 15910

if not os.path.exists(log_file):
pytest.fail(f"Log file not found: {log_file}")

with open(log_file, "r") as f:
log_lines = f.readlines()

target_line = None
for line in log_lines:
if "Reset block num" in line:
target_line = line.strip()
break

if target_line is None:
pytest.fail("日志中没有Reset block num信息")

match = re.search(r"total_block_num:(\d+)", target_line)
if not match:
pytest.fail(f"Failed to extract total_block_num from line: {target_line}")

try:
actual_value = int(match.group(1))
except ValueError:
pytest.fail(f"Invalid number format: {match.group(1)}")

lower_bound = baseline * (1 - 0.05)
upper_bound = baseline * (1 + 0.05)
print(f"Reset total_block_num: {actual_value}. baseline: {baseline}")

assert lower_bound <= actual_value <= upper_bound, (
f"Reset total_block_num {actual_value} 与 baseline {baseline} diff需要在5%以内"
f"Allowed range: [{lower_bound:.1f}, {upper_bound:.1f}]"
)
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import concurrent.futures
import json
import os
import re
import signal
import socket
import subprocess
Expand Down Expand Up @@ -599,3 +600,42 @@ def test_streaming(openai_client, capsys):
for chunk in response:
output.append(chunk.choices[0].text)
assert len(output) > 0


def test_profile_reset_block_num():
"""测试profile reset_block_num功能,与baseline diff不能超过5%"""
log_file = "./log/config.log"
baseline = 7514

if not os.path.exists(log_file):
pytest.fail(f"Log file not found: {log_file}")

with open(log_file, "r") as f:
log_lines = f.readlines()

target_line = None
for line in log_lines:
if "Reset block num" in line:
target_line = line.strip()
break

if target_line is None:
pytest.fail("日志中没有Reset block num信息")

match = re.search(r"total_block_num:(\d+)", target_line)
if not match:
pytest.fail(f"Failed to extract total_block_num from line: {target_line}")

try:
actual_value = int(match.group(1))
except ValueError:
pytest.fail(f"Invalid number format: {match.group(1)}")

lower_bound = baseline * (1 - 0.05)
upper_bound = baseline * (1 + 0.05)
print(f"Reset total_block_num: {actual_value}. baseline: {baseline}")

assert lower_bound <= actual_value <= upper_bound, (
f"Reset total_block_num {actual_value} 与 baseline {baseline} diff需要在5%以内"
f"Allowed range: [{lower_bound:.1f}, {upper_bound:.1f}]"
)
42 changes: 41 additions & 1 deletion test/ci_use/Qwen3-MoE/test_Qwen3-MoE_serving.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import os
import re
import signal
import socket
import subprocess
Expand Down Expand Up @@ -116,7 +117,7 @@ def setup_and_run_server():
)

# Wait up to 300 seconds for API server to be ready
for _ in range(300):
for _ in range(480):
if is_port_open("127.0.0.1", FD_API_PORT):
print(f"API server is up on port {FD_API_PORT}")
break
Expand Down Expand Up @@ -297,3 +298,42 @@ def test_non_thinking_prompt(api_url, headers):
assert not any(
x in content for x in ["根据", "我认为", "推测", "可能"]
), "Expected no reasoning in non-thinking response"


def test_profile_reset_block_num():
"""测试profile reset_block_num功能,与baseline diff不能超过5%"""
log_file = "./log/config.log"
baseline = 3253

if not os.path.exists(log_file):
pytest.fail(f"Log file not found: {log_file}")

with open(log_file, "r") as f:
log_lines = f.readlines()

target_line = None
for line in log_lines:
if "Reset block num" in line:
target_line = line.strip()
break

if target_line is None:
pytest.fail("日志中没有Reset block num信息")

match = re.search(r"total_block_num:(\d+)", target_line)
if not match:
pytest.fail(f"Failed to extract total_block_num from line: {target_line}")

try:
actual_value = int(match.group(1))
except ValueError:
pytest.fail(f"Invalid number format: {match.group(1)}")

lower_bound = baseline * (1 - 0.05)
upper_bound = baseline * (1 + 0.05)
print(f"Reset total_block_num: {actual_value}. baseline: {baseline}")

assert lower_bound <= actual_value <= upper_bound, (
f"Reset total_block_num {actual_value} 与 baseline {baseline} diff需要在5%以内"
f"Allowed range: [{lower_bound:.1f}, {upper_bound:.1f}]"
)
Loading