commit be4f45b5bf0e1675373554243f024efb2d45a2e8 from: Stefan Sperling date: Tue Dec 20 09:02:31 2022 UTC rename repo_req_wrong_commit.sh to req_wrong_commit.sh for consistency commit - 6eb6bfed344145baeb3edf2fb884be0852bf857f commit + be4f45b5bf0e1675373554243f024efb2d45a2e8 blob - da3f16b872bbbbf0dfdc1ee56d8de24d2e6e00d2 blob + 4df499c68e7f0c6fcb75510088da6bca9b323ba7 --- regress/gotd/Makefile +++ regress/gotd/Makefile @@ -189,7 +189,7 @@ test_repo_write_empty: prepare_test_repo_empty start_g test_req_wrong_commit: prepare_test_repo_empty start_gotd_ro @-$(GOTD_TRAP); su -m ${GOTD_TEST_USER} -c \ - 'env $(GOTD_TEST_ENV) sh ./repo_req_wrong_commit.sh' + 'env $(GOTD_TEST_ENV) sh ./req_wrong_commit.sh' @$(GOTD_STOP_CMD) 2>/dev/null .include blob - 97e05fec18b363301a607a121ab4b595f1fbd3c7 (mode 644) blob + /dev/null --- regress/gotd/repo_req_wrong_commit.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2022 Mikhail Pchelin -# -# Permission to use, copy, modify, and distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -. ../cmdline/common.sh -. ./common.sh - -test_req_wrong_commit() { - local testroot=`test_init req_wrong_commit` - - echo "0054want aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa multi_ack \ -side-band-64k ofs-delta" | ssh ${GOTD_DEVUSER}@127.0.0.1 \ - git-upload-pack '/test-repo' > $testroot/stdout \ - 2>$testroot/stderr - - echo -n "0041ERR object aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ -not found" > $testroot/stdout.expected - - echo "gotsh: object aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ -not found" > $testroot/stderr.expected - - # We use OpenBSD cmp(1) offset extension - cmp -s $testroot/stdout $testroot/stdout.expected 112 0 - ret=$? - if [ $ret -ne 0 ]; then - echo "unexpected stdout" >&2 - test_done "$testroot" "1" - return 1 - fi - - cmp -s $testroot/stderr $testroot/stderr.expected - ret=$? - if [ $ret -ne 0 ]; then - echo "unexpected stderr" >&2 - test_done "$testroot" "1" - return 1 - fi - test_done "$testroot" "$ret" -} - -test_parseargs "$@" -run_test test_req_wrong_commit blob - /dev/null blob + 97e05fec18b363301a607a121ab4b595f1fbd3c7 (mode 644) --- /dev/null +++ regress/gotd/req_wrong_commit.sh @@ -0,0 +1,54 @@ +#!/bin/sh +# +# Copyright (c) 2022 Mikhail Pchelin +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +. ../cmdline/common.sh +. ./common.sh + +test_req_wrong_commit() { + local testroot=`test_init req_wrong_commit` + + echo "0054want aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa multi_ack \ +side-band-64k ofs-delta" | ssh ${GOTD_DEVUSER}@127.0.0.1 \ + git-upload-pack '/test-repo' > $testroot/stdout \ + 2>$testroot/stderr + + echo -n "0041ERR object aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ +not found" > $testroot/stdout.expected + + echo "gotsh: object aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ +not found" > $testroot/stderr.expected + + # We use OpenBSD cmp(1) offset extension + cmp -s $testroot/stdout $testroot/stdout.expected 112 0 + ret=$? + if [ $ret -ne 0 ]; then + echo "unexpected stdout" >&2 + test_done "$testroot" "1" + return 1 + fi + + cmp -s $testroot/stderr $testroot/stderr.expected + ret=$? + if [ $ret -ne 0 ]; then + echo "unexpected stderr" >&2 + test_done "$testroot" "1" + return 1 + fi + test_done "$testroot" "$ret" +} + +test_parseargs "$@" +run_test test_req_wrong_commit