mirror of
https://github.com/everett7623/nodeloc_vps_test.git
synced 2024-12-27 16:55:21 +00:00
Update nodeloc_vps_autotest_response.sh
This commit is contained in:
parent
4d0f5572ae
commit
981b538434
@ -91,14 +91,7 @@ show_welcome() {
|
|||||||
echo -e "${RED}---------------------------------By'Jensfrank---------------------------------${NC}"
|
echo -e "${RED}---------------------------------By'Jensfrank---------------------------------${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
echo "一键脚本将测试以下项目:"
|
echo "一键脚本将测试以下项目:"
|
||||||
echo "1. Yabs"
|
echo "响应测试"
|
||||||
echo "2. 融合怪"
|
|
||||||
echo "3. IP质量"
|
|
||||||
echo "4. 流媒体解锁"
|
|
||||||
echo "5. 响应测试"
|
|
||||||
echo "6. 多线程测试"
|
|
||||||
echo "7. 单线程测试"
|
|
||||||
echo "8. 回程路由"
|
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "${RED}按任意键开始测试...${NC}"
|
echo -e "${RED}按任意键开始测试...${NC}"
|
||||||
read -n 1 -s
|
read -n 1 -s
|
||||||
@ -108,12 +101,6 @@ show_welcome() {
|
|||||||
# 定义一个数组来存储每个命令的输出
|
# 定义一个数组来存储每个命令的输出
|
||||||
declare -a test_results
|
declare -a test_results
|
||||||
|
|
||||||
# 去除响应板块ANSI转义码
|
|
||||||
response_process_output() {
|
|
||||||
local input="$1"
|
|
||||||
echo "$input" | sed 's/\x1b\[[0-9;]*m//g'
|
|
||||||
}
|
|
||||||
|
|
||||||
# 在每个命令执行后保存结果
|
# 在每个命令执行后保存结果
|
||||||
run_and_capture() {
|
run_and_capture() {
|
||||||
local command_output
|
local command_output
|
||||||
@ -122,6 +109,12 @@ run_and_capture() {
|
|||||||
echo "$command_output"
|
echo "$command_output"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 去除响应板块ANSI转义码
|
||||||
|
response_process_output() {
|
||||||
|
local input="$1"
|
||||||
|
echo "$input" | sed -E 's/\x1b\[[0-9;]*[a-zA-Z]//g'
|
||||||
|
}
|
||||||
|
|
||||||
# 运行所有测试
|
# 运行所有测试
|
||||||
run_all_tests() {
|
run_all_tests() {
|
||||||
echo -e "${RED}开始测试,测试时间较长,请耐心等待...${NC}"
|
echo -e "${RED}开始测试,测试时间较长,请耐心等待...${NC}"
|
||||||
@ -137,9 +130,11 @@ run_all_tests() {
|
|||||||
|
|
||||||
# 格式化结果为 Markdown
|
# 格式化结果为 Markdown
|
||||||
format_results() {
|
format_results() {
|
||||||
# 处理响应测试结果
|
|
||||||
local processed_response_result
|
# 处理响应测试结果
|
||||||
processed_response_result=$(response_process_output "$response_result")
|
local processed_response_result
|
||||||
|
processed_response_result=$(response_process_output "$response_result")
|
||||||
|
|
||||||
result="[tabs]
|
result="[tabs]
|
||||||
[tab=\"响应\"]
|
[tab=\"响应\"]
|
||||||
\`\`\`
|
\`\`\`
|
||||||
@ -149,7 +144,7 @@ $processed_response_result
|
|||||||
[/tabs]"
|
[/tabs]"
|
||||||
|
|
||||||
echo "$result" > results.md
|
echo "$result" > results.md
|
||||||
echo -e "${GREEN}结果已保存到 results.md 文件中。${NC}"
|
echo -e "${YELLOW}结果已保存到 results.md 文件中。${NC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# 主函数
|
# 主函数
|
||||||
@ -157,9 +152,9 @@ main() {
|
|||||||
install_dependencies
|
install_dependencies
|
||||||
show_welcome
|
show_welcome
|
||||||
run_all_tests
|
run_all_tests
|
||||||
echo -e "${GREEN}所有测试完成。点击屏幕任意位置复制结果。${NC}"
|
echo -e "${YELLOW}所有测试完成,可到results.md复制到Nodeloc使用。${NC}"
|
||||||
read -n 1 -s
|
read -n 1 -s
|
||||||
echo "最终结果文件内容:" >&2
|
echo "最终测试结果如下:" >&2
|
||||||
cat results.md >&2
|
cat results.md >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user