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

build tweaks to support testing on OSX

parent ae222928
...@@ -16,6 +16,7 @@ MAINTAINERCLEANFILES = ...@@ -16,6 +16,7 @@ MAINTAINERCLEANFILES =
EXTRA_DIST = EXTRA_DIST =
BUILT_SOURCES = BUILT_SOURCES =
include_HEADERS = include/margo.h include_HEADERS = include/margo.h
TESTS_ENVIRONMENT =
EXTRA_DIST += \ EXTRA_DIST += \
prepare.sh prepare.sh
......
...@@ -25,6 +25,28 @@ AC_PROG_RANLIB ...@@ -25,6 +25,28 @@ AC_PROG_RANLIB
AC_PROG_MKDIR_P 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_REQUIRE_CPP
AC_CHECK_SIZEOF([long int]) AC_CHECK_SIZEOF([long int])
......
TESTS_ENVIRONMENT += \
TIMEOUT="$(TIMEOUT)" \
MKTEMP="$(MKTEMP)"
check_PROGRAMS += \ check_PROGRAMS += \
examples/sleep \ examples/sleep \
examples/server \ examples/server \
......
...@@ -2,12 +2,16 @@ ...@@ -2,12 +2,16 @@
# General test script utilities # General test script utilities
# #
if [ -z "$TIMEOUT" ] ; then
echo expected TIMEOUT variable defined to its respective command
exit 1
fi
function run_to () function run_to ()
{ {
maxtime=${1}s maxtime=${1}s
shift shift
timeout --signal=9 $maxtime "$@" $TIMEOUT --signal=9 $maxtime "$@"
} }
function test_start_servers () function test_start_servers ()
...@@ -23,7 +27,7 @@ function test_start_servers () ...@@ -23,7 +27,7 @@ function test_start_servers ()
# start daemons # start daemons
for i in `seq $startport $endport` for i in `seq $startport $endport`
do 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 if [ $? -ne 0 ]; then
# TODO: this doesn't actually work; can't check return code of # TODO: this doesn't actually work; can't check return code of
# something executing in background. We have to rely on the # something executing in background. We have to rely on the
......
...@@ -4,9 +4,15 @@ if [ -z $srcdir ]; then ...@@ -4,9 +4,15 @@ if [ -z $srcdir ]; then
echo srcdir variable not set. echo srcdir variable not set.
exit 1 exit 1
fi fi
if [ -z "$MKTEMP" ] ; then
echo expected MKTEMP variable defined to its respective command
exit 1
fi
source $srcdir/tests/test-util-hang.sh 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 # start 1 server with 2 second wait, 8s timeout
test_start_servers 1 2 8 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