-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAT
More file actions
executable file
·196 lines (168 loc) · 3.78 KB
/
AT
File metadata and controls
executable file
·196 lines (168 loc) · 3.78 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#!/bin/sh
log=Meta/AT.log
>>"$log"
buildlog=Meta/AT.build-logs
mkdir -p "$buildlog"
t="/tmp/AT.$$"
trap 'rm -f "$t.*"; exit' 0 1 2 3 15
_x40="[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]"
_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
log_prune () {
cp "$log" "$log.bak"
git for-each-ref --format='%(objectname)' 'refs/heads/*/*' |
git rev-list --not ko/maint --not --stdin |
while read commit
do
git rev-parse --verify "$commit^{tree}"
done | sort -u >"$t.tree0"
sed -ne "s/A \($_x40\) .*/\1/p" "$log" | sort -u >"$t.tree1"
comm -13 "$t.tree0" "$t.tree1" | sed -e 's|.*|/^A &/d|' >"$t.prune"
next=$(git rev-parse --verify "refs/heads/next^0")
ko_next=$(git rev-parse --verify "refs/remotes/ko/next^0")
echo "/^N /{
s/^N $next /&/
t ok
s/^N $ko_next /&/
t ok
d
: ok
}" >>"$t.prune"
sed -f "$t.prune" "$log" >"$t.pruned"
cat "$t.pruned" >"$log"
}
check_skip_test () {
GIT_SKIP_TESTS=
git diff --name-only ko/master "$1" >"$t.d"
if ! grep -q -e git-svn "$t.d"
then
GIT_SKIP_TESTS="$GIT_SKIP_TESTS t91??"
fi
if ! grep -q -e git-cvsexportcommit "$t.d"
then
GIT_SKIP_TESTS="$GIT_SKIP_TESTS t9200"
fi
if ! grep -q -e git-cvsimport "$t.d"
then
GIT_SKIP_TESTS="$GIT_SKIP_TESTS t9600"
fi
if test -n "$GIT_SKIP_TESTS"
then
export GIT_SKIP_TESTS
else
unset GIT_SKIP_TESTS
fi
}
autotest () {
commit=$(git rev-parse --verify "$1^0") &&
tree=$(git rev-parse --verify "$commit^{tree}") || return 1
grep -s "^A $tree " "$log" >/dev/null && return 0
o="$buildlog/$tree"
git reset -q --hard HEAD^0 &&
git checkout -q "$commit^0" || return 1
check_skip_test "$tree"
PAGER= git show -s --pretty='format:* %h %s%n' "$commit" --
if ! Meta/Make -pedantic >"$o" 2>&1
then
status="build error"
elif ! Meta/Make -pedantic test >>"$o" 2>&1
then
status="test error"
else
status=ok
rm -f "$o"
fi
: Meta/Make clean >/dev/null 2>&1
echo "A $tree $status" >>"$log"
echo "$status"
}
append_to_status () {
if test -z "$status"
then
status="$1"
else
status="$status; $1"
fi
}
nexttest () {
mb=$(git merge-base "$commit" "$next") || return 1
test "$mb" = "$commit" && return 0
grep -s "^N $next $commit " "$log" >/dev/null && return 0
branch="${refname#refs/heads/}"
git reset -q --hard next^0
echo "* $branch"
status= skip_build=
if ! git merge "$commit" >/dev/null 2>&1
then
conflict_count=$(git ls-files -u |
sed -e 's/.* //' |
sort -u |
xargs grep -e '^<<<<<<< ' |
wc -l)
if test $conflict_count = 0
then
append_to_status "rerere ok"
else
skip_build=t
append_to_status "conflict $conflict_count"
fi
fi
if test -z "$skip_build"
then
o="$buildlog/$commit"
check_skip_test "$commit"
if ! Meta/Make -pedantic >"$o" 2>&1
then
append_to_status "build error"
elif ! Meta/Make -pedantic test >>"$o" 2>&1
then
append_to_status "test error"
else
append_to_status "test ok"
rm -f "$o"
fi
fi
: Meta/Make clean >/dev/null 2>&1
echo "N $next $commit $status" >>"$log"
echo "$status"
}
loop () {
Meta/Make clean >/dev/null 2>&1
git reset --hard -q
git checkout -q HEAD^0
next=$(git rev-parse --verify "refs/remotes/ko/next^0")
while :
do
log_prune
date
l0=$(ls -l "$log")
git for-each-ref --format='%(objectname)' 'refs/heads/*/*' |
git rev-list --not ko/maint ko/master --not --stdin |
while read commit
do
autotest "$commit" || echo "oops?"
done
l1=$(ls -l "$log")
test "$l0" = "$l1" || continue
git for-each-ref --format='%(objectname) %(refname)' \
'refs/heads/*/*' |
while read commit refname
do
nexttest "$commit" "$refname" || echo "oops?"
done
l1=$(ls -l "$log")
test "$l0" = "$l1" || continue
sleep 600 || exit
done
}
case "$#" in
0)
loop
exit ;;
esac
(
git rev-list --no-walk "$@" 2>/dev/null || git rev-list "$@"
) |
while read commit
do
autotest "$commit"
done