Compare commits

..

4 Commits

Author SHA1 Message Date
Jensfrank
12b15e12d7
Update Nlbench.sh 2024-09-07 15:04:54 +08:00
Jensfrank
cd5677ae71
Update Nlbench.sh 2024-09-07 14:47:29 +08:00
Jensfrank
b60766e8f1
Update version.sh 2024-09-07 13:57:50 +08:00
Jensfrank
e0537f57e6
Update Nlbench.sh 2024-09-07 13:57:23 +08:00
2 changed files with 52 additions and 63 deletions

View File

@ -1,9 +1,10 @@
#!/bin/bash #!/bin/bash
# 定义版本 # 定义版本
CURRENT_VERSION="2024-08-28 v1.1.4" # 最新版本号 CURRENT_VERSION="2024-09-07 v1.2.0" # 最新版本号
SCRIPT_URL="https://raw.githubusercontent.com/everett7623/nodeloc_vps_test/main/Nlbench.sh" SCRIPT_URL="https://raw.githubusercontent.com/everett7623/nodeloc_vps_test/main/Nlbench.sh"
VERSION_URL="https://raw.githubusercontent.com/everett7623/nodeloc_vps_test/main/version.sh" VERSION_URL="https://raw.githubusercontent.com/everett7623/nodeloc_vps_test/main/version.sh"
PASTE_SERVICE_URL="http://nodeloc.uukk.de/test/"
# 定义颜色 # 定义颜色
RED='\033[0;31m' RED='\033[0;31m'
@ -368,38 +369,8 @@ run_script() {
sed -i '/^\s*$/d' "$temp_file" sed -i '/^\s*$/d' "$temp_file"
cp "$temp_file" "${output_file}_yabs" cp "$temp_file" "${output_file}_yabs"
;; ;;
# Geekbench5
2)
# 获取系统总内存包括swap单位为MB
total_memory_mb=$(free -m | awk '/^Mem:/{print $2}')
total_swap_mb=$(free -m | awk '/^Swap:/{print $2}')
total_memory_swap=$((total_memory_mb + total_swap_mb))
# 设置Geekbench 5所需的最小内存MB
min_required_memory=1024
if [ "$total_memory_swap" -lt "$min_required_memory" ]; then
echo "本机内存和Swap总计小于${min_required_memory}MB不满足GB5测试条件。"
echo "系统总内存: ${total_memory_mb}MB"
echo "Swap大小: ${total_swap_mb}MB"
echo "总计: ${total_memory_swap}MB"
echo "将跳过Geekbench 5测试进行其他测试项目。"
sleep 3
# 跳过Geekbench 5测试继续执行其他测试
# 可以在这里调用其他测试函数或脚本
else
echo -e "运行${YELLOW}Geekbench 5...${NC}"
bash <(curl -sL gb5.top) | tee "$temp_file"
sed -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file"
sed -i 's/\x1B\[.*?[mGKH]//g' "$temp_file"
sed -i 's/\r//' "$temp_file"
sed -i '/^$/d' "$temp_file"
sed -i -n '/当前时间:/,${p}' "$temp_file"
cp "$temp_file" "${output_file}_gb5"
fi
;;
# 融合怪 # 融合怪
3) 2)
echo -e "运行${YELLOW}融合怪...${NC}" echo -e "运行${YELLOW}融合怪...${NC}"
curl -L https://gitlab.com/spiritysdx/za/-/raw/main/ecs.sh -o ecs.sh && chmod +x ecs.sh && bash ecs.sh -m 1 <<< "y" | tee "$temp_file" curl -L https://gitlab.com/spiritysdx/za/-/raw/main/ecs.sh -o ecs.sh && chmod +x ecs.sh && bash ecs.sh -m 1 <<< "y" | tee "$temp_file"
sed -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file" sed -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file"
@ -409,7 +380,7 @@ run_script() {
cp "$temp_file" "${output_file}_fusion" cp "$temp_file" "${output_file}_fusion"
;; ;;
# IP质量 # IP质量
4) 3)
echo -e "运行${YELLOW}IP质量测试...${NC}" echo -e "运行${YELLOW}IP质量测试...${NC}"
echo y | bash <(curl -Ls IP.Check.Place) | tee "$temp_file" echo y | bash <(curl -Ls IP.Check.Place) | tee "$temp_file"
sed -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file" sed -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file"
@ -420,7 +391,7 @@ run_script() {
cp "$temp_file" "${output_file}_ip_quality" cp "$temp_file" "${output_file}_ip_quality"
;; ;;
# 流媒体解锁 # 流媒体解锁
5) 4)
echo -e "运行${YELLOW}流媒体解锁测试...${NC}" echo -e "运行${YELLOW}流媒体解锁测试...${NC}"
local region=$(detect_region) local region=$(detect_region)
bash <(curl -L -s media.ispvps.com) <<< "$region" | tee "$temp_file" bash <(curl -L -s media.ispvps.com) <<< "$region" | tee "$temp_file"
@ -431,21 +402,21 @@ run_script() {
cp "$temp_file" "${output_file}_streaming" cp "$temp_file" "${output_file}_streaming"
;; ;;
# 响应测试 # 响应测试
6) 5)
echo -e "运行${YELLOW}响应测试...${NC}" echo -e "运行${YELLOW}响应测试...${NC}"
bash <(curl -sL https://nodebench.mereith.com/scripts/curltime.sh) | tee "$temp_file" bash <(curl -sL https://nodebench.mereith.com/scripts/curltime.sh) | tee "$temp_file"
sed -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file" sed -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file"
cp "$temp_file" "${output_file}_response" cp "$temp_file" "${output_file}_response"
;; ;;
# 多线程测速 # 多线程测速
7) 6)
echo -e "运行${YELLOW}多线程测速...${NC}" echo -e "运行${YELLOW}多线程测速...${NC}"
if [ "$use_ipv6" = true ]; then if [ "$use_ipv6" = true ]; then
echo "使用IPv6测试选项" echo "使用IPv6测试选项"
bash <(curl -sL bash.icu/speedtest) <<< "3" | tee "$temp_file" bash <(curl -sL https://raw.githubusercontent.com/i-abc/Speedtest/main/speedtest.sh) <<< "3" | tee "$temp_file"
else else
echo "使用IPv4测试选项" echo "使用IPv4测试选项"
bash <(curl -sL bash.icu/speedtest) <<< "1" | tee "$temp_file" bash <(curl -sL https://raw.githubusercontent.com/i-abc/Speedtest/main/speedtest.sh) <<< "1" | tee "$temp_file"
fi fi
sed -r -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file" sed -r -i 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file"
sed -i -r '1,/序号\:/d' "$temp_file" sed -i -r '1,/序号\:/d' "$temp_file"
@ -455,7 +426,7 @@ run_script() {
cp "$temp_file" "${output_file}_multi_thread" cp "$temp_file" "${output_file}_multi_thread"
;; ;;
# 单线程测速 # 单线程测速
8) 7)
echo -e "运行${YELLOW}单线程测速...${NC}" echo -e "运行${YELLOW}单线程测速...${NC}"
if [ "$use_ipv6" = true ]; then if [ "$use_ipv6" = true ]; then
echo "使用IPv6测试选项" echo "使用IPv6测试选项"
@ -472,7 +443,7 @@ run_script() {
cp "$temp_file" "${output_file}_single_thread" cp "$temp_file" "${output_file}_single_thread"
;; ;;
# iperf3测试 # iperf3测试
9) 8)
echo -e "运行${YELLOW}iperf3测试...${NC}" echo -e "运行${YELLOW}iperf3测试...${NC}"
run_iperf3_test | tee "$temp_file" run_iperf3_test | tee "$temp_file"
sed -i -e 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file" sed -i -e 's/\x1B\[[0-9;]*[JKmsu]//g' "$temp_file"
@ -481,7 +452,7 @@ run_script() {
cp "$temp_file" "${output_file}_iperf3" cp "$temp_file" "${output_file}_iperf3"
;; ;;
# 回程路由 # 回程路由
10) 9)
echo -e "运行${YELLOW}回程路由测试...${NC}" echo -e "运行${YELLOW}回程路由测试...${NC}"
if [ "$use_ipv6" = true ]; then if [ "$use_ipv6" = true ]; then
echo "使用IPv6测试选项" echo "使用IPv6测试选项"
@ -501,36 +472,54 @@ run_script() {
# 生成最终的 Markdown 输出 # 生成最终的 Markdown 输出
generate_markdown_output() { generate_markdown_output() {
local base_output_file=$1 local base_output_file=$1
local final_output_file="${base_output_file}.md" local temp_output_file="${base_output_file}.md"
local sections=("YABS" "Geekbench5" "融合怪" "IP质量" "流媒体" "响应" "多线程测速" "单线程测速" "iperf3" "回程路由") local sections=("YABS" "Geekbench5" "融合怪" "IP质量" "流媒体" "响应" "多线程测速" "单线程测速" "iperf3" "回程路由")
local file_suffixes=("yabs" "gb5" "fusion" "ip_quality" "streaming" "response" "multi_thread" "single_thread" "iperf3" "route") local file_suffixes=("yabs" "gb5" "fusion" "ip_quality" "streaming" "response" "multi_thread" "single_thread" "iperf3" "route")
local empty_tabs=("去程路由" "Ping.pe" "哪吒 ICMP" "其他") local empty_tabs=("去程路由" "Ping.pe" "哪吒 ICMP" "其他")
echo "[tabs]" > "$final_output_file" echo "[tabs]" > "$temp_output_file"
# 输出有内容的标签 # 输出有内容的标签
for i in "${!sections[@]}"; do for i in "${!sections[@]}"; do
section="${sections[$i]}" section="${sections[$i]}"
suffix="${file_suffixes[$i]}" suffix="${file_suffixes[$i]}"
if [ -f "${base_output_file}_${suffix}" ]; then if [ -f "${base_output_file}_${suffix}" ]; then
echo "[tab=\"$section\"]" >> "$final_output_file" echo "[tab=\"$section\"]" >> "$temp_output_file"
echo "\`\`\`" >> "$final_output_file" echo "\`\`\`" >> "$temp_output_file"
cat "${base_output_file}_${suffix}" >> "$final_output_file" cat "${base_output_file}_${suffix}" >> "$temp_output_file"
echo "\`\`\`" >> "$final_output_file" echo "\`\`\`" >> "$temp_output_file"
echo "[/tab]" >> "$final_output_file" echo "[/tab]" >> "$temp_output_file"
rm "${base_output_file}_${suffix}" rm "${base_output_file}_${suffix}"
fi fi
done done
# 添加保留的空白标签 # 添加保留的空白标签
for tab in "${empty_tabs[@]}"; do for tab in "${empty_tabs[@]}"; do
echo "[tab=\"$tab\"]" >> "$final_output_file" echo "[tab=\"$tab\"]" >> "$temp_output_file"
echo "[/tab]" >> "$final_output_file" echo "[/tab]" >> "$temp_output_file"
done done
echo "[/tabs]" >> "$final_output_file" echo "[/tabs]" >> "$temp_output_file"
echo "所有测试完成,结果已保存在 $final_output_file 中。" # 生成包含时间戳和随机字符的文件名
local timestamp=$(date +"%Y%m%d%H%M%S")
local random_chars=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1)
local filename="${timestamp}${random_chars}.txt"
# 构造完整的URL
local url="${PASTE_SERVICE_URL}${filename}"
# 上传文件
if curl -s -X PUT --data-binary @"$temp_output_file" "$url"; then
echo "测试结果已上传。您可以在以下链接查看:"
echo "$url"
echo "结果链接已保存到 $base_output_file.url"
echo "$url" > "$base_output_file.url"
else
echo "上传失败。结果已保存在本地文件 $temp_output_file"
fi
rm "$temp_output_file"
read -p "按回车键继续..." read -p "按回车键继续..."
clear clear
} }
@ -552,15 +541,14 @@ run_selected_scripts() {
local base_output_file="NLvps_results_$(date +%Y%m%d_%H%M%S)" local base_output_file="NLvps_results_$(date +%Y%m%d_%H%M%S)"
echo -e "${YELLOW}Nodeloc VPS 自动测试脚本 $VERSION${NC}" echo -e "${YELLOW}Nodeloc VPS 自动测试脚本 $VERSION${NC}"
echo "1. Yabs" echo "1. Yabs"
echo "2. Geekbench5" echo "2. 融合怪"
echo "3. 融合怪" echo "3. IP质量"
echo "4. IP质量" echo "4. 流媒体解锁"
echo "5. 流媒体解锁" echo "5. 响应测试"
echo "6. 响应测试" echo "6. 多线程测试"
echo "7. 多线程测试" echo "7. 单线程测试"
echo "8. 单线程测试" echo "8. iperf3"
echo "9. iperf3" echo "9. 回程路由"
echo "10. 回程路由"
echo "0. 返回" echo "0. 返回"
while true; do while true; do
@ -568,7 +556,7 @@ run_selected_scripts() {
if [[ "$script_numbers" =~ ^(0|10|[1-9])(,(0|10|[1-9]))*$ ]]; then if [[ "$script_numbers" =~ ^(0|10|[1-9])(,(0|10|[1-9]))*$ ]]; then
break break
else else
echo -e "${RED}无效输入请输入0-10之间的数字,用英文逗号分隔。${NC}" echo -e "${RED}无效输入请输入0-9之间的数字,用英文逗号分隔。${NC}"
fi fi
done done
@ -588,7 +576,7 @@ run_selected_scripts() {
# 主菜单 # 主菜单
main_menu() { main_menu() {
echo -e "${GREEN}测试项目:${NC}YabsGeekbench5融合怪IP质量流媒体解锁响应测试多线程测试" echo -e "${GREEN}测试项目:${NC}Yabs融合怪IP质量流媒体解锁响应测试多线程测试"
echo " 单线程测试iperf3回程路由。" echo " 单线程测试iperf3回程路由。"
echo -e "${YELLOW}1. 执行所有测试脚本${NC}" echo -e "${YELLOW}1. 执行所有测试脚本${NC}"
echo -e "${YELLOW}2. 选择特定测试脚本${NC}" echo -e "${YELLOW}2. 选择特定测试脚本${NC}"

View File

@ -17,3 +17,4 @@
# 2024-08-13 v1.1.2 - 优化tab标签。 # 2024-08-13 v1.1.2 - 优化tab标签。
# 2024-08-19 v1.1.3 - 优化系统更新代码。 # 2024-08-19 v1.1.3 - 优化系统更新代码。
# 2024-08-28 v1.1.4 - 优化系统更新代码。 # 2024-08-28 v1.1.4 - 优化系统更新代码。
# 2024-09-07 v1.2.0 - 优化系统更新代码。