diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-10-12 02:44:25 +0200 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-10-12 02:44:25 +0200 |
commit | de580e7999400b7d8789ce3747db4f2a63f2538b (patch) | |
tree | 968cd75d779c844123dc10a0b3999f80628c90cc /tests/blogc-git-receiver/check_post_receive.sh.in | |
parent | bc7d2545d47bf54acebb38ab3d1e2dd7251ddb99 (diff) | |
download | blogc-de580e7999400b7d8789ce3747db4f2a63f2538b.tar.gz blogc-de580e7999400b7d8789ce3747db4f2a63f2538b.tar.bz2 blogc-de580e7999400b7d8789ce3747db4f2a63f2538b.zip |
build: use bash, but get it properly during build time
hardcoding it for travis, as bash is always installed there.
Diffstat (limited to 'tests/blogc-git-receiver/check_post_receive.sh.in')
-rwxr-xr-x | tests/blogc-git-receiver/check_post_receive.sh.in | 86 |
1 files changed, 86 insertions, 0 deletions
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" <<EOF +blob +mark :1 +data 4 +bar + +reset refs/heads/master +commit refs/heads/master +mark :2 +author Rafael G. Martins <rafael@rafaelmartins.eng.br> 1476033730 +0200 +committer Rafael G. Martins <rafael@rafaelmartins.eng.br> 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" <<EOF +[repo:boo.git] +mirror = 123 + +[repo:foo.git] +mirror = ${TEMP}/repos/bar3.git + +[repo:bar.git] +mirror = lol +EOF +git init --bare "${TEMP}/repos/bar3.git" &> /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" <<EOF +asd[repo:boo.git] +mirror = 123 + +[repo:foo.git] +mirror = ${TEMP}/repos/bar4.git + +[repo:bar.git] +mirror = lol +EOF +git init --bare "${TEMP}/repos/bar4.git" &> /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" |