GitLab maintenance scheduled for Tomorrow, 2020-03-31, from 17:00 to 18:00 CT - Services will be unavailable during this time.

test-util.sh 854 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#
# 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 "$@"
}

function hepnos_test_start_servers()
{
    nservers=${1:-4}
    startwait=${2:-15}
    maxtime=${3:-120}
22 23
    config=${4:-config.yaml}
    cfile=${5:-connection.yaml}
24 25
    rm -rf ${cfile}

26
    run_to $maxtime mpirun -np $nservers ../bin/hepnos-daemon $config $cfile &
27 28 29 30 31 32 33 34 35 36 37
    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
        # return codes of the actual client side tests to tell if
        # everything started properly
        exit 1
    fi

    # wait for servers to start
    sleep ${startwait}
}