Blame


1 ddbe612c 2022-11-17 stsp #!/bin/sh
2 ddbe612c 2022-11-17 stsp #
3 ddbe612c 2022-11-17 stsp # Copyright (c) 2022 Stefan Sperling <stsp@openbsd.org>
4 ddbe612c 2022-11-17 stsp #
5 ddbe612c 2022-11-17 stsp # Permission to use, copy, modify, and distribute this software for any
6 ddbe612c 2022-11-17 stsp # purpose with or without fee is hereby granted, provided that the above
7 ddbe612c 2022-11-17 stsp # copyright notice and this permission notice appear in all copies.
8 ddbe612c 2022-11-17 stsp #
9 ddbe612c 2022-11-17 stsp # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 ddbe612c 2022-11-17 stsp # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 ddbe612c 2022-11-17 stsp # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 ddbe612c 2022-11-17 stsp # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 ddbe612c 2022-11-17 stsp # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 ddbe612c 2022-11-17 stsp # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 ddbe612c 2022-11-17 stsp # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 ddbe612c 2022-11-17 stsp
17 ddbe612c 2022-11-17 stsp . ../cmdline/common.sh
18 ddbe612c 2022-11-17 stsp . ./common.sh
19 ddbe612c 2022-11-17 stsp
20 ddbe612c 2022-11-17 stsp test_clone_basic_access_denied() {
21 ddbe612c 2022-11-17 stsp local testroot=`test_init clone_basic_access_denied 1`
22 ddbe612c 2022-11-17 stsp
23 ddbe612c 2022-11-17 stsp cp -r ${GOTD_TEST_REPO} $testroot/repo-copy
24 ddbe612c 2022-11-17 stsp
25 ddbe612c 2022-11-17 stsp got clone -q ${GOTD_TEST_REPO_URL} $testroot/repo-clone \
26 30eb1ad6 2022-12-09 stsp 2> $testroot/stderr.raw
27 ddbe612c 2022-11-17 stsp ret=$?
28 ddbe612c 2022-11-17 stsp if [ $ret -eq 0 ]; then
29 ddbe612c 2022-11-17 stsp echo "got clone succeeded unexpectedly" >&2
30 ddbe612c 2022-11-17 stsp test_done "$testroot" "1"
31 ddbe612c 2022-11-17 stsp return 1
32 ddbe612c 2022-11-17 stsp fi
33 30eb1ad6 2022-12-09 stsp grep -v ^gotsh: $testroot/stderr.raw > $testroot/stderr
34 ddbe612c 2022-11-17 stsp
35 ddbe612c 2022-11-17 stsp # Verify that the clone operation failed.
36 ddbe612c 2022-11-17 stsp echo 'got-fetch-pack: test-repo: Permission denied' \
37 ddbe612c 2022-11-17 stsp > $testroot/stderr.expected
38 ddbe612c 2022-11-17 stsp echo 'got: fetch failed' >> $testroot/stderr.expected
39 ddbe612c 2022-11-17 stsp cmp -s $testroot/stderr.expected $testroot/stderr
40 ddbe612c 2022-11-17 stsp ret=$?
41 ddbe612c 2022-11-17 stsp if [ $ret -ne 0 ]; then
42 ddbe612c 2022-11-17 stsp diff -u $testroot/stderr.expected $testroot/stderr
43 ddbe612c 2022-11-17 stsp fi
44 ddbe612c 2022-11-17 stsp test_done "$testroot" "$ret"
45 ddbe612c 2022-11-17 stsp }
46 ddbe612c 2022-11-17 stsp
47 ddbe612c 2022-11-17 stsp test_parseargs "$@"
48 ddbe612c 2022-11-17 stsp run_test test_clone_basic_access_denied