From 57f21cba0fff7f050f0727db263ccd15e4384a6a Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Mon, 20 Aug 2018 18:32:01 +0200 Subject: [PATCH] tests: fix integration tests --- tests/integration/api-nodes.sh | 10 ++-- tests/integration/api-restart.sh | 20 +++++--- tests/integration/api-stress.sh | 13 +++-- tests/integration/hook-print.sh | 9 ++-- tests/integration/hook-scale.sh | 2 +- tests/integration/hook-shift_seq.sh | 8 ++- tests/integration/hook-shift_ts.sh | 3 +- tests/integration/hook-skip_first.sh | 3 +- tests/integration/hook-skip_first2.sh | 3 +- tests/integration/node-infiniband.sh | 6 +++ tests/integration/node-loopback-socket.sh | 27 +++++++--- tests/integration/node-mux_demux.sh | 15 +++--- tests/integration/node-stats.sh | 19 +++---- tests/integration/pipe-file-advio.sh | 17 +++++-- tests/integration/pipe-loopback-file.sh | 15 +++--- .../integration/pipe-loopback-iec61850-9-2.sh | 22 ++++++-- tests/integration/pipe-loopback-loopback.sh | 4 +- tests/integration/pipe-loopback-nanomsg.sh | 49 +++++++----------- tests/integration/pipe-loopback-shmem.sh | 10 ++-- ...t.sh => pipe-loopback-socket-multicast.sh} | 22 ++++---- tests/integration/pipe-loopback-socket.sh | 18 +++++-- tests/integration/pipe-loopback-websocket.sh | 10 ++-- tests/integration/pipe-loopback-zeromq.sh | 50 +++++++------------ tests/integration/pipe-python-protobuf.sh | 16 ++++-- 24 files changed, 207 insertions(+), 164 deletions(-) rename tests/integration/{pipe-loopback-multicast.sh => pipe-loopback-socket-multicast.sh} (85%) diff --git a/tests/integration/api-nodes.sh b/tests/integration/api-nodes.sh index f010b7b2e..ace5b4686 100755 --- a/tests/integration/api-nodes.sh +++ b/tests/integration/api-nodes.sh @@ -38,8 +38,12 @@ cat > ${CONFIG_FILE} < /dev/null +jq -e '.response[0].name == "testnode1" and .response[0].type == "websocket" and (.response | length == 2)' ${FETCHED_NODES} > /dev/null RC=$? rm -f ${CONFIG_FILE} ${FETCHED_NODES} diff --git a/tests/integration/api-restart.sh b/tests/integration/api-restart.sh index 4bac0e386..f9f4855e3 100755 --- a/tests/integration/api-restart.sh +++ b/tests/integration/api-restart.sh @@ -32,14 +32,23 @@ cat < ${LOCAL_CONF} "nodes" : { "node1" : { "type" : "socket", - "local" : "*:12000", - "remote" : "127.0.0.1:12001" + "format" : "csv", + + "in" : { + "address" : "*:12000" + }, + "out" : { + "address" : "127.0.0.1:12001" + } } }, "paths" : [ { - "in" : "node1", "out" : "node1", - "hooks" : [ { "type" : "print" } ] + "in" : "node1", + "out" : "node1", + "hooks" : [ + { "type" : "print" } + ] } ] } @@ -63,11 +72,10 @@ curl -sX POST --data '{ "action" : "config", "id" : "5a786626-fbc6-4c04-98c2-480 # Shutdown VILLASnode kill %% - # Compare local config with the fetched one diff -u <(jq -S .response < ${FETCHED_CONF}) <(jq -S . < ${LOCAL_CONF}) RC=$? rm -f ${LOCAL_CONF} ${FETCHED_CONF} -exit $RC \ No newline at end of file +exit $RC diff --git a/tests/integration/api-stress.sh b/tests/integration/api-stress.sh index 4270868ad..27cacf7cb 100755 --- a/tests/integration/api-stress.sh +++ b/tests/integration/api-stress.sh @@ -27,7 +27,6 @@ SCRIPTPATH=$(dirname ${SCRIPT}) LOCAL_CONF=${SCRIPTPATH}/../../etc/loopback.json - # Start VILLASnode instance with local config (via advio) villas-node file://${LOCAL_CONF} & PID=$! @@ -35,6 +34,7 @@ PID=$! # Wait for node to complete init sleep 1 +RUNS=100 FAILED=0 SUCCESS=0 @@ -44,11 +44,12 @@ mkfifo ${FIFO} # Fifo must be opened in both directions! # https://www.gnu.org/software/libc/manual/html_node/FIFO-Special-Files.html#FIFO-Special-Files -# Quote: "However, it has to be open at both ends simultaneously before you can proceed to do any input or output operations on it" +# Quote: "However, it has to be open at both ends simultaneously before you can proceed to +# do any input or output operations on it" exec 5<>${FIFO} JOBS="" -for J in {1..100}; do +for J in {1..${RUNS}}; do ( set -e trap "echo error-trap >> ${FIFO}" ERR @@ -76,7 +77,7 @@ wait $PID echo "Check return codes" FAILED=0 SUCCESS=0 -for J in {1..100}; do +for J in {1..${RUNS}}; do read status <&5 if [ "$status" == "success" ]; then @@ -86,7 +87,9 @@ for J in {1..100}; do fi done -echo "Success: ${SUCCESS} / 100" +echo "Success: ${SUCCESS} / ${RUNS}" +echo "Failed: ${FAILED} / ${RUNS}" + if [ "$FAILED" -gt "0" ]; then exit 1; fi diff --git a/tests/integration/hook-print.sh b/tests/integration/hook-print.sh index 86a332be2..75ed63e5f 100755 --- a/tests/integration/hook-print.sh +++ b/tests/integration/hook-print.sh @@ -22,22 +22,21 @@ # along with this program. If not, see . ################################################################################## -INPUT_FILE=$(mktemp) OUTPUT_FILE1=$(mktemp) OUTPUT_FILE2=$(mktemp) +INPUT_FILE=$(mktemp) NUM_SAMPLES=${NUM_SAMPLES:-100} # Prepare some test data villas-signal random -v 1 -r 10 -l ${NUM_SAMPLES} -n > ${INPUT_FILE} -villas-hook print -o format=villas.human -o output=${OUTPUT_FILE1} < ${INPUT_FILE} > ${OUTPUT_FILE2} +villas-hook print -o format=villas.human -o output=${OUTPUT_FILE1} > ${OUTPUT_FILE2} < ${INPUT_FILE} # Compare only the data values -villas-test-cmp ${OUTPUT_FILE1} ${INPUT_FILE} && \ -villas-test-cmp ${OUTPUT_FILE2} ${INPUT_FILE} +villas-test-cmp ${OUTPUT_FILE1} ${OUTPUT_FILE2} ${INPUT_FILE} RC=$? -rm -f ${INPUT_FILE} ${OUTPUT_FILE1} ${OUTPUT_FILE2} +rm -f ${OUTPUT_FILE1} ${OUTPUT_FILE2} ${INPUT_FILE} exit $RC diff --git a/tests/integration/hook-scale.sh b/tests/integration/hook-scale.sh index e8a3cbd11..749786f7f 100755 --- a/tests/integration/hook-scale.sh +++ b/tests/integration/hook-scale.sh @@ -52,7 +52,7 @@ cat < ${EXPECT_FILE} 1490500400.676379108-1.490500e+09(9) -15.877850 -15.877850 -15.877850 -15.877850 EOF -villas-hook scale -p -o scale=10 -o offset=-10 < ${INPUT_FILE} > ${OUTPUT_FILE} +villas-hook scale -o scale=10 -o offset=-10 < ${INPUT_FILE} > ${OUTPUT_FILE} # Compare only the data values villas-test-cmp ${OUTPUT_FILE} ${EXPECT_FILE} diff --git a/tests/integration/hook-shift_seq.sh b/tests/integration/hook-shift_seq.sh index 40dc842d9..6a2ad6844 100755 --- a/tests/integration/hook-shift_seq.sh +++ b/tests/integration/hook-shift_seq.sh @@ -23,13 +23,11 @@ ################################################################################## OUTPUT_FILE=$(mktemp) -INPUT_FILE=$(mktemp) OFFSET=100 -villas-signal random -l ${NUM_SAMPLES} -n > ${INPUT_FILE} - -villas-hook shift_seq -o offset=${OFFSET} > ${OUTPUT_FILE} < ${INPUT_FILE} +villas-signal random -l ${NUM_SAMPLES} -n | \ +villas-hook shift_seq -o offset=${OFFSET} > ${OUTPUT_FILE} # Compare shifted sequence no diff -u \ @@ -38,6 +36,6 @@ diff -u \ RC=$? -rm -f ${OUTPUT_FILE} ${INPUT_FILE} +rm -f ${OUTPUT_FILE} exit $RC diff --git a/tests/integration/hook-shift_ts.sh b/tests/integration/hook-shift_ts.sh index 082778013..9b5b5aed6 100755 --- a/tests/integration/hook-shift_ts.sh +++ b/tests/integration/hook-shift_ts.sh @@ -30,11 +30,10 @@ OFFSET=-10.0 EPSILON=0.05 villas-signal random -l ${NUM_SAMPLES} -r 50 | \ -villas-hook shift_ts -o offset=${OFFSET} | \ +villas-hook shift_ts -o offset=${OFFSET} | \ villas-hook stats -o format=json -o output="${STATS_FILE}" > /dev/null jq .owd ${STATS_FILE} - jq -e ".owd.mean + ${OFFSET} | length < ${EPSILON}" ${STATS_FILE} > /dev/null RC=$? diff --git a/tests/integration/hook-skip_first.sh b/tests/integration/hook-skip_first.sh index 734824590..4482b84dc 100755 --- a/tests/integration/hook-skip_first.sh +++ b/tests/integration/hook-skip_first.sh @@ -28,7 +28,8 @@ SKIP=10 echo ${OUTPUT_FILE} -villas-signal random -r 1 -l ${NUM_SAMPLES} -n | villas-hook skip_first -o seconds=${SKIP} > ${OUTPUT_FILE} +villas-signal random -r 1 -l ${NUM_SAMPLES} -n | \ +villas-hook skip_first -o seconds=${SKIP} > ${OUTPUT_FILE} LINES=$(sed -re '/^#/d' ${OUTPUT_FILE} | wc -l) diff --git a/tests/integration/hook-skip_first2.sh b/tests/integration/hook-skip_first2.sh index 5d8e4f637..eb7e1407e 100755 --- a/tests/integration/hook-skip_first2.sh +++ b/tests/integration/hook-skip_first2.sh @@ -26,7 +26,8 @@ OUTPUT_FILE=$(mktemp) SKIP=50 -villas-signal random -r 1 -l ${NUM_SAMPLES} -n | villas-hook skip_first -o samples=${SKIP} > ${OUTPUT_FILE} +villas-signal random -r 1 -l ${NUM_SAMPLES} -n | \ +villas-hook skip_first -o samples=${SKIP} > ${OUTPUT_FILE} LINES=$(sed -re '/^#/d' ${OUTPUT_FILE} | wc -l) diff --git a/tests/integration/node-infiniband.sh b/tests/integration/node-infiniband.sh index c3f74a1ed..5e3d00a65 100755 --- a/tests/integration/node-infiniband.sh +++ b/tests/integration/node-infiniband.sh @@ -22,6 +22,12 @@ # along with this program. If not, see . ################################################################################## +# Check if tools are present +if ! command -v lspci; then + echo "lspci tool is missing" + exit 99 +fi + # Check if user is superuser. SU is used for namespace if [[ "$EUID" -ne 0 ]]; then echo "Please run as root" diff --git a/tests/integration/node-loopback-socket.sh b/tests/integration/node-loopback-socket.sh index 03a9fdcb3..108c62e90 100755 --- a/tests/integration/node-loopback-socket.sh +++ b/tests/integration/node-loopback-socket.sh @@ -37,17 +37,28 @@ cat > ${CONFIG_FILE} < ${CONFIG_FILE} < ${CONFIG_FILE} < ${CONFIG_FILE} < ${CONFIG_FILE} < ${CONFIG_FILE} < /dev/null +# Generate test data VILLAS_LOG_PREFIX=$(colorize "[Signal] ") \ villas-signal random -n -l ${NUM_SAMPLES} > ${INPUT_FILE} +# Upload data to cloud VILLAS_LOG_PREFIX=$(colorize "[Send] ") \ villas-pipe -s ${CONFIG_FILE} remote_file < ${INPUT_FILE} +# Download data from the cloud VILLAS_LOG_PREFIX=$(colorize "[Recv] ") \ villas-pipe -r -l ${NUM_SAMPLES} ${CONFIG_FILE} remote_file > ${OUTPUT_FILE} +# Compare results villas-test-cmp ${INPUT_FILE} ${OUTPUT_FILE} RC=$? diff --git a/tests/integration/pipe-loopback-file.sh b/tests/integration/pipe-loopback-file.sh index 25ad7664d..abf497186 100755 --- a/tests/integration/pipe-loopback-file.sh +++ b/tests/integration/pipe-loopback-file.sh @@ -36,11 +36,14 @@ cat > ${CONFIG_FILE} << EOF "type" : "file", "uri" : "${NODE_FILE}", - "mode" : "w+", - "epoch_mode" : "original", - "eof" : "wait", - "flush" : true + "in" : { + "epoch_mode" : "original", + "eof" : "wait" + }, + "out" : { + "flush" : true + } } } } @@ -55,10 +58,6 @@ villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < ${INPUT_FI villas-test-cmp ${INPUT_FILE} ${OUTPUT_FILE} RC=$? -cat ${OUTPUT_FILE} -echo -cat ${INPUT_FILE} - rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} ${NODE_FILE} exit $RC diff --git a/tests/integration/pipe-loopback-iec61850-9-2.sh b/tests/integration/pipe-loopback-iec61850-9-2.sh index 19422b0ae..ec055ae30 100755 --- a/tests/integration/pipe-loopback-iec61850-9-2.sh +++ b/tests/integration/pipe-loopback-iec61850-9-2.sh @@ -43,19 +43,31 @@ cat > ${CONFIG_FILE} << EOF "interface" : "lo", - "publish" : { + "out" : { "svid" : "1234", - "fields" : [ "float32", "float32", "float32", "float32" ] + "signals" : [ + { "iec_type" : "float32" }, + { "iec_type" : "float32" }, + { "iec_type" : "float32" }, + { "iec_type" : "float32" } + ] }, - "subscribe" : { - "fields" : [ "float32", "float32", "float32", "float32" ] + "in" : { + "signals" : [ + { "iec_type" : "float32" }, + { "iec_type" : "float32" }, + { "iec_type" : "float32" }, + { "iec_type" : "float32" } + ] } } } } EOF -villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < <(sleep 1; cat ${INPUT_FILE}; sleep 1) +cat ${CONFIG_FILE} + +villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < ${INPUT_FILE} # Compare data villas-test-cmp -t ${INPUT_FILE} ${OUTPUT_FILE} diff --git a/tests/integration/pipe-loopback-loopback.sh b/tests/integration/pipe-loopback-loopback.sh index d71a41c50..a3f443c19 100755 --- a/tests/integration/pipe-loopback-loopback.sh +++ b/tests/integration/pipe-loopback-loopback.sh @@ -39,11 +39,11 @@ cat > ${CONFIG_FILE} << EOF EOF # Generate test data -villas-signal random -l ${NUM_SAMPLES} -n > ${INPUT_FILE} +villas-signal mixed -v 5 -l ${NUM_SAMPLES} -n > ${INPUT_FILE} villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < ${INPUT_FILE} -# Comapre data +# Compare data villas-test-cmp ${INPUT_FILE} ${OUTPUT_FILE} RC=$? diff --git a/tests/integration/pipe-loopback-nanomsg.sh b/tests/integration/pipe-loopback-nanomsg.sh index 7a468ac9e..9b9d1f6fa 100755 --- a/tests/integration/pipe-loopback-nanomsg.sh +++ b/tests/integration/pipe-loopback-nanomsg.sh @@ -33,18 +33,10 @@ OUTPUT_FILE=$(mktemp) NUM_SAMPLES=${NUM_SAMPLES:-100} # Generate test data -villas-signal random -l ${NUM_SAMPLES} -n > ${INPUT_FILE} +villas-signal mixed -v 5 -l ${NUM_SAMPLES} -n > ${INPUT_FILE} -for FORMAT in villas.human villas.binary villas.web csv json gtnet.fake raw.flt32; do - -VECTORIZES="1" - -# The raw format does not support vectors -if villas_format_supports_vectorize ${FORMAT}; then - VECTORIZES="${VECTORIZES} 10" -fi - -for VECTORIZE in ${VECTORIZES}; do +FORMAT="protobuf" +VECTORIZE="10" cat > ${CONFIG_FILE} << EOF { @@ -55,8 +47,20 @@ cat > ${CONFIG_FILE} << EOF "format" : "${FORMAT}", "vectorize" : ${VECTORIZE}, - "subscribe" : "tcp://127.0.0.1:12000", - "publish" : "tcp://127.0.0.1:12000" + "in" : { + "endpoints" : [ "tcp://127.0.0.1:12000" ], + + "signals" : [ + { "type" : "float" }, + { "type" : "float" }, + { "type" : "float" }, + { "type" : "float" }, + { "type" : "float" } + ] + }, + "out" : { + "endpoints" : [ "tcp://127.0.0.1:12000" ] + } } } } @@ -64,29 +68,10 @@ EOF villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < ${INPUT_FILE} -# Ignore timestamp and seqeunce no if in raw format -if villas_format_supports_header ${FORMAT}; then - CMPFLAGS=-ts -fi - # Compare data villas-test-cmp ${CMPFLAGS} ${INPUT_FILE} ${OUTPUT_FILE} RC=$? -if (( ${RC} != 0 )); then - echo "=========== Sub-test failed for: format=${FORMAT}, vectorize=${VECTORIZE}" - cat ${CONFIG_FILE} - echo - cat ${INPUT_FILE} - echo - cat ${OUTPUT_FILE} - exit ${RC} -else - echo "=========== Sub-test succeeded for: format=${FORMAT}, vectorize=${VECTORIZE}" -fi - -done; done - rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} exit $RC diff --git a/tests/integration/pipe-loopback-shmem.sh b/tests/integration/pipe-loopback-shmem.sh index 7a0769e3f..67f13dbce 100755 --- a/tests/integration/pipe-loopback-shmem.sh +++ b/tests/integration/pipe-loopback-shmem.sh @@ -40,8 +40,12 @@ cat > ${CONFIG_FILE} << EOF "nodes" : { "node1" : { "type" : "shmem", - "out_name" : "/villas-test", - "in_name" : "/villas-test", + "out" : { + "name" : "/villas-test" + }, + "in" : { + "name" : "/villas-test" + }, "samplelen" : ${SAMPLELEN}, "queuelen" : 1024, "polling" : ${POLLING}, @@ -56,7 +60,7 @@ villas-signal random -l ${NUM_SAMPLES} -v ${SAMPLELEN} -n > ${INPUT_FILE} villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < ${INPUT_FILE} -# Comapre data +# Compare data villas-test-cmp ${INPUT_FILE} ${OUTPUT_FILE} RC=$? diff --git a/tests/integration/pipe-loopback-multicast.sh b/tests/integration/pipe-loopback-socket-multicast.sh similarity index 85% rename from tests/integration/pipe-loopback-multicast.sh rename to tests/integration/pipe-loopback-socket-multicast.sh index b4be09a81..b3b22fa02 100755 --- a/tests/integration/pipe-loopback-multicast.sh +++ b/tests/integration/pipe-loopback-socket-multicast.sh @@ -33,16 +33,20 @@ cat > ${CONFIG_FILE} << EOF "nodes" : { "node1" : { "type" : "socket", - "layer" : "udp", + "format" : "protobuf", - "local" : "*:12000", - "remote" : "224.1.2.3:12000", + "in" : { + "address" : "*:12000", + + "multicast" : { + "enabled" : true, - "multicast" : { - "enabled" : true, - - "group" : "224.1.2.3", - "loop" : true + "group" : "224.1.2.3", + "loop" : true + } + }, + "out" : { + "address" : "224.1.2.3:12000" } } } @@ -54,7 +58,7 @@ villas-signal random -l ${NUM_SAMPLES} -n > ${INPUT_FILE} villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < ${INPUT_FILE} -# Comapre data +# Compare data villas-test-cmp ${INPUT_FILE} ${OUTPUT_FILE} RC=$? diff --git a/tests/integration/pipe-loopback-socket.sh b/tests/integration/pipe-loopback-socket.sh index eb1cedb5c..92b1439c8 100755 --- a/tests/integration/pipe-loopback-socket.sh +++ b/tests/integration/pipe-loopback-socket.sh @@ -37,7 +37,7 @@ NUM_VALUES=${NUM_VALUES:-4} # Generate test data villas-signal random -v ${NUM_VALUES} -l ${NUM_SAMPLES} -n > ${INPUT_FILE} -for FORMAT in villas.human villas.binary villas.web csv json gtnet.fake raw.flt32 protobuf; do +for FORMAT in villas.human villas.binary villas.web csv json gtnet.fake raw.32.le raw.64.be protobuf; do for LAYER in udp ip eth unix; do for VERIFY_SOURCE in true false; do @@ -83,10 +83,20 @@ cat > ${CONFIG_FILE} << EOF "vectorize" : ${VECTORIZE}, "format" : "${FORMAT}", "layer" : "${LAYER}", - "verify_source" : ${VERIFY_SOURCE}, - "local" : "${LOCAL}", - "remote" : "${REMOTE}" + "out" : { + "address" : "${REMOTE}" + }, + "in" : { + "address" : "${LOCAL}", + "verify_source" : ${VERIFY_SOURCE}, + "signals" : [ + { "type" : "float" }, + { "type" : "float" }, + { "type" : "float" }, + { "type" : "float" } + ] + } } } } diff --git a/tests/integration/pipe-loopback-websocket.sh b/tests/integration/pipe-loopback-websocket.sh index f42838c1e..44d8c21fe 100755 --- a/tests/integration/pipe-loopback-websocket.sh +++ b/tests/integration/pipe-loopback-websocket.sh @@ -35,12 +35,13 @@ NUM_SAMPLES=${NUM_SAMPLES:-100} cat > ${CONFIG_FILE} << EOF { + "logging" : { "level" : 15 }, "nodes" : { "node1" : { "type" : "websocket", "destinations" : [ - "ws://127.0.0.1:81/node2" + "ws://127.0.0.1:81/node2.protobuf" ] } } @@ -52,6 +53,7 @@ cat > ${CONFIG_FILE2} << EOF "http" : { "port" : 81 }, + "logging" : { "level" : 15 }, "nodes" : { "node2" : { "type" : "websocket" @@ -65,10 +67,12 @@ VILLAS_LOG_PREFIX=$(colorize "[Signal]") \ villas-signal random -l ${NUM_SAMPLES} -n > ${INPUT_FILE} VILLAS_LOG_PREFIX=$(colorize "[Recv] ") \ -villas-pipe -r -d 15 -l ${NUM_SAMPLES} ${CONFIG_FILE2} node2 > ${OUTPUT_FILE} & +villas-pipe -r -d 15 -l ${NUM_SAMPLES} ${CONFIG_FILE2} node2 | tee ${OUTPUT_FILE} & + +sleep 1 VILLAS_LOG_PREFIX=$(colorize "[Send] ") \ -villas-pipe -s -d 15 ${CONFIG_FILE} node1 < ${INPUT_FILE} +villas-pipe -s -d 15 ${CONFIG_FILE} node1 < <(sleep 1; cat ${INPUT_FILE}) wait $! diff --git a/tests/integration/pipe-loopback-zeromq.sh b/tests/integration/pipe-loopback-zeromq.sh index 294703d60..a49ffdf59 100755 --- a/tests/integration/pipe-loopback-zeromq.sh +++ b/tests/integration/pipe-loopback-zeromq.sh @@ -33,18 +33,10 @@ OUTPUT_FILE=$(mktemp) NUM_SAMPLES=${NUM_SAMPLES:-10} # Generate test data -villas-signal random -l ${NUM_SAMPLES} -n -v 10 > ${INPUT_FILE} - -for FORMAT in villas.human villas.binary villas.web csv json gtnet.fake raw.flt32; do +villas-signal random -l ${NUM_SAMPLES} -n -v 5 > ${INPUT_FILE} -VECTORIZES="1" - -# The raw format does not support vectors -if villas_format_supports_vectorize ${FORMAT}; then - VECTORIZES="${VECTORIZES} 10" -fi - -for VECTORIZE in ${VECTORIZES}; do +VECTORIZE="10" +FORMAT="protobuf" cat > ${CONFIG_FILE} << EOF { @@ -55,8 +47,19 @@ cat > ${CONFIG_FILE} << EOF "format" : "${FORMAT}", "vectorize" : ${VECTORIZE}, "pattern" : "pubsub", - "subscribe" : "tcp://127.0.0.1:12000", - "publish" : "tcp://127.0.0.1:12000" + "out" : { + "publish" : "tcp://127.0.0.1:12000" + }, + "in" : { + "subscribe" : "tcp://127.0.0.1:12000", + "signals" : [ + { "type" : "float" }, + { "type" : "float" }, + { "type" : "float" }, + { "type" : "float" }, + { "type" : "float" } + ] + } } } } @@ -64,29 +67,10 @@ EOF villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < ${INPUT_FILE} -# Ignore timestamp and seqeunce no if in raw format -if villas_format_supports_header ${FORMAT}; then - CMPFLAGS=-ts -fi - # Compare data -villas-test-cmp ${CMPFLAGS} ${INPUT_FILE} ${OUTPUT_FILE} +villas-test-cmp ${INPUT_FILE} ${OUTPUT_FILE} RC=$? -if (( ${RC} != 0 )); then - echo "=========== Sub-test failed for: format=${FORMAT}, vectorize=${VECTORIZE}" - cat ${CONFIG_FILE} - echo - cat ${INPUT_FILE} - echo - cat ${OUTPUT_FILE} - exit ${RC} -else - echo "=========== Sub-test succeeded for: format=${FORMAT}, vectorize=${VECTORIZE}" -fi - -done; done - rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} exit $RC diff --git a/tests/integration/pipe-python-protobuf.sh b/tests/integration/pipe-python-protobuf.sh index b1e671051..ca975386c 100755 --- a/tests/integration/pipe-python-protobuf.sh +++ b/tests/integration/pipe-python-protobuf.sh @@ -60,22 +60,30 @@ cat > ${CONFIG_FILE} << EOF "layer": "${LAYER}", "format" : "${FORMAT}", - "local" : "${LOCAL}", - "remote" : "${REMOTE}" + "in" : { + "address" : "${LOCAL}" + }, + "out" : { + "address" : "${REMOTE}" + } } } } EOF +export PYTHONPATH=${BUILDDIR}/clients/python + # Start Python client in background python ${SRCDIR}/clients/python/villas.py unix & CPID=$! # Wait for client to be ready if [ "${LAYER}" = "unix" ]; then - while [ ! -S "${REMOTE}" ]; do sleep 0.1; done + while [ ! -S "${REMOTE}" ]; do + sleep 1 + done fi -sleep 0.2 +sleep 1 villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} py-client > ${OUTPUT_FILE} < ${INPUT_FILE}