3 0e673013 2019-01-02 stsp # Copyright (c) 2019 Stefan Sperling <stsp@openbsd.org>
5 0e673013 2019-01-02 stsp # Permission to use, copy, modify, and distribute this software for any
6 0e673013 2019-01-02 stsp # purpose with or without fee is hereby granted, provided that the above
7 0e673013 2019-01-02 stsp # copyright notice and this permission notice appear in all copies.
9 0e673013 2019-01-02 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 0e673013 2019-01-02 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 0e673013 2019-01-02 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 0e673013 2019-01-02 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 0e673013 2019-01-02 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 0e673013 2019-01-02 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 0e673013 2019-01-02 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 0e673013 2019-01-02 stsp . ./common.sh
19 0e673013 2019-01-02 stsp function test_checkout_basic {
20 0e673013 2019-01-02 stsp local testroot=`test_init checkout_basic`
22 0e673013 2019-01-02 stsp echo "A $testroot/wt/alpha" > $testroot/stdout.expected
23 0e673013 2019-01-02 stsp echo "A $testroot/wt/beta" >> $testroot/stdout.expected
24 0e673013 2019-01-02 stsp echo "A $testroot/wt/epsilon/zeta" >> $testroot/stdout.expected
25 0e673013 2019-01-02 stsp echo "A $testroot/wt/gamma/delta" >> $testroot/stdout.expected
26 0e673013 2019-01-02 stsp echo "Now shut up and hack" >> $testroot/stdout.expected
28 0e673013 2019-01-02 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
30 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
31 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
35 0e673013 2019-01-02 stsp cmp $testroot/stdout.expected $testroot/stdout
37 e60e7f5b 2019-02-10 stsp if [ "$ret" != "0" ]; then
38 0e673013 2019-01-02 stsp diff -u $testroot/stdout.expected $testroot/stdout
39 e60e7f5b 2019-02-10 stsp test_done "$testroot" "$ret"
43 0e673013 2019-01-02 stsp echo "alpha" > $testroot/content.expected
44 0e673013 2019-01-02 stsp echo "beta" >> $testroot/content.expected
45 0e673013 2019-01-02 stsp echo "zeta" >> $testroot/content.expected
46 0e673013 2019-01-02 stsp echo "delta" >> $testroot/content.expected
47 0e673013 2019-01-02 stsp cat $testroot/wt/alpha $testroot/wt/beta $testroot/wt/epsilon/zeta \
48 0e673013 2019-01-02 stsp $testroot/wt/gamma/delta > $testroot/content
50 0e673013 2019-01-02 stsp cmp $testroot/content.expected $testroot/content
52 693719bc 2019-01-03 stsp if [ "$ret" != "0" ]; then
53 0e673013 2019-01-02 stsp diff -u $testroot/content.expected $testroot/content
55 693719bc 2019-01-03 stsp test_done "$testroot" "$ret"
58 68ed9ba5 2019-02-10 stsp function test_checkout_sets_xbit {
59 68ed9ba5 2019-02-10 stsp local testroot=`test_init checkout_sets_xbit 1`
61 68ed9ba5 2019-02-10 stsp touch $testroot/repo/xfile
62 68ed9ba5 2019-02-10 stsp chmod +x $testroot/repo/xfile
63 68ed9ba5 2019-02-10 stsp (cd $testroot/repo && git add .)
64 68ed9ba5 2019-02-10 stsp git_commit $testroot/repo -m "adding executable file"
66 68ed9ba5 2019-02-10 stsp echo "A $testroot/wt/xfile" > $testroot/stdout.expected
67 68ed9ba5 2019-02-10 stsp echo "Now shut up and hack" >> $testroot/stdout.expected
69 68ed9ba5 2019-02-10 stsp got checkout $testroot/repo $testroot/wt > $testroot/stdout
71 68ed9ba5 2019-02-10 stsp if [ "$ret" != "0" ]; then
72 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
76 68ed9ba5 2019-02-10 stsp cmp $testroot/stdout.expected $testroot/stdout
78 68ed9ba5 2019-02-10 stsp if [ "$ret" != "0" ]; then
79 68ed9ba5 2019-02-10 stsp diff -u $testroot/stdout.expected $testroot/stdout
80 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
84 68ed9ba5 2019-02-10 stsp ls -l $testroot/wt/xfile | grep -q '^-rwx'
86 68ed9ba5 2019-02-10 stsp if [ "$ret" != "0" ]; then
87 68ed9ba5 2019-02-10 stsp echo "file is not executable" >&2
88 68ed9ba5 2019-02-10 stsp ls -l $testroot/wt/xfile >&2
90 68ed9ba5 2019-02-10 stsp test_done "$testroot" "$ret"
93 0e673013 2019-01-02 stsp run_test test_checkout_basic
94 68ed9ba5 2019-02-10 stsp run_test test_checkout_sets_xbit