diff --git a/tests/integration/api-config.sh b/tests/integration/api-config.sh
index 4300d5949..dc4778d25 100755
--- a/tests/integration/api-config.sh
+++ b/tests/integration/api-config.sh
@@ -22,9 +22,10 @@
# along with this program. If not, see .
##################################################################################
-set -e
+SCRIPT=$(realpath $0)
+SCRIPTPATH=$(dirname ${SCRIPT})
-LOCAL_CONF=${SRCDIR}/etc/loopback.json
+LOCAL_CONF=${SCRIPTPATH}/../../etc/loopback.json
FETCHED_CONF=$(mktemp)
FETCHED_JSON_CONF=$(mktemp)
diff --git a/tests/integration/node-loopback-socket.sh b/tests/integration/node-loopback-socket.sh
index a2ca9f70c..d8b9315d7 100755
--- a/tests/integration/node-loopback-socket.sh
+++ b/tests/integration/node-loopback-socket.sh
@@ -22,6 +22,10 @@
# along with this program. If not, see .
##################################################################################
+SCRIPT=$(realpath $0)
+SCRIPTPATH=$(dirname ${SCRIPT})
+source ${SCRIPTPATH}/../../tools/integration-tests-helper.sh
+
CONFIG_FILE=$(mktemp)
INPUT_FILE=$(mktemp)
OUTPUT_FILE=$(mktemp)
@@ -29,42 +33,40 @@ OUTPUT_FILE=$(mktemp)
NUM_SAMPLES=${NUM_SAMPLES:-10}
cat > ${CONFIG_FILE} < ${INPUT_FILE}
# Start node
+VILLAS_LOG_PREFIX=$(colorize "[Node] ") \
villas-node ${CONFIG_FILE} &
# Wait for node to complete init
sleep 1
# Send / Receive data to node
+VILLAS_LOG_PREFIX=$(colorize "[Pipe] ") \
villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node2 > ${OUTPUT_FILE} < ${INPUT_FILE}
# Wait for node to handle samples
diff --git a/tests/integration/pipe-file-advio.sh b/tests/integration/pipe-file-advio.sh
index b0f38b7c6..4bd7cdbd1 100755
--- a/tests/integration/pipe-file-advio.sh
+++ b/tests/integration/pipe-file-advio.sh
@@ -22,6 +22,10 @@
# along with this program. If not, see .
##################################################################################
+SCRIPT=$(realpath $0)
+SCRIPTPATH=$(dirname ${SCRIPT})
+source ${SCRIPTPATH}/../../tools/integration-tests-helper.sh
+
CONFIG_FILE=$(mktemp)
INPUT_FILE=$(mktemp)
OUTPUT_FILE=$(mktemp)
@@ -35,36 +39,29 @@ URI=https://1Nrd46fZX8HbggT:badpass@rwth-aachen.sciebo.de/public.php/webdav/node
cat > ${CONFIG_FILE} < /dev/null
+VILLAS_LOG_PREFIX=$(colorize "[Signal] ") \
villas-signal random -n -l ${NUM_SAMPLES} > ${INPUT_FILE}
-villas-pipe -s ${CONFIG_FILE} remote_file_out < ${INPUT_FILE}
+VILLAS_LOG_PREFIX=$(colorize "[Send] ") \
+villas-pipe -s ${CONFIG_FILE} remote_file < ${INPUT_FILE}
-villas-pipe -r ${CONFIG_FILE} remote_file_in > ${OUTPUT_FILE}
+VILLAS_LOG_PREFIX=$(colorize "[Recv] ") \
+villas-pipe -r -l ${NUM_SAMPLES} ${CONFIG_FILE} remote_file > ${OUTPUT_FILE}
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 f80af1eaa..ce961e5b3 100755
--- a/tests/integration/pipe-loopback-file.sh
+++ b/tests/integration/pipe-loopback-file.sh
@@ -35,18 +35,12 @@ cat > ${CONFIG_FILE} << EOF
"node1" : {
"type" : "file",
- "in" : {
- "uri" : "${NODE_FILE}",
- "mode" : "w+",
+ "uri" : "${NODE_FILE}",
+ "mode" : "w+",
- "epoch_mode" : "original",
- "eof" : "wait"
- },
- "out" : {
- "uri" : "${NODE_FILE}",
- "mode" : "w+",
- "flush" : true
- }
+ "epoch_mode" : "original",
+ "eof" : "wait",
+ "flush" : true
}
}
}
@@ -58,10 +52,14 @@ villas-signal random -l ${NUM_SAMPLES} -n > ${INPUT_FILE}
# We delay EOF of the INPUT_FILE by 1 second in order to wait for incoming data to be received
villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < ${INPUT_FILE}
-# Comapre data
+# Compare data
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-nanomsg.sh b/tests/integration/pipe-loopback-nanomsg.sh
index e080ee5ce..34c9fc53d 100755
--- a/tests/integration/pipe-loopback-nanomsg.sh
+++ b/tests/integration/pipe-loopback-nanomsg.sh
@@ -22,17 +22,38 @@
# along with this program. If not, see .
##################################################################################
+SCRIPT=$(realpath $0)
+SCRIPTPATH=$(dirname ${SCRIPT})
+source ${SCRIPTPATH}/../../tools/integration-tests-helper.sh
+
CONFIG_FILE=$(mktemp)
INPUT_FILE=$(mktemp)
OUTPUT_FILE=$(mktemp)
-NUM_SAMPLES=${NUM_SAMPLES:-10}
+NUM_SAMPLES=${NUM_SAMPLES:-100}
+
+# Generate test data
+villas-signal random -l ${NUM_SAMPLES} -n > ${INPUT_FILE}
+
+for FORMAT in csv json villas csv msg gtnet-fake raw-flt32 gtnet-fake; 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
cat > ${CONFIG_FILE} << EOF
{
"nodes" : {
"node1" : {
"type" : "nanomsg",
+
+ "format" : "${FORMAT}",
+ "vectorize" : ${VECTORIZE},
"subscribe" : "tcp://127.0.0.1:12000",
"publish" : "tcp://127.0.0.1:12000"
@@ -41,20 +62,32 @@ cat > ${CONFIG_FILE} << EOF
}
EOF
-# Generate test data
-villas-signal random -l ${NUM_SAMPLES} -n > ${INPUT_FILE}
-
# We delay EOF of the INPUT_FILE by 1 second in order to wait for incoming data to be received
villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < ${INPUT_FILE}
-cat ${INPUT_FILE}
-echo
-cat ${OUTPUT_FILE}
+# Ignore timestamp and seqeunce no if in raw format
+if villas_format_supports_header ${FORMAT}; then
+ CMPFLAGS=-ts
+fi
-# Comapre data
-villas-test-cmp ${INPUT_FILE} ${OUTPUT_FILE}
+# 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-socket.sh b/tests/integration/pipe-loopback-socket.sh
index 5cf4d6ec5..25e1fd9e7 100755
--- a/tests/integration/pipe-loopback-socket.sh
+++ b/tests/integration/pipe-loopback-socket.sh
@@ -22,20 +22,34 @@
# along with this program. If not, see .
##################################################################################
+SCRIPT=$(realpath $0)
+SCRIPTPATH=$(dirname ${SCRIPT})
+source ${SCRIPTPATH}/../../tools/integration-tests-helper.sh
+
CONFIG_FILE=$(mktemp)
INPUT_FILE=$(mktemp)
OUTPUT_FILE=$(mktemp)
THEORIES=$(mktemp)
-NUM_SAMPLES=${NUM_SAMPLES:-10}
+NUM_SAMPLES=${NUM_SAMPLES:-100}
# Generate test data
villas-signal random -l ${NUM_SAMPLES} -n > ${INPUT_FILE}
+for FORMAT in csv json villas csv msg gtnet-fake raw-flt32 gtnet-fake; do
for LAYER in udp ip eth; do
for HEADER in none default; do
for ENDIAN in big little; do
for VERIFY_SOURCE in true false; 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
case ${LAYER} in
udp)
@@ -54,15 +68,16 @@ case ${LAYER} in
LOCAL="00:00:00:00:00:00%lo:34997"
REMOTE="00:00:00:00:00:00%lo:34997"
;;
- esac
-
+esac
cat > ${CONFIG_FILE} << EOF
{
"nodes" : {
"node1" : {
"type" : "socket",
-
+
+ "vectorize" : ${VECTORIZE},
+ "format" : "${FORMAT}",
"layer" : "${LAYER}",
"header" : "${HEADER}",
"endian" : "${ENDIAN}",
@@ -78,12 +93,17 @@ EOF
# We delay EOF of the INPUT_FILE by 1 second in order to wait for incoming data to be received
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 ${INPUT_FILE} ${OUTPUT_FILE}
-RC:$?
+villas-test-cmp ${CMPFLAGS} ${INPUT_FILE} ${OUTPUT_FILE}
+RC=$?
if (( ${RC} != 0 )); then
- echo "=========== Sub-test failed for: layer=${LAYER}, header=${HEADER}, endian=${ENDIAN}, verify_source=${VERIFY_SOURCE}"
+ echo "=========== Sub-test failed for: format=${FORMAT}, layer=${LAYER}, header=${HEADER}, endian=${ENDIAN}, verify_source=${VERIFY_SOURCE}, vectorize=${VECTORIZE}"
cat ${CONFIG_FILE}
echo
cat ${INPUT_FILE}
@@ -91,10 +111,10 @@ if (( ${RC} != 0 )); then
cat ${OUTPUT_FILE}
exit ${RC}
else
- echo "=========== Sub-test succeeded for: layer=${LAYER}, header=${HEADER}, endian=${ENDIAN}, verify_source=${VERIFY_SOURCE}"
+ echo "=========== Sub-test succeeded for: format=${FORMAT}, layer=${LAYER}, header=${HEADER}, endian=${ENDIAN}, verify_source=${VERIFY_SOURCE}, vectorize=${VECTORIZE}"
fi
-done; done; done; done
+done; done; done; done; done; done
rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} ${THEORIES}
diff --git a/tests/integration/pipe-loopback-websocket.sh b/tests/integration/pipe-loopback-websocket.sh
new file mode 100755
index 000000000..a3ed5747e
--- /dev/null
+++ b/tests/integration/pipe-loopback-websocket.sh
@@ -0,0 +1,87 @@
+#!/bin/bash
+#
+# Integration loopback test for villas-pipe.
+#
+# @author Steffen Vogel
+# @copyright 2017, 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/integration-tests-helper.sh
+
+CONFIG_FILE=$(mktemp)
+CONFIG_FILE2=$(mktemp)
+INPUT_FILE=$(mktemp)
+OUTPUT_FILE=$(mktemp)
+
+NUM_SAMPLES=${NUM_SAMPLES:-10}
+
+cat > ${CONFIG_FILE} << EOF
+{
+ "nodes" : {
+ "node1" : {
+ "type" : "websocket",
+
+ "destinations" : [
+ "ws://127.0.0.1:81/node2"
+ ]
+ }
+ }
+}
+EOF
+
+cat > ${CONFIG_FILE2} << EOF
+{
+ "http" : {
+ "port" : 81
+ },
+ "nodes" : {
+ "node2" : {
+ "type" : "websocket"
+ }
+ }
+}
+EOF
+
+# Generate test data
+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} &
+
+PID=$!
+
+VILLAS_LOG_PREFIX=$(colorize "[Send] ") \
+villas-pipe -s -d 15 ${CONFIG_FILE} node1 < ${INPUT_FILE}
+
+wait ${PID}
+
+cat ${OUTPUT_FILE}
+echo
+cat ${INPUT_FILE}
+
+# Compare data
+villas-test-cmp ${INPUT_FILE} ${OUTPUT_FILE}
+RC=$?
+
+rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} ${CONFIG_FILE2}
+
+exit $RC
diff --git a/tests/integration/pipe-loopback-zeromq.sh b/tests/integration/pipe-loopback-zeromq.sh
index b3ff05594..881663ba6 100755
--- a/tests/integration/pipe-loopback-zeromq.sh
+++ b/tests/integration/pipe-loopback-zeromq.sh
@@ -22,18 +22,38 @@
# along with this program. If not, see .
##################################################################################
+SCRIPT=$(realpath $0)
+SCRIPTPATH=$(dirname ${SCRIPT})
+source ${SCRIPTPATH}/../../tools/integration-tests-helper.sh
+
CONFIG_FILE=$(mktemp)
INPUT_FILE=$(mktemp)
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 csv json villas csv msg gtnet-fake raw-flt32 gtnet-fake; 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
+
cat > ${CONFIG_FILE} << EOF
{
"nodes" : {
"node1" : {
"type" : "zeromq",
+ "format" : "${FORMAT}",
+ "vectorize" : ${VECTORIZE},
"pattern" : "pubsub",
"subscribe" : "tcp://127.0.0.1:12000",
"publish" : "tcp://127.0.0.1:12000"
@@ -42,16 +62,32 @@ cat > ${CONFIG_FILE} << EOF
}
EOF
-# Generate test data
-villas-signal random -l ${NUM_SAMPLES} -n > ${INPUT_FILE}
-
# We delay EOF of the INPUT_FILE by 1 second in order to wait for incoming data to be received
villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < ${INPUT_FILE}
-# Comapre data
-villas-test-cmp ${INPUT_FILE} ${OUTPUT_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