From d8892c4ddab81ac85b45f361a2d9204dba35cb74 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 8 Nov 2016 21:50:55 +1030 Subject: [PATCH] test: do version check during setup. Waiting until lightningd is up is too long: do a --version test in setup, and then check that all reported versions match later on. Signed-off-by: Rusty Russell --- daemon/test/scripts/setup.sh | 3 +++ daemon/test/test.sh | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/daemon/test/scripts/setup.sh b/daemon/test/scripts/setup.sh index af6208344..1057ad589 100755 --- a/daemon/test/scripts/setup.sh +++ b/daemon/test/scripts/setup.sh @@ -2,6 +2,9 @@ . `dirname $0`/vars.sh +VERSION=$(`dirname $0`/../../lightning-cli --version | head -n1) +[ $VERSION = `git describe --always --dirty` ] || (echo Wrong version $VERSION >&2; exit 1) + if $CLI getinfo 2>/dev/null; then echo $DAEMON already running >&2 exit 1 diff --git a/daemon/test/test.sh b/daemon/test/test.sh index 81b950a31..7d54049ac 100755 --- a/daemon/test/test.sh +++ b/daemon/test/test.sh @@ -441,9 +441,14 @@ if ! check "$LCLI3 getlog 2>/dev/null | $FGREP Hello"; then exit 1 fi -# Version should be correct -VERSION=`$LCLI1 getinfo | sed -n 's/.*"version" : "\([^"]*\)".*/\1/p'` -[ $VERSION = `git describe --always --dirty` ] || (echo Wrong version $VERSION >&2; exit 1) +# Version should match binary version +GETINFO_VERSION=`$LCLI1 getinfo | sed -n 's/.*"version" : "\([^"]*\)".*/\1/p'` +LCLI_VERSION=$($LCLI1 --version | head -n1) +LDAEMON_VERSION=$($LIGHTNINGD1 --version | head -n1) +if [ $GETINFO_VERSION != $LCLI_VERSION -o $GETINFO_VERSION != $LDAEMON_VERSION ]; then + echo Wrong versions: getinfo gave $GETINFO_VERSION, cli gave $LCLI_VERSION, daemon gave $LDAEMON_VERSION >&2 + exit 1 +fi ID1=`$LCLI1 getlog | sed -n 's/.*"ID: \([0-9a-f]*\)".*/\1/p'` [ `$LCLI1 getinfo | sed -n 's/.*"id" : "\([0-9a-f]*\)".*/\1/p'` = $ID1 ]