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 f6cae3ed 2020-09-13 naddy 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 f6cae3ed 2020-09-13 naddy 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 f6cae3ed 2020-09-13 naddy 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 f6cae3ed 2020-09-13 naddy 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 a84c0d30 2022-03-12 stsp
151 a84c0d30 2022-03-12 stsp cmp -s $testroot/stdout.expected $testroot/stdout
152 a84c0d30 2022-03-12 stsp ret="$?"
153 a84c0d30 2022-03-12 stsp if [ "$ret" != "0" ]; then
154 a84c0d30 2022-03-12 stsp diff -u $testroot/stdout.expected $testroot/stdout
155 a84c0d30 2022-03-12 stsp test_done "$testroot" "$ret"
156 a84c0d30 2022-03-12 stsp return 1
157 a84c0d30 2022-03-12 stsp fi
158 a84c0d30 2022-03-12 stsp
159 a84c0d30 2022-03-12 stsp (cd $testroot/wt && got status epsilon/zeta > $testroot/stdout)
160 0dbc2271 2019-02-05 stsp
161 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
162 e60e7f5b 2019-02-10 stsp ret="$?"
163 a062651c 2019-07-27 stsp if [ "$ret" != "0" ]; then
164 0dbc2271 2019-02-05 stsp diff -u $testroot/stdout.expected $testroot/stdout
165 0dbc2271 2019-02-05 stsp fi
166 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
167 0dbc2271 2019-02-05 stsp }
168 0dbc2271 2019-02-05 stsp
169 f6cae3ed 2020-09-13 naddy test_status_shows_local_mods_after_update() {
170 02c07007 2019-02-10 stsp local testroot=`test_init status_shows_local_mods_after_update 1`
171 02c07007 2019-02-10 stsp
172 02c07007 2019-02-10 stsp echo "1" > $testroot/repo/numbers
173 02c07007 2019-02-10 stsp echo "2" >> $testroot/repo/numbers
174 02c07007 2019-02-10 stsp echo "3" >> $testroot/repo/numbers
175 02c07007 2019-02-10 stsp echo "4" >> $testroot/repo/numbers
176 02c07007 2019-02-10 stsp echo "5" >> $testroot/repo/numbers
177 02c07007 2019-02-10 stsp echo "6" >> $testroot/repo/numbers
178 02c07007 2019-02-10 stsp echo "7" >> $testroot/repo/numbers
179 02c07007 2019-02-10 stsp echo "8" >> $testroot/repo/numbers
180 02c07007 2019-02-10 stsp (cd $testroot/repo && git add numbers)
181 02c07007 2019-02-10 stsp git_commit $testroot/repo -m "added numbers file"
182 02c07007 2019-02-10 stsp
183 02c07007 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
184 02c07007 2019-02-10 stsp ret="$?"
185 02c07007 2019-02-10 stsp if [ "$ret" != "0" ]; then
186 02c07007 2019-02-10 stsp test_done "$testroot" "$ret"
187 02c07007 2019-02-10 stsp return 1
188 02c07007 2019-02-10 stsp fi
189 02c07007 2019-02-10 stsp
190 02c07007 2019-02-10 stsp sed -i 's/2/22/' $testroot/repo/numbers
191 02c07007 2019-02-10 stsp git_commit $testroot/repo -m "modified line 2"
192 02c07007 2019-02-10 stsp
193 02c07007 2019-02-10 stsp # modify line 7; both changes should merge cleanly
194 02c07007 2019-02-10 stsp sed -i 's/7/77/' $testroot/wt/numbers
195 02c07007 2019-02-10 stsp
196 02c07007 2019-02-10 stsp echo "G numbers" > $testroot/stdout.expected
197 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
198 02c07007 2019-02-10 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
199 02c07007 2019-02-10 stsp echo >> $testroot/stdout.expected
200 02c07007 2019-02-10 stsp
201 02c07007 2019-02-10 stsp (cd $testroot/wt && got update > $testroot/stdout)
202 02c07007 2019-02-10 stsp
203 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
204 02c07007 2019-02-10 stsp ret="$?"
205 02c07007 2019-02-10 stsp if [ "$ret" != "0" ]; then
206 02c07007 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
207 02c07007 2019-02-10 stsp test_done "$testroot" "$ret"
208 02c07007 2019-02-10 stsp return 1
209 02c07007 2019-02-10 stsp fi
210 02c07007 2019-02-10 stsp
211 02c07007 2019-02-10 stsp echo 'M numbers' > $testroot/stdout.expected
212 02c07007 2019-02-10 stsp
213 02c07007 2019-02-10 stsp (cd $testroot/wt && got status > $testroot/stdout)
214 02c07007 2019-02-10 stsp
215 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
216 02c07007 2019-02-10 stsp ret="$?"
217 02c07007 2019-02-10 stsp if [ "$ret" != "0" ]; then
218 02c07007 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
219 02c07007 2019-02-10 stsp fi
220 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
221 02c07007 2019-02-10 stsp }
222 02c07007 2019-02-10 stsp
223 f6cae3ed 2020-09-13 naddy test_status_unversioned_subdirs() {
224 18831e78 2019-02-10 stsp local testroot=`test_init status_unversioned_subdirs 1`
225 18831e78 2019-02-10 stsp
226 18831e78 2019-02-10 stsp mkdir $testroot/repo/cdfs/
227 18831e78 2019-02-10 stsp touch $testroot/repo/cdfs/Makefile
228 18831e78 2019-02-10 stsp mkdir $testroot/repo/common/
229 18831e78 2019-02-10 stsp touch $testroot/repo/common/Makefile
230 18831e78 2019-02-10 stsp mkdir $testroot/repo/iso/
231 18831e78 2019-02-10 stsp touch $testroot/repo/iso/Makefile
232 18831e78 2019-02-10 stsp mkdir $testroot/repo/ramdisk/
233 18831e78 2019-02-10 stsp touch $testroot/repo/ramdisk/Makefile
234 18831e78 2019-02-10 stsp touch $testroot/repo/ramdisk/list.local
235 18831e78 2019-02-10 stsp mkdir $testroot/repo/ramdisk_cd/
236 18831e78 2019-02-10 stsp touch $testroot/repo/ramdisk_cd/Makefile
237 18831e78 2019-02-10 stsp touch $testroot/repo/ramdisk_cd/list.local
238 18831e78 2019-02-10 stsp (cd $testroot/repo && git add .)
239 18831e78 2019-02-10 stsp git_commit $testroot/repo -m "first commit"
240 18831e78 2019-02-10 stsp
241 18831e78 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
242 18831e78 2019-02-10 stsp ret="$?"
243 18831e78 2019-02-10 stsp if [ "$ret" != "0" ]; then
244 18831e78 2019-02-10 stsp test_done "$testroot" "$ret"
245 18831e78 2019-02-10 stsp return 1
246 18831e78 2019-02-10 stsp fi
247 18831e78 2019-02-10 stsp
248 18831e78 2019-02-10 stsp mkdir $testroot/wt/cdfs/obj
249 18831e78 2019-02-10 stsp mkdir $testroot/wt/ramdisk/obj
250 18831e78 2019-02-10 stsp mkdir $testroot/wt/ramdisk_cd/obj
251 18831e78 2019-02-10 stsp mkdir $testroot/wt/iso/obj
252 18831e78 2019-02-10 stsp
253 18831e78 2019-02-10 stsp echo -n > $testroot/stdout.expected
254 18831e78 2019-02-10 stsp
255 18831e78 2019-02-10 stsp # This used to erroneously print:
256 18831e78 2019-02-10 stsp #
257 18831e78 2019-02-10 stsp # ! ramdisk_cd/Makefile
258 18831e78 2019-02-10 stsp # ! ramdisk_cd/list.local
259 18831e78 2019-02-10 stsp # ? ramdisk_cd/Makefile
260 18831e78 2019-02-10 stsp # ? ramdisk_cd/list.local
261 18831e78 2019-02-10 stsp (cd $testroot/wt && got status > $testroot/stdout)
262 18831e78 2019-02-10 stsp
263 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
264 18831e78 2019-02-10 stsp ret="$?"
265 18831e78 2019-02-10 stsp if [ "$ret" != "0" ]; then
266 18831e78 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
267 18831e78 2019-02-10 stsp fi
268 18831e78 2019-02-10 stsp test_done "$testroot" "$ret"
269 18831e78 2019-02-10 stsp }
270 18831e78 2019-02-10 stsp
271 f6cae3ed 2020-09-13 naddy test_status_symlink() {
272 00bb5ea0 2020-07-23 stsp local testroot=`test_init status_symlink`
273 2c201a36 2019-02-10 stsp
274 2c201a36 2019-02-10 stsp mkdir $testroot/repo/ramdisk/
275 2c201a36 2019-02-10 stsp touch $testroot/repo/ramdisk/Makefile
276 d4ae64fa 2020-07-23 stsp (cd $testroot/repo && ln -s alpha alpha.link)
277 d4ae64fa 2020-07-23 stsp (cd $testroot/repo && ln -s epsilon epsilon.link)
278 d4ae64fa 2020-07-23 stsp (cd $testroot/repo && ln -s nonexistent nonexistent.link)
279 2c201a36 2019-02-10 stsp (cd $testroot/repo && git add .)
280 2c201a36 2019-02-10 stsp git_commit $testroot/repo -m "first commit"
281 2c201a36 2019-02-10 stsp
282 2c201a36 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > /dev/null
283 2c201a36 2019-02-10 stsp ret="$?"
284 2c201a36 2019-02-10 stsp if [ "$ret" != "0" ]; then
285 2c201a36 2019-02-10 stsp test_done "$testroot" "$ret"
286 2c201a36 2019-02-10 stsp return 1
287 2c201a36 2019-02-10 stsp fi
288 2c201a36 2019-02-10 stsp
289 2c201a36 2019-02-10 stsp ln -s /usr/obj/distrib/i386/ramdisk $testroot/wt/ramdisk/obj
290 3cbbd752 2019-02-19 stsp
291 00bb5ea0 2020-07-23 stsp echo "? ramdisk/obj" > $testroot/stdout.expected
292 00bb5ea0 2020-07-23 stsp
293 00bb5ea0 2020-07-23 stsp (cd $testroot/wt && got status > $testroot/stdout)
294 00bb5ea0 2020-07-23 stsp
295 00bb5ea0 2020-07-23 stsp cmp -s $testroot/stdout.expected $testroot/stdout
296 00bb5ea0 2020-07-23 stsp ret="$?"
297 00bb5ea0 2020-07-23 stsp if [ "$ret" != "0" ]; then
298 00bb5ea0 2020-07-23 stsp diff -u $testroot/stdout.expected $testroot/stdout
299 00bb5ea0 2020-07-23 stsp test_done "$testroot" "$ret"
300 00bb5ea0 2020-07-23 stsp return 1
301 00bb5ea0 2020-07-23 stsp fi
302 00bb5ea0 2020-07-23 stsp
303 d4ae64fa 2020-07-23 stsp (cd $testroot/wt && ln -sf beta alpha.link)
304 d4ae64fa 2020-07-23 stsp (cd $testroot/wt && ln -sfh gamma epsilon.link)
305 d4ae64fa 2020-07-23 stsp
306 00bb5ea0 2020-07-23 stsp (cd $testroot/wt && ln -s /etc/passwd passwd.link)
307 00bb5ea0 2020-07-23 stsp (cd $testroot/wt && ln -s ../beta epsilon/beta.link)
308 d4ae64fa 2020-07-23 stsp (cd $testroot/wt && got add passwd.link epsilon/beta.link > /dev/null)
309 00bb5ea0 2020-07-23 stsp
310 d4ae64fa 2020-07-23 stsp (cd $testroot/wt && got rm nonexistent.link > /dev/null)
311 d4ae64fa 2020-07-23 stsp
312 d4ae64fa 2020-07-23 stsp echo 'M alpha.link' > $testroot/stdout.expected
313 00bb5ea0 2020-07-23 stsp echo 'A epsilon/beta.link' >> $testroot/stdout.expected
314 d4ae64fa 2020-07-23 stsp echo 'M epsilon.link' >> $testroot/stdout.expected
315 d4ae64fa 2020-07-23 stsp echo 'D nonexistent.link' >> $testroot/stdout.expected
316 00bb5ea0 2020-07-23 stsp echo 'A passwd.link' >> $testroot/stdout.expected
317 00bb5ea0 2020-07-23 stsp echo "? ramdisk/obj" >> $testroot/stdout.expected
318 3cbbd752 2019-02-19 stsp
319 3cbbd752 2019-02-19 stsp (cd $testroot/wt && got status > $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 fi
326 3cbbd752 2019-02-19 stsp test_done "$testroot" "$ret"
327 3cbbd752 2019-02-19 stsp }
328 3cbbd752 2019-02-19 stsp
329 f6cae3ed 2020-09-13 naddy test_status_shows_no_mods_after_complete_merge() {
330 3cbbd752 2019-02-19 stsp local testroot=`test_init status_shows_no_mods_after_complete_merge 1`
331 3cbbd752 2019-02-19 stsp
332 3cbbd752 2019-02-19 stsp # make this file larger than the usual blob buffer size of 8192
333 3cbbd752 2019-02-19 stsp echo -n > $testroot/repo/numbers
334 3cbbd752 2019-02-19 stsp for i in `jot 16384`; do
335 3cbbd752 2019-02-19 stsp echo "$i" >> $testroot/repo/numbers
336 3cbbd752 2019-02-19 stsp done
337 3cbbd752 2019-02-19 stsp
338 3cbbd752 2019-02-19 stsp (cd $testroot/repo && git add numbers)
339 3cbbd752 2019-02-19 stsp git_commit $testroot/repo -m "added numbers file"
340 3cbbd752 2019-02-19 stsp
341 3cbbd752 2019-02-19 stsp got checkout $testroot/repo $testroot/wt > /dev/null
342 3cbbd752 2019-02-19 stsp ret="$?"
343 3cbbd752 2019-02-19 stsp if [ "$ret" != "0" ]; then
344 3cbbd752 2019-02-19 stsp test_done "$testroot" "$ret"
345 3cbbd752 2019-02-19 stsp return 1
346 3cbbd752 2019-02-19 stsp fi
347 2c201a36 2019-02-10 stsp
348 3cbbd752 2019-02-19 stsp sed -i 's/2/22/' $testroot/repo/numbers
349 3cbbd752 2019-02-19 stsp git_commit $testroot/repo -m "modified line 2"
350 3cbbd752 2019-02-19 stsp
351 3cbbd752 2019-02-19 stsp sleep 1
352 3cbbd752 2019-02-19 stsp # modify line 2 again; no local changes are left after merge
353 3cbbd752 2019-02-19 stsp sed -i 's/2/22/' $testroot/wt/numbers
354 3cbbd752 2019-02-19 stsp
355 3cbbd752 2019-02-19 stsp echo "G numbers" > $testroot/stdout.expected
356 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
357 3cbbd752 2019-02-19 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
358 3cbbd752 2019-02-19 stsp echo >> $testroot/stdout.expected
359 3cbbd752 2019-02-19 stsp
360 3cbbd752 2019-02-19 stsp (cd $testroot/wt && got update > $testroot/stdout)
361 3cbbd752 2019-02-19 stsp
362 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
363 3cbbd752 2019-02-19 stsp ret="$?"
364 3cbbd752 2019-02-19 stsp if [ "$ret" != "0" ]; then
365 3cbbd752 2019-02-19 stsp diff -u $testroot/stdout.expected $testroot/stdout
366 3cbbd752 2019-02-19 stsp test_done "$testroot" "$ret"
367 3cbbd752 2019-02-19 stsp return 1
368 3cbbd752 2019-02-19 stsp fi
369 3cbbd752 2019-02-19 stsp
370 2c201a36 2019-02-10 stsp echo -n > $testroot/stdout.expected
371 2c201a36 2019-02-10 stsp
372 2c201a36 2019-02-10 stsp (cd $testroot/wt && got status > $testroot/stdout)
373 2c201a36 2019-02-10 stsp
374 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
375 2c201a36 2019-02-10 stsp ret="$?"
376 2c201a36 2019-02-10 stsp if [ "$ret" != "0" ]; then
377 2c201a36 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
378 2c201a36 2019-02-10 stsp fi
379 2c201a36 2019-02-10 stsp test_done "$testroot" "$ret"
380 2c201a36 2019-02-10 stsp }
381 7154f6ce 2019-03-27 stsp
382 f6cae3ed 2020-09-13 naddy test_status_shows_conflict() {
383 7154f6ce 2019-03-27 stsp local testroot=`test_init status_shows_conflict 1`
384 2c201a36 2019-02-10 stsp
385 7154f6ce 2019-03-27 stsp echo "1" > $testroot/repo/numbers
386 7154f6ce 2019-03-27 stsp echo "2" >> $testroot/repo/numbers
387 7154f6ce 2019-03-27 stsp echo "3" >> $testroot/repo/numbers
388 7154f6ce 2019-03-27 stsp echo "4" >> $testroot/repo/numbers
389 7154f6ce 2019-03-27 stsp echo "5" >> $testroot/repo/numbers
390 7154f6ce 2019-03-27 stsp echo "6" >> $testroot/repo/numbers
391 7154f6ce 2019-03-27 stsp echo "7" >> $testroot/repo/numbers
392 7154f6ce 2019-03-27 stsp echo "8" >> $testroot/repo/numbers
393 7154f6ce 2019-03-27 stsp (cd $testroot/repo && git add numbers)
394 7154f6ce 2019-03-27 stsp git_commit $testroot/repo -m "added numbers file"
395 7154f6ce 2019-03-27 stsp
396 7154f6ce 2019-03-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
397 7154f6ce 2019-03-27 stsp ret="$?"
398 7154f6ce 2019-03-27 stsp if [ "$ret" != "0" ]; then
399 7154f6ce 2019-03-27 stsp test_done "$testroot" "$ret"
400 7154f6ce 2019-03-27 stsp return 1
401 7154f6ce 2019-03-27 stsp fi
402 7154f6ce 2019-03-27 stsp
403 7154f6ce 2019-03-27 stsp sed -i 's/2/22/' $testroot/repo/numbers
404 7154f6ce 2019-03-27 stsp git_commit $testroot/repo -m "modified line 2"
405 7154f6ce 2019-03-27 stsp
406 7154f6ce 2019-03-27 stsp # modify line 2 in a conflicting way
407 7154f6ce 2019-03-27 stsp sed -i 's/2/77/' $testroot/wt/numbers
408 7154f6ce 2019-03-27 stsp
409 7154f6ce 2019-03-27 stsp echo "C numbers" > $testroot/stdout.expected
410 4f3c844b 2021-09-14 stsp echo -n "Updated to refs/heads/master: " >> $testroot/stdout.expected
411 7154f6ce 2019-03-27 stsp git_show_head $testroot/repo >> $testroot/stdout.expected
412 7154f6ce 2019-03-27 stsp echo >> $testroot/stdout.expected
413 9627c110 2020-04-18 stsp echo "Files with new merge conflicts: 1" >> $testroot/stdout.expected
414 7154f6ce 2019-03-27 stsp
415 7154f6ce 2019-03-27 stsp (cd $testroot/wt && got update > $testroot/stdout)
416 7154f6ce 2019-03-27 stsp
417 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
418 7154f6ce 2019-03-27 stsp ret="$?"
419 7154f6ce 2019-03-27 stsp if [ "$ret" != "0" ]; then
420 7154f6ce 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
421 7154f6ce 2019-03-27 stsp test_done "$testroot" "$ret"
422 7154f6ce 2019-03-27 stsp return 1
423 7154f6ce 2019-03-27 stsp fi
424 7154f6ce 2019-03-27 stsp
425 7154f6ce 2019-03-27 stsp echo 'C numbers' > $testroot/stdout.expected
426 7154f6ce 2019-03-27 stsp
427 7154f6ce 2019-03-27 stsp (cd $testroot/wt && got status > $testroot/stdout)
428 c577a9ce 2019-07-27 stsp
429 c577a9ce 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
430 c577a9ce 2019-07-27 stsp ret="$?"
431 c577a9ce 2019-07-27 stsp if [ "$ret" != "0" ]; then
432 c577a9ce 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
433 c577a9ce 2019-07-27 stsp fi
434 c577a9ce 2019-07-27 stsp test_done "$testroot" "$ret"
435 c577a9ce 2019-07-27 stsp }
436 c577a9ce 2019-07-27 stsp
437 f6cae3ed 2020-09-13 naddy test_status_empty_dir() {
438 c577a9ce 2019-07-27 stsp local testroot=`test_init status_empty_dir`
439 c577a9ce 2019-07-27 stsp
440 c577a9ce 2019-07-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
441 c577a9ce 2019-07-27 stsp ret="$?"
442 c577a9ce 2019-07-27 stsp if [ "$ret" != "0" ]; then
443 c577a9ce 2019-07-27 stsp test_done "$testroot" "$ret"
444 c577a9ce 2019-07-27 stsp return 1
445 c577a9ce 2019-07-27 stsp fi
446 c577a9ce 2019-07-27 stsp
447 c577a9ce 2019-07-27 stsp rm $testroot/wt/epsilon/zeta
448 c577a9ce 2019-07-27 stsp
449 c577a9ce 2019-07-27 stsp echo '! epsilon/zeta' > $testroot/stdout.expected
450 c577a9ce 2019-07-27 stsp
451 c577a9ce 2019-07-27 stsp (cd $testroot/wt && got status epsilon > $testroot/stdout)
452 c577a9ce 2019-07-27 stsp
453 c577a9ce 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
454 c577a9ce 2019-07-27 stsp ret="$?"
455 c577a9ce 2019-07-27 stsp if [ "$ret" != "0" ]; then
456 c577a9ce 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
457 c577a9ce 2019-07-27 stsp fi
458 c577a9ce 2019-07-27 stsp test_done "$testroot" "$ret"
459 c577a9ce 2019-07-27 stsp }
460 7154f6ce 2019-03-27 stsp
461 f6cae3ed 2020-09-13 naddy test_status_empty_dir_unversioned_file() {
462 c577a9ce 2019-07-27 stsp local testroot=`test_init status_empty_dir_unversioned_file`
463 c577a9ce 2019-07-27 stsp
464 c577a9ce 2019-07-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
465 c577a9ce 2019-07-27 stsp ret="$?"
466 c577a9ce 2019-07-27 stsp if [ "$ret" != "0" ]; then
467 c577a9ce 2019-07-27 stsp test_done "$testroot" "$ret"
468 c577a9ce 2019-07-27 stsp return 1
469 c577a9ce 2019-07-27 stsp fi
470 c577a9ce 2019-07-27 stsp
471 c577a9ce 2019-07-27 stsp rm $testroot/wt/epsilon/zeta
472 c577a9ce 2019-07-27 stsp touch $testroot/wt/epsilon/unversioned
473 c577a9ce 2019-07-27 stsp
474 c577a9ce 2019-07-27 stsp echo '? epsilon/unversioned' > $testroot/stdout.expected
475 c577a9ce 2019-07-27 stsp echo '! epsilon/zeta' >> $testroot/stdout.expected
476 c577a9ce 2019-07-27 stsp
477 c577a9ce 2019-07-27 stsp (cd $testroot/wt && got status epsilon > $testroot/stdout)
478 c577a9ce 2019-07-27 stsp
479 8d301dd9 2019-05-14 stsp cmp -s $testroot/stdout.expected $testroot/stdout
480 7154f6ce 2019-03-27 stsp ret="$?"
481 7154f6ce 2019-03-27 stsp if [ "$ret" != "0" ]; then
482 7154f6ce 2019-03-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
483 7154f6ce 2019-03-27 stsp fi
484 7154f6ce 2019-03-27 stsp test_done "$testroot" "$ret"
485 7154f6ce 2019-03-27 stsp }
486 72ea6654 2019-07-27 stsp
487 f6cae3ed 2020-09-13 naddy test_status_many_paths() {
488 72ea6654 2019-07-27 stsp local testroot=`test_init status_many_paths`
489 7154f6ce 2019-03-27 stsp
490 72ea6654 2019-07-27 stsp got checkout $testroot/repo $testroot/wt > /dev/null
491 72ea6654 2019-07-27 stsp ret="$?"
492 72ea6654 2019-07-27 stsp if [ "$ret" != "0" ]; then
493 72ea6654 2019-07-27 stsp test_done "$testroot" "$ret"
494 72ea6654 2019-07-27 stsp return 1
495 72ea6654 2019-07-27 stsp fi
496 72ea6654 2019-07-27 stsp
497 72ea6654 2019-07-27 stsp echo "modified alpha" > $testroot/wt/alpha
498 72ea6654 2019-07-27 stsp (cd $testroot/wt && got rm beta >/dev/null)
499 72ea6654 2019-07-27 stsp echo "unversioned file" > $testroot/wt/foo
500 72ea6654 2019-07-27 stsp rm $testroot/wt/epsilon/zeta
501 72ea6654 2019-07-27 stsp touch $testroot/wt/beta
502 72ea6654 2019-07-27 stsp echo "new file" > $testroot/wt/new
503 72ea6654 2019-07-27 stsp mkdir $testroot/wt/newdir
504 72ea6654 2019-07-27 stsp (cd $testroot/wt && got add new >/dev/null)
505 72ea6654 2019-07-27 stsp
506 10a623df 2021-10-11 stsp (cd $testroot/wt && got status alpha > $testroot/stdout.expected)
507 10a623df 2021-10-11 stsp (cd $testroot/wt && got status beta >> $testroot/stdout.expected)
508 72ea6654 2019-07-27 stsp (cd $testroot/wt && got status epsilon >> $testroot/stdout.expected)
509 72ea6654 2019-07-27 stsp (cd $testroot/wt && got status foo >> $testroot/stdout.expected)
510 72ea6654 2019-07-27 stsp (cd $testroot/wt && got status new >> $testroot/stdout.expected)
511 10a623df 2021-10-11 stsp (cd $testroot/wt && got status newdir >> $testroot/stdout.expected)
512 72ea6654 2019-07-27 stsp (cd $testroot/wt && got status . >> $testroot/stdout.expected)
513 72ea6654 2019-07-27 stsp
514 72ea6654 2019-07-27 stsp (cd $testroot/wt && got status newdir alpha epsilon foo new beta . \
515 72ea6654 2019-07-27 stsp > $testroot/stdout)
516 6841da00 2019-08-08 stsp
517 6841da00 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
518 6841da00 2019-08-08 stsp ret="$?"
519 6841da00 2019-08-08 stsp if [ "$ret" != "0" ]; then
520 6841da00 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
521 6841da00 2019-08-08 stsp fi
522 6841da00 2019-08-08 stsp test_done "$testroot" "$ret"
523 6841da00 2019-08-08 stsp }
524 6841da00 2019-08-08 stsp
525 f6cae3ed 2020-09-13 naddy test_status_cvsignore() {
526 6841da00 2019-08-08 stsp local testroot=`test_init status_cvsignore`
527 6841da00 2019-08-08 stsp
528 6841da00 2019-08-08 stsp got checkout $testroot/repo $testroot/wt > /dev/null
529 6841da00 2019-08-08 stsp ret="$?"
530 6841da00 2019-08-08 stsp if [ "$ret" != "0" ]; then
531 6841da00 2019-08-08 stsp test_done "$testroot" "$ret"
532 6841da00 2019-08-08 stsp return 1
533 6841da00 2019-08-08 stsp fi
534 72ea6654 2019-07-27 stsp
535 6841da00 2019-08-08 stsp echo "unversioned file" > $testroot/wt/foo
536 6841da00 2019-08-08 stsp echo "unversioned file" > $testroot/wt/foop
537 3143d852 2020-06-25 stsp echo "unversioned file" > $testroot/wt/epsilon/foo
538 6841da00 2019-08-08 stsp echo "unversioned file" > $testroot/wt/epsilon/bar
539 6841da00 2019-08-08 stsp echo "unversioned file" > $testroot/wt/epsilon/boo
540 6841da00 2019-08-08 stsp echo "unversioned file" > $testroot/wt/epsilon/moo
541 3143d852 2020-06-25 stsp mkdir -p $testroot/wt/epsilon/new/
542 3143d852 2020-06-25 stsp echo "unversioned file" > $testroot/wt/epsilon/new/foo
543 3143d852 2020-06-25 stsp echo "**/foo" > $testroot/wt/.cvsignore
544 8f2ca62d 2021-10-13 stsp echo "**/gamma" >> $testroot/wt/.cvsignore
545 6841da00 2019-08-08 stsp echo "bar" > $testroot/wt/epsilon/.cvsignore
546 6841da00 2019-08-08 stsp echo "moo" >> $testroot/wt/epsilon/.cvsignore
547 6841da00 2019-08-08 stsp
548 6841da00 2019-08-08 stsp echo '? .cvsignore' > $testroot/stdout.expected
549 6841da00 2019-08-08 stsp echo '? epsilon/.cvsignore' >> $testroot/stdout.expected
550 6841da00 2019-08-08 stsp echo '? epsilon/boo' >> $testroot/stdout.expected
551 6841da00 2019-08-08 stsp echo '? foop' >> $testroot/stdout.expected
552 6841da00 2019-08-08 stsp (cd $testroot/wt && got status > $testroot/stdout)
553 3143d852 2020-06-25 stsp
554 3143d852 2020-06-25 stsp cmp -s $testroot/stdout.expected $testroot/stdout
555 3143d852 2020-06-25 stsp ret="$?"
556 3143d852 2020-06-25 stsp if [ "$ret" != "0" ]; then
557 3143d852 2020-06-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
558 3143d852 2020-06-25 stsp test_done "$testroot" "$ret"
559 3143d852 2020-06-25 stsp return 1
560 3143d852 2020-06-25 stsp fi
561 3143d852 2020-06-25 stsp
562 3143d852 2020-06-25 stsp echo '? epsilon/.cvsignore' > $testroot/stdout.expected
563 3143d852 2020-06-25 stsp echo '? epsilon/boo' >> $testroot/stdout.expected
564 3143d852 2020-06-25 stsp (cd $testroot/wt && got status epsilon > $testroot/stdout)
565 b80270a7 2019-08-08 stsp
566 b80270a7 2019-08-08 stsp cmp -s $testroot/stdout.expected $testroot/stdout
567 b80270a7 2019-08-08 stsp ret="$?"
568 b80270a7 2019-08-08 stsp if [ "$ret" != "0" ]; then
569 b80270a7 2019-08-08 stsp diff -u $testroot/stdout.expected $testroot/stdout
570 b80270a7 2019-08-08 stsp test_done "$testroot" "$ret"
571 b80270a7 2019-08-08 stsp return 1
572 b80270a7 2019-08-08 stsp fi
573 3143d852 2020-06-25 stsp
574 3143d852 2020-06-25 stsp echo -n '' > $testroot/stdout.expected
575 3143d852 2020-06-25 stsp (cd $testroot/wt && got status epsilon/new > $testroot/stdout)
576 6841da00 2019-08-08 stsp
577 3143d852 2020-06-25 stsp cmp -s $testroot/stdout.expected $testroot/stdout
578 3143d852 2020-06-25 stsp ret="$?"
579 3143d852 2020-06-25 stsp if [ "$ret" != "0" ]; then
580 3143d852 2020-06-25 stsp diff -u $testroot/stdout.expected $testroot/stdout
581 3143d852 2020-06-25 stsp test_done "$testroot" "$ret"
582 3143d852 2020-06-25 stsp return 1
583 3143d852 2020-06-25 stsp fi
584 3143d852 2020-06-25 stsp
585 b80270a7 2019-08-08 stsp echo '? .cvsignore' > $testroot/stdout.expected
586 b80270a7 2019-08-08 stsp echo '? epsilon/.cvsignore' >> $testroot/stdout.expected
587 b80270a7 2019-08-08 stsp echo '? epsilon/boo' >> $testroot/stdout.expected
588 bd8de430 2019-10-04 stsp echo '? foop' >> $testroot/stdout.expected
589 bd8de430 2019-10-04 stsp (cd $testroot/wt/gamma && got status > $testroot/stdout)
590 f6343036 2021-06-22 stsp
591 f6343036 2021-06-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
592 f6343036 2021-06-22 stsp ret="$?"
593 f6343036 2021-06-22 stsp if [ "$ret" != "0" ]; then
594 f6343036 2021-06-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
595 f6343036 2021-06-22 stsp test_done "$testroot" "$ret"
596 f6343036 2021-06-22 stsp return 1
597 f6343036 2021-06-22 stsp fi
598 f6343036 2021-06-22 stsp
599 f6343036 2021-06-22 stsp cat > $testroot/stdout.expected <<EOF
600 f6343036 2021-06-22 stsp ? .cvsignore
601 f6343036 2021-06-22 stsp ? epsilon/.cvsignore
602 f6343036 2021-06-22 stsp ? epsilon/bar
603 f6343036 2021-06-22 stsp ? epsilon/boo
604 f6343036 2021-06-22 stsp ? epsilon/foo
605 f6343036 2021-06-22 stsp ? epsilon/moo
606 f6343036 2021-06-22 stsp ? epsilon/new/foo
607 f6343036 2021-06-22 stsp ? foo
608 f6343036 2021-06-22 stsp ? foop
609 f6343036 2021-06-22 stsp EOF
610 f6343036 2021-06-22 stsp (cd $testroot/wt && got status -I > $testroot/stdout)
611 f6343036 2021-06-22 stsp ret="$?"
612 f6343036 2021-06-22 stsp if [ "$ret" != "0" ]; then
613 f6343036 2021-06-22 stsp echo "got status failed unexpectedly" >&2
614 f6343036 2021-06-22 stsp test_done "$testroot" "1"
615 f6343036 2021-06-22 stsp return 1
616 f6343036 2021-06-22 stsp fi
617 bd8de430 2019-10-04 stsp
618 bd8de430 2019-10-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
619 bd8de430 2019-10-04 stsp ret="$?"
620 bd8de430 2019-10-04 stsp if [ "$ret" != "0" ]; then
621 bd8de430 2019-10-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
622 bd8de430 2019-10-04 stsp fi
623 bd8de430 2019-10-04 stsp test_done "$testroot" "$ret"
624 bd8de430 2019-10-04 stsp }
625 bd8de430 2019-10-04 stsp
626 f6cae3ed 2020-09-13 naddy test_status_gitignore() {
627 bd8de430 2019-10-04 stsp local testroot=`test_init status_gitignore`
628 bd8de430 2019-10-04 stsp
629 bd8de430 2019-10-04 stsp got checkout $testroot/repo $testroot/wt > /dev/null
630 bd8de430 2019-10-04 stsp ret="$?"
631 bd8de430 2019-10-04 stsp if [ "$ret" != "0" ]; then
632 bd8de430 2019-10-04 stsp test_done "$testroot" "$ret"
633 bd8de430 2019-10-04 stsp return 1
634 bd8de430 2019-10-04 stsp fi
635 bd8de430 2019-10-04 stsp
636 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/foo
637 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/foop
638 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/barp
639 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/epsilon/bar
640 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/epsilon/boo
641 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/epsilon/moo
642 bd8de430 2019-10-04 stsp mkdir -p $testroot/wt/a/b/c/
643 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/a/b/c/foo
644 bd8de430 2019-10-04 stsp echo "unversioned file" > $testroot/wt/a/b/c/zoo
645 bd8de430 2019-10-04 stsp echo "foo" > $testroot/wt/.gitignore
646 bd8de430 2019-10-04 stsp echo "bar*" >> $testroot/wt/.gitignore
647 bd8de430 2019-10-04 stsp echo "epsilon/**" >> $testroot/wt/.gitignore
648 bd8de430 2019-10-04 stsp echo "a/**/foo" >> $testroot/wt/.gitignore
649 bd8de430 2019-10-04 stsp echo "**/zoo" >> $testroot/wt/.gitignore
650 bd8de430 2019-10-04 stsp
651 bd8de430 2019-10-04 stsp echo '? .gitignore' > $testroot/stdout.expected
652 b80270a7 2019-08-08 stsp echo '? foop' >> $testroot/stdout.expected
653 bd8de430 2019-10-04 stsp (cd $testroot/wt && got status > $testroot/stdout)
654 bd8de430 2019-10-04 stsp
655 bd8de430 2019-10-04 stsp cmp -s $testroot/stdout.expected $testroot/stdout
656 bd8de430 2019-10-04 stsp ret="$?"
657 bd8de430 2019-10-04 stsp if [ "$ret" != "0" ]; then
658 bd8de430 2019-10-04 stsp diff -u $testroot/stdout.expected $testroot/stdout
659 bd8de430 2019-10-04 stsp test_done "$testroot" "$ret"
660 bd8de430 2019-10-04 stsp return 1
661 bd8de430 2019-10-04 stsp fi
662 bd8de430 2019-10-04 stsp
663 bd8de430 2019-10-04 stsp echo '? .gitignore' > $testroot/stdout.expected
664 bd8de430 2019-10-04 stsp echo '? foop' >> $testroot/stdout.expected
665 b80270a7 2019-08-08 stsp (cd $testroot/wt/gamma && got status > $testroot/stdout)
666 b80270a7 2019-08-08 stsp
667 72ea6654 2019-07-27 stsp cmp -s $testroot/stdout.expected $testroot/stdout
668 72ea6654 2019-07-27 stsp ret="$?"
669 72ea6654 2019-07-27 stsp if [ "$ret" != "0" ]; then
670 72ea6654 2019-07-27 stsp diff -u $testroot/stdout.expected $testroot/stdout
671 f6343036 2021-06-22 stsp test_done "$testroot" "$ret"
672 f6343036 2021-06-22 stsp return 1
673 72ea6654 2019-07-27 stsp fi
674 f6343036 2021-06-22 stsp
675 f6343036 2021-06-22 stsp cat > $testroot/stdout.expected <<EOF
676 f6343036 2021-06-22 stsp ? .gitignore
677 f6343036 2021-06-22 stsp ? a/b/c/foo
678 f6343036 2021-06-22 stsp ? a/b/c/zoo
679 f6343036 2021-06-22 stsp ? barp
680 f6343036 2021-06-22 stsp ? epsilon/bar
681 f6343036 2021-06-22 stsp ? epsilon/boo
682 f6343036 2021-06-22 stsp ? epsilon/moo
683 f6343036 2021-06-22 stsp ? foo
684 f6343036 2021-06-22 stsp ? foop
685 f6343036 2021-06-22 stsp EOF
686 f6343036 2021-06-22 stsp (cd $testroot/wt && got status -I > $testroot/stdout)
687 f6343036 2021-06-22 stsp ret="$?"
688 f6343036 2021-06-22 stsp if [ "$ret" != "0" ]; then
689 f6343036 2021-06-22 stsp echo "got status failed unexpectedly" >&2
690 f6343036 2021-06-22 stsp test_done "$testroot" "1"
691 f6343036 2021-06-22 stsp return 1
692 f6343036 2021-06-22 stsp fi
693 f6343036 2021-06-22 stsp
694 f6343036 2021-06-22 stsp cmp -s $testroot/stdout.expected $testroot/stdout
695 f6343036 2021-06-22 stsp ret="$?"
696 f6343036 2021-06-22 stsp if [ "$ret" != "0" ]; then
697 f6343036 2021-06-22 stsp diff -u $testroot/stdout.expected $testroot/stdout
698 f6343036 2021-06-22 stsp fi
699 72ea6654 2019-07-27 stsp test_done "$testroot" "$ret"
700 72ea6654 2019-07-27 stsp }
701 081470ac 2020-08-13 stsp
702 f6cae3ed 2020-09-13 naddy test_status_status_code() {
703 081470ac 2020-08-13 stsp local testroot=`test_init status_status_code`
704 081470ac 2020-08-13 stsp
705 081470ac 2020-08-13 stsp got checkout $testroot/repo $testroot/wt > /dev/null
706 081470ac 2020-08-13 stsp ret="$?"
707 081470ac 2020-08-13 stsp if [ "$ret" != "0" ]; then
708 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
709 081470ac 2020-08-13 stsp return 1
710 081470ac 2020-08-13 stsp fi
711 081470ac 2020-08-13 stsp
712 081470ac 2020-08-13 stsp echo "modified alpha" > $testroot/wt/alpha
713 081470ac 2020-08-13 stsp (cd $testroot/wt && got rm beta >/dev/null)
714 081470ac 2020-08-13 stsp echo "unversioned file" > $testroot/wt/foo
715 081470ac 2020-08-13 stsp rm $testroot/wt/epsilon/zeta
716 081470ac 2020-08-13 stsp touch $testroot/wt/beta
717 081470ac 2020-08-13 stsp echo "new file" > $testroot/wt/new
718 081470ac 2020-08-13 stsp (cd $testroot/wt && got add new >/dev/null)
719 081470ac 2020-08-13 stsp
720 081470ac 2020-08-13 stsp (cd $testroot/wt && got status -s xDM \
721 081470ac 2020-08-13 stsp > $testroot/stdout 2> $testroot/stderr)
722 081470ac 2020-08-13 stsp ret="$?"
723 54c39596 2020-12-28 stsp if [ "$ret" = "0" ]; then
724 081470ac 2020-08-13 stsp echo "status succeeded unexpectedly" >&2
725 081470ac 2020-08-13 stsp test_done "$testroot" "1"
726 081470ac 2020-08-13 stsp return 1
727 081470ac 2020-08-13 stsp fi
728 081470ac 2020-08-13 stsp
729 081470ac 2020-08-13 stsp echo "got: invalid status code 'x'" > $testroot/stderr.expected
730 081470ac 2020-08-13 stsp cmp -s $testroot/stderr.expected $testroot/stderr
731 081470ac 2020-08-13 stsp ret="$?"
732 081470ac 2020-08-13 stsp if [ "$ret" != "0" ]; then
733 081470ac 2020-08-13 stsp diff -u $testroot/stderr.expected $testroot/stderr
734 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
735 081470ac 2020-08-13 stsp return 1
736 081470ac 2020-08-13 stsp fi
737 72ea6654 2019-07-27 stsp
738 081470ac 2020-08-13 stsp echo 'M alpha' > $testroot/stdout.expected
739 081470ac 2020-08-13 stsp (cd $testroot/wt && got status -s M > $testroot/stdout)
740 081470ac 2020-08-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
741 081470ac 2020-08-13 stsp ret="$?"
742 081470ac 2020-08-13 stsp if [ "$ret" != "0" ]; then
743 081470ac 2020-08-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
744 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
745 081470ac 2020-08-13 stsp return 1
746 081470ac 2020-08-13 stsp fi
747 081470ac 2020-08-13 stsp
748 081470ac 2020-08-13 stsp echo 'D beta' > $testroot/stdout.expected
749 081470ac 2020-08-13 stsp (cd $testroot/wt && got status -s D > $testroot/stdout)
750 081470ac 2020-08-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
751 081470ac 2020-08-13 stsp ret="$?"
752 081470ac 2020-08-13 stsp if [ "$ret" != "0" ]; then
753 081470ac 2020-08-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
754 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
755 081470ac 2020-08-13 stsp return 1
756 081470ac 2020-08-13 stsp fi
757 081470ac 2020-08-13 stsp
758 081470ac 2020-08-13 stsp echo '! epsilon/zeta' > $testroot/stdout.expected
759 081470ac 2020-08-13 stsp echo '? foo' >> $testroot/stdout.expected
760 67d7451c 2021-09-15 naddy (cd $testroot/wt && got status -s !\? > $testroot/stdout)
761 081470ac 2020-08-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
762 081470ac 2020-08-13 stsp ret="$?"
763 081470ac 2020-08-13 stsp if [ "$ret" != "0" ]; then
764 081470ac 2020-08-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
765 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
766 081470ac 2020-08-13 stsp return 1
767 081470ac 2020-08-13 stsp fi
768 081470ac 2020-08-13 stsp
769 081470ac 2020-08-13 stsp echo 'A new' > $testroot/stdout.expected
770 081470ac 2020-08-13 stsp (cd $testroot/wt && got status -s A > $testroot/stdout)
771 081470ac 2020-08-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
772 081470ac 2020-08-13 stsp ret="$?"
773 081470ac 2020-08-13 stsp if [ "$ret" != "0" ]; then
774 081470ac 2020-08-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
775 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
776 081470ac 2020-08-13 stsp return 1
777 081470ac 2020-08-13 stsp fi
778 081470ac 2020-08-13 stsp
779 081470ac 2020-08-13 stsp (cd $testroot/wt && got stage new > $testroot/stdout)
780 081470ac 2020-08-13 stsp
781 081470ac 2020-08-13 stsp echo ' A new' > $testroot/stdout.expected
782 081470ac 2020-08-13 stsp (cd $testroot/wt && got status -s A > $testroot/stdout)
783 081470ac 2020-08-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
784 081470ac 2020-08-13 stsp ret="$?"
785 081470ac 2020-08-13 stsp if [ "$ret" != "0" ]; then
786 081470ac 2020-08-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
787 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
788 081470ac 2020-08-13 stsp return 1
789 081470ac 2020-08-13 stsp fi
790 081470ac 2020-08-13 stsp
791 081470ac 2020-08-13 stsp echo 'changed file new' > $testroot/wt/new
792 081470ac 2020-08-13 stsp
793 081470ac 2020-08-13 stsp echo 'MA new' > $testroot/stdout.expected
794 081470ac 2020-08-13 stsp (cd $testroot/wt && got status -s A > $testroot/stdout)
795 081470ac 2020-08-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
796 081470ac 2020-08-13 stsp ret="$?"
797 081470ac 2020-08-13 stsp if [ "$ret" != "0" ]; then
798 081470ac 2020-08-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
799 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
800 081470ac 2020-08-13 stsp return 1
801 081470ac 2020-08-13 stsp fi
802 081470ac 2020-08-13 stsp
803 081470ac 2020-08-13 stsp echo 'M alpha' > $testroot/stdout.expected
804 081470ac 2020-08-13 stsp echo 'MA new' >> $testroot/stdout.expected
805 081470ac 2020-08-13 stsp (cd $testroot/wt && got status -s M > $testroot/stdout)
806 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
807 67c65ed7 2021-09-14 tracey ret="$?"
808 67c65ed7 2021-09-14 tracey if [ "$ret" != "0" ]; then
809 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
810 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
811 67c65ed7 2021-09-14 tracey return 1
812 67c65ed7 2021-09-14 tracey fi
813 67c65ed7 2021-09-14 tracey
814 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
815 67c65ed7 2021-09-14 tracey }
816 67c65ed7 2021-09-14 tracey
817 67c65ed7 2021-09-14 tracey test_status_suppress() {
818 67c65ed7 2021-09-14 tracey local testroot=`test_init status_suppress`
819 67c65ed7 2021-09-14 tracey
820 67c65ed7 2021-09-14 tracey got checkout $testroot/repo $testroot/wt > /dev/null
821 67c65ed7 2021-09-14 tracey ret="$?"
822 67c65ed7 2021-09-14 tracey if [ "$ret" != "0" ]; then
823 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
824 67c65ed7 2021-09-14 tracey return 1
825 67c65ed7 2021-09-14 tracey fi
826 67c65ed7 2021-09-14 tracey
827 67c65ed7 2021-09-14 tracey echo "modified alpha" > $testroot/wt/alpha
828 67c65ed7 2021-09-14 tracey (cd $testroot/wt && got rm beta >/dev/null)
829 67c65ed7 2021-09-14 tracey echo "unversioned file" > $testroot/wt/foo
830 67c65ed7 2021-09-14 tracey rm $testroot/wt/epsilon/zeta
831 67c65ed7 2021-09-14 tracey touch $testroot/wt/beta
832 67c65ed7 2021-09-14 tracey echo "new file" > $testroot/wt/new
833 67c65ed7 2021-09-14 tracey (cd $testroot/wt && got add new >/dev/null)
834 e3a46353 2021-09-14 stsp
835 e3a46353 2021-09-14 stsp (cd $testroot/wt && got status -S A -s M \
836 e3a46353 2021-09-14 stsp > $testroot/stdout 2> $testroot/stderr)
837 e3a46353 2021-09-14 stsp ret="$?"
838 e3a46353 2021-09-14 stsp if [ "$ret" = "0" ]; then
839 e3a46353 2021-09-14 stsp echo "status succeeded unexpectedly" >&2
840 e3a46353 2021-09-14 stsp test_done "$testroot" "1"
841 e3a46353 2021-09-14 stsp return 1
842 e3a46353 2021-09-14 stsp fi
843 e3a46353 2021-09-14 stsp
844 e3a46353 2021-09-14 stsp echo "got: -s and -S options are mutually exclusive" \
845 e3a46353 2021-09-14 stsp > $testroot/stderr.expected
846 e3a46353 2021-09-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
847 e3a46353 2021-09-14 stsp ret="$?"
848 e3a46353 2021-09-14 stsp if [ "$ret" != "0" ]; then
849 e3a46353 2021-09-14 stsp diff -u $testroot/stderr.expected $testroot/stderr
850 e3a46353 2021-09-14 stsp test_done "$testroot" "$ret"
851 e3a46353 2021-09-14 stsp return 1
852 e3a46353 2021-09-14 stsp fi
853 e3a46353 2021-09-14 stsp
854 e3a46353 2021-09-14 stsp (cd $testroot/wt && got status -s A -S M \
855 e3a46353 2021-09-14 stsp > $testroot/stdout 2> $testroot/stderr)
856 e3a46353 2021-09-14 stsp ret="$?"
857 e3a46353 2021-09-14 stsp if [ "$ret" = "0" ]; then
858 e3a46353 2021-09-14 stsp echo "status succeeded unexpectedly" >&2
859 e3a46353 2021-09-14 stsp test_done "$testroot" "1"
860 e3a46353 2021-09-14 stsp return 1
861 e3a46353 2021-09-14 stsp fi
862 67c65ed7 2021-09-14 tracey
863 e3a46353 2021-09-14 stsp echo "got: -S and -s options are mutually exclusive" \
864 e3a46353 2021-09-14 stsp > $testroot/stderr.expected
865 e3a46353 2021-09-14 stsp cmp -s $testroot/stderr.expected $testroot/stderr
866 e3a46353 2021-09-14 stsp ret="$?"
867 e3a46353 2021-09-14 stsp if [ "$ret" != "0" ]; then
868 e3a46353 2021-09-14 stsp diff -u $testroot/stderr.expected $testroot/stderr
869 e3a46353 2021-09-14 stsp test_done "$testroot" "$ret"
870 e3a46353 2021-09-14 stsp return 1
871 e3a46353 2021-09-14 stsp fi
872 e3a46353 2021-09-14 stsp
873 67c65ed7 2021-09-14 tracey (cd $testroot/wt && got status -S xDM \
874 67c65ed7 2021-09-14 tracey > $testroot/stdout 2> $testroot/stderr)
875 67c65ed7 2021-09-14 tracey ret="$?"
876 67c65ed7 2021-09-14 tracey if [ "$ret" = "0" ]; then
877 67c65ed7 2021-09-14 tracey echo "status succeeded unexpectedly" >&2
878 67c65ed7 2021-09-14 tracey test_done "$testroot" "1"
879 67c65ed7 2021-09-14 tracey return 1
880 67c65ed7 2021-09-14 tracey fi
881 67c65ed7 2021-09-14 tracey
882 67c65ed7 2021-09-14 tracey echo "got: invalid status code 'x'" > $testroot/stderr.expected
883 67c65ed7 2021-09-14 tracey cmp -s $testroot/stderr.expected $testroot/stderr
884 67c65ed7 2021-09-14 tracey ret="$?"
885 67c65ed7 2021-09-14 tracey if [ "$ret" != "0" ]; then
886 67c65ed7 2021-09-14 tracey diff -u $testroot/stderr.expected $testroot/stderr
887 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
888 67c65ed7 2021-09-14 tracey return 1
889 67c65ed7 2021-09-14 tracey fi
890 67c65ed7 2021-09-14 tracey
891 67c65ed7 2021-09-14 tracey echo 'M alpha' > $testroot/stdout.expected
892 67d7451c 2021-09-15 naddy (cd $testroot/wt && got status -S D\?A! > $testroot/stdout)
893 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
894 67c65ed7 2021-09-14 tracey ret="$?"
895 67c65ed7 2021-09-14 tracey if [ "$ret" != "0" ]; then
896 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
897 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
898 67c65ed7 2021-09-14 tracey return 1
899 67c65ed7 2021-09-14 tracey fi
900 67c65ed7 2021-09-14 tracey
901 67c65ed7 2021-09-14 tracey echo 'D beta' > $testroot/stdout.expected
902 67d7451c 2021-09-15 naddy (cd $testroot/wt && got status -S M\?A! > $testroot/stdout)
903 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
904 67c65ed7 2021-09-14 tracey ret="$?"
905 67c65ed7 2021-09-14 tracey if [ "$ret" != "0" ]; then
906 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
907 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
908 67c65ed7 2021-09-14 tracey return 1
909 67c65ed7 2021-09-14 tracey fi
910 67c65ed7 2021-09-14 tracey
911 67c65ed7 2021-09-14 tracey echo '! epsilon/zeta' > $testroot/stdout.expected
912 67c65ed7 2021-09-14 tracey echo '? foo' >> $testroot/stdout.expected
913 67c65ed7 2021-09-14 tracey (cd $testroot/wt && got status -S MDA > $testroot/stdout)
914 081470ac 2020-08-13 stsp cmp -s $testroot/stdout.expected $testroot/stdout
915 081470ac 2020-08-13 stsp ret="$?"
916 081470ac 2020-08-13 stsp if [ "$ret" != "0" ]; then
917 081470ac 2020-08-13 stsp diff -u $testroot/stdout.expected $testroot/stdout
918 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
919 081470ac 2020-08-13 stsp return 1
920 081470ac 2020-08-13 stsp fi
921 081470ac 2020-08-13 stsp
922 67c65ed7 2021-09-14 tracey echo 'A new' > $testroot/stdout.expected
923 67d7451c 2021-09-15 naddy (cd $testroot/wt && got status -S MD\?! > $testroot/stdout)
924 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
925 67c65ed7 2021-09-14 tracey ret="$?"
926 67c65ed7 2021-09-14 tracey if [ "$ret" != "0" ]; then
927 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
928 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
929 67c65ed7 2021-09-14 tracey return 1
930 67c65ed7 2021-09-14 tracey fi
931 67c65ed7 2021-09-14 tracey
932 67c65ed7 2021-09-14 tracey (cd $testroot/wt && got stage new > $testroot/stdout)
933 67c65ed7 2021-09-14 tracey
934 67c65ed7 2021-09-14 tracey echo ' A new' > $testroot/stdout.expected
935 67d7451c 2021-09-15 naddy (cd $testroot/wt && got status -S MD\?! > $testroot/stdout)
936 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
937 67c65ed7 2021-09-14 tracey ret="$?"
938 67c65ed7 2021-09-14 tracey if [ "$ret" != "0" ]; then
939 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
940 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
941 67c65ed7 2021-09-14 tracey return 1
942 67c65ed7 2021-09-14 tracey fi
943 67c65ed7 2021-09-14 tracey
944 67c65ed7 2021-09-14 tracey echo 'changed file new' > $testroot/wt/new
945 67c65ed7 2021-09-14 tracey
946 67c65ed7 2021-09-14 tracey echo 'M alpha' > $testroot/stdout.expected
947 67c65ed7 2021-09-14 tracey echo 'MA new' >> $testroot/stdout.expected
948 67d7451c 2021-09-15 naddy (cd $testroot/wt && got status -S D\?! > $testroot/stdout)
949 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
950 67c65ed7 2021-09-14 tracey ret="$?"
951 67c65ed7 2021-09-14 tracey if [ "$ret" != "0" ]; then
952 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
953 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
954 67c65ed7 2021-09-14 tracey return 1
955 67c65ed7 2021-09-14 tracey fi
956 67c65ed7 2021-09-14 tracey
957 67c65ed7 2021-09-14 tracey echo 'M alpha' > $testroot/stdout.expected
958 67d7451c 2021-09-15 naddy (cd $testroot/wt && got status -S AD\?! > $testroot/stdout)
959 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
960 67c65ed7 2021-09-14 tracey ret="$?"
961 67c65ed7 2021-09-14 tracey if [ "$ret" != "0" ]; then
962 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
963 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
964 67c65ed7 2021-09-14 tracey return 1
965 67c65ed7 2021-09-14 tracey fi
966 67c65ed7 2021-09-14 tracey
967 67c65ed7 2021-09-14 tracey rm $testroot/stdout.expected
968 67c65ed7 2021-09-14 tracey touch $testroot/stdout.expected
969 67c65ed7 2021-09-14 tracey
970 67d7451c 2021-09-15 naddy (cd $testroot/wt && got status -S MD\?! > $testroot/stdout)
971 67c65ed7 2021-09-14 tracey cmp -s $testroot/stdout.expected $testroot/stdout
972 67c65ed7 2021-09-14 tracey ret="$?"
973 67c65ed7 2021-09-14 tracey if [ "$ret" != "0" ]; then
974 67c65ed7 2021-09-14 tracey diff -u $testroot/stdout.expected $testroot/stdout
975 67c65ed7 2021-09-14 tracey test_done "$testroot" "$ret"
976 67c65ed7 2021-09-14 tracey return 1
977 67c65ed7 2021-09-14 tracey fi
978 67c65ed7 2021-09-14 tracey
979 081470ac 2020-08-13 stsp test_done "$testroot" "$ret"
980 081470ac 2020-08-13 stsp }
981 4a26d3f8 2020-10-07 stsp
982 4a26d3f8 2020-10-07 stsp test_status_empty_file() {
983 4a26d3f8 2020-10-07 stsp local testroot=`test_init status_empty_file`
984 4a26d3f8 2020-10-07 stsp
985 4a26d3f8 2020-10-07 stsp got checkout $testroot/repo $testroot/wt > /dev/null
986 4a26d3f8 2020-10-07 stsp ret="$?"
987 4a26d3f8 2020-10-07 stsp if [ "$ret" != "0" ]; then
988 4a26d3f8 2020-10-07 stsp test_done "$testroot" "$ret"
989 4a26d3f8 2020-10-07 stsp return 1
990 4a26d3f8 2020-10-07 stsp fi
991 4a26d3f8 2020-10-07 stsp
992 4a26d3f8 2020-10-07 stsp echo -n "" > $testroot/wt/empty
993 4a26d3f8 2020-10-07 stsp (cd $testroot/wt && got add empty >/dev/null)
994 4a26d3f8 2020-10-07 stsp
995 4a26d3f8 2020-10-07 stsp echo 'A empty' > $testroot/stdout.expected
996 4a26d3f8 2020-10-07 stsp
997 4a26d3f8 2020-10-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
998 4a26d3f8 2020-10-07 stsp
999 4a26d3f8 2020-10-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1000 4a26d3f8 2020-10-07 stsp ret="$?"
1001 4a26d3f8 2020-10-07 stsp if [ "$ret" != "0" ]; then
1002 4a26d3f8 2020-10-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1003 4a26d3f8 2020-10-07 stsp test_done "$testroot" "$ret"
1004 4a26d3f8 2020-10-07 stsp return 1
1005 4a26d3f8 2020-10-07 stsp fi
1006 4a26d3f8 2020-10-07 stsp
1007 4a26d3f8 2020-10-07 stsp (cd $testroot/wt && got commit -m "empty file" >/dev/null)
1008 4a26d3f8 2020-10-07 stsp
1009 4a26d3f8 2020-10-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1010 081470ac 2020-08-13 stsp
1011 4a26d3f8 2020-10-07 stsp echo -n > $testroot/stdout.expected
1012 4a26d3f8 2020-10-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1013 4a26d3f8 2020-10-07 stsp ret="$?"
1014 4a26d3f8 2020-10-07 stsp if [ "$ret" != "0" ]; then
1015 4a26d3f8 2020-10-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1016 4a26d3f8 2020-10-07 stsp test_done "$testroot" "$ret"
1017 4a26d3f8 2020-10-07 stsp return 1
1018 4a26d3f8 2020-10-07 stsp fi
1019 081470ac 2020-08-13 stsp
1020 4a26d3f8 2020-10-07 stsp # update the timestamp; this used to make the file show up as:
1021 4a26d3f8 2020-10-07 stsp # M empty
1022 4a26d3f8 2020-10-07 stsp # which should not happen
1023 4a26d3f8 2020-10-07 stsp touch $testroot/wt/empty
1024 4a26d3f8 2020-10-07 stsp
1025 4a26d3f8 2020-10-07 stsp (cd $testroot/wt && got status > $testroot/stdout)
1026 4a26d3f8 2020-10-07 stsp
1027 4a26d3f8 2020-10-07 stsp echo -n > $testroot/stdout.expected
1028 4a26d3f8 2020-10-07 stsp cmp -s $testroot/stdout.expected $testroot/stdout
1029 4a26d3f8 2020-10-07 stsp ret="$?"
1030 4a26d3f8 2020-10-07 stsp if [ "$ret" != "0" ]; then
1031 4a26d3f8 2020-10-07 stsp diff -u $testroot/stdout.expected $testroot/stdout
1032 4a26d3f8 2020-10-07 stsp fi
1033 4a26d3f8 2020-10-07 stsp test_done "$testroot" "$ret"
1034 4a26d3f8 2020-10-07 stsp }
1035 4a26d3f8 2020-10-07 stsp
1036 7fb414ae 2020-08-08 stsp test_parseargs "$@"
1037 35dc4510 2019-02-04 stsp run_test test_status_basic
1038 f02ba292 2019-02-05 stsp run_test test_status_subdir_no_mods
1039 f02ba292 2019-02-05 stsp run_test test_status_subdir_no_mods2
1040 0dbc2271 2019-02-05 stsp run_test test_status_obstructed
1041 02c07007 2019-02-10 stsp run_test test_status_shows_local_mods_after_update
1042 18831e78 2019-02-10 stsp run_test test_status_unversioned_subdirs
1043 00bb5ea0 2020-07-23 stsp run_test test_status_symlink
1044 3cbbd752 2019-02-19 stsp run_test test_status_shows_no_mods_after_complete_merge
1045 7154f6ce 2019-03-27 stsp run_test test_status_shows_conflict
1046 c577a9ce 2019-07-27 stsp run_test test_status_empty_dir
1047 c577a9ce 2019-07-27 stsp run_test test_status_empty_dir_unversioned_file
1048 72ea6654 2019-07-27 stsp run_test test_status_many_paths
1049 6841da00 2019-08-08 stsp run_test test_status_cvsignore
1050 bd8de430 2019-10-04 stsp run_test test_status_gitignore
1051 081470ac 2020-08-13 stsp run_test test_status_status_code
1052 67c65ed7 2021-09-14 tracey run_test test_status_suppress
1053 4a26d3f8 2020-10-07 stsp run_test test_status_empty_file