Update Nlbench_pro.sh

This commit is contained in:
Jensfrank 2024-07-02 14:49:14 +08:00 committed by GitHub
parent 2eb74fc482
commit 08910226fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -144,79 +144,98 @@ run_test() {
rm "$temp_file" rm "$temp_file"
} }
# 生成输出结果 # 格式化结果为 Markdown
generate_output() { format_results() {
local output_file=$1 local output_file=$1
echo "[tabs]"
echo # 处理yabs测试结果
echo "[tab=\"YABS\"]" local processed_yabs_result=$(cat "${output_file}_yabs")
echo "\`\`\`"
cat "${output_file}_yabs" # 处理融合怪结果
echo "\`\`\`" local processed_fusion_result=$(cat "${output_file}_ecs")
echo "[/tab]"
echo # 处理IP质量结果
echo "[tab=\"融合怪\"]" local processed_ip_result=$(cat "${output_file}_ip_quality")
echo "\`\`\`"
cat "${output_file}_ecs" # 处理流媒体解锁结果
echo "\`\`\`" local processed_streaming_result=$(cat "${output_file}_streaming")
echo "[/tab]"
echo # 处理响应测试结果
echo "[tab=\"IP质量\"]" local processed_response_result=$(cat "${output_file}_response")
cat "${output_file}_ip_quality"
echo "[/tab]" # 处理三网测速结果
echo local processed_speedtest_multi_result=$(cat "${output_file}_multi_thread")
echo "[tab=\"流媒体\"]" local processed_speedtest_single_result=$(cat "${output_file}_single_thread")
echo "\`\`\`"
cat "${output_file}_streaming" # 处理回程路由结果
echo "\`\`\`" local processed_autotrace_result=$(cat "${output_file}_route")
echo "[/tab]"
echo # Tabs分栏输出结果用于复制到Nodeloc论坛
echo "[tab=\"响应\"]" result="[tabs]
echo "\`\`\`" [tab=\"YABS\"]
cat "${output_file}_response" \`\`\`
echo "\`\`\`" $processed_yabs_result
echo "[/tab]" \`\`\`
echo [/tab]
echo "[tab=\"多线程测速\"]" [tab=\"融合怪\"]
echo "\`\`\`" \`\`\`
cat "${output_file}_multi_thread" $processed_fusion_result
echo "\`\`\`" \`\`\`
echo "[/tab]" [/tab]
echo [tab=\"IP质量\"]
echo "[tab=\"单线程测速\"]" \`\`\`
echo "\`\`\`" ########################################################################
cat "${output_file}_single_thread" $processed_ip_result
echo "\`\`\`" \`\`\`
echo "[/tab]" [/tab]
echo [tab=\"流媒体\"]
echo "[tab=\"回程路由\"]" \`\`\`
echo "\`\`\`" $processed_streaming_result
cat "${output_file}_route" \`\`\`
echo "\`\`\`" [/tab]
echo "[/tab]" [tab=\"响应\"]
echo \`\`\`
echo "[tab=\"去程路由\"]" $processed_response_result
echo "[/tab]" \`\`\`
echo [/tab]
echo "[tab=\"iperf3\"]" [tab=\"多线程测速\"]
echo "\`\`\`" \`\`\`
iperf3 -c iperf.online -P 8 -t 10 $processed_speedtest_multi_result
echo "\`\`\`" \`\`\`
echo "[/tab]" [/tab]
echo [tab=\"单线程测速\"]
echo "[tab=\"Ping.pe\"]" \`\`\`
echo "\`\`\`" $processed_speedtest_single_result
curl -s https://ping.pe/$ipv4_address | grep -E 'AS|Country|City' \`\`\`
echo "\`\`\`" [/tab]
echo "[/tab]" [tab=\"回程路由\"]
echo \`\`\`
echo "[tab=\"哪吒 ICMP\"]" $processed_autotrace_result
echo "[/tab]" \`\`\`
echo [/tab]
echo "[tab=\"其他\"]" [tab=\"去程路由\"]
echo "[/tab]"
echo [/tab]
echo "[/tabs]" [tab=\"iperf3\"]
\`\`\`
$(iperf3 -c iperf.online -P 8 -t 10)
\`\`\`
[/tab]
[tab=\"Ping.pe\"]
\`\`\`
$(curl -s https://ping.pe/$ipv4_address | grep -E 'AS|Country|City')
\`\`\`
[/tab]
[tab=\"哪吒 ICMP\"]
[/tab]
[tab=\"其他\"]
[/tab]
[/tabs]"
echo "$result" > "${output_file}.md"
echo -e "${YELLOW}结果已保存到 ${output_file}.md 文件中。${NC}"
} }
# 主函数 # 主函数
@ -314,7 +333,7 @@ main() {
fi fi
# 生成最终输出 # 生成最终输出
generate_output "$output_file" > "${output_file}.md" format_results "$output_file"
# 清理临时文件 # 清理临时文件
rm -f "${output_file}_"* rm -f "${output_file}_"*