Blame


1 35dc4510 2019-02-04 stsp #!/bin/sh
2 35dc4510 2019-02-04 stsp #
3 35dc4510 2019-02-04 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
4 35dc4510 2019-02-04 stsp #
5 35dc4510 2019-02-04 stsp # Permission to use, copy, modify, and distribute this software for any
6 35dc4510 2019-02-04 stsp # purpose with or without fee is hereby granted, provided that the above
7 35dc4510 2019-02-04 stsp # copyright notice and this permission notice appear in all copies.
8 35dc4510 2019-02-04 stsp #
9 35dc4510 2019-02-04 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 35dc4510 2019-02-04 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 35dc4510 2019-02-04 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 35dc4510 2019-02-04 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 35dc4510 2019-02-04 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 35dc4510 2019-02-04 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 35dc4510 2019-02-04 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 35dc4510 2019-02-04 stsp
17 35dc4510 2019-02-04 stsp . ./common.sh
18 35dc4510 2019-02-04 stsp
19 35dc4510 2019-02-04 stsp function test_status_basic {
20 35dc4510 2019-02-04 stsp local testroot=`test_init status_basic`
21 35dc4510 2019-02-04 stsp
22 35dc4510 2019-02-04 stsp got checkout $testroot/repo $testroot/wt > /dev/null
23 e60e7f5b 2019-02-10 stsp ret="$?"
24 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
25 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
26 35dc4510 2019-02-04 stsp return 1
27 35dc4510 2019-02-04 stsp fi
28 35dc4510 2019-02-04 stsp
29 35dc4510 2019-02-04 stsp echo "modified alpha" > $testroot/wt/alpha
30 2ec1f75b 2019-03-26 stsp (cd $testroot/wt && got rm beta >/dev/null)
31 35dc4510 2019-02-04 stsp echo "unversioned file" > $testroot/wt/foo
32 35dc4510 2019-02-04 stsp rm $testroot/wt/epsilon/zeta
33 14e5d4dc 2019-02-05 stsp touch $testroot/wt/beta
34 d00136be 2019-03-26 stsp echo "new file" > $testroot/wt/new
35 d00136be 2019-03-26 stsp (cd $testroot/wt && got add new >/dev/null)
36 40b289d7 2019-09-07 stsp mkdir -m 0000 $testroot/wt/bar
37 35dc4510 2019-02-04 stsp
38 35dc4510 2019-02-04 stsp echo 'M alpha' > $testroot/stdout.expected
39 2ec1f75b 2019-03-26 stsp echo 'D beta' >> $testroot/stdout.expected
40 35dc4510 2019-02-04 stsp echo '! epsilon/zeta' >> $testroot/stdout.expected
41 35dc4510 2019-02-04 stsp echo '? foo' >> $testroot/stdout.expected
42 d00136be 2019-03-26 stsp echo 'A new' >> $testroot/stdout.expected
43 35dc4510 2019-02-04 stsp
44 35dc4510 2019-02-04 stsp (cd $testroot/wt && got status > $testroot/stdout)
45 35dc4510 2019-02-04 stsp
46 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
47 e60e7f5b 2019-02-10 stsp ret="$?"
48 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
49 35dc4510 2019-02-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
50 35dc4510 2019-02-04 stsp fi
51 40b289d7 2019-09-07 stsp chmod 700 $testroot/wt/bar
52 40b289d7 2019-09-07 stsp rmdir $testroot/wt/bar
53 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
54 35dc4510 2019-02-04 stsp }
55 35dc4510 2019-02-04 stsp
56 f02ba292 2019-02-05 stsp function test_status_subdir_no_mods {
57 f02ba292 2019-02-05 stsp local testroot=`test_init status_subdir_no_mods 1`
58 f02ba292 2019-02-05 stsp
59 f02ba292 2019-02-05 stsp mkdir $testroot/repo/Basic/
60 f02ba292 2019-02-05 stsp mkdir $testroot/repo/Basic/Targets/
61 f02ba292 2019-02-05 stsp touch $testroot/repo/Basic/Targets/AArch64.cpp
62 f02ba292 2019-02-05 stsp touch $testroot/repo/Basic/Targets.cpp
63 f02ba292 2019-02-05 stsp touch $testroot/repo/Basic/Targets.h
64 f02ba292 2019-02-05 stsp (cd $testroot/repo && git add .)
65 f02ba292 2019-02-05 stsp git_commit $testroot/repo -m "add subdir with files"
66 f02ba292 2019-02-05 stsp
67 f02ba292 2019-02-05 stsp got checkout $testroot/repo $testroot/wt > /dev/null
68 e60e7f5b 2019-02-10 stsp ret="$?"
69 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
70 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
71 f02ba292 2019-02-05 stsp return 1
72 f02ba292 2019-02-05 stsp fi
73 f02ba292 2019-02-05 stsp
74 f02ba292 2019-02-05 stsp touch $testroot/stdout.expected
75 f02ba292 2019-02-05 stsp
76 f02ba292 2019-02-05 stsp # This used to erroneously print:
77 f02ba292 2019-02-05 stsp #
78 f02ba292 2019-02-05 stsp # ! Basic/Targets.cpp
79 f02ba292 2019-02-05 stsp # ? Basic/Targets.cpp
80 f02ba292 2019-02-05 stsp (cd $testroot/wt && got status > $testroot/stdout)
81 f02ba292 2019-02-05 stsp
82 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
83 e60e7f5b 2019-02-10 stsp ret="$?"
84 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
85 f02ba292 2019-02-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
86 f02ba292 2019-02-05 stsp fi
87 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
88 f02ba292 2019-02-05 stsp }
89 f02ba292 2019-02-05 stsp
90 f02ba292 2019-02-05 stsp function test_status_subdir_no_mods2 {
91 f02ba292 2019-02-05 stsp local testroot=`test_init status_subdir_no_mods2 1`
92 f02ba292 2019-02-05 stsp
93 f02ba292 2019-02-05 stsp mkdir $testroot/repo/AST
94 f02ba292 2019-02-05 stsp touch $testroot/repo/AST/APValue.cpp
95 f02ba292 2019-02-05 stsp mkdir $testroot/repo/ASTMatchers
96 f02ba292 2019-02-05 stsp touch $testroot/repo/ASTMatchers/ASTMatchFinder.cpp
97 f02ba292 2019-02-05 stsp mkdir $testroot/repo/Frontend
98 f02ba292 2019-02-05 stsp touch $testroot/repo/Frontend/ASTConsumers.cpp
99 f02ba292 2019-02-05 stsp mkdir $testroot/repo/Frontend/Rewrite
100 f02ba292 2019-02-05 stsp touch $testroot/repo/Frontend/Rewrite/CMakeLists.txt
101 f02ba292 2019-02-05 stsp mkdir $testroot/repo/FrontendTool
102 f02ba292 2019-02-05 stsp touch $testroot/repo/FrontendTool/CMakeLists.txt
103 f02ba292 2019-02-05 stsp touch $testroot/repo/FrontendTool/ExecuteCompilerInvocation.cpp
104 f02ba292 2019-02-05 stsp (cd $testroot/repo && git add .)
105 f02ba292 2019-02-05 stsp git_commit $testroot/repo -m "add subdir with files"
106 f02ba292 2019-02-05 stsp
107 f02ba292 2019-02-05 stsp got checkout $testroot/repo $testroot/wt > /dev/null
108 e60e7f5b 2019-02-10 stsp ret="$?"
109 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
110 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
111 f02ba292 2019-02-05 stsp return 1
112 f02ba292 2019-02-05 stsp fi
113 f02ba292 2019-02-05 stsp
114 f02ba292 2019-02-05 stsp touch $testroot/stdout.expected
115 f02ba292 2019-02-05 stsp
116 f02ba292 2019-02-05 stsp # This used to erroneously print:
117 f02ba292 2019-02-05 stsp #
118 f02ba292 2019-02-05 stsp # ! AST/APValue.cpp
119 f02ba292 2019-02-05 stsp # ? AST/APValue.cpp
120 f02ba292 2019-02-05 stsp # ! Frontend/ASTConsumers.cpp
121 f02ba292 2019-02-05 stsp # ! Frontend/Rewrite/CMakeLists.txt
122 f02ba292 2019-02-05 stsp # ? Frontend/ASTConsumers.cpp
123 f02ba292 2019-02-05 stsp # ? Frontend/Rewrite/CMakeLists.txt
124 f02ba292 2019-02-05 stsp (cd $testroot/wt && got status > $testroot/stdout)
125 f02ba292 2019-02-05 stsp
126 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
127 e60e7f5b 2019-02-10 stsp ret="$?"
128 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
129 f02ba292 2019-02-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
130 f02ba292 2019-02-05 stsp fi
131 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
132 f02ba292 2019-02-05 stsp }
133 f02ba292 2019-02-05 stsp
134 0dbc2271 2019-02-05 stsp function test_status_obstructed {
135 0dbc2271 2019-02-05 stsp local testroot=`test_init status_obstructed`
136 0dbc2271 2019-02-05 stsp
137 0dbc2271 2019-02-05 stsp got checkout $testroot/repo $testroot/wt > /dev/null
138 e60e7f5b 2019-02-10 stsp ret="$?"
139 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
140 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
141 0dbc2271 2019-02-05 stsp return 1
142 0dbc2271 2019-02-05 stsp fi
143 0dbc2271 2019-02-05 stsp
144 0dbc2271 2019-02-05 stsp rm $testroot/wt/epsilon/zeta
145 0dbc2271 2019-02-05 stsp mkdir $testroot/wt/epsilon/zeta
146 0dbc2271 2019-02-05 stsp
147 0dbc2271 2019-02-05 stsp echo '~ epsilon/zeta' > $testroot/stdout.expected
148 0dbc2271 2019-02-05 stsp
149 0dbc2271 2019-02-05 stsp (cd $testroot/wt && got status > $testroot/stdout)
150 0dbc2271 2019-02-05 stsp
151 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
152 e60e7f5b 2019-02-10 stsp ret="$?"
153 a062651c 2019-07-27 stsp if [ "$ret" != "0" ]; then
154 0dbc2271 2019-02-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
155 0dbc2271 2019-02-05 stsp fi
156 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
157 0dbc2271 2019-02-05 stsp }
158 0dbc2271 2019-02-05 stsp
159 02c07007 2019-02-10 stsp function test_status_shows_local_mods_after_update {
160 02c07007 2019-02-10 stsp local testroot=`test_init status_shows_local_mods_after_update 1`
161 02c07007 2019-02-10 stsp
162 02c07007 2019-02-10 stsp echo "1" > $testroot/repo/numbers
163 02c07007 2019-02-10 stsp echo "2" >> $testroot/repo/numbers
164 02c07007 2019-02-10 stsp echo "3" >> $testroot/repo/numbers
165 02c07007 2019-02-10 stsp echo "4" >> $testroot/repo/numbers
166 02c07007 2019-02-10 stsp echo "5" >> $testroot/repo/numbers
167 02c07007 2019-02-10 stsp echo "6" >> $testroot/repo/numbers
168 02c07007 2019-02-10 stsp echo "7" >> $testroot/repo/numbers
169 02c07007 2019-02-10 stsp echo "8" >> $testroot/repo/numbers
170 02c07007 2019-02-10 stsp (cd $testroot/repo && git add numbers)
171 02c07007 2019-02-10 stsp git_commit $testroot/repo -m "added numbers file"
172 02c07007 2019-02-10 stsp
173 02c07007 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
174 02c07007 2019-02-10 stsp ret="$?"
175 02c07007 2019-02-10 stsp if [ "$ret" != "0" ]; then
176 02c07007 2019-02-10 stsp test_done "$testroot" "$ret"
177 02c07007 2019-02-10 stsp return 1
178 02c07007 2019-02-10 stsp fi
179 02c07007 2019-02-10 stsp
180 02c07007 2019-02-10 stsp sed -i 's/2/22/' $testroot/repo/numbers
181 02c07007 2019-02-10 stsp git_commit $testroot/repo -m "modified line 2"
182 02c07007 2019-02-10 stsp
183 02c07007 2019-02-10 stsp # modify line 7; both changes should merge cleanly
184 02c07007 2019-02-10 stsp sed -i 's/7/77/' $testroot/wt/numbers
185 02c07007 2019-02-10 stsp
186 02c07007 2019-02-10 stsp echo "G numbers" > $testroot/stdout.expected
187 02c07007 2019-02-10 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
188 02c07007 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
189 02c07007 2019-02-10 stsp echo >> $testroot/stdout.expected
190 02c07007 2019-02-10 stsp
191 02c07007 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
192 02c07007 2019-02-10 stsp
193 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
194 02c07007 2019-02-10 stsp ret="$?"
195 02c07007 2019-02-10 stsp if [ "$ret" != "0" ]; then
196 02c07007 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
197 02c07007 2019-02-10 stsp test_done "$testroot" "$ret"
198 02c07007 2019-02-10 stsp return 1
199 02c07007 2019-02-10 stsp fi
200 02c07007 2019-02-10 stsp
201 02c07007 2019-02-10 stsp echo 'M numbers' > $testroot/stdout.expected
202 02c07007 2019-02-10 stsp
203 02c07007 2019-02-10 stsp (cd $testroot/wt && got status > $testroot/stdout)
204 02c07007 2019-02-10 stsp
205 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
206 02c07007 2019-02-10 stsp ret="$?"
207 02c07007 2019-02-10 stsp if [ "$ret" != "0" ]; then
208 02c07007 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
209 02c07007 2019-02-10 stsp fi
210 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
211 02c07007 2019-02-10 stsp }
212 02c07007 2019-02-10 stsp
213 18831e78 2019-02-10 stsp function test_status_unversioned_subdirs {
214 18831e78 2019-02-10 stsp local testroot=`test_init status_unversioned_subdirs 1`
215 18831e78 2019-02-10 stsp
216 18831e78 2019-02-10 stsp mkdir $testroot/repo/cdfs/
217 18831e78 2019-02-10 stsp touch $testroot/repo/cdfs/Makefile
218 18831e78 2019-02-10 stsp mkdir $testroot/repo/common/
219 18831e78 2019-02-10 stsp touch $testroot/repo/common/Makefile
220 18831e78 2019-02-10 stsp mkdir $testroot/repo/iso/
221 18831e78 2019-02-10 stsp touch $testroot/repo/iso/Makefile
222 18831e78 2019-02-10 stsp mkdir $testroot/repo/ramdisk/
223 18831e78 2019-02-10 stsp touch $testroot/repo/ramdisk/Makefile
224 18831e78 2019-02-10 stsp touch $testroot/repo/ramdisk/list.local
225 18831e78 2019-02-10 stsp mkdir $testroot/repo/ramdisk_cd/
226 18831e78 2019-02-10 stsp touch $testroot/repo/ramdisk_cd/Makefile
227 18831e78 2019-02-10 stsp touch $testroot/repo/ramdisk_cd/list.local
228 18831e78 2019-02-10 stsp (cd $testroot/repo && git add .)
229 18831e78 2019-02-10 stsp git_commit $testroot/repo -m "first commit"
230 18831e78 2019-02-10 stsp
231 18831e78 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
232 18831e78 2019-02-10 stsp ret="$?"
233 18831e78 2019-02-10 stsp if [ "$ret" != "0" ]; then
234 18831e78 2019-02-10 stsp test_done "$testroot" "$ret"
235 18831e78 2019-02-10 stsp return 1
236 18831e78 2019-02-10 stsp fi
237 18831e78 2019-02-10 stsp
238 18831e78 2019-02-10 stsp mkdir $testroot/wt/cdfs/obj
239 18831e78 2019-02-10 stsp mkdir $testroot/wt/ramdisk/obj
240 18831e78 2019-02-10 stsp mkdir $testroot/wt/ramdisk_cd/obj
241 18831e78 2019-02-10 stsp mkdir $testroot/wt/iso/obj
242 18831e78 2019-02-10 stsp
243 18831e78 2019-02-10 stsp echo -n > $testroot/stdout.expected
244 18831e78 2019-02-10 stsp
245 18831e78 2019-02-10 stsp # This used to erroneously print:
246 18831e78 2019-02-10 stsp #
247 18831e78 2019-02-10 stsp # ! ramdisk_cd/Makefile
248 18831e78 2019-02-10 stsp # ! ramdisk_cd/list.local
249 18831e78 2019-02-10 stsp # ? ramdisk_cd/Makefile
250 18831e78 2019-02-10 stsp # ? ramdisk_cd/list.local
251 18831e78 2019-02-10 stsp (cd $testroot/wt && got status > $testroot/stdout)
252 18831e78 2019-02-10 stsp
253 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
254 18831e78 2019-02-10 stsp ret="$?"
255 18831e78 2019-02-10 stsp if [ "$ret" != "0" ]; then
256 18831e78 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
257 18831e78 2019-02-10 stsp fi
258 18831e78 2019-02-10 stsp test_done "$testroot" "$ret"
259 18831e78 2019-02-10 stsp }
260 18831e78 2019-02-10 stsp
261 2c201a36 2019-02-10 stsp # 'got status' ignores symlinks at present; this might change eventually
262 2c201a36 2019-02-10 stsp function test_status_ignores_symlink {
263 2c201a36 2019-02-10 stsp local testroot=`test_init status_ignores_symlink 1`
264 2c201a36 2019-02-10 stsp
265 2c201a36 2019-02-10 stsp mkdir $testroot/repo/ramdisk/
266 2c201a36 2019-02-10 stsp touch $testroot/repo/ramdisk/Makefile
267 2c201a36 2019-02-10 stsp (cd $testroot/repo && git add .)
268 2c201a36 2019-02-10 stsp git_commit $testroot/repo -m "first commit"
269 2c201a36 2019-02-10 stsp
270 2c201a36 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
271 2c201a36 2019-02-10 stsp ret="$?"
272 2c201a36 2019-02-10 stsp if [ "$ret" != "0" ]; then
273 2c201a36 2019-02-10 stsp test_done "$testroot" "$ret"
274 2c201a36 2019-02-10 stsp return 1
275 2c201a36 2019-02-10 stsp fi
276 2c201a36 2019-02-10 stsp
277 2c201a36 2019-02-10 stsp ln -s /usr/obj/distrib/i386/ramdisk $testroot/wt/ramdisk/obj
278 3cbbd752 2019-02-19 stsp
279 3cbbd752 2019-02-19 stsp echo -n > $testroot/stdout.expected
280 3cbbd752 2019-02-19 stsp
281 3cbbd752 2019-02-19 stsp (cd $testroot/wt && got status > $testroot/stdout)
282 3cbbd752 2019-02-19 stsp
283 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
284 3cbbd752 2019-02-19 stsp ret="$?"
285 3cbbd752 2019-02-19 stsp if [ "$ret" != "0" ]; then
286 3cbbd752 2019-02-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
287 3cbbd752 2019-02-19 stsp fi
288 3cbbd752 2019-02-19 stsp test_done "$testroot" "$ret"
289 3cbbd752 2019-02-19 stsp }
290 3cbbd752 2019-02-19 stsp
291 3cbbd752 2019-02-19 stsp function test_status_shows_no_mods_after_complete_merge {
292 3cbbd752 2019-02-19 stsp local testroot=`test_init status_shows_no_mods_after_complete_merge 1`
293 3cbbd752 2019-02-19 stsp
294 3cbbd752 2019-02-19 stsp # make this file larger than the usual blob buffer size of 8192
295 3cbbd752 2019-02-19 stsp echo -n > $testroot/repo/numbers
296 3cbbd752 2019-02-19 stsp for i in `jot 16384`; do
297 3cbbd752 2019-02-19 stsp echo "$i" >> $testroot/repo/numbers
298 3cbbd752 2019-02-19 stsp done
299 3cbbd752 2019-02-19 stsp
300 3cbbd752 2019-02-19 stsp (cd $testroot/repo && git add numbers)
301 3cbbd752 2019-02-19 stsp git_commit $testroot/repo -m "added numbers file"
302 3cbbd752 2019-02-19 stsp
303 3cbbd752 2019-02-19 stsp got checkout $testroot/repo $testroot/wt > /dev/null
304 3cbbd752 2019-02-19 stsp ret="$?"
305 3cbbd752 2019-02-19 stsp if [ "$ret" != "0" ]; then
306 3cbbd752 2019-02-19 stsp test_done "$testroot" "$ret"
307 3cbbd752 2019-02-19 stsp return 1
308 3cbbd752 2019-02-19 stsp fi
309 2c201a36 2019-02-10 stsp
310 3cbbd752 2019-02-19 stsp sed -i 's/2/22/' $testroot/repo/numbers
311 3cbbd752 2019-02-19 stsp git_commit $testroot/repo -m "modified line 2"
312 3cbbd752 2019-02-19 stsp
313 3cbbd752 2019-02-19 stsp sleep 1
314 3cbbd752 2019-02-19 stsp # modify line 2 again; no local changes are left after merge
315 3cbbd752 2019-02-19 stsp sed -i 's/2/22/' $testroot/wt/numbers
316 3cbbd752 2019-02-19 stsp
317 3cbbd752 2019-02-19 stsp echo "G numbers" > $testroot/stdout.expected
318 3cbbd752 2019-02-19 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
319 3cbbd752 2019-02-19 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
320 3cbbd752 2019-02-19 stsp echo >> $testroot/stdout.expected
321 3cbbd752 2019-02-19 stsp
322 3cbbd752 2019-02-19 stsp (cd $testroot/wt && got update > $testroot/stdout)
323 3cbbd752 2019-02-19 stsp
324 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
325 3cbbd752 2019-02-19 stsp ret="$?"
326 3cbbd752 2019-02-19 stsp if [ "$ret" != "0" ]; then
327 3cbbd752 2019-02-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
328 3cbbd752 2019-02-19 stsp test_done "$testroot" "$ret"
329 3cbbd752 2019-02-19 stsp return 1
330 3cbbd752 2019-02-19 stsp fi
331 3cbbd752 2019-02-19 stsp
332 2c201a36 2019-02-10 stsp echo -n > $testroot/stdout.expected
333 2c201a36 2019-02-10 stsp
334 2c201a36 2019-02-10 stsp (cd $testroot/wt && got status > $testroot/stdout)
335 2c201a36 2019-02-10 stsp
336 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
337 2c201a36 2019-02-10 stsp ret="$?"
338 2c201a36 2019-02-10 stsp if [ "$ret" != "0" ]; then
339 2c201a36 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
340 2c201a36 2019-02-10 stsp fi
341 2c201a36 2019-02-10 stsp test_done "$testroot" "$ret"
342 2c201a36 2019-02-10 stsp }
343 7154f6ce 2019-03-27 stsp
344 7154f6ce 2019-03-27 stsp function test_status_shows_conflict {
345 7154f6ce 2019-03-27 stsp local testroot=`test_init status_shows_conflict 1`
346 2c201a36 2019-02-10 stsp
347 7154f6ce 2019-03-27 stsp echo "1" > $testroot/repo/numbers
348 7154f6ce 2019-03-27 stsp echo "2" >> $testroot/repo/numbers
349 7154f6ce 2019-03-27 stsp echo "3" >> $testroot/repo/numbers
350 7154f6ce 2019-03-27 stsp echo "4" >> $testroot/repo/numbers
351 7154f6ce 2019-03-27 stsp echo "5" >> $testroot/repo/numbers
352 7154f6ce 2019-03-27 stsp echo "6" >> $testroot/repo/numbers
353 7154f6ce 2019-03-27 stsp echo "7" >> $testroot/repo/numbers
354 7154f6ce 2019-03-27 stsp echo "8" >> $testroot/repo/numbers
355 7154f6ce 2019-03-27 stsp (cd $testroot/repo && git add numbers)
356 7154f6ce 2019-03-27 stsp git_commit $testroot/repo -m "added numbers file"
357 7154f6ce 2019-03-27 stsp
358 7154f6ce 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
359 7154f6ce 2019-03-27 stsp ret="$?"
360 7154f6ce 2019-03-27 stsp if [ "$ret" != "0" ]; then
361 7154f6ce 2019-03-27 stsp test_done "$testroot" "$ret"
362 7154f6ce 2019-03-27 stsp return 1
363 7154f6ce 2019-03-27 stsp fi
364 7154f6ce 2019-03-27 stsp
365 7154f6ce 2019-03-27 stsp sed -i 's/2/22/' $testroot/repo/numbers
366 7154f6ce 2019-03-27 stsp git_commit $testroot/repo -m "modified line 2"
367 7154f6ce 2019-03-27 stsp
368 7154f6ce 2019-03-27 stsp # modify line 2 in a conflicting way
369 7154f6ce 2019-03-27 stsp sed -i 's/2/77/' $testroot/wt/numbers
370 7154f6ce 2019-03-27 stsp
371 7154f6ce 2019-03-27 stsp echo "C numbers" > $testroot/stdout.expected
372 7154f6ce 2019-03-27 stsp echo -n "Updated to commit " >> $testroot/stdout.expected
373 7154f6ce 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
374 7154f6ce 2019-03-27 stsp echo >> $testroot/stdout.expected
375 7154f6ce 2019-03-27 stsp
376 7154f6ce 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
377 7154f6ce 2019-03-27 stsp
378 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
379 7154f6ce 2019-03-27 stsp ret="$?"
380 7154f6ce 2019-03-27 stsp if [ "$ret" != "0" ]; then
381 7154f6ce 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
382 7154f6ce 2019-03-27 stsp test_done "$testroot" "$ret"
383 7154f6ce 2019-03-27 stsp return 1
384 7154f6ce 2019-03-27 stsp fi
385 7154f6ce 2019-03-27 stsp
386 7154f6ce 2019-03-27 stsp echo 'C numbers' > $testroot/stdout.expected
387 7154f6ce 2019-03-27 stsp
388 7154f6ce 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
389 c577a9ce 2019-07-27 stsp
390 c577a9ce 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
391 c577a9ce 2019-07-27 stsp ret="$?"
392 c577a9ce 2019-07-27 stsp if [ "$ret" != "0" ]; then
393 c577a9ce 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
394 c577a9ce 2019-07-27 stsp fi
395 c577a9ce 2019-07-27 stsp test_done "$testroot" "$ret"
396 c577a9ce 2019-07-27 stsp }
397 c577a9ce 2019-07-27 stsp
398 c577a9ce 2019-07-27 stsp function test_status_empty_dir {
399 c577a9ce 2019-07-27 stsp local testroot=`test_init status_empty_dir`
400 c577a9ce 2019-07-27 stsp
401 c577a9ce 2019-07-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
402 c577a9ce 2019-07-27 stsp ret="$?"
403 c577a9ce 2019-07-27 stsp if [ "$ret" != "0" ]; then
404 c577a9ce 2019-07-27 stsp test_done "$testroot" "$ret"
405 c577a9ce 2019-07-27 stsp return 1
406 c577a9ce 2019-07-27 stsp fi
407 c577a9ce 2019-07-27 stsp
408 c577a9ce 2019-07-27 stsp rm $testroot/wt/epsilon/zeta
409 c577a9ce 2019-07-27 stsp
410 c577a9ce 2019-07-27 stsp echo '! epsilon/zeta' > $testroot/stdout.expected
411 c577a9ce 2019-07-27 stsp
412 c577a9ce 2019-07-27 stsp (cd $testroot/wt && got status epsilon > $testroot/stdout)
413 c577a9ce 2019-07-27 stsp
414 c577a9ce 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
415 c577a9ce 2019-07-27 stsp ret="$?"
416 c577a9ce 2019-07-27 stsp if [ "$ret" != "0" ]; then
417 c577a9ce 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
418 c577a9ce 2019-07-27 stsp fi
419 c577a9ce 2019-07-27 stsp test_done "$testroot" "$ret"
420 c577a9ce 2019-07-27 stsp }
421 7154f6ce 2019-03-27 stsp
422 c577a9ce 2019-07-27 stsp function test_status_empty_dir_unversioned_file {
423 c577a9ce 2019-07-27 stsp local testroot=`test_init status_empty_dir_unversioned_file`
424 c577a9ce 2019-07-27 stsp
425 c577a9ce 2019-07-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
426 c577a9ce 2019-07-27 stsp ret="$?"
427 c577a9ce 2019-07-27 stsp if [ "$ret" != "0" ]; then
428 c577a9ce 2019-07-27 stsp test_done "$testroot" "$ret"
429 c577a9ce 2019-07-27 stsp return 1
430 c577a9ce 2019-07-27 stsp fi
431 c577a9ce 2019-07-27 stsp
432 c577a9ce 2019-07-27 stsp rm $testroot/wt/epsilon/zeta
433 c577a9ce 2019-07-27 stsp touch $testroot/wt/epsilon/unversioned
434 c577a9ce 2019-07-27 stsp
435 c577a9ce 2019-07-27 stsp echo '? epsilon/unversioned' > $testroot/stdout.expected
436 c577a9ce 2019-07-27 stsp echo '! epsilon/zeta' >> $testroot/stdout.expected
437 c577a9ce 2019-07-27 stsp
438 c577a9ce 2019-07-27 stsp (cd $testroot/wt && got status epsilon > $testroot/stdout)
439 c577a9ce 2019-07-27 stsp
440 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
441 7154f6ce 2019-03-27 stsp ret="$?"
442 7154f6ce 2019-03-27 stsp if [ "$ret" != "0" ]; then
443 7154f6ce 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
444 7154f6ce 2019-03-27 stsp fi
445 7154f6ce 2019-03-27 stsp test_done "$testroot" "$ret"
446 7154f6ce 2019-03-27 stsp }
447 72ea6654 2019-07-27 stsp
448 72ea6654 2019-07-27 stsp function test_status_many_paths {
449 72ea6654 2019-07-27 stsp local testroot=`test_init status_many_paths`
450 7154f6ce 2019-03-27 stsp
451 72ea6654 2019-07-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
452 72ea6654 2019-07-27 stsp ret="$?"
453 72ea6654 2019-07-27 stsp if [ "$ret" != "0" ]; then
454 72ea6654 2019-07-27 stsp test_done "$testroot" "$ret"
455 72ea6654 2019-07-27 stsp return 1
456 72ea6654 2019-07-27 stsp fi
457 72ea6654 2019-07-27 stsp
458 72ea6654 2019-07-27 stsp echo "modified alpha" > $testroot/wt/alpha
459 72ea6654 2019-07-27 stsp (cd $testroot/wt && got rm beta >/dev/null)
460 72ea6654 2019-07-27 stsp echo "unversioned file" > $testroot/wt/foo
461 72ea6654 2019-07-27 stsp rm $testroot/wt/epsilon/zeta
462 72ea6654 2019-07-27 stsp touch $testroot/wt/beta
463 72ea6654 2019-07-27 stsp echo "new file" > $testroot/wt/new
464 72ea6654 2019-07-27 stsp mkdir $testroot/wt/newdir
465 72ea6654 2019-07-27 stsp (cd $testroot/wt && got add new >/dev/null)
466 72ea6654 2019-07-27 stsp
467 72ea6654 2019-07-27 stsp (cd $testroot/wt && got status newdir > $testroot/stdout.expected)
468 72ea6654 2019-07-27 stsp (cd $testroot/wt && got status alpha >> $testroot/stdout.expected)
469 72ea6654 2019-07-27 stsp (cd $testroot/wt && got status epsilon >> $testroot/stdout.expected)
470 72ea6654 2019-07-27 stsp (cd $testroot/wt && got status foo >> $testroot/stdout.expected)
471 72ea6654 2019-07-27 stsp (cd $testroot/wt && got status new >> $testroot/stdout.expected)
472 72ea6654 2019-07-27 stsp (cd $testroot/wt && got status beta >> $testroot/stdout.expected)
473 72ea6654 2019-07-27 stsp (cd $testroot/wt && got status . >> $testroot/stdout.expected)
474 72ea6654 2019-07-27 stsp
475 72ea6654 2019-07-27 stsp (cd $testroot/wt && got status newdir alpha epsilon foo new beta . \
476 72ea6654 2019-07-27 stsp > $testroot/stdout)
477 6841da00 2019-08-08 stsp
478 6841da00 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
479 6841da00 2019-08-08 stsp ret="$?"
480 6841da00 2019-08-08 stsp if [ "$ret" != "0" ]; then
481 6841da00 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
482 6841da00 2019-08-08 stsp fi
483 6841da00 2019-08-08 stsp test_done "$testroot" "$ret"
484 6841da00 2019-08-08 stsp }
485 6841da00 2019-08-08 stsp
486 6841da00 2019-08-08 stsp function test_status_cvsignore {
487 6841da00 2019-08-08 stsp local testroot=`test_init status_cvsignore`
488 6841da00 2019-08-08 stsp
489 6841da00 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
490 6841da00 2019-08-08 stsp ret="$?"
491 6841da00 2019-08-08 stsp if [ "$ret" != "0" ]; then
492 6841da00 2019-08-08 stsp test_done "$testroot" "$ret"
493 6841da00 2019-08-08 stsp return 1
494 6841da00 2019-08-08 stsp fi
495 72ea6654 2019-07-27 stsp
496 6841da00 2019-08-08 stsp echo "unversioned file" > $testroot/wt/foo
497 6841da00 2019-08-08 stsp echo "unversioned file" > $testroot/wt/foop
498 6841da00 2019-08-08 stsp echo "unversioned file" > $testroot/wt/epsilon/bar
499 6841da00 2019-08-08 stsp echo "unversioned file" > $testroot/wt/epsilon/boo
500 6841da00 2019-08-08 stsp echo "unversioned file" > $testroot/wt/epsilon/moo
501 6841da00 2019-08-08 stsp echo "foo" > $testroot/wt/.cvsignore
502 6841da00 2019-08-08 stsp echo "bar" > $testroot/wt/epsilon/.cvsignore
503 6841da00 2019-08-08 stsp echo "moo" >> $testroot/wt/epsilon/.cvsignore
504 6841da00 2019-08-08 stsp
505 6841da00 2019-08-08 stsp echo '? .cvsignore' > $testroot/stdout.expected
506 6841da00 2019-08-08 stsp echo '? epsilon/.cvsignore' >> $testroot/stdout.expected
507 6841da00 2019-08-08 stsp echo '? epsilon/boo' >> $testroot/stdout.expected
508 6841da00 2019-08-08 stsp echo '? foop' >> $testroot/stdout.expected
509 6841da00 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
510 b80270a7 2019-08-08 stsp
511 b80270a7 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
512 b80270a7 2019-08-08 stsp ret="$?"
513 b80270a7 2019-08-08 stsp if [ "$ret" != "0" ]; then
514 b80270a7 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
515 b80270a7 2019-08-08 stsp test_done "$testroot" "$ret"
516 b80270a7 2019-08-08 stsp return 1
517 b80270a7 2019-08-08 stsp fi
518 6841da00 2019-08-08 stsp
519 b80270a7 2019-08-08 stsp echo '? .cvsignore' > $testroot/stdout.expected
520 b80270a7 2019-08-08 stsp echo '? epsilon/.cvsignore' >> $testroot/stdout.expected
521 b80270a7 2019-08-08 stsp echo '? epsilon/boo' >> $testroot/stdout.expected
522 bd8de430 2019-10-04 stsp echo '? foop' >> $testroot/stdout.expected
523 bd8de430 2019-10-04 stsp (cd $testroot/wt/gamma && got status > $testroot/stdout)
524 bd8de430 2019-10-04 stsp
525 bd8de430 2019-10-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
526 bd8de430 2019-10-04 stsp ret="$?"
527 bd8de430 2019-10-04 stsp if [ "$ret" != "0" ]; then
528 bd8de430 2019-10-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
529 bd8de430 2019-10-04 stsp fi
530 bd8de430 2019-10-04 stsp test_done "$testroot" "$ret"
531 bd8de430 2019-10-04 stsp }
532 bd8de430 2019-10-04 stsp
533 bd8de430 2019-10-04 stsp function test_status_gitignore {
534 bd8de430 2019-10-04 stsp local testroot=`test_init status_gitignore`
535 bd8de430 2019-10-04 stsp
536 bd8de430 2019-10-04 stsp got checkout $testroot/repo $testroot/wt > /dev/null
537 bd8de430 2019-10-04 stsp ret="$?"
538 bd8de430 2019-10-04 stsp if [ "$ret" != "0" ]; then
539 bd8de430 2019-10-04 stsp test_done "$testroot" "$ret"
540 bd8de430 2019-10-04 stsp return 1
541 bd8de430 2019-10-04 stsp fi
542 bd8de430 2019-10-04 stsp
543 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/foo
544 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/foop
545 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/barp
546 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/epsilon/bar
547 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/epsilon/boo
548 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/epsilon/moo
549 bd8de430 2019-10-04 stsp mkdir -p $testroot/wt/a/b/c/
550 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/a/b/c/foo
551 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/a/b/c/zoo
552 bd8de430 2019-10-04 stsp echo "foo" > $testroot/wt/.gitignore
553 bd8de430 2019-10-04 stsp echo "bar*" >> $testroot/wt/.gitignore
554 bd8de430 2019-10-04 stsp echo "epsilon/**" >> $testroot/wt/.gitignore
555 bd8de430 2019-10-04 stsp echo "a/**/foo" >> $testroot/wt/.gitignore
556 bd8de430 2019-10-04 stsp echo "**/zoo" >> $testroot/wt/.gitignore
557 bd8de430 2019-10-04 stsp
558 bd8de430 2019-10-04 stsp echo '? .gitignore' > $testroot/stdout.expected
559 b80270a7 2019-08-08 stsp echo '? foop' >> $testroot/stdout.expected
560 bd8de430 2019-10-04 stsp (cd $testroot/wt && got status > $testroot/stdout)
561 bd8de430 2019-10-04 stsp
562 bd8de430 2019-10-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
563 bd8de430 2019-10-04 stsp ret="$?"
564 bd8de430 2019-10-04 stsp if [ "$ret" != "0" ]; then
565 bd8de430 2019-10-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
566 bd8de430 2019-10-04 stsp test_done "$testroot" "$ret"
567 bd8de430 2019-10-04 stsp return 1
568 bd8de430 2019-10-04 stsp fi
569 bd8de430 2019-10-04 stsp
570 bd8de430 2019-10-04 stsp echo '? .gitignore' > $testroot/stdout.expected
571 bd8de430 2019-10-04 stsp echo '? foop' >> $testroot/stdout.expected
572 b80270a7 2019-08-08 stsp (cd $testroot/wt/gamma && got status > $testroot/stdout)
573 b80270a7 2019-08-08 stsp
574 72ea6654 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
575 72ea6654 2019-07-27 stsp ret="$?"
576 72ea6654 2019-07-27 stsp if [ "$ret" != "0" ]; then
577 72ea6654 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
578 72ea6654 2019-07-27 stsp fi
579 72ea6654 2019-07-27 stsp test_done "$testroot" "$ret"
580 72ea6654 2019-07-27 stsp }
581 72ea6654 2019-07-27 stsp
582 35dc4510 2019-02-04 stsp run_test test_status_basic
583 f02ba292 2019-02-05 stsp run_test test_status_subdir_no_mods
584 f02ba292 2019-02-05 stsp run_test test_status_subdir_no_mods2
585 0dbc2271 2019-02-05 stsp run_test test_status_obstructed
586 02c07007 2019-02-10 stsp run_test test_status_shows_local_mods_after_update
587 18831e78 2019-02-10 stsp run_test test_status_unversioned_subdirs
588 2c201a36 2019-02-10 stsp run_test test_status_ignores_symlink
589 3cbbd752 2019-02-19 stsp run_test test_status_shows_no_mods_after_complete_merge
590 7154f6ce 2019-03-27 stsp run_test test_status_shows_conflict
591 c577a9ce 2019-07-27 stsp run_test test_status_empty_dir
592 c577a9ce 2019-07-27 stsp run_test test_status_empty_dir_unversioned_file
593 72ea6654 2019-07-27 stsp run_test test_status_many_paths
594 6841da00 2019-08-08 stsp run_test test_status_cvsignore
595 bd8de430 2019-10-04 stsp run_test test_status_gitignore