Blame


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