From de580e7999400b7d8789ce3747db4f2a63f2538b Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Wed, 12 Oct 2016 02:44:25 +0200 Subject: build: use bash, but get it properly during build time hardcoding it for travis, as bash is always installed there. --- .gitignore | 3 + Makefile.am | 12 +- build-aux/travis-build.sh | 2 +- build-aux/travis-deploy.sh | 2 +- build-aux/valgrind.sh | 4 - configure.ac | 19 ++- tests/blogc-git-receiver/check_post_receive.sh | 86 ------------- tests/blogc-git-receiver/check_post_receive.sh.in | 86 +++++++++++++ tests/blogc-git-receiver/check_pre_receive.sh | 146 ---------------------- tests/blogc-git-receiver/check_pre_receive.sh.in | 146 ++++++++++++++++++++++ tests/blogc-git-receiver/check_shell.sh | 73 ----------- tests/blogc-git-receiver/check_shell.sh.in | 73 +++++++++++ 12 files changed, 332 insertions(+), 320 deletions(-) delete mode 100755 tests/blogc-git-receiver/check_post_receive.sh create mode 100755 tests/blogc-git-receiver/check_post_receive.sh.in delete mode 100755 tests/blogc-git-receiver/check_pre_receive.sh create mode 100755 tests/blogc-git-receiver/check_pre_receive.sh.in delete mode 100755 tests/blogc-git-receiver/check_shell.sh create mode 100755 tests/blogc-git-receiver/check_shell.sh.in diff --git a/.gitignore b/.gitignore index 32b3f51..9929690 100644 --- a/.gitignore +++ b/.gitignore @@ -59,8 +59,11 @@ blogc*.html /tests/blogc/check_source_parser /tests/blogc/check_template_parser /tests/blogc-git-receiver/check_pre_receive_parser +/tests/blogc-git-receiver/check_pre_receive.sh /tests/blogc-git-receiver/check_post_receive +/tests/blogc-git-receiver/check_post_receive.sh /tests/blogc-git-receiver/check_shell_command_parser +/tests/blogc-git-receiver/check_shell.sh /tests/blogc-runserver/check_httpd_utils /tests/blogc-runserver/check_mime /tests/common/check_config_parser diff --git a/Makefile.am b/Makefile.am index 212bcfe..8aed820 100644 --- a/Makefile.am +++ b/Makefile.am @@ -92,7 +92,7 @@ endif check_PROGRAMS = \ $(NULL) -dist_check_SCRIPTS = \ +check_SCRIPTS = \ $(NULL) @@ -322,7 +322,7 @@ endif if BUILD_TESTS if BUILD_GIT_RECEIVER -dist_check_SCRIPTS += \ +check_SCRIPTS += \ tests/blogc-git-receiver/check_post_receive.sh \ tests/blogc-git-receiver/check_pre_receive.sh \ tests/blogc-git-receiver/check_shell.sh \ @@ -654,7 +654,11 @@ endif TESTS = \ $(check_PROGRAMS) \ - $(dist_check_SCRIPTS) \ + $(check_SCRIPTS) \ + $(NULL) + +CLEANFILES += \ + $(check_SCRIPTS) \ $(NULL) @@ -684,5 +688,5 @@ if USE_VALGRIND valgrind: all $(MAKE) check TESTS_ENVIRONMENT=" \ VALGRIND=$(VALGRIND) \ - $(top_srcdir)/build-aux/valgrind.sh" + $(BASH) -e $(top_srcdir)/build-aux/valgrind.sh" endif diff --git a/build-aux/travis-build.sh b/build-aux/travis-build.sh index 106c230..53cf589 100755 --- a/build-aux/travis-build.sh +++ b/build-aux/travis-build.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -ex diff --git a/build-aux/travis-deploy.sh b/build-aux/travis-deploy.sh index dea0b0f..51aac3e 100755 --- a/build-aux/travis-deploy.sh +++ b/build-aux/travis-deploy.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e diff --git a/build-aux/valgrind.sh b/build-aux/valgrind.sh index 3de3855..64091a1 100755 --- a/build-aux/valgrind.sh +++ b/build-aux/valgrind.sh @@ -1,7 +1,3 @@ -#!/bin/sh - -set -e - export TESTS_ENVIRONMENT=" ${VALGRIND:-valgrind} \ --tool=memcheck \ diff --git a/configure.ac b/configure.ac index e5b9ac9..4779308 100644 --- a/configure.ac +++ b/configure.ac @@ -147,11 +147,12 @@ AS_IF([test "x$enable_tests" != "xno"], [ ], [ have_bgr_deps=yes ]) + AC_PATH_PROG([bash], [bash]) AC_PATH_PROG([tee], [tee]) - AS_IF([test "x$ac_cv_path_tee" = "x"], [ - have_tee=no + AS_IF([test "x$ac_cv_path_bash" = "x" -o "x$ac_cv_path_tee" = "x"], [ + have_blogc_deps=no ], [ - have_tee=yes + have_blogc_deps=yes ]) ], [ have_tests=no @@ -161,8 +162,8 @@ AS_IF([test "x$have_tests" = "xyes"], [ AS_IF([test "x$have_cmocka" = "xyes"],, [ AC_MSG_ERROR([tests requested but cmocka not found]) ]) - AS_IF([test "x$have_tee" = "xyes"],, [ - AC_MSG_ERROR([tests requested but tee not found]) + AS_IF([test "x$have_blogc_deps" = "xyes"],, [ + AC_MSG_ERROR([tests requested but bash and/or tee not found]) ]) AS_IF([test "x$have_bgr_deps" = "xyes"], , [ AS_IF([test "x$have_git_receiver" = "xyes"], [ @@ -173,6 +174,8 @@ AS_IF([test "x$have_tests" = "xyes"], [ AM_CONDITIONAL([BUILD_TESTS], [test "x$have_tests" = "xyes"]) AM_CONDITIONAL([USE_CMOCKA], [test "x$have_cmocka" = "xyes"]) AM_CONDITIONAL([USE_BGR_DEPS], [test "x$have_bgr_deps" = "xyes"]) +BASH="$ac_cv_path_bash" +AC_SUBST(BASH) AC_CHECK_HEADERS([sys/stat.h time.h]) @@ -182,6 +185,12 @@ AC_CONFIG_FILES([ Makefile blogc.spec ]) +AC_CONFIG_FILES([tests/blogc-git-receiver/check_pre_receive.sh], + [chmod +x tests/blogc-git-receiver/check_pre_receive.sh]) +AC_CONFIG_FILES([tests/blogc-git-receiver/check_post_receive.sh], + [chmod +x tests/blogc-git-receiver/check_post_receive.sh]) +AC_CONFIG_FILES([tests/blogc-git-receiver/check_shell.sh], + [chmod +x tests/blogc-git-receiver/check_shell.sh]) AC_OUTPUT diff --git a/tests/blogc-git-receiver/check_post_receive.sh b/tests/blogc-git-receiver/check_post_receive.sh deleted file mode 100755 index ac07c64..0000000 --- a/tests/blogc-git-receiver/check_post_receive.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/sh - -set -xe -o pipefail - -export LC_ALL=C - -TEMP="$(mktemp -d)" -[[ -n "${TEMP}" ]] - -trap_func() { - [[ -e "${TEMP}/output.txt" ]] && cat "${TEMP}/output.txt" - [[ -n "${TEMP}" ]] && rm -rf "${TEMP}" -} - -trap trap_func EXIT - -mkdir -p "${TEMP}/repos" -git init --bare "${TEMP}/repos/foo.git" &> /dev/null - -ln -s "${PWD}/blogc-git-receiver" "${TEMP}/repos/foo.git/hooks/post-receive" - -cat > "${TEMP}/tmp.txt" < 1476033730 +0200 -committer Rafael G. Martins 1476033888 +0200 -data 11 -testing... -M 100644 :1 foo - -EOF - -cd "${TEMP}/repos/foo.git" -git fast-import < "${TEMP}/tmp.txt" &> /dev/null - -git init --bare "${TEMP}/repos/bar.git" &> /dev/null - -HOME="${TEMP}" ${TESTS_ENVIRONMENT} ./hooks/post-receive 2>&1 | tee "${TEMP}/output.txt" -grep "warning: repository mirroring disabled" "${TEMP}/output.txt" &> /dev/null - -git config --local remote.mirror.pushurl "${TEMP}/repos/bar.git" -HOME="${TEMP}" ${TESTS_ENVIRONMENT} ./hooks/post-receive 2>&1 | tee "${TEMP}/output.txt" -grep "[new branch] *master" "${TEMP}/output.txt" &> /dev/null - -git config --local --unset remote.mirror.pushurl -git init --bare "${TEMP}/repos/bar2.git" &> /dev/null -git config --local remote.mirror.url "${TEMP}/repos/bar2.git" -HOME="${TEMP}" ${TESTS_ENVIRONMENT} ./hooks/post-receive 2>&1 | tee "${TEMP}/output.txt" -grep "[new branch] *master" "${TEMP}/output.txt" &> /dev/null - -git config --local --unset remote.mirror.url -cat > "${TEMP}/blogc-git-receiver.ini" < /dev/null -HOME="${TEMP}" ${TESTS_ENVIRONMENT} ./hooks/post-receive 2>&1 | tee "${TEMP}/output.txt" -grep "[new branch] *master" "${TEMP}/output.txt" &> /dev/null - -cat > "${TEMP}/blogc-git-receiver.ini" < /dev/null -HOME="${TEMP}" ${TESTS_ENVIRONMENT} ./hooks/post-receive 2>&1 | tee "${TEMP}/output.txt" -grep "warning: failed to parse configuration file " "${TEMP}/output.txt" &> /dev/null - -rm "${TEMP}/output.txt" diff --git a/tests/blogc-git-receiver/check_post_receive.sh.in b/tests/blogc-git-receiver/check_post_receive.sh.in new file mode 100755 index 0000000..6ed7f9d --- /dev/null +++ b/tests/blogc-git-receiver/check_post_receive.sh.in @@ -0,0 +1,86 @@ +#!@BASH@ + +set -xe -o pipefail + +export LC_ALL=C + +TEMP="$(mktemp -d)" +[[ -n "${TEMP}" ]] + +trap_func() { + [[ -e "${TEMP}/output.txt" ]] && cat "${TEMP}/output.txt" + [[ -n "${TEMP}" ]] && rm -rf "${TEMP}" +} + +trap trap_func EXIT + +mkdir -p "${TEMP}/repos" +git init --bare "${TEMP}/repos/foo.git" &> /dev/null + +ln -s "${PWD}/blogc-git-receiver" "${TEMP}/repos/foo.git/hooks/post-receive" + +cat > "${TEMP}/tmp.txt" < 1476033730 +0200 +committer Rafael G. Martins 1476033888 +0200 +data 11 +testing... +M 100644 :1 foo + +EOF + +cd "${TEMP}/repos/foo.git" +git fast-import < "${TEMP}/tmp.txt" &> /dev/null + +git init --bare "${TEMP}/repos/bar.git" &> /dev/null + +HOME="${TEMP}" ${TESTS_ENVIRONMENT} ./hooks/post-receive 2>&1 | tee "${TEMP}/output.txt" +grep "warning: repository mirroring disabled" "${TEMP}/output.txt" &> /dev/null + +git config --local remote.mirror.pushurl "${TEMP}/repos/bar.git" +HOME="${TEMP}" ${TESTS_ENVIRONMENT} ./hooks/post-receive 2>&1 | tee "${TEMP}/output.txt" +grep "[new branch] *master" "${TEMP}/output.txt" &> /dev/null + +git config --local --unset remote.mirror.pushurl +git init --bare "${TEMP}/repos/bar2.git" &> /dev/null +git config --local remote.mirror.url "${TEMP}/repos/bar2.git" +HOME="${TEMP}" ${TESTS_ENVIRONMENT} ./hooks/post-receive 2>&1 | tee "${TEMP}/output.txt" +grep "[new branch] *master" "${TEMP}/output.txt" &> /dev/null + +git config --local --unset remote.mirror.url +cat > "${TEMP}/blogc-git-receiver.ini" < /dev/null +HOME="${TEMP}" ${TESTS_ENVIRONMENT} ./hooks/post-receive 2>&1 | tee "${TEMP}/output.txt" +grep "[new branch] *master" "${TEMP}/output.txt" &> /dev/null + +cat > "${TEMP}/blogc-git-receiver.ini" < /dev/null +HOME="${TEMP}" ${TESTS_ENVIRONMENT} ./hooks/post-receive 2>&1 | tee "${TEMP}/output.txt" +grep "warning: failed to parse configuration file " "${TEMP}/output.txt" &> /dev/null + +rm "${TEMP}/output.txt" diff --git a/tests/blogc-git-receiver/check_pre_receive.sh b/tests/blogc-git-receiver/check_pre_receive.sh deleted file mode 100755 index 2df713a..0000000 --- a/tests/blogc-git-receiver/check_pre_receive.sh +++ /dev/null @@ -1,146 +0,0 @@ -#!/bin/sh - -set -xe -o pipefail - -export LC_ALL=C - -TEMP="$(mktemp -d)" -[[ -n "${TEMP}" ]] - -trap_func() { - [[ -e "${TEMP}/output.txt" ]] && cat "${TEMP}/output.txt" - [[ -n "${TEMP}" ]] && rm -rf "${TEMP}" -} - -trap trap_func EXIT - -mkdir -p "${TEMP}/repos" -git init --bare "${TEMP}/repos/foo.git" &> /dev/null - -SELF="${PWD}/blogc-git-receiver" - -ln -s "${SELF}" "${TEMP}/repos/foo.git/hooks/pre-receive" - -cat > "${TEMP}/payload.txt" <&1 | tee "${TEMP}/output.txt" -grep "warning: no reference to master branch found. nothing to deploy." "${TEMP}/output.txt" &> /dev/null - -cat > "${TEMP}/tmp.txt" < \$(OUTPUT_DIR)/foo.txt - -reset refs/heads/master -commit refs/heads/master -mark :2 -author Rafael G. Martins 1476139736 +0200 -committer Rafael G. Martins 1476139736 +0200 -data 11 -testing... -M 100644 :1 Makefil - -EOF - -git fast-import < "${TEMP}/tmp.txt" &> /dev/null - -cat > "${TEMP}/payload.txt" <&1 | tee "${TEMP}/output.txt" -grep "warning: no makefile found. skipping ..." "${TEMP}/output.txt" &> /dev/null - -cd "${TEMP}" -git init --bare "${TEMP}/repos/foo2.git" &> /dev/null -ln -s "${SELF}" "${TEMP}/repos/foo2.git/hooks/pre-receive" - -cat > "${TEMP}/tmp.txt" < \$(OUTPUT_DIR)/foo.txt - -reset refs/heads/master -commit refs/heads/master -mark :2 -author Rafael G. Martins 1476139736 +0200 -committer Rafael G. Martins 1476139736 +0200 -data 11 -testing... -M 100644 :1 Makefile - -EOF - -cd "${TEMP}/repos/foo2.git" -git fast-import < "${TEMP}/tmp.txt" &> /dev/null - -cat > "${TEMP}/payload.txt" <&1 | tee "${TEMP}/output.txt" -grep "echo lol" "${TEMP}/output.txt" &> /dev/null - -[[ -h htdocs ]] -[[ "$(cat htdocs/foo.txt)" == "lol" ]] - -DEST="$(readlink htdocs)" -[[ -e "${DEST}" ]] - -cd "${TEMP}" -git init --bare "${TEMP}/repos/foo3.git" &> /dev/null -ln -s "${SELF}" "${TEMP}/repos/foo3.git/hooks/pre-receive" - -cat > "${TEMP}/tmp.txt" < \$(OUTPUT_DIR)/foo.txt - - -commit refs/heads/master -mark :2 -author Rafael G. Martins 1476142917 +0200 -committer Rafael G. Martins 1476142917 +0200 -data 12 -testing2... -M 100644 :1 Makefile - -EOF - -cd "${TEMP}/repos/foo3.git" -ln -s "${DEST}" htdocs -git fast-import < "${TEMP}/tmp.txt" &> /dev/null - -cat > "${TEMP}/payload.txt" <&1 | tee "${TEMP}/output.txt" -grep "echo lol" "${TEMP}/output.txt" &> /dev/null - -[[ -h htdocs ]] -[[ "$(cat htdocs/foo.txt)" == "lol" ]] -[[ "${DEST}" != "$(readlink htdocs)" ]] -[[ ! -e "${DEST}" ]] - -rm "${TEMP}/output.txt" diff --git a/tests/blogc-git-receiver/check_pre_receive.sh.in b/tests/blogc-git-receiver/check_pre_receive.sh.in new file mode 100755 index 0000000..10fd4d9 --- /dev/null +++ b/tests/blogc-git-receiver/check_pre_receive.sh.in @@ -0,0 +1,146 @@ +#!@BASH@ + +set -xe -o pipefail + +export LC_ALL=C + +TEMP="$(mktemp -d)" +[[ -n "${TEMP}" ]] + +trap_func() { + [[ -e "${TEMP}/output.txt" ]] && cat "${TEMP}/output.txt" + [[ -n "${TEMP}" ]] && rm -rf "${TEMP}" +} + +trap trap_func EXIT + +mkdir -p "${TEMP}/repos" +git init --bare "${TEMP}/repos/foo.git" &> /dev/null + +SELF="${PWD}/blogc-git-receiver" + +ln -s "${SELF}" "${TEMP}/repos/foo.git/hooks/pre-receive" + +cat > "${TEMP}/payload.txt" <&1 | tee "${TEMP}/output.txt" +grep "warning: no reference to master branch found. nothing to deploy." "${TEMP}/output.txt" &> /dev/null + +cat > "${TEMP}/tmp.txt" < \$(OUTPUT_DIR)/foo.txt + +reset refs/heads/master +commit refs/heads/master +mark :2 +author Rafael G. Martins 1476139736 +0200 +committer Rafael G. Martins 1476139736 +0200 +data 11 +testing... +M 100644 :1 Makefil + +EOF + +git fast-import < "${TEMP}/tmp.txt" &> /dev/null + +cat > "${TEMP}/payload.txt" <&1 | tee "${TEMP}/output.txt" +grep "warning: no makefile found. skipping ..." "${TEMP}/output.txt" &> /dev/null + +cd "${TEMP}" +git init --bare "${TEMP}/repos/foo2.git" &> /dev/null +ln -s "${SELF}" "${TEMP}/repos/foo2.git/hooks/pre-receive" + +cat > "${TEMP}/tmp.txt" < \$(OUTPUT_DIR)/foo.txt + +reset refs/heads/master +commit refs/heads/master +mark :2 +author Rafael G. Martins 1476139736 +0200 +committer Rafael G. Martins 1476139736 +0200 +data 11 +testing... +M 100644 :1 Makefile + +EOF + +cd "${TEMP}/repos/foo2.git" +git fast-import < "${TEMP}/tmp.txt" &> /dev/null + +cat > "${TEMP}/payload.txt" <&1 | tee "${TEMP}/output.txt" +grep "echo lol" "${TEMP}/output.txt" &> /dev/null + +[[ -h htdocs ]] +[[ "$(cat htdocs/foo.txt)" == "lol" ]] + +DEST="$(readlink htdocs)" +[[ -e "${DEST}" ]] + +cd "${TEMP}" +git init --bare "${TEMP}/repos/foo3.git" &> /dev/null +ln -s "${SELF}" "${TEMP}/repos/foo3.git/hooks/pre-receive" + +cat > "${TEMP}/tmp.txt" < \$(OUTPUT_DIR)/foo.txt + + +commit refs/heads/master +mark :2 +author Rafael G. Martins 1476142917 +0200 +committer Rafael G. Martins 1476142917 +0200 +data 12 +testing2... +M 100644 :1 Makefile + +EOF + +cd "${TEMP}/repos/foo3.git" +ln -s "${DEST}" htdocs +git fast-import < "${TEMP}/tmp.txt" &> /dev/null + +cat > "${TEMP}/payload.txt" <&1 | tee "${TEMP}/output.txt" +grep "echo lol" "${TEMP}/output.txt" &> /dev/null + +[[ -h htdocs ]] +[[ "$(cat htdocs/foo.txt)" == "lol" ]] +[[ "${DEST}" != "$(readlink htdocs)" ]] +[[ ! -e "${DEST}" ]] + +rm "${TEMP}/output.txt" diff --git a/tests/blogc-git-receiver/check_shell.sh b/tests/blogc-git-receiver/check_shell.sh deleted file mode 100755 index f563c02..0000000 --- a/tests/blogc-git-receiver/check_shell.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/sh - -set -xe -o pipefail - -export LC_ALL=C - -TEMP="$(mktemp -d)" -[[ -n "${TEMP}" ]] - -trap_func() { - [[ -e "${TEMP}/output.txt" ]] && cat "${TEMP}/output.txt" - [[ -n "${TEMP}" ]] && rm -rf "${TEMP}" -} - -trap trap_func EXIT - -SELF="${PWD}/blogc-git-receiver" - -call_bgr() { - [[ -n "${VALGRIND}" ]] && export __VALGRIND_ENABLED=1 - SHELL="${SELF}" HOME="${TEMP}" ${TESTS_ENVIRONMENT} "${SELF}" "$@" -} - -call_bgr -c "bola 'lol.git'" 2>&1 | tee "${TEMP}/output.txt" || true -grep "error: invalid git-shell command: bola 'lol\.git'" "${TEMP}/output.txt" &> /dev/null - -echo 0000 | call_bgr -c "git-receive-pack 'lol.git'" 2>&1 > "${TEMP}/output.txt" -if [[ -n "${VALGRIND}" ]]; then - grep "git-shell -c \"git-receive-pack '.*repos/lol.git'\"" "${TEMP}/output.txt" &> /dev/null -else - grep "agent=" "${TEMP}/output.txt" &> /dev/null -fi -[[ -d "${TEMP}/repos/lol.git" ]] -[[ -h "${TEMP}/repos/lol.git/hooks/pre-receive" ]] -[[ "$(readlink "${TEMP}/repos/lol.git/hooks/pre-receive")" == "${SELF}" ]] -[[ -h "${TEMP}/repos/lol.git/hooks/post-receive" ]] -[[ "$(readlink "${TEMP}/repos/lol.git/hooks/post-receive")" == "${SELF}" ]] - -cat > "${TEMP}/tmp.txt" < 1476033730 +0200 -committer Rafael G. Martins 1476033888 +0200 -data 11 -testing... -M 100644 :1 foo - -EOF -cd "${TEMP}/repos/lol.git" -git fast-import < "${TEMP}/tmp.txt" &> /dev/null -cd - > /dev/null - -echo 0000 | call_bgr -c "git-upload-pack 'lol.git'" 2>&1 > "${TEMP}/output.txt" -if [[ -n "${VALGRIND}" ]]; then - grep "git-shell -c \"git-upload-pack '.*repos/lol.git'\"" "${TEMP}/output.txt" &> /dev/null -else - grep "agent=" "${TEMP}/output.txt" &> /dev/null -fi - -echo 0000 | call_bgr -c "git-upload-archive 'lol.git'" 2>&1 > "${TEMP}/output.txt" || true -if [[ -n "${VALGRIND}" ]]; then - grep "git-shell -c \"git-upload-archive '.*repos/lol.git'\"" "${TEMP}/output.txt" &> /dev/null -else - grep "ACK" "${TEMP}/output.txt" &> /dev/null -fi - -rm "${TEMP}/output.txt" diff --git a/tests/blogc-git-receiver/check_shell.sh.in b/tests/blogc-git-receiver/check_shell.sh.in new file mode 100755 index 0000000..0099df3 --- /dev/null +++ b/tests/blogc-git-receiver/check_shell.sh.in @@ -0,0 +1,73 @@ +#!@BASH@ + +set -xe -o pipefail + +export LC_ALL=C + +TEMP="$(mktemp -d)" +[[ -n "${TEMP}" ]] + +trap_func() { + [[ -e "${TEMP}/output.txt" ]] && cat "${TEMP}/output.txt" + [[ -n "${TEMP}" ]] && rm -rf "${TEMP}" +} + +trap trap_func EXIT + +SELF="${PWD}/blogc-git-receiver" + +call_bgr() { + [[ -n "${VALGRIND}" ]] && export __VALGRIND_ENABLED=1 + SHELL="${SELF}" HOME="${TEMP}" ${TESTS_ENVIRONMENT} "${SELF}" "$@" +} + +call_bgr -c "bola 'lol.git'" 2>&1 | tee "${TEMP}/output.txt" || true +grep "error: invalid git-shell command: bola 'lol\.git'" "${TEMP}/output.txt" &> /dev/null + +echo 0000 | call_bgr -c "git-receive-pack 'lol.git'" 2>&1 > "${TEMP}/output.txt" +if [[ -n "${VALGRIND}" ]]; then + grep "git-shell -c \"git-receive-pack '.*repos/lol.git'\"" "${TEMP}/output.txt" &> /dev/null +else + grep "agent=" "${TEMP}/output.txt" &> /dev/null +fi +[[ -d "${TEMP}/repos/lol.git" ]] +[[ -h "${TEMP}/repos/lol.git/hooks/pre-receive" ]] +[[ "$(readlink "${TEMP}/repos/lol.git/hooks/pre-receive")" == "${SELF}" ]] +[[ -h "${TEMP}/repos/lol.git/hooks/post-receive" ]] +[[ "$(readlink "${TEMP}/repos/lol.git/hooks/post-receive")" == "${SELF}" ]] + +cat > "${TEMP}/tmp.txt" < 1476033730 +0200 +committer Rafael G. Martins 1476033888 +0200 +data 11 +testing... +M 100644 :1 foo + +EOF +cd "${TEMP}/repos/lol.git" +git fast-import < "${TEMP}/tmp.txt" &> /dev/null +cd - > /dev/null + +echo 0000 | call_bgr -c "git-upload-pack 'lol.git'" 2>&1 > "${TEMP}/output.txt" +if [[ -n "${VALGRIND}" ]]; then + grep "git-shell -c \"git-upload-pack '.*repos/lol.git'\"" "${TEMP}/output.txt" &> /dev/null +else + grep "agent=" "${TEMP}/output.txt" &> /dev/null +fi + +echo 0000 | call_bgr -c "git-upload-archive 'lol.git'" 2>&1 > "${TEMP}/output.txt" || true +if [[ -n "${VALGRIND}" ]]; then + grep "git-shell -c \"git-upload-archive '.*repos/lol.git'\"" "${TEMP}/output.txt" &> /dev/null +else + grep "ACK" "${TEMP}/output.txt" &> /dev/null +fi + +rm "${TEMP}/output.txt" -- cgit v1.2.3-18-g5258