|
0 |
#!/bin/bash
|
|
1 |
# Analyze debian CI test failures for rust packages against some known failures.
|
|
2 |
#
|
|
3 |
# Usage:
|
|
4 |
# $ dev/rust-regressions.sh # analyse logs mentioned in rust-regressions.list
|
|
5 |
# $ dev/rust-regressions.sh [<test logs>] # analyse logs downloaded manually
|
|
6 |
#
|
|
7 |
|
|
8 |
set -e
|
|
9 |
#set -x
|
|
10 |
shopt -s lastpipe
|
|
11 |
|
|
12 |
declare -A results
|
|
13 |
|
|
14 |
classify() {
|
|
15 |
local c=0
|
|
16 |
local url="$1"
|
|
17 |
local name="${url#ci.debian.net/data/autopkgtest/testing/*/r/}"
|
|
18 |
name="${name%%/*}"
|
|
19 |
if zegrep -q '^error\[E0554\]' "$url"; then
|
|
20 |
results["falsepositive_unstable"]+="$name"$'\n'
|
|
21 |
c=$((c+1))
|
|
22 |
fi
|
|
23 |
if zgrep -q "^crate directory not found" "$url"; then
|
|
24 |
results["falsepositive_autopkgtest_version_bug"]+="$name"$'\n'
|
|
25 |
c=$((c+1))
|
|
26 |
fi
|
|
27 |
if zgrep -q "^error: no matching package named" "$url"; then
|
|
28 |
results["falsepositive_debcargo_945560"]+="$name"$'\n'
|
|
29 |
c=$((c+1))
|
|
30 |
fi
|
|
31 |
if zgrep -q "^error.* No such file or directory (os error 2)$" "$url"; then
|
|
32 |
results["maybetestbroken_filemissing"]+="$name"$'\n'
|
|
33 |
c=$((c+1))
|
|
34 |
fi
|
|
35 |
if [ "$c" = 0 ]; then
|
|
36 |
results["UNKNOWN"]+="$url"$'\n'
|
|
37 |
results["UNKNOWN"]+="$(zgrep ^error "$url" | head -n3 || true)"
|
|
38 |
results["UNKNOWN"]+=$'\n\n'
|
|
39 |
fi
|
|
40 |
}
|
|
41 |
|
|
42 |
declare -A action explain
|
|
43 |
|
|
44 |
action["UNKNOWN"]="Analyze the relevant test log and deal with it. Ask in #debian-rust for help if you get stuck."
|
|
45 |
explain["UNKNOWN"]="We weren't able to automatically guess the reason behind the test failure"
|
|
46 |
|
|
47 |
action["falsepositive_unstable"]="Re-run the test via the ci.debian.net web interface. No package upload is necessary."
|
|
48 |
explain["falsepositive_unstable"]="dh-cargo since version 23 will automatically detect this error and re-run the test with RUSTC_BOOTSTRAP=1"
|
|
49 |
|
|
50 |
action["falsepositive_autopkgtest_version_bug"]="Either wait for the bug to be fixed, or help to fix the bug. Don't change the rust packaging."
|
|
51 |
explain["falsepositive_autopkgtest_version_bug"]="Autopkgtest has a bug, see https://alioth-lists.debian.net/pipermail/pkg-rust-maintainers/2020-January/009512.html"
|
|
52 |
|
|
53 |
action["falsepositive_debcargo_945560"]="regenerate your crate packaging using debcargo 2.4.2 or later"
|
|
54 |
explain["falsepositive_debcargo_945560"]="cargo requires more dependencies than necessary, and debcargo did not work around this until 2.4.2"
|
|
55 |
|
|
56 |
action["maybetestbroken_filemissing"]="Mark the relevant tests as test_is_broken=true in debcargo.toml, re-upload the package, and file a bug upstream for them to fix it."
|
|
57 |
explain["maybetestbroken_filemissing"]="Carge does not enforce that tests pass per-crate, so sometimes crate authors run tests on a per-workspace basis and have crate tests depend on files in the parent workspace, which are not part of the crate when uploaded to crates.io."
|
|
58 |
|
|
59 |
if [ -z "$*" ]; then
|
|
60 |
if ! [ -f rust-regressions.list ]; then
|
|
61 |
echo >&2 "rust-regressions.list does not exist, run \`dev/rust-excuses.mk refresh all\` to update it"
|
|
62 |
elif [ $(($(date +%s) - $(stat -c %Y rust-regressions.list))) -gt 7200 ]; then
|
|
63 |
echo >&2 "rust-regressions.list is a bit old, run \`dev/rust-excuses.mk refresh all\` to update it"
|
|
64 |
fi
|
|
65 |
if [ -z "$DEB_RUST_SKIP_CI_DL" ]; then
|
|
66 |
echo >&2 "Downloading CI test logs. If you did this recently and want to skip, re-run me with DEB_RUST_SKIP_CI_DL=1"
|
|
67 |
wget -nv --mirror $(< rust-regressions.list)
|
|
68 |
fi
|
|
69 |
cat rust-regressions.list | while read url; do
|
|
70 |
classify "${url#https://}"
|
|
71 |
done
|
|
72 |
else
|
|
73 |
for i in "$@"; do classify "$i"; done
|
|
74 |
fi
|
|
75 |
|
|
76 |
for p in "${!results[@]}"; do
|
|
77 |
echo "$p"
|
|
78 |
done | LC_COLLATE=C.UTF-8 sort | while read p; do
|
|
79 |
echo "$p"
|
|
80 |
echo "$p" | sed -e 's/./=/g'
|
|
81 |
echo
|
|
82 |
case "$p" in
|
|
83 |
UNKNOWN)
|
|
84 |
printf "%s" "${results[$p]}"
|
|
85 |
;;
|
|
86 |
*)
|
|
87 |
printf "%s" "${results[$p]}" | sort -u | tr '\n' ','
|
|
88 |
echo
|
|
89 |
;;
|
|
90 |
esac
|
|
91 |
echo
|
|
92 |
echo "You should: ${action[$p]}"
|
|
93 |
echo "Explanation: ${explain[$p]}"
|
|
94 |
echo
|
|
95 |
done
|