Commit 8a302896 authored by Jonathan Jenkins's avatar Jonathan Jenkins

build tweaks to support testing on OSX

parent ae222928
......@@ -16,6 +16,7 @@ MAINTAINERCLEANFILES =
EXTRA_DIST =
BUILT_SOURCES =
include_HEADERS = include/margo.h
TESTS_ENVIRONMENT =
EXTRA_DIST += \
prepare.sh
......
......@@ -25,6 +25,28 @@ AC_PROG_RANLIB
AC_PROG_MKDIR_P
# coreutils checks for OSX
AC_ARG_VAR([TIMEOUT], timeout program)
AC_ARG_VAR([MKTEMP], mktemp program)
if test -z "$TIMEOUT" ; then
AC_CHECK_PROGS(TIMEOUT, [timeout gtimeout])
if test -z "$TIMEOUT" ; then
AC_MSG_ERROR([Could not find timeout command (can optionally provide via the TIMEOUT variable)])
fi
else
AC_SUBST([TIMEOUT], ["$TIMEOUT"])
fi
if test -z "$MKTEMP" ; then
AC_CHECK_PROGS(MKTEMP, [mktemp gmktemp])
if test -z "$MKTEMP" ; then
AC_MSG_ERROR([Could not find mktemp command (can optionally provide via the MKTEMP variable)])
fi
else
AC_SUBST([MKTEMP], ["$MKTEMP"])
fi
AC_REQUIRE_CPP
AC_CHECK_SIZEOF([long int])
......
TESTS_ENVIRONMENT += \
TIMEOUT="$(TIMEOUT)" \
MKTEMP="$(MKTEMP)"
check_PROGRAMS += \
examples/sleep \
examples/server \
......
......@@ -2,12 +2,16 @@
# General test script utilities
#
if [ -z "$TIMEOUT" ] ; then
echo expected TIMEOUT variable defined to its respective command
exit 1
fi
function run_to ()
{
maxtime=${1}s
shift
timeout --signal=9 $maxtime "$@"
$TIMEOUT --signal=9 $maxtime "$@"
}
function test_start_servers ()
......@@ -23,7 +27,7 @@ function test_start_servers ()
# start daemons
for i in `seq $startport $endport`
do
timeout --signal=9 ${maxtime} examples/server-hang tcp://localhost:$i &
$TIMEOUT --signal=9 ${maxtime} examples/server-hang tcp://localhost:$i &
if [ $? -ne 0 ]; then
# TODO: this doesn't actually work; can't check return code of
# something executing in background. We have to rely on the
......
......@@ -4,9 +4,15 @@ if [ -z $srcdir ]; then
echo srcdir variable not set.
exit 1
fi
if [ -z "$MKTEMP" ] ; then
echo expected MKTEMP variable defined to its respective command
exit 1
fi
source $srcdir/tests/test-util-hang.sh
TMPOUT=$(mktemp --tmpdir test-XXXXXX)
TMPOUT=$($MKTEMP --tmpdir test-XXXXXX)
# start 1 server with 2 second wait, 8s timeout
test_start_servers 1 2 8
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment