From 461980dbcf17fb95db5bffe2d98a906dc307c11c Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Thu, 10 Sep 2020 17:32:02 +0200 Subject: [PATCH] tests: fix a lot of the integration tests --- tests/integration/api-capabilities.sh | 2 +- tests/integration/api-config.sh | 2 +- tests/integration/api-nodes.sh | 2 +- tests/integration/api-paths.sh | 2 +- tests/integration/api-restart.sh | 2 +- tests/integration/hook-average.sh | 2 +- tests/integration/hook-cast.sh | 2 +- tests/integration/hook-decimate.sh | 2 +- tests/integration/hook-dp.sh | 2 +- tests/integration/hook-drop.sh | 2 +- tests/integration/hook-gate.sh | 2 +- tests/integration/hook-limit_rate.sh | 2 +- tests/integration/hook-print.sh | 2 +- tests/integration/hook-scale.sh | 2 +- tests/integration/hook-shift_seq.sh | 2 +- tests/integration/hook-shift_ts.sh | 2 +- tests/integration/node-can.sh | 2 +- tests/integration/node-infiniband.sh | 4 +- tests/integration/node-loopback-socket.sh | 2 +- tests/integration/node-multiple_sources.sh | 90 +++++++++++++++++++ tests/integration/node-mux_demux.sh | 32 ++++--- tests/integration/node-stats.sh | 5 +- tests/integration/pipe-file-advio.sh | 2 +- tests/integration/pipe-loopback-amqp.sh | 2 +- tests/integration/pipe-loopback-exec.sh | 2 +- tests/integration/pipe-loopback-file.sh | 2 +- .../integration/pipe-loopback-iec61850-9-2.sh | 2 +- tests/integration/pipe-loopback-loopback.sh | 2 +- tests/integration/pipe-loopback-mqtt.sh | 2 +- tests/integration/pipe-loopback-nanomsg.sh | 2 +- tests/integration/pipe-loopback-rtp-dual.sh | 2 +- tests/integration/pipe-loopback-rtp-remote.sh | 2 +- tests/integration/pipe-loopback-rtp-tbf.sh | 2 +- tests/integration/pipe-loopback-rtp.sh | 2 +- tests/integration/pipe-loopback-shmem.sh | 2 +- .../pipe-loopback-socket-multicast.sh | 2 +- tests/integration/pipe-loopback-socket.sh | 2 +- tests/integration/pipe-loopback-websocket.sh | 2 +- tests/integration/pipe-loopback-zeromq.sh | 2 +- tests/integration/pipe-python-protobuf.sh | 2 +- tests/integration/test-config.sh | 6 +- 41 files changed, 152 insertions(+), 57 deletions(-) create mode 100755 tests/integration/node-multiple_sources.sh diff --git a/tests/integration/api-capabilities.sh b/tests/integration/api-capabilities.sh index 793f38d7a..705993150 100755 --- a/tests/integration/api-capabilities.sh +++ b/tests/integration/api-capabilities.sh @@ -44,4 +44,4 @@ RC=$? rm ${FETCHED_CONF} -exit $RC +exit ${RC} diff --git a/tests/integration/api-config.sh b/tests/integration/api-config.sh index 7da4d3005..11a0e0bc0 100755 --- a/tests/integration/api-config.sh +++ b/tests/integration/api-config.sh @@ -61,4 +61,4 @@ RC=$? rm -f ${FETCHED_CONF} ${CONFIG_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/api-nodes.sh b/tests/integration/api-nodes.sh index 544e4ef58..5ecf57746 100755 --- a/tests/integration/api-nodes.sh +++ b/tests/integration/api-nodes.sh @@ -80,4 +80,4 @@ RC=$? rm -f ${CONFIG_FILE} ${FETCHED_NODES} -exit $RC +exit ${RC} diff --git a/tests/integration/api-paths.sh b/tests/integration/api-paths.sh index 709463742..4dcfff7db 100755 --- a/tests/integration/api-paths.sh +++ b/tests/integration/api-paths.sh @@ -80,4 +80,4 @@ RC=$? rm -f ${CONFIG_FILE} ${FETCHED_PATHS} -exit $RC +exit ${RC} diff --git a/tests/integration/api-restart.sh b/tests/integration/api-restart.sh index 12500b280..c2e76a8db 100755 --- a/tests/integration/api-restart.sh +++ b/tests/integration/api-restart.sh @@ -83,4 +83,4 @@ RC=$? rm -f ${LOCAL_CONF} ${FETCHED_CONF} ${BASE_CONF} -exit $RC +exit ${RC} diff --git a/tests/integration/hook-average.sh b/tests/integration/hook-average.sh index b56c40d23..726890d6e 100755 --- a/tests/integration/hook-average.sh +++ b/tests/integration/hook-average.sh @@ -62,4 +62,4 @@ RC=$? rm -f ${INPUT_FILE} ${OUTPUT_FILE} ${EXPECT_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/hook-cast.sh b/tests/integration/hook-cast.sh index 7b8f10ab7..2cc8cc1b1 100755 --- a/tests/integration/hook-cast.sh +++ b/tests/integration/hook-cast.sh @@ -62,4 +62,4 @@ RC=$? rm -f ${INPUT_FILE} ${OUTPUT_FILE} ${EXPECT_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/hook-decimate.sh b/tests/integration/hook-decimate.sh index db7de51f9..985a3f31e 100755 --- a/tests/integration/hook-decimate.sh +++ b/tests/integration/hook-decimate.sh @@ -55,4 +55,4 @@ RC=$? rm -f ${INPUT_FILE} ${OUTPUT_FILE} ${EXPECT_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/hook-dp.sh b/tests/integration/hook-dp.sh index de97f16a9..b6c5eec20 100755 --- a/tests/integration/hook-dp.sh +++ b/tests/integration/hook-dp.sh @@ -52,4 +52,4 @@ RC=$? rm -f ${INPUT_FILE} ${OUTPUT_FILE} ${EXPECT_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/hook-drop.sh b/tests/integration/hook-drop.sh index 495d84779..fd46ae616 100755 --- a/tests/integration/hook-drop.sh +++ b/tests/integration/hook-drop.sh @@ -61,4 +61,4 @@ RC=$? rm -f ${INPUT_FILE} ${OUTPUT_FILE} ${EXPECT_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/hook-gate.sh b/tests/integration/hook-gate.sh index 9960acc2c..6773cbe65 100755 --- a/tests/integration/hook-gate.sh +++ b/tests/integration/hook-gate.sh @@ -57,4 +57,4 @@ RC=$? rm -f ${INPUT_FILE} ${OUTPUT_FILE} ${EXPECT_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/hook-limit_rate.sh b/tests/integration/hook-limit_rate.sh index d5b422d2e..bead1e62f 100755 --- a/tests/integration/hook-limit_rate.sh +++ b/tests/integration/hook-limit_rate.sh @@ -38,4 +38,4 @@ RC=$? rm -f ${INPUT_FILE} ${OUTPUT_FILE} ${EXPECT_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/hook-print.sh b/tests/integration/hook-print.sh index 85a59b6c7..407fbe3e6 100755 --- a/tests/integration/hook-print.sh +++ b/tests/integration/hook-print.sh @@ -39,4 +39,4 @@ RC=$? rm -f ${OUTPUT_FILE1} ${OUTPUT_FILE2} ${INPUT_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/hook-scale.sh b/tests/integration/hook-scale.sh index b69fe8bcc..a270e4092 100755 --- a/tests/integration/hook-scale.sh +++ b/tests/integration/hook-scale.sh @@ -62,4 +62,4 @@ RC=$? rm -f ${INPUT_FILE} ${OUTPUT_FILE} ${EXPECT_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/hook-shift_seq.sh b/tests/integration/hook-shift_seq.sh index 938aa9da1..fd41fff4c 100755 --- a/tests/integration/hook-shift_seq.sh +++ b/tests/integration/hook-shift_seq.sh @@ -38,4 +38,4 @@ RC=$? rm -f ${OUTPUT_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/hook-shift_ts.sh b/tests/integration/hook-shift_ts.sh index 1f102dcb1..e945e2559 100755 --- a/tests/integration/hook-shift_ts.sh +++ b/tests/integration/hook-shift_ts.sh @@ -41,4 +41,4 @@ RC=$? rm ${STATS_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/node-can.sh b/tests/integration/node-can.sh index e997adb65..cef1340ce 100755 --- a/tests/integration/node-can.sh +++ b/tests/integration/node-can.sh @@ -150,4 +150,4 @@ RC=$? #rm ${CAN_OUT_FILE} ${INPUT_FILE} ${OUTPUT_FILE} rm ${INPUT_FILE} ${OUTPUT_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/node-infiniband.sh b/tests/integration/node-infiniband.sh index 270b256b4..06150195c 100755 --- a/tests/integration/node-infiniband.sh +++ b/tests/integration/node-infiniband.sh @@ -191,7 +191,7 @@ do if [[ $RC != 0 ]]; then rm ${CONFIG_FILE} ${CONFIG_FILE_TARGET} ${INPUT_FILE} ${OUTPUT_FILE} ${DATAFIFO} - exit $RC + exit ${RC} fi echo "#############################" @@ -206,4 +206,4 @@ done rm ${CONFIG_FILE} ${CONFIG_FILE_TARGET} ${INPUT_FILE} ${OUTPUT_FILE} ${DATAFIFO} -exit $RC +exit ${RC} diff --git a/tests/integration/node-loopback-socket.sh b/tests/integration/node-loopback-socket.sh index 09752c937..9d193f18b 100755 --- a/tests/integration/node-loopback-socket.sh +++ b/tests/integration/node-loopback-socket.sh @@ -102,4 +102,4 @@ RC=$? rm ${CONFIG_FILE} ${INPUT_FILE} ${OUTPUT_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/node-multiple_sources.sh b/tests/integration/node-multiple_sources.sh new file mode 100755 index 000000000..d51e9dc9f --- /dev/null +++ b/tests/integration/node-multiple_sources.sh @@ -0,0 +1,90 @@ +#!/bin/bash +# +# Integration loopback test using villas-node. +# +# @author Steffen Vogel +# @copyright 2014-2020, Institute for Automation of Complex Power Systems, EONERC +# @license GNU General Public License (version 3) +# +# VILLASnode +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +################################################################################## + +SCRIPT=$(realpath $0) +SCRIPTPATH=$(dirname ${SCRIPT}) +source ${SCRIPTPATH}/../../tools/villas-helper.sh + +CONFIG_FILE=$(mktemp) +OUTPUT_FILE1=$(mktemp) +OUTPUT_FILE2=$(mktemp) +EXPECT_FILE=$(mktemp) + +cat > ${CONFIG_FILE} < ${EXPECT_FILE} + +# Start node +VILLAS_LOG_PREFIX=$(colorize "[Node] ") \ +villas-node ${CONFIG_FILE} & +P1=$! + +sleep 2 + +kill ${P1} +wait ${P1} + +# Compare only the data values +villas-test-cmp ${OUTPUT_FILE1} ${EXPECT_FILE} && \ +villas-test-cmp ${OUTPUT_FILE2} ${EXPECT_FILE} +RC=$? + +rm ${CONFIG_FILE} ${EXPECT_FILE} \ + ${OUTPUT_FILE1} ${OUTPUT_FILE2} + +exit ${RC} diff --git a/tests/integration/node-mux_demux.sh b/tests/integration/node-mux_demux.sh index ac94a88a8..dc19df24f 100755 --- a/tests/integration/node-mux_demux.sh +++ b/tests/integration/node-mux_demux.sh @@ -28,6 +28,14 @@ source ${SCRIPTPATH}/../../tools/villas-helper.sh CONFIG_FILE=$(mktemp) OUTPUT_FILE=$(mktemp) +EXPECT_FILE=$(mktemp) + +cat < ${EXPECT_FILE} +1599745986.343431058+1.451000e-06(7) 4.000000 20.000000 100.000000 +1599745986.843081878+8.820000e-07(16) 9.000000 50.000000 200.000000 +1599745987.343081848+9.440000e-07(24) 14.000000 70.000000 300.000000 +1599745987.843081745+8.630000e-07(33) 19.000000 100.000000 400.000000 +EOF cat > ${CONFIG_FILE} < ${CONFIG_FILE} < ${CONFIG_FILE} < ${CONFIG_FILE} < ${CONFIG_FILE} < ${CONFIG_FILE} < ${CONFIG_FILE} < ${CONFIG_FILE} < /dev/null RC=$? diff --git a/tests/integration/pipe-file-advio.sh b/tests/integration/pipe-file-advio.sh index 6f527c00e..bf4c5620b 100755 --- a/tests/integration/pipe-file-advio.sh +++ b/tests/integration/pipe-file-advio.sh @@ -77,4 +77,4 @@ RC=$? rm -f ${CONFIG_FILE} ${INPUT_FILE} ${OUTPUT_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/pipe-loopback-amqp.sh b/tests/integration/pipe-loopback-amqp.sh index f9c8ed6f0..851d2ff4c 100755 --- a/tests/integration/pipe-loopback-amqp.sh +++ b/tests/integration/pipe-loopback-amqp.sh @@ -79,4 +79,4 @@ RC=$? rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/pipe-loopback-exec.sh b/tests/integration/pipe-loopback-exec.sh index ca8451846..be4ea2ab9 100755 --- a/tests/integration/pipe-loopback-exec.sh +++ b/tests/integration/pipe-loopback-exec.sh @@ -58,4 +58,4 @@ RC=$? rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/pipe-loopback-file.sh b/tests/integration/pipe-loopback-file.sh index 4240d33a5..8d15b0ba0 100755 --- a/tests/integration/pipe-loopback-file.sh +++ b/tests/integration/pipe-loopback-file.sh @@ -60,4 +60,4 @@ RC=$? rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} ${NODE_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/pipe-loopback-iec61850-9-2.sh b/tests/integration/pipe-loopback-iec61850-9-2.sh index 8cb0a5a50..32e250a78 100755 --- a/tests/integration/pipe-loopback-iec61850-9-2.sh +++ b/tests/integration/pipe-loopback-iec61850-9-2.sh @@ -73,4 +73,4 @@ RC=$? rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/pipe-loopback-loopback.sh b/tests/integration/pipe-loopback-loopback.sh index af7e5ea69..f6ada7c6e 100755 --- a/tests/integration/pipe-loopback-loopback.sh +++ b/tests/integration/pipe-loopback-loopback.sh @@ -49,4 +49,4 @@ RC=$? rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/pipe-loopback-mqtt.sh b/tests/integration/pipe-loopback-mqtt.sh index 48451fa92..8c424723b 100755 --- a/tests/integration/pipe-loopback-mqtt.sh +++ b/tests/integration/pipe-loopback-mqtt.sh @@ -78,4 +78,4 @@ RC=$? rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/pipe-loopback-nanomsg.sh b/tests/integration/pipe-loopback-nanomsg.sh index a7f9ac5ca..dc15d6ae9 100755 --- a/tests/integration/pipe-loopback-nanomsg.sh +++ b/tests/integration/pipe-loopback-nanomsg.sh @@ -71,4 +71,4 @@ RC=$? rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/pipe-loopback-rtp-dual.sh b/tests/integration/pipe-loopback-rtp-dual.sh index 1856829f1..e66df593f 100755 --- a/tests/integration/pipe-loopback-rtp-dual.sh +++ b/tests/integration/pipe-loopback-rtp-dual.sh @@ -133,4 +133,4 @@ rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE_SRC} ${CONFIG_FILE_DEST} kill $PID -exit $RC +exit ${RC} diff --git a/tests/integration/pipe-loopback-rtp-remote.sh b/tests/integration/pipe-loopback-rtp-remote.sh index 3ac2f2d1d..d39543e1d 100755 --- a/tests/integration/pipe-loopback-rtp-remote.sh +++ b/tests/integration/pipe-loopback-rtp-remote.sh @@ -145,4 +145,4 @@ ${REMOTE} rm ${OUTPUT_FILE} ${CONFIG_FILE_DEST} kill ${PID} -exit $RC +exit ${RC} diff --git a/tests/integration/pipe-loopback-rtp-tbf.sh b/tests/integration/pipe-loopback-rtp-tbf.sh index ca1b086c1..f8461a29f 100755 --- a/tests/integration/pipe-loopback-rtp-tbf.sh +++ b/tests/integration/pipe-loopback-rtp-tbf.sh @@ -138,4 +138,4 @@ RC=$? rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE_SRC} ${CONFIG_FILE_DEST} kill $PID -exit $RC +exit ${RC} diff --git a/tests/integration/pipe-loopback-rtp.sh b/tests/integration/pipe-loopback-rtp.sh index 838e25f61..d06997479 100755 --- a/tests/integration/pipe-loopback-rtp.sh +++ b/tests/integration/pipe-loopback-rtp.sh @@ -90,4 +90,4 @@ RC=$? rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/pipe-loopback-shmem.sh b/tests/integration/pipe-loopback-shmem.sh index 1d0a16933..4f5d51951 100755 --- a/tests/integration/pipe-loopback-shmem.sh +++ b/tests/integration/pipe-loopback-shmem.sh @@ -76,4 +76,4 @@ done; done; done rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/pipe-loopback-socket-multicast.sh b/tests/integration/pipe-loopback-socket-multicast.sh index 61988ab81..e271c7915 100755 --- a/tests/integration/pipe-loopback-socket-multicast.sh +++ b/tests/integration/pipe-loopback-socket-multicast.sh @@ -64,4 +64,4 @@ RC=$? rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/pipe-loopback-socket.sh b/tests/integration/pipe-loopback-socket.sh index b660d45b5..ca0244972 100755 --- a/tests/integration/pipe-loopback-socket.sh +++ b/tests/integration/pipe-loopback-socket.sh @@ -127,4 +127,4 @@ done; done; done rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} ${THEORIES} -exit $RC +exit ${RC} diff --git a/tests/integration/pipe-loopback-websocket.sh b/tests/integration/pipe-loopback-websocket.sh index 57858a6db..c975b5832 100755 --- a/tests/integration/pipe-loopback-websocket.sh +++ b/tests/integration/pipe-loopback-websocket.sh @@ -80,4 +80,4 @@ RC=$? rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} ${CONFIG_FILE2} -exit $RC +exit ${RC} diff --git a/tests/integration/pipe-loopback-zeromq.sh b/tests/integration/pipe-loopback-zeromq.sh index 8b2a5b107..c91e494f7 100755 --- a/tests/integration/pipe-loopback-zeromq.sh +++ b/tests/integration/pipe-loopback-zeromq.sh @@ -70,4 +70,4 @@ RC=$? rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/pipe-python-protobuf.sh b/tests/integration/pipe-python-protobuf.sh index 3d00f3f4b..3d65640a5 100755 --- a/tests/integration/pipe-python-protobuf.sh +++ b/tests/integration/pipe-python-protobuf.sh @@ -97,4 +97,4 @@ RC=$? rm ${CONFIG_FILE} ${INPUT_FILE} ${OUTPUT_FILE} -exit $RC +exit ${RC} diff --git a/tests/integration/test-config.sh b/tests/integration/test-config.sh index 96e4d3d89..ff30400cf 100755 --- a/tests/integration/test-config.sh +++ b/tests/integration/test-config.sh @@ -25,13 +25,13 @@ set -e -cd ${SRCDIR}/etc/ - -CONFIGS=$(find . -name '*.conf' -o -name '*.json') +CONFIGS=$(find ${SRCDIR}/etc/ -name '*.conf' -o -name '*.json') for CONFIG in ${CONFIGS}; do if [ "$(basename ${CONFIG})" == "opal.conf" ] || [ "$(basename ${CONFIG})" == "paths.conf" ] || + [ "$(basename ${CONFIG})" == "vc707_ips.conf" ] || + [ "$(basename ${CONFIG})" == "uldaq.conf" ] || [ "$(basename ${CONFIG})" == "global.conf" ]; then echo "=== Skipping config: ${CONFIG}" continue