2015-05-14 17:56:05 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# this should run from the git-lfs project root.
|
|
|
|
set -e
|
|
|
|
|
2015-05-15 16:52:42 +00:00
|
|
|
wait_for_file() {
|
|
|
|
local filename=$1
|
|
|
|
for ((n=30; n>0; n--)); do
|
|
|
|
if [ -s $filename ]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
sleep 0.5
|
|
|
|
done
|
|
|
|
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2015-05-14 17:56:05 +00:00
|
|
|
# cleanup
|
2015-05-15 17:28:19 +00:00
|
|
|
rm -rf "test/remote"
|
|
|
|
rm -rf "test/local"
|
|
|
|
mkdir -p "test/remote"
|
|
|
|
mkdir -p "test/local"
|
2015-05-14 17:56:05 +00:00
|
|
|
ROOTDIR=`pwd`
|
|
|
|
|
|
|
|
echo "compile git-lfs"
|
|
|
|
script/bootstrap
|
|
|
|
GITLFS="`pwd`/bin/git-lfs"
|
|
|
|
|
2015-05-15 16:52:42 +00:00
|
|
|
echo "spin up test server"
|
2015-05-15 17:28:19 +00:00
|
|
|
LFSTEST_URL="test/remote/url" go run "test/cmd/lfstest-gitserver.go" &
|
|
|
|
wait_for_file "test/remote/url"
|
|
|
|
GITSERVER=$(cat "test/remote/url")
|
2015-05-15 16:52:42 +00:00
|
|
|
echo $GITSERVER
|
|
|
|
|
2015-05-14 17:56:05 +00:00
|
|
|
echo "set up 'remote' git repository"
|
|
|
|
REPONAME="$(basename "$0")"
|
|
|
|
REPODIR="`pwd`/tests/remote/$REPONAME.git"
|
|
|
|
mkdir -p $REPODIR
|
|
|
|
cd $REPODIR
|
|
|
|
git init --bare
|
|
|
|
git config http.receivepack true
|
|
|
|
git config receive.denyCurrentBranch ignore
|
|
|
|
|
|
|
|
echo "set up 'local' test directory with git clone"
|
|
|
|
cd $ROOTDIR
|
|
|
|
TESTDIR="$(mktemp -d "`pwd`/tests/local/XXXXXX")"
|
|
|
|
cd $TESTDIR
|
2015-05-15 16:52:42 +00:00
|
|
|
git clone $GITSERVER/$REPONAME repo
|
|
|
|
cd repo
|
2015-05-14 17:56:05 +00:00
|
|
|
|
2015-05-15 16:52:42 +00:00
|
|
|
echo "start the test"
|
2015-05-14 17:56:05 +00:00
|
|
|
|
|
|
|
out=$($GITLFS track "*.dat")
|
|
|
|
echo "$out"
|
|
|
|
echo "$out" | grep "dat"
|
|
|
|
|
2015-05-15 16:52:42 +00:00
|
|
|
# only run if this test complete
|
2015-05-14 17:56:05 +00:00
|
|
|
rm -rf $TESTDIR
|
2015-05-15 16:52:42 +00:00
|
|
|
|
|
|
|
# run after the entire test run regardless of success or failure
|
|
|
|
curl $GITSERVER/shutdown
|