Files
FastDeploy/scripts/coverage_run.sh
bukejiyu 77514e3e1e
Some checks failed
CE Compile Job / ce_job_pre_check (push) Has been cancelled
CE Compile Job / print_ce_job_pre_check_outputs (push) Has been cancelled
CE Compile Job / FD-Clone-Linux (push) Has been cancelled
CE Compile Job / Show Code Archive Output (push) Has been cancelled
CE Compile Job / BUILD_SM8090 (push) Has been cancelled
CE Compile Job / BUILD_SM8689 (push) Has been cancelled
CE Compile Job / CE_UPLOAD (push) Has been cancelled
Deploy GitHub Pages / deploy (push) Has been cancelled
Publish Job / publish_pre_check (push) Has been cancelled
Publish Job / print_publish_pre_check_outputs (push) Has been cancelled
Publish Job / FD-Clone-Linux (push) Has been cancelled
Publish Job / Show Code Archive Output (push) Has been cancelled
Publish Job / BUILD_SM8090 (push) Has been cancelled
Publish Job / BUILD_SM8689 (push) Has been cancelled
Publish Job / PADDLE_PYPI_UPLOAD_8090 (push) Has been cancelled
Publish Job / PADDLE_PYPI_UPLOAD_8689 (push) Has been cancelled
Publish Job / Run FastDeploy Unit Tests and Coverage (push) Has been cancelled
Publish Job / Run FastDeploy LogProb Tests (push) Has been cancelled
Publish Job / Extracted partial CE model tasks to run in CI. (push) Has been cancelled
Publish Job / Run Base Tests (push) Has been cancelled
Publish Job / Run Accuracy Tests (push) Has been cancelled
[V1 Loader] support weight_only (#3413)
* support wint4/wint8

* delete smoe case

* update ci

* print log
2025-08-23 13:13:41 +08:00

86 lines
2.5 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
run_path="$DIR/../tests/"
export PYTEST_INI="$DIR/../tests/pytest.ini"
cd "$run_path" || exit 1
failed_tests_file="failed_tests.log"
> "$failed_tests_file"
##################################
# 执行特殊单测case(不符合unittest/pytest格式)
##################################
special_tests=(
"graph_optimization/test_cuda_graph_dynamic_subgraph.py"
"graph_optimization/test_cuda_graph_spec_decode.py"
"layers/test_quant_layer.py"
"operators/test_token_penalty.py"
"operators/test_split_fuse.py"
"operators/test_flash_mask_attn.py"
"operators/test_w4afp8_gemm.py"
"model_loader/test_load_ernie_vl.py"
"operators/test_tree_mask.py"
)
failed_special=0
success_special=0
for test_file in "${special_tests[@]}"; do
if [ -f "$test_file" ]; then
echo "Running special test: $test_file"
python -m coverage run --parallel-mode "$test_file"
status=$?
if [ "$status" -ne 0 ]; then
echo "$test_file" >> "$failed_tests_file"
failed_special=$((failed_special+1))
else
success_special=$((success_special+1))
fi
else
echo "Warning: $test_file not found"
failed_special=$((failed_special+1))
fi
done
##################################
# 执行 pytest每个文件单独跑
##################################
# 收集 pytest 文件
TEST_FILES=$(python -m pytest --collect-only -q -c pytest.ini --disable-warnings | grep -Eo '^.*test_.*\.py' | sort | uniq)
failed_pytest=0
success_pytest=0
for file in $TEST_FILES; do
echo "Running pytest file: $file"
python -m coverage run --parallel-mode -m pytest "$file" -vv -s
status=$?
if [ "$status" -ne 0 ]; then
echo "$file" >> "$failed_tests_file"
failed_pytest=$((failed_pytest+1))
else
success_pytest=$((success_pytest+1))
fi
done
##################################
# 汇总结果
##################################
echo "===================================="
echo "Pytest total: $((failed_pytest + success_pytest))"
echo "Pytest successful: $success_pytest"
echo "Pytest failed: $failed_pytest"
echo "Special tests total: ${#special_tests[@]}"
echo "Special tests successful: $success_special"
echo "Special tests failed: $failed_special"
if [ "$failed_pytest" -ne 0 ] || [ "$failed_special" -ne 0 ]; then
echo "Failed test cases are listed in $failed_tests_file"
cat "$failed_tests_file"
exit 8
fi
echo "All tests passed!"