Blob


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