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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2016-11-08 21:50:55 +10:30
parent 35b2ee9c42
commit d8892c4dda
2 changed files with 11 additions and 3 deletions

View File

@ -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

View File

@ -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 ]