Skip to content

Commit 5e7ce49

Browse files
committed
fix path error
1 parent 98573dc commit 5e7ce49

7 files changed

Lines changed: 54 additions & 22 deletions

File tree

.github/workflows/_unit_test_coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ jobs:
355355
if [ -f "${filename}" ];then
356356
echo "Failed test cases:"
357357
cat "${filename}"
358-
echo "unittest_logs_url=${UNIT_TEST_LOGS_URL}"
358+
echo "unittest_logs_url=${unittest_logs_url}"
359359
fi
360360
exit "$TEST_EXIT_CODE"
361361
fi

scripts/coverage_run.sh

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ run_test_with_logging() {
5454
local log_prefix=$2
5555
local status
5656

57-
echo "Running: $test_file"
57+
echo "Running pytest file: $test_file"
5858

5959
# Create isolated log directory for this test to avoid race conditions
6060
# Format: unittest_logs/<test_dir>/<test_file_base>/log
@@ -97,9 +97,36 @@ run_test_with_logging() {
9797
grep -Rni --color=auto "error" "${isolated_log_dir}" || true
9898
fi
9999

100+
# print all server logs
101+
server_logs=("${run_path}"/*.log)
102+
if [ "${#server_logs[@]}" -gt 0 ]; then
103+
for server_log in "${server_logs[@]}"; do
104+
# skip failed_tests_file
105+
[[ "$(basename "$server_log")" == "$failed_tests_file" ]] && continue
106+
if [ -f "${server_log}" ]; then
107+
echo
108+
echo "---------------- ${server_log} (last 100 lines) ----------------"
109+
tail -n 100 "${server_log}" || true
110+
echo "---------------------------------------------------------------"
111+
fi
112+
done
113+
else
114+
echo "No *.log files found"
115+
fi
116+
100117
echo "======================================================="
101118
fi
102119

120+
# if passed, remove the isolated log directory and server logs
121+
if [ "$status" -eq 0 ]; then
122+
rm -rf "${isolated_log_dir}" || true
123+
# Clean up server logs in run_path on pass
124+
for f in "${run_path}"/*.log; do
125+
[[ "$(basename "$f")" != "${failed_tests_file}" ]] && rm -f "$f" || true
126+
done
127+
fi
128+
129+
103130
# Clean up port-related processes
104131
if [ -n "$FD_CACHE_QUEUE_PORT" ]; then
105132
ps -ef | grep "${FD_CACHE_QUEUE_PORT}" | grep -v grep | awk '{print $2}' | xargs -r kill -9 || true
@@ -297,25 +324,25 @@ echo "===================================="
297324

298325
# Exit with error and package logs if there were failures
299326
if [ "$failed_count" -ne 0 ]; then
300-
echo "Failed test cases are listed in $failed_tests_file"
301-
cat "$failed_tests_file"
327+
echo "Failed test cases are listed in $failed_tests_file"
328+
cat "$failed_tests_file"
302329

303-
# Only package logs when there are failures
304-
echo "===================================="
305-
echo "Step 5: Packaging logs (only on failure)"
306-
echo "===================================="
330+
# Only package logs when there are failures
331+
echo "===================================="
332+
echo "Step 5: Packaging logs (only on failure)"
333+
echo "===================================="
307334

308-
if [ -d "${run_path}/unittest_logs" ]; then
309-
tar -czf "${run_path}/unittest_logs.tar.gz" -C "${run_path}" unittest_logs
310-
echo "unittest_logs packaged to: ${run_path}/unittest_logs.tar.gz"
311-
ls -lh "${run_path}/unittest_logs.tar.gz"
312-
else
313-
echo "No unittest_logs directory found."
314-
fi
335+
if [ -d "${run_path}/unittest_logs" ]; then
336+
tar -czf "${run_path}/unittest_logs.tar.gz" -C "${run_path}" unittest_logs
337+
echo "Logs packaged to: ${run_path}/unittest_logs.tar.gz"
338+
ls -lh "${run_path}/unittest_logs.tar.gz"
339+
else
340+
echo "No unittest_logs directory found."
341+
fi
315342

316-
echo "===================================="
343+
echo "===================================="
317344

318-
exit 8
345+
exit 8
319346
fi
320347

321348
echo "All tests passed!"

tests/e2e/test_EB_Lite_serving.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,8 @@ def test_streaming_chat_finish_reason(openai_client):
13891389

13901390
def test_profile_reset_block_num():
13911391
"""测试profile reset_block_num功能,与baseline diff不能超过5%"""
1392-
log_file = "./log/config.log"
1392+
log_dir = os.getenv("FD_LOG_DIR", "log")
1393+
log_file = os.path.join(log_dir, "config.log")
13931394
baseline = 31446
13941395

13951396
if not os.path.exists(log_file):

tests/e2e/test_EB_VL_Lite_serving.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,8 @@ def test_chat_with_response_max_tokens(openai_client):
734734

735735
def test_profile_reset_block_num():
736736
"""测试profile reset_block_num功能,与baseline diff不能超过5%"""
737-
log_file = "./log/config.log"
737+
log_dir = os.getenv("FD_LOG_DIR", "log")
738+
log_file = os.path.join(log_dir, "config.log")
738739
baseline = 40000
739740

740741
if not os.path.exists(log_file):

tests/e2e/test_Qwen2-7B-Instruct_serving.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,8 @@ def test_streaming(openai_client, capsys):
612612

613613
def test_profile_reset_block_num():
614614
"""测试profile reset_block_num功能,与baseline diff不能超过5%"""
615-
log_file = "./log/config.log"
615+
log_dir = os.getenv("FD_LOG_DIR", "log")
616+
log_file = os.path.join(log_dir, "config.log")
616617
baseline = 32562
617618

618619
if not os.path.exists(log_file):

tests/e2e/test_Qwen2_5_VL_serving.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,8 @@ def test_streaming_chat_with_return_token_ids(openai_client, capsys):
430430

431431
def test_profile_reset_block_num():
432432
"""测试profile reset_block_num功能,与baseline diff不能超过15%"""
433-
log_file = "./log/config.log"
433+
log_dir = os.getenv("FD_LOG_DIR", "log")
434+
log_file = os.path.join(log_dir, "config.log")
434435
baseline = 30000
435436

436437
if not os.path.exists(log_file):

tests/entrypoints/openai/test_multi_api_server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ def test_start_servers_success(self, mock_is_port_available, mock_popen):
9999
# Verify environment variables are set correctly
100100
first_call_kwargs = mock_popen.call_args_list[0][1]
101101
self.assertIn("env", first_call_kwargs)
102-
self.assertEqual(first_call_kwargs["env"]["FD_LOG_DIR"], "log/log_0")
102+
log_dir = os.getenv("FD_LOG_DIR", "log")
103+
self.assertEqual(first_call_kwargs["env"]["FD_LOG_DIR"], os.path.join(log_dir, "log_0"))
103104

104105
@patch("fastdeploy.entrypoints.openai.multi_api_server.is_port_available")
105106
def test_check_param_success(self, mock_is_port_available):

0 commit comments

Comments
 (0)