diff options
author | Miklos Vajna <vmiklos@frugalware.org> | 2009-10-22 12:26:11 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@frugalware.org> | 2009-10-22 12:26:11 +0200 |
commit | 1699dee3a67089fb524d5cb3b99eb3209676501f (patch) | |
tree | 98e203c2c49bca28c5e5ff41a4d580739ac7f0cf | |
parent | 86bda5c4d4040164512f1bd3c3f28c4e3a3ce9fb (diff) | |
download | python-fastimport-1699dee3a67089fb524d5cb3b99eb3209676501f.tar.gz |
darcs-fast-export: add testcase for http export support
-rw-r--r-- | exporters/darcs/t/lib-httpd.sh | 67 | ||||
-rw-r--r-- | exporters/darcs/t/test2-git-http.sh | 22 |
2 files changed, 89 insertions, 0 deletions
diff --git a/exporters/darcs/t/lib-httpd.sh b/exporters/darcs/t/lib-httpd.sh new file mode 100644 index 0000000..fad953e --- /dev/null +++ b/exporters/darcs/t/lib-httpd.sh @@ -0,0 +1,67 @@ +#!/bin/sh +# +# This is based on git's t/lib-httpd.sh, which is +# Copyright (c) 2008 Clemens Buchacher <drizzd@aon.at> +# + +if test -n "$DFE_TEST_SKIP_HTTPD" +then + echo "skipping test (undef DFE_TEST_SKIP_HTTPD to enable)" + exit +fi + +LIB_HTTPD_PATH=${LIB_HTTPD_PATH-'/usr/sbin/httpd'} +LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'8111'} + +HTTPD_ROOT_PATH="$PWD"/httpd +HTTPD_DOCUMENT_ROOT_PATH=$HTTPD_ROOT_PATH/www + +if ! test -x "$LIB_HTTPD_PATH" +then + echo "skipping test, no web server found at '$LIB_HTTPD_PATH'" + exit +fi + +HTTPD_VERSION=`$LIB_HTTPD_PATH -v | \ + sed -n 's/^Server version: Apache\/\([0-9]*\)\..*$/\1/p; q'` + +if test -n "$HTTPD_VERSION" +then + if test -z "$LIB_HTTPD_MODULE_PATH" + then + if ! test $HTTPD_VERSION -ge 2 + then + echo "skipping test, at least Apache version 2 is required" + exit + fi + + LIB_HTTPD_MODULE_PATH='/usr/lib/apache' + fi +else + error "Could not identify web server at '$LIB_HTTPD_PATH'" +fi + +HTTPD_PARA="-d $HTTPD_ROOT_PATH -f $HTTPD_ROOT_PATH/apache.conf" + +prepare_httpd() { + mkdir -p $HTTPD_DOCUMENT_ROOT_PATH + + ln -s $LIB_HTTPD_MODULE_PATH $HTTPD_ROOT_PATH/modules + + echo "PidFile httpd.pid" > $HTTPD_ROOT_PATH/apache.conf + echo "DocumentRoot www" >> $HTTPD_ROOT_PATH/apache.conf + echo "ErrorLog error.log" >> $HTTPD_ROOT_PATH/apache.conf + + HTTPD_URL=http://127.0.0.1:$LIB_HTTPD_PORT +} + +start_httpd() { + prepare_httpd + + "$LIB_HTTPD_PATH" $HTTPD_PARA \ + -c "Listen 127.0.0.1:$LIB_HTTPD_PORT" -k start +} + +stop_httpd() { + "$LIB_HTTPD_PATH" $HTTPD_PARA -k stop +} diff --git a/exporters/darcs/t/test2-git-http.sh b/exporters/darcs/t/test2-git-http.sh new file mode 100644 index 0000000..02549e4 --- /dev/null +++ b/exporters/darcs/t/test2-git-http.sh @@ -0,0 +1,22 @@ +. ./lib.sh +. ./lib-httpd.sh + +rm -rf test2.darcs test2.git httpd +create_darcs test2 --darcs-2 +mkdir -p $HTTPD_DOCUMENT_ROOT_PATH +mv -v test2 $HTTPD_DOCUMENT_ROOT_PATH +ln -s $HTTPD_DOCUMENT_ROOT_PATH/test2 . + +mkdir test2.git +cd test2.git +git --bare init +cd .. +start_httpd +darcs-fast-export $HTTPD_URL/test2 |(cd test2.git; git fast-import) +ret=$? +stop_httpd +if [ $ret != 0 ]; then + exit $ret +fi +diff_git test2 +exit $? |