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