@@ -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
299326if [ " $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
319346fi
320347
321348echo " All tests passed!"
0 commit comments