2024-02-29 20:03:12 +01:00
|
|
|
#!/usr/bin/env bash
|
2021-08-10 10:12:48 -04:00
|
|
|
#
|
|
|
|
# Integration loopback test using villas node.
|
|
|
|
#
|
|
|
|
# This test checks if a single node can be used as an input
|
|
|
|
# in multiple paths.
|
|
|
|
#
|
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
|
2021-08-10 10:12:48 -04:00
|
|
|
|
2022-01-11 10:18:05 -05:00
|
|
|
echo "Test is broken"
|
|
|
|
exit 99
|
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
set -e
|
|
|
|
|
|
|
|
DIR=$(mktemp -d)
|
|
|
|
pushd ${DIR}
|
|
|
|
|
|
|
|
function finish {
|
2024-02-29 21:54:10 +01:00
|
|
|
popd
|
|
|
|
rm -rf ${DIR}
|
2021-08-10 10:12:48 -04:00
|
|
|
}
|
|
|
|
trap finish EXIT
|
|
|
|
|
|
|
|
cat > config.json <<EOF
|
|
|
|
{
|
2024-02-29 21:54:10 +01:00
|
|
|
"nodes": {
|
|
|
|
"sig_1": {
|
|
|
|
"type": "signal",
|
|
|
|
"values": 1,
|
|
|
|
"signal": "counter",
|
|
|
|
"offset": 100,
|
|
|
|
"limit": 10,
|
|
|
|
"realtime": false
|
|
|
|
},
|
|
|
|
"file_1": {
|
|
|
|
"type": "file",
|
|
|
|
"uri": "output1.dat"
|
|
|
|
},
|
|
|
|
"file_2": {
|
|
|
|
"type": "file",
|
|
|
|
"uri": "output2.dat"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"paths": [
|
|
|
|
{
|
|
|
|
"in": "sig_1",
|
|
|
|
"out": "file_1"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"in": "sig_1",
|
|
|
|
"out": "file_2"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"in": "sig_1"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"in": "sig_1"
|
|
|
|
}
|
|
|
|
]
|
2021-08-10 10:12:48 -04:00
|
|
|
}
|
|
|
|
EOF
|
|
|
|
|
|
|
|
villas signal counter -o 100 -v 1 -l 10 -n > expect.dat
|
|
|
|
|
|
|
|
timeout --preserve-status -k 15s 1s \
|
|
|
|
villas node config.json
|
|
|
|
|
|
|
|
villas compare output1.dat expect.dat && \
|
|
|
|
villas compare output2.dat expect.dat
|