From: François HORTA Date: Tue, 23 Nov 2021 17:25:27 +0000 (+0100) Subject: Fix broken tests X-Git-Tag: v1.8.0~13^2~3 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=558e1e0ffc65f4ac4509be531c210d3e57f0b481;p=thirdparty%2Frrdtool-1.x.git Fix broken tests --- diff --git a/tests/functions b/tests/functions index b5526ce8..cafb5abf 100644 --- a/tests/functions +++ b/tests/functions @@ -138,6 +138,8 @@ function run_cached { stop_cached local ADDR + [ -z "$RRDCACHED_SOCK" ] && RRDCACHED_SOCK="unix" + if [ $RRDCACHED_SOCK == "unix" ]; then export BASEDIR="${BUILDDIR}/cached" export BUILDDIR="${BASEDIR}" @@ -202,7 +204,13 @@ function run_cached { export RRDTOOL=RRDTOOLCOMPAT randport=$(python -S -c "import random; random.seed('$(basename $0)'); print(random.randrange(49152,65535))") - ADDR="localhost:$randport" + port=$(python -S << HERE +import socketserver +with socketserver.TCPServer(("localhost", 0), None) as s: + print(s.server_address[1]) +HERE +) + ADDR="localhost:$port" fi CACHED_PID_FILE="$BASEDIR/$(basename $0)-rrdcached.pid" diff --git a/tests/list1 b/tests/list1 index 0cb8c9d8..15c2a9dc 100755 --- a/tests/list1 +++ b/tests/list1 @@ -83,6 +83,9 @@ if [ -n "$TEMP_RRDCACHED_ADDRESS" ]; then export RRDCACHED_ADDRESS=$TEMP_RRDCACHED_ADDRESS else run_cached + BUILDDIR=$BUILDDIR + BUILD=$BUILDDIR/`basename $0` + LIST_DIR=$BUILDDIR/`basename $0`_dir fi if is_cached; then