ISSUE-262 make running checks more solid

git-svn-id: http://google-refine.googlecode.com/svn/trunk@1958 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Stefano Mazzocchi 2010-12-24 22:21:40 +00:00
parent e6415bab4f
commit 2ab131b87a

38
refine
View File

@ -92,7 +92,7 @@ add_option() {
load_configs() { load_configs() {
TEMP_CONFIG=$(mktemp -t refine.XXXXXXX) TEMP_CONFIG=$(mktemp -t refine.XXXXXXX)
if [ "${TEMP_CONFIG}" == "" ]; then if [ "${TEMP_CONFIG}" == "" ] ; then
error "Could not create temporary file to load configurations" error "Could not create temporary file to load configurations"
fi fi
cat $1 | egrep "^[A-Z]" | sed 's/^\(.*\)$/export \1/' > ${TEMP_CONFIG} cat $1 | egrep "^[A-Z]" | sed 's/^\(.*\)$/export \1/' > ${TEMP_CONFIG}
@ -152,12 +152,27 @@ check_pywin32() {
check_running() { check_running() {
check_downloaders check_downloaders
URL="http://${REFINE_HOST}:${REFINE_PORT}/" URL="http://${REFINE_HOST}:${REFINE_PORT}/"
CHECK_STR="<title>Google Refine</title>"
if [ "$CURL" ] ; then if [ "$CURL" ] ; then
NOT_RUNNING=`curl -s $URL > /dev/null || echo not_running` NOT_RUNNING=`curl -s -S $URL 2>&1 > /dev/null | grep "couldn't connect to host"`
elif [ "$WGET" ] ; then elif [ "$WGET" ] ; then
NOT_RUNNING=`wget -q -O - $URL > /dev/null || echo not_running` NOT_RUNNING=`wget -O - $URL 2>&1 > /dev/null | grep "Connection refused"`
fi fi
if [ -z "${NOT_RUNNING}" ] ; then
if [ "$CURL" ] ; then
RUNNING=`curl -s $URL | grep "$CHECK_STR"`
elif [ "$WGET" ] ; then
RUNNING=`wget -q -O - $URL | grep "$CHECK_STR"`
fi
if [ -z "${RUNNING}" ] ; then
error "Something is already running on $URL but doesn't seem to be Google Refine"
fi
else
RUNNING=""
fi
} }
get_version() { get_version() {
@ -546,7 +561,7 @@ ui_test() {
echo "Waiting for Google Refine to load..." echo "Waiting for Google Refine to load..."
sleep 5 sleep 5
check_running check_running
if [ ! -z "$NOT_RUNNING" ] ; then if [ -z "$RUNNING" ] ; then
sleep 10 sleep 10
fi fi
echo "... proceed with the tests." echo "... proceed with the tests."
@ -595,7 +610,7 @@ run() {
check_running check_running
if [ -z "$NOT_RUNNING" ] ; then if [ "$RUNNING" ] ; then
warn "Google Refine is already running." warn "Google Refine is already running."
fi fi
@ -658,15 +673,6 @@ broker_build() {
broker_run() { broker_run() {
FORK=$1 FORK=$1
REFINE_HOST=127.0.0.1
REFINE_PORT=3334
check_running
if [ -z "$NOT_RUNNING" ] ; then
warn "Google Refine Broker is already running."
fi
if [ ! -d "broker/core/WEB-INF/lib" ] ; then if [ ! -d "broker/core/WEB-INF/lib" ] ; then
broker_build broker_build
echo "" echo ""
@ -818,7 +824,7 @@ if [ "$OS" = "macosx" ] ; then
fi fi
fi fi
if [ "$JAVA_HOME" ]; then if [ "$JAVA_HOME" ] ; then
JAVA="$JAVA_HOME/bin/java" JAVA="$JAVA_HOME/bin/java"
else else
JAVA="`which javas 2> /dev/null`" JAVA="`which javas 2> /dev/null`"