summaryrefslogtreecommitdiff
path: root/tcwg-report-ci-status.sh
blob: 7033f30a034f49716bcb989e128df24570153543 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/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]}"