Files
ccdi/run_duplicate_test.sh

65 lines
1.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
echo "================================"
echo "导入重复检测功能测试脚本"
echo "================================"
echo ""
# 检查Python是否安装
if ! command -v python3 &> /dev/null; then
echo "[错误] 未检测到Python请先安装Python 3.7+"
exit 1
fi
echo "[1/3] 检查Python依赖..."
python3 -c "import requests" 2>/dev/null
if [ $? -ne 0 ]; then
echo "[提示] 正在安装依赖库..."
pip3 install requests openpyxl
if [ $? -ne 0 ]; then
echo "[错误] 依赖安装失败"
exit 1
fi
fi
python3 -c "import openpyxl" 2>/dev/null
if [ $? -ne 0 ]; then
echo "[提示] 正在安装依赖库..."
pip3 install openpyxl
if [ $? -ne 0 ]; then
echo "[错误] 依赖安装失败"
exit 1
fi
fi
echo "[√] 依赖检查完成"
echo ""
echo "[2/3] 检查后端服务..."
curl -s http://localhost:8080/login/test > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "[警告] 无法连接到后端服务 (http://localhost:8080)"
echo "[提示] 请确认后端服务已启动"
echo ""
read -p "是否继续运行测试? (y/n): " continue
if [ "$continue" != "y" ]; then
exit 1
fi
else
echo "[√] 后端服务正常运行"
fi
echo ""
echo "[3/3] 开始运行测试..."
echo "================================"
echo ""
python3 doc/test-scripts/test_import_duplicate_detection.py
echo ""
echo "================================"
echo "测试完成"
echo ""
echo "测试报告保存在: doc/test-reports/"
echo "================================"