#!/bin/bash view_url=https://ci.linaro.org/view/ views=(tcwg_bmk tcwg_bmk-bisect tcwg_gcc tcwg_gnu_native tcwg_gnu_cross tcwg_kernel-gnu tcwg_kernel-llvm) declare -A nb declare -A all # get view html file for view in "${views[@]}"; do wget -o /dev/null -O "/tmp/$view.html" "$view_url/$view" done # Print INSTANT PICTURE status list_pat=("Success" "In progress" "Failed" "Aborted" "Disabled") printf "%-22s | %13s | %13s | %13s | %13s | %13s |\n" "TODAY PICTURE" "${list_pat[@]}" printf "========================================================================================================\n" for view in "${views[@]}"; do printf "%-22s |" "$view" for pat in "${list_pat[@]}"; do nb["$pat"]=$(grep -c "tooltip=\"$pat\"" < "/tmp/$view.html") all["$pat"]=$((all["$pat"] + nb["$pat"])) printf " %13s |" "${nb["$pat"]}" done printf "\n" done printf "========================================================================================================\n" printf "%-22s | %13s | %13s | %13s | %13s | %13s |\n" \ "TOTAL" "${all[Success]}" "${all[In progress]}" "${all[Failed]}" "${all[Aborted]}" "${all[Disabled]}" echo "" echo "" # Print WHEATHER PICTURE status list_name=("No-fail" "1-fail" "2-fails" "3-fails" "4-fails" "All-fails") list_pat=("No recent" "1 out of the last 5" "2 out of the last 5" "3 out of the last 5" "4 out of the last 5" "All recent") printf "%-22s | %13s | %13s | %13s | %13s | %13s | %13s |\n" "WHEATHER (5 last runs)" "${list_name[@]}" printf "========================================================================================================================\n" for view in "${views[@]}"; do printf "%-22s |" "$view" for nbfail in {0..5}; do pat="${list_pat[$nbfail]}" nb["$nbfail"]=$(grep -c "Build stability: $pat builds failed." < "/tmp/$view.html") all["$nbfail"]=$((all["$nbfail"] + nb["$nbfail"])) printf " %13s |" "${nb[$nbfail]}" done printf "\n" done printf "========================================================================================================================\n" printf "%-22s | %13s | %13s | %13s | %13s | %13s | %13s |\n" \ "TOTAL" "${all[0]}" "${all[1]}" "${all[2]}" "${all[3]}" "${all[4]}" "${all[5]}"