What's cooking (2015/02 #06)
[alt-git.git] / AT
blobe3acfd9213976101f23062a40654755930a2e43b
1 #!/bin/sh
3 log=Meta/AT.log
4 >>"$log"
5 buildlog=Meta/AT.build-logs
6 mkdir -p "$buildlog"
7 t="/tmp/AT.$$"
9 trap 'rm -f "$t.*"; exit' 0 1 2 3 15
11 _x40="[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]"
12 _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
14 log_prune () {
15 cp "$log" "$log.bak"
17 git for-each-ref --format='%(objectname)' 'refs/heads/*/*' |
18 git rev-list --not ko/maint --not --stdin |
19 while read commit
21 git rev-parse --verify "$commit^{tree}"
22 done | sort -u >"$t.tree0"
23 sed -ne "s/A \($_x40\) .*/\1/p" "$log" | sort -u >"$t.tree1"
24 comm -13 "$t.tree0" "$t.tree1" | sed -e 's|.*|/^A &/d|' >"$t.prune"
26 next=$(git rev-parse --verify "refs/heads/next^0")
27 ko_next=$(git rev-parse --verify "refs/remotes/ko/next^0")
28 echo "/^N /{
29 s/^N $next /&/
30 t ok
31 s/^N $ko_next /&/
32 t ok
34 : ok
35 }" >>"$t.prune"
37 sed -f "$t.prune" "$log" >"$t.pruned"
38 cat "$t.pruned" >"$log"
41 check_skip_test () {
42 GIT_SKIP_TESTS=
43 git diff --name-only ko/master "$1" >"$t.d"
44 if ! grep -q -e git-svn "$t.d"
45 then
46 GIT_SKIP_TESTS="$GIT_SKIP_TESTS t91??"
48 if ! grep -q -e git-cvsexportcommit "$t.d"
49 then
50 GIT_SKIP_TESTS="$GIT_SKIP_TESTS t9200"
52 if ! grep -q -e git-cvsimport "$t.d"
53 then
54 GIT_SKIP_TESTS="$GIT_SKIP_TESTS t9600"
56 if test -n "$GIT_SKIP_TESTS"
57 then
58 export GIT_SKIP_TESTS
59 else
60 unset GIT_SKIP_TESTS
64 autotest () {
65 commit=$(git rev-parse --verify "$1^0") &&
66 tree=$(git rev-parse --verify "$commit^{tree}") || return 1
67 grep -s "^A $tree " "$log" >/dev/null && return 0
68 o="$buildlog/$tree"
70 git reset -q --hard HEAD^0 &&
71 git checkout -q "$commit^0" || return 1
73 check_skip_test "$tree"
75 PAGER= git show -s --pretty='format:* %h %s%n' "$commit" --
76 if ! Meta/Make -pedantic >"$o" 2>&1
77 then
78 status="build error"
79 elif ! Meta/Make -pedantic test >>"$o" 2>&1
80 then
81 status="test error"
82 else
83 status=ok
84 rm -f "$o"
86 : Meta/Make clean >/dev/null 2>&1
87 echo "A $tree $status" >>"$log"
88 echo "$status"
91 append_to_status () {
92 if test -z "$status"
93 then
94 status="$1"
95 else
96 status="$status; $1"
100 nexttest () {
101 mb=$(git merge-base "$commit" "$next") || return 1
102 test "$mb" = "$commit" && return 0
103 grep -s "^N $next $commit " "$log" >/dev/null && return 0
105 branch="${refname#refs/heads/}"
106 git reset -q --hard next^0
108 echo "* $branch"
110 status= skip_build=
111 if ! git merge "$commit" >/dev/null 2>&1
112 then
113 conflict_count=$(git ls-files -u |
114 sed -e 's/.* //' |
115 sort -u |
116 xargs grep -e '^<<<<<<< ' |
117 wc -l)
118 if test $conflict_count = 0
119 then
120 append_to_status "rerere ok"
121 else
122 skip_build=t
123 append_to_status "conflict $conflict_count"
126 if test -z "$skip_build"
127 then
128 o="$buildlog/$commit"
129 check_skip_test "$commit"
130 if ! Meta/Make -pedantic >"$o" 2>&1
131 then
132 append_to_status "build error"
133 elif ! Meta/Make -pedantic test >>"$o" 2>&1
134 then
135 append_to_status "test error"
136 else
137 append_to_status "test ok"
138 rm -f "$o"
141 : Meta/Make clean >/dev/null 2>&1
142 echo "N $next $commit $status" >>"$log"
143 echo "$status"
146 loop () {
147 Meta/Make clean >/dev/null 2>&1
148 git reset --hard -q
149 git checkout -q HEAD^0
150 next=$(git rev-parse --verify "refs/remotes/ko/next^0")
152 while :
154 log_prune
156 date
158 l0=$(ls -l "$log")
160 git for-each-ref --format='%(objectname)' 'refs/heads/*/*' |
161 git rev-list --not ko/maint ko/master --not --stdin |
162 while read commit
164 autotest "$commit" || echo "oops?"
165 done
167 l1=$(ls -l "$log")
168 test "$l0" = "$l1" || continue
170 git for-each-ref --format='%(objectname) %(refname)' \
171 'refs/heads/*/*' |
172 while read commit refname
174 nexttest "$commit" "$refname" || echo "oops?"
175 done
177 l1=$(ls -l "$log")
178 test "$l0" = "$l1" || continue
180 sleep 600 || exit
181 done
184 case "$#" in
186 loop
187 exit ;;
188 esac
191 git rev-list --no-walk "$@" 2>/dev/null || git rev-list "$@"
193 while read commit
195 autotest "$commit"
196 done