modify reboot endurance script

This commit is contained in:
Your Name
2025-05-07 08:15:13 +00:00
parent 8ba3039e36
commit 29c5beeb7b
5 changed files with 99 additions and 5 deletions

46
test_failure_item.sh Normal file
View File

@@ -0,0 +1,46 @@
#!/bin/bash
# 設定測試設備的IP地址
TARGET_IP=$DUT_IP
# 建立 test_report 資料夾,如果不存在的話
mkdir -p test_report
# 從文字檔中讀取測試項目
# 假設你的文字檔名叫 test_list.txt請根據實際情況修改
while IFS= read -r test_item || [[ -n "$test_item" ]]; do
# 移除可能的空白字符
test_item=$(echo "$test_item" | xargs)
# 跳過空行
[ -z "$test_item" ] && continue
echo "正在執行測試: $test_item"
# 執行測試
tast run "$TARGET_IP" "$test_item"
# 找到最新的測試結果資料夾
# 使用 ls -t 排序並取第一個(最新的)
latest_result=$(ls -td /tmp/tast/results/* | head -n 1)
if [ -d "$latest_result" ]; then
# 取得資料夾名稱
folder_name=$(basename "$latest_result")
# 新的資料夾名稱加上測試項目名稱
new_name="${folder_name}_${test_item}"
# 複製到 test_report 資料夾並重新命名
cp -r "$latest_result" "test_report/$new_name"
echo "測試結果已儲存至: test_report/$new_name"
else
echo "警告: 找不到測試結果資料夾 for $test_item"
fi
echo "----------------------------------------"
done < test_list.txt
echo "所有測試已完成!"