1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-16 00:00:02 +01:00
VILLASnode/tests/integration/pipe-python-protobuf.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

82 lines
1.5 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
#
# Test protobuf serialization with Python client
#
2022-03-15 09:18:01 -04:00
# Author: Steffen Vogel <post@steffenvogel.de>
2022-03-15 09:28:57 -04:00
# SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
2022-07-04 18:20:03 +02:00
# SPDX-License-Identifier: Apache-2.0
echo "Test is broken"
2021-03-19 06:38:29 -04:00
exit 99
set -e
DIR=$(mktemp -d)
pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
}
trap finish EXIT
LAYER="unix"
FORMAT="protobuf"
NUM_SAMPLES=${NUM_SAMPLES:-20}
NUM_VALUES=${NUM_VALUES:-5}
case ${LAYER} in
unix)
LOCAL="/var/run/villas-node.server.sock"
REMOTE="/var/run/villas-node.client.sock"
;;
udp)
LOCAL="*:12000"
REMOTE="127.0.0.1:12001"
;;
esac
cat > config.json << EOF
{
"nodes": {
"py-client": {
"type": "socket",
"layer": "${LAYER}",
"format": "${FORMAT}",
"in": {
"address": "${LOCAL}"
},
"out": {
"address": "${REMOTE}"
}
}
}
}
EOF
2018-12-04 13:27:42 +01:00
export PYTHONPATH=${BUILDDIR}/python:${SRCDIR}/python
2018-08-20 18:32:01 +02:00
# Start Python client in background
2021-03-19 06:38:29 -04:00
python3 ${SRCDIR}/clients/python/client.py unix &
# Wait for client to be ready
if [ "${LAYER}" = "unix" ]; then
while [ ! -S "${REMOTE}" ]; do
sleep 1
done
fi
2018-12-04 13:27:42 +01:00
2018-08-20 18:32:01 +02:00
sleep 1
villas signal -l ${NUM_SAMPLES} -v ${NUM_VALUES} -n random > input.dat
villas pipe -l ${NUM_SAMPLES} config.json py-client > output.dat < input.dat
kill %%
wait %%
villas compare ${CMPFLAGS} input.dat output.dat