git-lfs/script/integration

62 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
. "test/testenv.sh"
set -e
SHUTDOWN_LFS=no
SHOW_LOGS=yes
TESTS=( "$@" )
atexit() {
res=${1:-$?}
SHUTDOWN_LFS=yes
if [ "$res" = "0" ]; then
SHOW_LOGS=no
fi
if [ "$SHOW_LOGS" = "yes" ] && [ "$VERBOSE_LOGS" = "1" ]; then
if [ -s "$REMOTEDIR/gitserver.log" ]; then
echo ""
echo "gitserver.log:"
cat "$REMOTEDIR/gitserver.log"
fi
echo ""
echo "env:"
env
fi
shutdown
exit $res
}
trap "atexit" EXIT
if [ -s "$LFS_URL_FILE" ]; then
SHOW_LOGS=no
echo "$LFS_URL_FILE still exists!"
echo "Confirm other tests are done, and run:"
echo " $ curl $(cat "$LFS_URL_FILE")/shutdown"
exit 1
fi
setup
parallel=${GIT_LFS_TEST_MAXPROCS:-4}
echo "Running this maxprocs=$parallel"
echo
if [ ${#TESTS[@]} -eq 0 ]
then
testfiles=(test/test-*.sh)
else
for ((i=0; i<${#TESTS[@]}; i++)); do
testfiles[i]=test/test-${TESTS[i]}.sh
done
fi
for file in "${testfiles[@]}"; do
echo "0$(cat .$(basename $file).time 2>/dev/null || true) $file"
done | sort -rnk1 | awk '{ print $2 }' | xargs -I % -P $parallel -n 1 /bin/sh -c % --batch