From bc24676138ddf993241d9a2f10180dd7e04749aa Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Thu, 29 Feb 2024 21:54:10 +0100 Subject: [PATCH] Use spaces for indention of shell scripts Signed-off-by: Steffen Vogel --- packaging/live-iso/ensure_loop.sh | 24 +- python/.envrc | 38 +-- tests/benchmarks/run-benchmark.sh | 254 +++++++++--------- tests/integration/api-capabilities.sh | 10 +- tests/integration/api-config.sh | 20 +- tests/integration/api-nodes.sh | 62 ++--- tests/integration/api-paths.sh | 62 ++--- tests/integration/api-restart.sh | 58 ++-- tests/integration/api-shutdown.sh | 10 +- tests/integration/api-stress.sh | 44 +-- tests/integration/compare.sh | 4 +- tests/integration/convert.sh | 18 +- tests/integration/hook-average.sh | 4 +- tests/integration/hook-cast.sh | 4 +- tests/integration/hook-decimate.sh | 4 +- tests/integration/hook-digest.sh | 4 +- tests/integration/hook-drop.sh | 4 +- tests/integration/hook-frame.sh | 4 +- tests/integration/hook-gate.sh | 4 +- tests/integration/hook-limit_rate.sh | 4 +- tests/integration/hook-lua.sh | 18 +- tests/integration/hook-lua_script.sh | 50 ++-- tests/integration/hook-print.sh | 4 +- tests/integration/hook-reorder_ts.sh | 4 +- tests/integration/hook-scale.sh | 4 +- tests/integration/hook-shift_seq.sh | 8 +- tests/integration/hook-shift_ts.sh | 4 +- tests/integration/hook-skip_first.sh | 4 +- tests/integration/hook-skip_first2.sh | 4 +- tests/integration/missing-example-configs.sh | 36 +-- tests/integration/node-can.sh | 124 ++++----- tests/integration/node-example.sh | 36 +-- tests/integration/node-hook.sh | 78 +++--- tests/integration/node-infiniband.sh | 172 ++++++------ tests/integration/node-loopback-socket.sh | 74 ++--- tests/integration/node-mapping.sh | 88 +++--- .../integration/node-multiple-destinations.sh | 50 ++-- tests/integration/node-multiple-sources.sh | 72 ++--- tests/integration/node-multiplexing.sh | 90 +++---- tests/integration/node-rate.sh | 58 ++-- tests/integration/node-stats.sh | 80 +++--- tests/integration/node-test_rtt.sh | 70 ++--- tests/integration/pipe-loopback-amqp.sh | 28 +- tests/integration/pipe-loopback-exec.sh | 20 +- tests/integration/pipe-loopback-file.sh | 30 +-- .../integration/pipe-loopback-iec61850-9-2.sh | 50 ++-- tests/integration/pipe-loopback-loopback.sh | 14 +- tests/integration/pipe-loopback-mqtt.sh | 42 +-- tests/integration/pipe-loopback-nanomsg.sh | 38 +-- tests/integration/pipe-loopback-redis.sh | 22 +- tests/integration/pipe-loopback-rtp-dual.sh | 112 ++++---- tests/integration/pipe-loopback-rtp-remote.sh | 124 ++++----- tests/integration/pipe-loopback-rtp-tbf.sh | 120 ++++----- tests/integration/pipe-loopback-rtp.sh | 62 ++--- tests/integration/pipe-loopback-shmem.sh | 32 +-- .../pipe-loopback-socket-multicast.sh | 38 +-- .../integration/pipe-loopback-socket-netem.sh | 48 ++-- tests/integration/pipe-loopback-socket.sh | 78 +++--- tests/integration/pipe-loopback-websocket.sh | 44 +-- tests/integration/pipe-loopback-zeromq.sh | 40 +-- tests/integration/pipe-python-protobuf.sh | 52 ++-- tests/integration/relay.sh | 24 +- tests/integration/signal.sh | 4 +- tests/integration/test-config.sh | 2 +- tools/integration-tests.sh | 146 +++++----- tools/pci-rebind-device.sh | 6 +- tools/tc-dump.sh | 4 +- tools/tc-netem.sh | 48 ++-- tools/tc-netem2.sh | 34 +-- tools/tune-realtime.sh | 14 +- tools/villas-helper.sh | 32 +-- 71 files changed, 1536 insertions(+), 1536 deletions(-) diff --git a/packaging/live-iso/ensure_loop.sh b/packaging/live-iso/ensure_loop.sh index b292d58ba..3510eba6d 100755 --- a/packaging/live-iso/ensure_loop.sh +++ b/packaging/live-iso/ensure_loop.sh @@ -7,20 +7,20 @@ # SPDX-License-Identifier: Apache-2.0 ensure_loop(){ - num="$1" - dev="/dev/loop$num" - if test -b "$dev"; then - echo "$dev is a usable loop device." - return 0 - fi + num="$1" + dev="/dev/loop$num" + if test -b "$dev"; then + echo "$dev is a usable loop device." + return 0 + fi - echo "Attempting to create $dev for docker ..." - if ! mknod -m660 $dev b 7 $num; then - echo "Failed to create $dev!" 1>&2 - return 3 - fi + echo "Attempting to create $dev for docker ..." + if ! mknod -m660 $dev b 7 $num; then + echo "Failed to create $dev!" 1>&2 + return 3 + fi - return 0 + return 0 } LOOP_A=$(losetup -f) diff --git a/python/.envrc b/python/.envrc index 5a55089c7..58aee6e7d 100644 --- a/python/.envrc +++ b/python/.envrc @@ -3,17 +3,17 @@ export_or_unset() { - local var=$1 + local var=$1 - if [ -z "${!var+x}" ]; then - return - fi + if [ -z "${!var+x}" ]; then + return + fi - if [ -n "$2" ]; then - export $var="$2" - else - unset $var - fi + if [ -n "$2" ]; then + export $var="$2" + else + unset $var + fi } @@ -21,16 +21,16 @@ if direnv_version "2.30.0" \ && has nix \ && nix show-config experimental-features 2>/dev/null | grep -wqF flakes then - local oldtmp="$TMP" - local oldtemp="$TEMP" - local oldtmpdir="$TMPDIR" - local oldtempdir="$TEMPDIR" + local oldtmp="$TMP" + local oldtemp="$TEMP" + local oldtmpdir="$TMPDIR" + local oldtempdir="$TEMPDIR" - watch_file ../packaging/nix/*.nix - use flake ../packaging/nix#villas-python + watch_file ../packaging/nix/*.nix + use flake ../packaging/nix#villas-python - export_or_unset TMP "$oldtmp" - export_or_unset TEMP "$oldtemp" - export_or_unset TMPDIR "$oldtmpdir" - export_or_unset TEMPDIR "$oldtempdir" + export_or_unset TMP "$oldtmp" + export_or_unset TEMP "$oldtemp" + export_or_unset TMPDIR "$oldtmpdir" + export_or_unset TEMPDIR "$oldtempdir" fi diff --git a/tests/benchmarks/run-benchmark.sh b/tests/benchmarks/run-benchmark.sh index 84f74ea13..83a54ca53 100755 --- a/tests/benchmarks/run-benchmark.sh +++ b/tests/benchmarks/run-benchmark.sh @@ -21,20 +21,20 @@ IB_MODES=("RC") # Check if user is superuser. SU is used for namespace if [[ "$EUID" -ne 0 ]]; then - echo "Please run as root" - exit 99 + echo "Please run as root" + exit 99 fi # Check whether cpuset cset command is availble if [[ ! $(command -v cset) ]]; then - echo "Cset is not availble for root. Please install it: https://github.com/lpechacek/cpuset" - exit 99 + echo "Cset is not availble for root. Please install it: https://github.com/lpechacek/cpuset" + exit 99 fi # Check if Infiniband card is present if [[ ! $(lspci | grep Infiniband) ]]; then - echo "Did not find any Infiniband cards in system" - exit 99 + echo "Did not find any Infiniband cards in system" + exit 99 fi # Create list of configs and check whether they are valid @@ -43,32 +43,32 @@ OIFS=$IFS; IFS=$'\n'; CONFIG_FILES=($(ls configs | sed -e "s/.conf//")); IFS=$OI NODETYPES=() if [[ ! $1 ]]; then - echo "Please define for which node-type to run the script" - exit 1 + echo "Please define for which node-type to run the script" + exit 1 elif [[ $1 == all ]]; then - echo "Benchmarking the following nodes:" - for NODETYPE in "${CONFIG_FILES[@]}" - do - echo ${NODETYPE} - NODETYPES+=(${NODETYPE}) - done + echo "Benchmarking the following nodes:" + for NODETYPE in "${CONFIG_FILES[@]}" + do + echo ${NODETYPE} + NODETYPES+=(${NODETYPE}) + done else - FOUND=0 + FOUND=0 - for NODETYPE in "${CONFIG_FILES[@]}" - do - if [[ $1 == ${NODETYPE} ]]; then - NODETYPES=$1 - FOUND=1 - break - fi - done + for NODETYPE in "${CONFIG_FILES[@]}" + do + if [[ $1 == ${NODETYPE} ]]; then + NODETYPES=$1 + FOUND=1 + break + fi + done - if [[ ${FOUND} == 0 ]]; then - echo "Please define a valid node-type for which a config file is present in ./configs!" - exit 1 - fi + if [[ ${FOUND} == 0 ]]; then + echo "Please define a valid node-type for which a config file is present in ./configs!" + exit 1 + fi fi # SET PATHS @@ -89,17 +89,17 @@ echo ${CONFIG_FILES[1]} for NODETYPE in "${NODETYPES[@]}" do - # CREATE PATH CONFIG FILES + # CREATE PATH CONFIG FILES - # Set target and source config file, which is the same for both runs + # Set target and source config file, which is the same for both runs cat > ${CONFIG_SOURCE} < ${CONFIG_TARGET} < ${CONFIG_TARGET} < ${CONFIG} <> ${CONFIG} + cat configs/${NODETYPE}.conf | sed -e "s/\${NUM_VALUE}/${NUM_VALUE}/" -e "s/\${IB_MODE}/${IB_MODE}/" >> ${CONFIG} cat >> ${CONFIG} < config.json < config.json < config.json < config.json < base.json < local.json < config.json <${FIFO} JOBS="" for J in $(seq 1 ${RUNS}); do - ( - set -e - trap "echo error-trap >> ${FIFO}" ERR + ( + set -e + trap "echo error-trap >> ${FIFO}" ERR - FETCHED_CONF=$(mktemp -p ${DIR}) + FETCHED_CONF=$(mktemp -p ${DIR}) - curl -s http://localhost:8080/api/v2/config > ${FETCHED_CONF} - diff -u <(jq -S . < ${FETCHED_CONF}) <(jq -S . < ${LOCAL_CONF}) - RC=$? + curl -s http://localhost:8080/api/v2/config > ${FETCHED_CONF} + diff -u <(jq -S . < ${FETCHED_CONF}) <(jq -S . < ${LOCAL_CONF}) + RC=$? - if [ "$RC" -eq "0" ]; then - echo success >&5 - else - echo error >&5 - fi - ) & - JOBS+=" $!" + if [ "$RC" -eq "0" ]; then + echo success >&5 + else + echo error >&5 + fi + ) & + JOBS+=" $!" done echo "Waiting for jobs to complete: ${JOBS}" @@ -68,13 +68,13 @@ wait %1 echo "Check return codes" for J in $(seq 1 ${RUNS}); do - read -t 10 -u 5 STATUS + read -t 10 -u 5 STATUS - if [ "${STATUS}" == "success" ]; then - let ++SUCCESS - else - let ++FAILED - fi + if [ "${STATUS}" == "success" ]; then + let ++SUCCESS + else + let ++FAILED + fi done echo "Success: ${SUCCESS} / ${RUNS}" diff --git a/tests/integration/compare.sh b/tests/integration/compare.sh index c68f27f32..7a31ec9dd 100755 --- a/tests/integration/compare.sh +++ b/tests/integration/compare.sh @@ -10,8 +10,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT diff --git a/tests/integration/convert.sh b/tests/integration/convert.sh index c047c6303..47b24e881 100755 --- a/tests/integration/convert.sh +++ b/tests/integration/convert.sh @@ -12,8 +12,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT @@ -22,13 +22,13 @@ FORMATS="villas.human csv tsv json opal.asyncip" villas signal -v5 -n -l20 mixed > input.dat for FORMAT in ${FORMATS}; do - villas convert -o ${FORMAT} < input.dat | tee ${TEMP} | \ - villas convert -i ${FORMAT} > output.dat + villas convert -o ${FORMAT} < input.dat | tee ${TEMP} | \ + villas convert -i ${FORMAT} > output.dat - CMP_FLAGS="" - if [ ${FORMAT} = "opal.asyncip" ]; then - CMP_FLAGS+=-T - fi + CMP_FLAGS="" + if [ ${FORMAT} = "opal.asyncip" ]; then + CMP_FLAGS+=-T + fi - villas compare ${CMP_FLAGS} input.dat output.dat + villas compare ${CMP_FLAGS} input.dat output.dat done diff --git a/tests/integration/hook-average.sh b/tests/integration/hook-average.sh index e5fe2021d..f2c5aa37f 100755 --- a/tests/integration/hook-average.sh +++ b/tests/integration/hook-average.sh @@ -12,8 +12,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT diff --git a/tests/integration/hook-cast.sh b/tests/integration/hook-cast.sh index 5c22a4697..70e9b1557 100755 --- a/tests/integration/hook-cast.sh +++ b/tests/integration/hook-cast.sh @@ -12,8 +12,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT diff --git a/tests/integration/hook-decimate.sh b/tests/integration/hook-decimate.sh index 2eb995991..e600e61be 100755 --- a/tests/integration/hook-decimate.sh +++ b/tests/integration/hook-decimate.sh @@ -12,8 +12,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT diff --git a/tests/integration/hook-digest.sh b/tests/integration/hook-digest.sh index 13bcbaf9a..bc07f21d2 100755 --- a/tests/integration/hook-digest.sh +++ b/tests/integration/hook-digest.sh @@ -12,8 +12,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT diff --git a/tests/integration/hook-drop.sh b/tests/integration/hook-drop.sh index 7d5a5e7c9..2456a699f 100755 --- a/tests/integration/hook-drop.sh +++ b/tests/integration/hook-drop.sh @@ -12,8 +12,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT diff --git a/tests/integration/hook-frame.sh b/tests/integration/hook-frame.sh index a852c72c2..b2c058d04 100755 --- a/tests/integration/hook-frame.sh +++ b/tests/integration/hook-frame.sh @@ -12,8 +12,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT diff --git a/tests/integration/hook-gate.sh b/tests/integration/hook-gate.sh index c68828d28..8fe5647f5 100755 --- a/tests/integration/hook-gate.sh +++ b/tests/integration/hook-gate.sh @@ -12,8 +12,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT diff --git a/tests/integration/hook-limit_rate.sh b/tests/integration/hook-limit_rate.sh index 471677ca6..8c62911f4 100755 --- a/tests/integration/hook-limit_rate.sh +++ b/tests/integration/hook-limit_rate.sh @@ -12,8 +12,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT diff --git a/tests/integration/hook-lua.sh b/tests/integration/hook-lua.sh index d17907261..0bced8a46 100755 --- a/tests/integration/hook-lua.sh +++ b/tests/integration/hook-lua.sh @@ -12,20 +12,20 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT cat > config.json <= 0", "type": "boolean" }, - { "name": "abs(signal1)", "expression": "math.abs(smp.data.signal1)" }, - { "name": "signal4_scaled", "expression": "smp.data.signal4 * 100 + 55" }, - { "name": "sequence", "expression": "smp.sequence", "type": "integer" }, - { "name": "ts_origin", "expression": "smp.ts_origin[0] + smp.ts_origin[1] * 1e-9" } - ] + "signals": [ + { "name": "signal1_positive", "expression": "smp.data.signal1 >= 0", "type": "boolean" }, + { "name": "abs(signal1)", "expression": "math.abs(smp.data.signal1)" }, + { "name": "signal4_scaled", "expression": "smp.data.signal4 * 100 + 55" }, + { "name": "sequence", "expression": "smp.sequence", "type": "integer" }, + { "name": "ts_origin", "expression": "smp.ts_origin[0] + smp.ts_origin[1] * 1e-9" } + ] } EOF diff --git a/tests/integration/hook-lua_script.sh b/tests/integration/hook-lua_script.sh index 5f7e45d99..ae606860f 100755 --- a/tests/integration/hook-lua_script.sh +++ b/tests/integration/hook-lua_script.sh @@ -12,8 +12,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT @@ -22,43 +22,43 @@ global_var = 555 counter = 111 function prepare(cfg) - assert(true) - assert(cfg.custom.variable - 123.456 < 1e-9) - assert(cfg.custom.list[0] == 1) - assert(cfg.custom.list[1] - 2.0 < 1e-9) - assert(cfg.custom.list[2] == true) + assert(true) + assert(cfg.custom.variable - 123.456 < 1e-9) + assert(cfg.custom.list[0] == 1) + assert(cfg.custom.list[1] - 2.0 < 1e-9) + assert(cfg.custom.list[2] == true) end function start() - counter = 0 + counter = 0 end function process(smp) - assert(counter == smp.sequence) + assert(counter == smp.sequence) - counter = counter + 1 + counter = counter + 1 - smp.data.signal1 = smp.data.signal2 + smp.data.signal3 + smp.data.signal1 = smp.data.signal2 + smp.data.signal3 - return 0 + return 0 end EOF cat > config.json < output.dat < input.dat # Compare shifted sequence no diff -u \ - <(sed -re '/^#/d;s/^[0-9]+\.[0-9]+([\+\-][0-9]+\.[0-9]+(e[\+\-][0-9]+)?)?\(([0-9]+)\).*/\3/g' output.dat) \ - <(seq ${OFFSET} $((${NUM_SAMPLES}+${OFFSET}-1))) + <(sed -re '/^#/d;s/^[0-9]+\.[0-9]+([\+\-][0-9]+\.[0-9]+(e[\+\-][0-9]+)?)?\(([0-9]+)\).*/\3/g' output.dat) \ + <(seq ${OFFSET} $((${NUM_SAMPLES}+${OFFSET}-1))) diff --git a/tests/integration/hook-shift_ts.sh b/tests/integration/hook-shift_ts.sh index f4a9dad99..72422e8ef 100755 --- a/tests/integration/hook-shift_ts.sh +++ b/tests/integration/hook-shift_ts.sh @@ -12,8 +12,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT diff --git a/tests/integration/hook-skip_first.sh b/tests/integration/hook-skip_first.sh index 7665e980b..4f55839f5 100755 --- a/tests/integration/hook-skip_first.sh +++ b/tests/integration/hook-skip_first.sh @@ -12,8 +12,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT diff --git a/tests/integration/hook-skip_first2.sh b/tests/integration/hook-skip_first2.sh index 58a639d07..634114c39 100755 --- a/tests/integration/hook-skip_first2.sh +++ b/tests/integration/hook-skip_first2.sh @@ -12,8 +12,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT diff --git a/tests/integration/missing-example-configs.sh b/tests/integration/missing-example-configs.sh index dc3076e9f..781b6f39b 100755 --- a/tests/integration/missing-example-configs.sh +++ b/tests/integration/missing-example-configs.sh @@ -14,32 +14,32 @@ FORMAT_TYPES=$(villas node -C 2>/dev/null | jq -r '.formats | join(" ")') MISSING=0 for NODE in ${NODE_TYPES}; do - NODE=${NODE/./-} - [ ${NODE} == "loopback_internal" ] && continue + NODE=${NODE/./-} + [ ${NODE} == "loopback_internal" ] && continue - if [ ! -f "${SRCDIR}/etc/examples/nodes/${NODE}.conf" ]; then - echo "Missing example config for node-type: ${NODE}" - ((MISSING++)) - fi + if [ ! -f "${SRCDIR}/etc/examples/nodes/${NODE}.conf" ]; then + echo "Missing example config for node-type: ${NODE}" + ((MISSING++)) + fi done for HOOK in ${HOOK_TYPES}; do - [ ${HOOK} == "restart" ] || \ - [ ${HOOK} == "drop" ] || \ - [ ${HOOK} == "fix" ] && continue + [ ${HOOK} == "restart" ] || \ + [ ${HOOK} == "drop" ] || \ + [ ${HOOK} == "fix" ] && continue - if [ ! -f "${SRCDIR}/etc/examples/hooks/${HOOK}.conf" ]; then - echo "Missing example config for hook-type: ${HOOK}" - ((MISSING++)) - fi + if [ ! -f "${SRCDIR}/etc/examples/hooks/${HOOK}.conf" ]; then + echo "Missing example config for hook-type: ${HOOK}" + ((MISSING++)) + fi done for FORMAT in ${FORMAT_TYPES}; do - FORMAT=${FORMAT/./-} - if [ ! -f "${SRCDIR}/etc/examples/formats/${FORMAT}.conf" ]; then - echo "Missing example config for format-type: ${FORMAT}" - ((MISSING++)) - fi + FORMAT=${FORMAT/./-} + if [ ! -f "${SRCDIR}/etc/examples/formats/${FORMAT}.conf" ]; then + echo "Missing example config for format-type: ${FORMAT}" + ((MISSING++)) + fi done (( ${MISSING} == 0 )) diff --git a/tests/integration/node-can.sh b/tests/integration/node-can.sh index e32cf9ebb..5dd5047c6 100755 --- a/tests/integration/node-can.sh +++ b/tests/integration/node-can.sh @@ -29,8 +29,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT @@ -39,66 +39,66 @@ NUM_VALUES=${NUM_VALUES:-3} cat > config.json << EOF { - "nodes": { - "can_node1": { - "type": "can", - "interface_name": "${CAN_IF}", - "sample_rate": 500000, - "in": { - "signals": [ - { - "name": "sigin1", - "unit": "Volts", - "type": "float", - "enabled": true, - "can_id": 66, - "can_size": 4, - "can_offset": 0 - }, - { - "name": "sigin2", - "unit": "Volts", - "type": "float", - "enabled": true, - "can_id": 66, - "can_size": 4, - "can_offset": 4 - }, - { - "name": "sigin3", - "unit": "Volts", - "type": "float", - "enabled": true, - "can_id": 67, - "can_size": 8, - "can_offset": 0 - } - ] - }, - "out": { - "signals": [ - { - "type": "float", - "can_id": 66, - "can_size": 4, - "can_offset": 0 - }, - { - "type": "float", - "can_id": 66, - "can_size": 4, - "can_offset": 4 - }, - { - "type": "float", - "can_id": 67, - "can_size": 8, - "can_offset": 0 - } - ] - } - } - } + "nodes": { + "can_node1": { + "type": "can", + "interface_name": "${CAN_IF}", + "sample_rate": 500000, + "in": { + "signals": [ + { + "name": "sigin1", + "unit": "Volts", + "type": "float", + "enabled": true, + "can_id": 66, + "can_size": 4, + "can_offset": 0 + }, + { + "name": "sigin2", + "unit": "Volts", + "type": "float", + "enabled": true, + "can_id": 66, + "can_size": 4, + "can_offset": 4 + }, + { + "name": "sigin3", + "unit": "Volts", + "type": "float", + "enabled": true, + "can_id": 67, + "can_size": 8, + "can_offset": 0 + } + ] + }, + "out": { + "signals": [ + { + "type": "float", + "can_id": 66, + "can_size": 4, + "can_offset": 0 + }, + { + "type": "float", + "can_id": 66, + "can_size": 4, + "can_offset": 4 + }, + { + "type": "float", + "can_id": 67, + "can_size": 8, + "can_offset": 0 + } + ] + } + } + } } EOF diff --git a/tests/integration/node-example.sh b/tests/integration/node-example.sh index af263fd4f..cd74bcddb 100755 --- a/tests/integration/node-example.sh +++ b/tests/integration/node-example.sh @@ -15,8 +15,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT @@ -30,23 +30,23 @@ EOF cat > config.json < config.json < /dev/null; then - echo "lspci tool is missing" - exit 99 + 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" - exit 99 + echo "Please run as root" + exit 99 fi # Check if Infiniband card is present if [[ ! $(lspci | grep Infiniband) ]]; then - echo "Did not find any Infiniband cards in system" - exit 99 + echo "Did not find any Infiniband cards in system" + exit 99 fi DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT @@ -40,63 +40,63 @@ NUM_SAMPLES=${NUM_SAMPLES:-10} # Set config file with a MODE flag cat > config.json < target.json <output.dat <${FIFO} & - PID_PIPE=$! + PID_PIPE=$! - # Keep pipe alive - sleep 5 >${FIFO} & + # Keep pipe alive + sleep 5 >${FIFO} & - # Wait for pipe to connect to node - sleep 3 + # Wait for pipe to connect to node + sleep 3 - # Write data to pipe - cat input.dat >${FIFO} & + # Write data to pipe + cat input.dat >${FIFO} & - # Wait for node to handle samples - sleep 2 + # Wait for node to handle samples + sleep 2 - # Stop node - kill ${PID_PIPE} - kill ${PID_PROC} + # Stop node + kill ${PID_PIPE} + kill ${PID_PROC} - villas compare input.dat output.dat + villas compare input.dat output.dat - sed -i -e 's/'${MODE}'/MODE/g' config.json + sed -i -e 's/'${MODE}'/MODE/g' config.json done diff --git a/tests/integration/node-loopback-socket.sh b/tests/integration/node-loopback-socket.sh index b482d1673..e53d81599 100755 --- a/tests/integration/node-loopback-socket.sh +++ b/tests/integration/node-loopback-socket.sh @@ -12,10 +12,10 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} - kill -SIGTERM 0 # kill all decendants + kill -SIGTERM 0 # kill all decendants } trap finish EXIT @@ -23,40 +23,40 @@ NUM_SAMPLES=${NUM_SAMPLES:-10} cat > config.json < config.json < config.json < config.json < config.json < config.json < config.json < config.json < config.json << EOF { - "nodes": { - "node1": { - "type": "amqp", - "format": "${FORMAT}", - "vectorize": ${VECTORIZE}, + "nodes": { + "node1": { + "type": "amqp", + "format": "${FORMAT}", + "vectorize": ${VECTORIZE}, - "uri": "amqp://guest:guest@${HOST}:5672/%2f", + "uri": "amqp://guest:guest@${HOST}:5672/%2f", - "exchange": "mytestexchange", - "routing_key": "abc" - } - } + "exchange": "mytestexchange", + "routing_key": "abc" + } + } } EOF diff --git a/tests/integration/pipe-loopback-exec.sh b/tests/integration/pipe-loopback-exec.sh index 19adc58c0..2e8e7215b 100755 --- a/tests/integration/pipe-loopback-exec.sh +++ b/tests/integration/pipe-loopback-exec.sh @@ -12,8 +12,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT @@ -22,16 +22,16 @@ FORMAT="villas.human" cat > config.json << EOF { - "nodes": { - "node1": { - "type": "exec", - "format": "${FORMAT}", + "nodes": { + "node1": { + "type": "exec", + "format": "${FORMAT}", - "shell": true, + "shell": true, - "exec": "tee /tmp/test" - } - } + "exec": "tee /tmp/test" + } + } } EOF diff --git a/tests/integration/pipe-loopback-file.sh b/tests/integration/pipe-loopback-file.sh index e4c605864..27e1b8d32 100755 --- a/tests/integration/pipe-loopback-file.sh +++ b/tests/integration/pipe-loopback-file.sh @@ -12,8 +12,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT @@ -21,21 +21,21 @@ NUM_SAMPLES=${NUM_SAMPLES:-10} cat > config.json << EOF { - "nodes": { - "node1": { - "type": "file", + "nodes": { + "node1": { + "type": "file", - "uri": "file.dat", + "uri": "file.dat", - "in": { - "epoch_mode": "original", - "eof": "wait" - }, - "out": { - "flush": true - } - } - } + "in": { + "epoch_mode": "original", + "eof": "wait" + }, + "out": { + "flush": true + } + } + } } EOF diff --git a/tests/integration/pipe-loopback-iec61850-9-2.sh b/tests/integration/pipe-loopback-iec61850-9-2.sh index c4f684eef..32efab3dd 100755 --- a/tests/integration/pipe-loopback-iec61850-9-2.sh +++ b/tests/integration/pipe-loopback-iec61850-9-2.sh @@ -15,8 +15,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT @@ -24,31 +24,31 @@ NUM_SAMPLES=${NUM_SAMPLES:-100} cat > config.json << EOF { - "nodes": { - "node1": { - "type": "iec61850-9-2", + "nodes": { + "node1": { + "type": "iec61850-9-2", - "interface": "lo", + "interface": "lo", - "out": { - "svid": "1234", - "signals": [ - { "iec_type": "float32" }, - { "iec_type": "float32" }, - { "iec_type": "float32" }, - { "iec_type": "float32" } - ] - }, - "in": { - "signals": [ - { "iec_type": "float32" }, - { "iec_type": "float32" }, - { "iec_type": "float32" }, - { "iec_type": "float32" } - ] - } - } - } + "out": { + "svid": "1234", + "signals": [ + { "iec_type": "float32" }, + { "iec_type": "float32" }, + { "iec_type": "float32" }, + { "iec_type": "float32" } + ] + }, + "in": { + "signals": [ + { "iec_type": "float32" }, + { "iec_type": "float32" }, + { "iec_type": "float32" }, + { "iec_type": "float32" } + ] + } + } + } } EOF diff --git a/tests/integration/pipe-loopback-loopback.sh b/tests/integration/pipe-loopback-loopback.sh index d69916274..c80d9fce1 100755 --- a/tests/integration/pipe-loopback-loopback.sh +++ b/tests/integration/pipe-loopback-loopback.sh @@ -12,8 +12,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT @@ -21,11 +21,11 @@ NUM_SAMPLES=${NUM_SAMPLES:-10} cat > config.json << EOF { - "nodes": { - "node1": { - "type": "loopback" - } - } + "nodes": { + "node1": { + "type": "loopback" + } + } } EOF diff --git a/tests/integration/pipe-loopback-mqtt.sh b/tests/integration/pipe-loopback-mqtt.sh index ca4f0b47d..0be9923f1 100755 --- a/tests/integration/pipe-loopback-mqtt.sh +++ b/tests/integration/pipe-loopback-mqtt.sh @@ -12,8 +12,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT @@ -23,32 +23,32 @@ VECTORIZE="10" HOST="localhost" if [ -n "${CI}" ]; then - HOST="mosquitto" + HOST="mosquitto" else - HOST="localhost" + HOST="localhost" fi cat > config.json << EOF { - "nodes": { - "node1": { - "type": "mqtt", - "format": "${FORMAT}", - "vectorize": ${VECTORIZE}, + "nodes": { + "node1": { + "type": "mqtt", + "format": "${FORMAT}", + "vectorize": ${VECTORIZE}, - "username": "guest", - "password": "guest", - "host": "${HOST}", - "port": 1883, + "username": "guest", + "password": "guest", + "host": "${HOST}", + "port": 1883, - "out": { - "publish": "test-topic" - }, - "in": { - "subscribe": "test-topic" - } - } - } + "out": { + "publish": "test-topic" + }, + "in": { + "subscribe": "test-topic" + } + } + } } EOF diff --git a/tests/integration/pipe-loopback-nanomsg.sh b/tests/integration/pipe-loopback-nanomsg.sh index b1e4f3d6a..71a9b6584 100755 --- a/tests/integration/pipe-loopback-nanomsg.sh +++ b/tests/integration/pipe-loopback-nanomsg.sh @@ -12,8 +12,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT @@ -24,26 +24,26 @@ VECTORIZE="10" cat > config.json << EOF { - "nodes": { - "node1": { - "type": "nanomsg", + "nodes": { + "node1": { + "type": "nanomsg", - "format": "${FORMAT}", - "vectorize": ${VECTORIZE}, + "format": "${FORMAT}", + "vectorize": ${VECTORIZE}, - "in": { - "endpoints": [ "tcp://127.0.0.1:12000" ], + "in": { + "endpoints": [ "tcp://127.0.0.1:12000" ], - "signals": { - "type": "float", - "count": 5 - } - }, - "out": { - "endpoints": [ "tcp://127.0.0.1:12000" ] - } - } - } + "signals": { + "type": "float", + "count": 5 + } + }, + "out": { + "endpoints": [ "tcp://127.0.0.1:12000" ] + } + } + } } EOF diff --git a/tests/integration/pipe-loopback-redis.sh b/tests/integration/pipe-loopback-redis.sh index c41f733af..cefeea08a 100755 --- a/tests/integration/pipe-loopback-redis.sh +++ b/tests/integration/pipe-loopback-redis.sh @@ -15,8 +15,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT NUM_SAMPLES=${NUM_SAMPLES:-100} @@ -24,20 +24,20 @@ NUM_SAMPLES=${NUM_SAMPLES:-100} HOST="localhost" if [ -n "${CI}" ]; then - HOST="redis" + HOST="redis" fi cat > config.json << EOF { - "nodes": { - "node1": { - "type": "redis", - "format": "protobuf", - "vectorize": 10, + "nodes": { + "node1": { + "type": "redis", + "format": "protobuf", + "vectorize": 10, - "uri": "tcp://${HOST}:6379/0" - } - } + "uri": "tcp://${HOST}:6379/0" + } + } } EOF diff --git a/tests/integration/pipe-loopback-rtp-dual.sh b/tests/integration/pipe-loopback-rtp-dual.sh index a898d2b09..93a990609 100755 --- a/tests/integration/pipe-loopback-rtp-dual.sh +++ b/tests/integration/pipe-loopback-rtp-dual.sh @@ -16,8 +16,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT @@ -29,66 +29,66 @@ NUM_SAMPLES=2000 cat > src.json << EOF { - "logging": { - "level": "info" - }, - "nodes": { - "rtp_node": { - "type": "rtp", - "format": "${FORMAT}", - "vectorize": ${VECTORIZE}, - "rate": ${RATE}, - "rtcp": true, - "aimd": { - "a": 10, - "b": 0.5, - "hook_type": "decimate" - }, - "in": { - "address": "0.0.0.0:12002", - "signals": { - "count": 5, - "type": "float" - } - }, - "out": { - "address": "127.0.0.1:12000" - } - } - } + "logging": { + "level": "info" + }, + "nodes": { + "rtp_node": { + "type": "rtp", + "format": "${FORMAT}", + "vectorize": ${VECTORIZE}, + "rate": ${RATE}, + "rtcp": true, + "aimd": { + "a": 10, + "b": 0.5, + "hook_type": "decimate" + }, + "in": { + "address": "0.0.0.0:12002", + "signals": { + "count": 5, + "type": "float" + } + }, + "out": { + "address": "127.0.0.1:12000" + } + } + } } EOF cat > dest.json << EOF { - "logging": { - "level": "info" - }, - "nodes": { - "rtp_node": { - "type": "rtp", - "format": "${FORMAT}", - "vectorize": ${VECTORIZE}, - "rate": ${RATE}, - "rtcp": true, - "aimd": { - "a": 10, - "b": 0.5, + "logging": { + "level": "info" + }, + "nodes": { + "rtp_node": { + "type": "rtp", + "format": "${FORMAT}", + "vectorize": ${VECTORIZE}, + "rate": ${RATE}, + "rtcp": true, + "aimd": { + "a": 10, + "b": 0.5, - "hook_type": "decimate" - }, - "in": { - "address": "0.0.0.0:12000", - "signals": { - "count": 5, - "type": "float" - } - }, - "out": { - "address": "127.0.0.1:12002" - } - } - } + "hook_type": "decimate" + }, + "in": { + "address": "0.0.0.0:12000", + "signals": { + "count": 5, + "type": "float" + } + }, + "out": { + "address": "127.0.0.1:12002" + } + } + } } EOF diff --git a/tests/integration/pipe-loopback-rtp-remote.sh b/tests/integration/pipe-loopback-rtp-remote.sh index 0d5d928bc..97c8ccc6b 100755 --- a/tests/integration/pipe-loopback-rtp-remote.sh +++ b/tests/integration/pipe-loopback-rtp-remote.sh @@ -24,8 +24,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT @@ -37,36 +37,36 @@ NUM_SAMPLES=100 cat > src.json << EOF { - "logging": { - "level": "debug" - }, - "nodes": { - "rtp_node": { - "type": "rtp", - "format": "${FORMAT}", - "vectorize": ${VECTORIZE}, - "rate": ${RATE}, - "rtcp": { - "enabled": true, - "mode": "aimd", - "throttle_mode": "decimate" - }, - "aimd": { - "a": 10, - "b": 0.5 - }, - "in": { - "address": "0.0.0.0:33466", - "signals": { - "count": 5, - "type": "float" - } - }, - "out": { - "address": "${REMOTE_ADDR}:33464" - } - } - } + "logging": { + "level": "debug" + }, + "nodes": { + "rtp_node": { + "type": "rtp", + "format": "${FORMAT}", + "vectorize": ${VECTORIZE}, + "rate": ${RATE}, + "rtcp": { + "enabled": true, + "mode": "aimd", + "throttle_mode": "decimate" + }, + "aimd": { + "a": 10, + "b": 0.5 + }, + "in": { + "address": "0.0.0.0:33466", + "signals": { + "count": 5, + "type": "float" + } + }, + "out": { + "address": "${REMOTE_ADDR}:33464" + } + } + } } EOF @@ -74,36 +74,36 @@ EOF cat > dest.json << EOF { - "logging": { - "level": "debug" - }, - "nodes": { - "rtp_node": { - "type": "rtp", - "format": "${FORMAT}", - "vectorize": ${VECTORIZE}, - "rate": ${RATE}, - "rtcp": { - "enabled": true, - "mode": "aimd", - "throttle_mode": "decimate" - }, - "aimd": { - "a": 10, - "b": 0.5 - }, - "in": { - "address": "0.0.0.0:33464", - "signals": { - "count": 5, - "type": "float" - } - }, - "out": { - "address": "${LOCAL_ADDR}:33466" - } - } - } + "logging": { + "level": "debug" + }, + "nodes": { + "rtp_node": { + "type": "rtp", + "format": "${FORMAT}", + "vectorize": ${VECTORIZE}, + "rate": ${RATE}, + "rtcp": { + "enabled": true, + "mode": "aimd", + "throttle_mode": "decimate" + }, + "aimd": { + "a": 10, + "b": 0.5 + }, + "in": { + "address": "0.0.0.0:33464", + "signals": { + "count": 5, + "type": "float" + } + }, + "out": { + "address": "${LOCAL_ADDR}:33466" + } + } + } } EOF diff --git a/tests/integration/pipe-loopback-rtp-tbf.sh b/tests/integration/pipe-loopback-rtp-tbf.sh index 2e0bfc7ed..c0187632e 100755 --- a/tests/integration/pipe-loopback-rtp-tbf.sh +++ b/tests/integration/pipe-loopback-rtp-tbf.sh @@ -16,8 +16,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT @@ -30,69 +30,69 @@ NUM_VALUES=5 cat > src.json << EOF { - "logging": { - "level": "info" - }, - "nodes": { - "rtp_node": { - "type": "rtp", - "format": "${FORMAT}", - "vectorize": ${VECTORIZE}, - "rate": ${RATE}, - "rtcp": { - "enabled": true, - "mode": "aimd", - "throttle_mode": "decimate" - }, - "aimd": { - "a": 10, - "b": 0.75, - "start_rate": ${RATE} - }, - "in": { - "address": "0.0.0.0:12002", - "signals": { - "count": ${NUM_VALUES}, - "type": "float" - } - }, - "out": { - "address": "127.0.0.1:12000", - "fwmark": 123 - } - } - } + "logging": { + "level": "info" + }, + "nodes": { + "rtp_node": { + "type": "rtp", + "format": "${FORMAT}", + "vectorize": ${VECTORIZE}, + "rate": ${RATE}, + "rtcp": { + "enabled": true, + "mode": "aimd", + "throttle_mode": "decimate" + }, + "aimd": { + "a": 10, + "b": 0.75, + "start_rate": ${RATE} + }, + "in": { + "address": "0.0.0.0:12002", + "signals": { + "count": ${NUM_VALUES}, + "type": "float" + } + }, + "out": { + "address": "127.0.0.1:12000", + "fwmark": 123 + } + } + } } EOF cat > dest.json << EOF { - "logging": { - "level": "info" - }, - "nodes": { - "rtp_node": { - "type": "rtp", - "format": "${FORMAT}", - "vectorize": ${VECTORIZE}, - "rate": ${RATE}, - "rtcp": { - "enabled": true, - "mode": "aimd", - "throttle_mode": "decimate" - }, - "in": { - "address": "0.0.0.0:12000", - "signals": { - "count": ${NUM_VALUES}, - "type": "float" - } - }, - "out": { - "address": "127.0.0.1:12002" - } - } - } + "logging": { + "level": "info" + }, + "nodes": { + "rtp_node": { + "type": "rtp", + "format": "${FORMAT}", + "vectorize": ${VECTORIZE}, + "rate": ${RATE}, + "rtcp": { + "enabled": true, + "mode": "aimd", + "throttle_mode": "decimate" + }, + "in": { + "address": "0.0.0.0:12000", + "signals": { + "count": ${NUM_VALUES}, + "type": "float" + } + }, + "out": { + "address": "127.0.0.1:12002" + } + } + } } EOF diff --git a/tests/integration/pipe-loopback-rtp.sh b/tests/integration/pipe-loopback-rtp.sh index 4b8733486..b42ef132f 100755 --- a/tests/integration/pipe-loopback-rtp.sh +++ b/tests/integration/pipe-loopback-rtp.sh @@ -15,8 +15,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT @@ -28,40 +28,40 @@ NUM_SAMPLES=$((10*${RATE})) cat > config.json << EOF { - "logging": { - "level": "debug" - }, - "nodes": { - "node1": { - "type": "rtp", + "logging": { + "level": "debug" + }, + "nodes": { + "node1": { + "type": "rtp", - "format": "${FORMAT}", - "vectorize": ${VECTORIZE}, + "format": "${FORMAT}", + "vectorize": ${VECTORIZE}, - "rtcp": { - "enabled": true, - "throttle_mode": "limit_rate" - }, + "rtcp": { + "enabled": true, + "throttle_mode": "limit_rate" + }, - "aimd": { - "start_rate": 1, - "a": 10, - "b": 0.5 - }, + "aimd": { + "start_rate": 1, + "a": 10, + "b": 0.5 + }, - "in": { - "address": "127.0.0.1:12000", + "in": { + "address": "127.0.0.1:12000", - "signals": { - "type": "float", - "count": 5 - } - }, - "out": { - "address": "127.0.0.1:12000" - } - } - } + "signals": { + "type": "float", + "count": 5 + } + }, + "out": { + "address": "127.0.0.1:12000" + } + } + } } EOF diff --git a/tests/integration/pipe-loopback-shmem.sh b/tests/integration/pipe-loopback-shmem.sh index 6f905e952..8539d5d87 100755 --- a/tests/integration/pipe-loopback-shmem.sh +++ b/tests/integration/pipe-loopback-shmem.sh @@ -12,8 +12,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT @@ -25,20 +25,20 @@ for VECTORIZE in 1 5; do cat > config.json << EOF { - "nodes": { - "node1": { - "type": "shmem", - "out": { - "name": "/villas-test" - }, - "in": { - "name": "/villas-test" - }, - "queuelen": 1024, - "mode": "${MODE}", - "vectorize": ${VECTORIZE} - } - } + "nodes": { + "node1": { + "type": "shmem", + "out": { + "name": "/villas-test" + }, + "in": { + "name": "/villas-test" + }, + "queuelen": 1024, + "mode": "${MODE}", + "vectorize": ${VECTORIZE} + } + } } EOF diff --git a/tests/integration/pipe-loopback-socket-multicast.sh b/tests/integration/pipe-loopback-socket-multicast.sh index 47d40583e..ab8858b71 100755 --- a/tests/integration/pipe-loopback-socket-multicast.sh +++ b/tests/integration/pipe-loopback-socket-multicast.sh @@ -12,8 +12,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT @@ -21,26 +21,26 @@ NUM_SAMPLES=${NUM_SAMPLES:-10} cat > config.json << EOF { - "nodes": { - "node1": { - "type" : "socket", - "format": "protobuf", + "nodes": { + "node1": { + "type" : "socket", + "format": "protobuf", - "in": { - "address": "*:12000", + "in": { + "address": "*:12000", - "multicast": { - "enabled": true, + "multicast": { + "enabled": true, - "group" : "224.1.2.3", - "loop" : true - } - }, - "out": { - "address": "224.1.2.3:12000" - } - } - } + "group" : "224.1.2.3", + "loop" : true + } + }, + "out": { + "address": "224.1.2.3:12000" + } + } + } } EOF diff --git a/tests/integration/pipe-loopback-socket-netem.sh b/tests/integration/pipe-loopback-socket-netem.sh index 4b3901754..6c6aae8ef 100755 --- a/tests/integration/pipe-loopback-socket-netem.sh +++ b/tests/integration/pipe-loopback-socket-netem.sh @@ -7,13 +7,13 @@ # SPDX-License-Identifier: Apache-2.0 if ! modprobe -aqn sch_prio sch_netem cls_fw; then - echo "Netem / TC kernel modules are missing" - exit 99 + echo "Netem / TC kernel modules are missing" + exit 99 fi if [[ "${EUID}" -ne 0 ]]; then - echo "Test requires root permissions" - exit 99 + echo "Test requires root permissions" + exit 99 fi set -e @@ -22,8 +22,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT @@ -31,25 +31,25 @@ NUM_SAMPLES=${NUM_SAMPLES:-10} cat > config.json << EOF { - "nodes": { - "node1": { - "type" : "socket", - "format": "protobuf", + "nodes": { + "node1": { + "type" : "socket", + "format": "protobuf", - "in": { - "address": "*:12000" - }, - "out": { - "address": "127.0.0.1:12000", - "netem": { - "enabled": true, - "delay": 100000, - "jitter": 30000, - "loss": 20 - } - } - } - } + "in": { + "address": "*:12000" + }, + "out": { + "address": "127.0.0.1:12000", + "netem": { + "enabled": true, + "delay": 100000, + "jitter": 30000, + "loss": 20 + } + } + } + } } EOF diff --git a/tests/integration/pipe-loopback-socket.sh b/tests/integration/pipe-loopback-socket.sh index a25bd57c3..8808565f4 100755 --- a/tests/integration/pipe-loopback-socket.sh +++ b/tests/integration/pipe-loopback-socket.sh @@ -9,16 +9,16 @@ set -e if [[ "${EUID}" -ne 0 ]]; then - echo "Test requires root permissions" - exit 99 + echo "Test requires root permissions" + exit 99 fi DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT @@ -31,50 +31,50 @@ for LAYER in udp ip eth unix; do for VECTORIZE in ${VECTORIZES}; do case ${LAYER} in - udp) - LOCAL="127.0.0.1:12000" - REMOTE="127.0.0.1:12000" - ;; + udp) + LOCAL="127.0.0.1:12000" + REMOTE="127.0.0.1:12000" + ;; - ip) - # We use IP protocol number 253 which is reserved for experimentation and testing according to RFC 3692 - LOCAL="127.0.0.1:254" - REMOTE="127.0.0.1:254" - ;; + ip) + # We use IP protocol number 253 which is reserved for experimentation and testing according to RFC 3692 + LOCAL="127.0.0.1:254" + REMOTE="127.0.0.1:254" + ;; - eth) - LOCAL="00:00:00:00:00:00%lo:34997" - REMOTE="00:00:00:00:00:00%lo:34997" - ;; + eth) + LOCAL="00:00:00:00:00:00%lo:34997" + REMOTE="00:00:00:00:00:00%lo:34997" + ;; - unix) - LOCAL=$(mktemp) - REMOTE=${LOCAL} - ;; + unix) + LOCAL=$(mktemp) + REMOTE=${LOCAL} + ;; esac cat > config.json << EOF { - "nodes": { - "node1": { - "type": "socket", + "nodes": { + "node1": { + "type": "socket", - "vectorize": ${VECTORIZE}, - "format": "${FORMAT}", - "layer": "${LAYER}", + "vectorize": ${VECTORIZE}, + "format": "${FORMAT}", + "layer": "${LAYER}", - "out": { - "address": "${REMOTE}" - }, - "in": { - "address": "${LOCAL}", - "signals": { - "count": ${NUM_VALUES}, - "type": "float" - } - } - } - } + "out": { + "address": "${REMOTE}" + }, + "in": { + "address": "${LOCAL}", + "signals": { + "count": ${NUM_VALUES}, + "type": "float" + } + } + } + } } EOF diff --git a/tests/integration/pipe-loopback-websocket.sh b/tests/integration/pipe-loopback-websocket.sh index 9e65044c1..4e4d3ad90 100755 --- a/tests/integration/pipe-loopback-websocket.sh +++ b/tests/integration/pipe-loopback-websocket.sh @@ -15,8 +15,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT @@ -24,33 +24,33 @@ NUM_SAMPLES=${NUM_SAMPLES:-10} cat > config1.json << EOF { - "http": { - "port": 8081 - }, - "nodes": { - "node1": { - "type": "websocket", + "http": { + "port": 8081 + }, + "nodes": { + "node1": { + "type": "websocket", - "destinations": [ - "ws://127.0.0.1:8080/node2.protobuf" - ], + "destinations": [ + "ws://127.0.0.1:8080/node2.protobuf" + ], - "wait_connected": true - } - } + "wait_connected": true + } + } } EOF cat > config2.json << EOF { - "http": { - "port": 8080 - }, - "nodes": { - "node2": { - "type": "websocket" - } - } + "http": { + "port": 8080 + }, + "nodes": { + "node2": { + "type": "websocket" + } + } } EOF diff --git a/tests/integration/pipe-loopback-zeromq.sh b/tests/integration/pipe-loopback-zeromq.sh index fdba678ca..3fe9caa94 100755 --- a/tests/integration/pipe-loopback-zeromq.sh +++ b/tests/integration/pipe-loopback-zeromq.sh @@ -12,8 +12,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT @@ -24,25 +24,25 @@ FORMAT="protobuf" cat > config.json << EOF { - "nodes": { - "node1": { - "type": "zeromq", + "nodes": { + "node1": { + "type": "zeromq", - "format": "${FORMAT}", - "vectorize": ${VECTORIZE}, - "pattern": "pubsub", - "out": { - "publish": "tcp://127.0.0.1:12000" - }, - "in": { - "subscribe": "tcp://127.0.0.1:12000", - "signals": { - "type": "float", - "count": 5 - } - } - } - } + "format": "${FORMAT}", + "vectorize": ${VECTORIZE}, + "pattern": "pubsub", + "out": { + "publish": "tcp://127.0.0.1:12000" + }, + "in": { + "subscribe": "tcp://127.0.0.1:12000", + "signals": { + "type": "float", + "count": 5 + } + } + } + } } EOF diff --git a/tests/integration/pipe-python-protobuf.sh b/tests/integration/pipe-python-protobuf.sh index f9bff522d..0d5a32b71 100755 --- a/tests/integration/pipe-python-protobuf.sh +++ b/tests/integration/pipe-python-protobuf.sh @@ -15,8 +15,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT @@ -27,33 +27,33 @@ 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" - ;; + unix) + LOCAL="/var/run/villas-node.server.sock" + REMOTE="/var/run/villas-node.client.sock" + ;; - udp) - LOCAL="*:12000" - REMOTE="127.0.0.1:12001" - ;; + udp) + LOCAL="*:12000" + REMOTE="127.0.0.1:12001" + ;; esac cat > config.json << EOF { - "nodes": { - "py-client": { - "type": "socket", - "layer": "${LAYER}", - "format": "${FORMAT}", + "nodes": { + "py-client": { + "type": "socket", + "layer": "${LAYER}", + "format": "${FORMAT}", - "in": { - "address": "${LOCAL}" - }, - "out": { - "address": "${REMOTE}" - } - } - } + "in": { + "address": "${LOCAL}" + }, + "out": { + "address": "${REMOTE}" + } + } + } } EOF @@ -64,9 +64,9 @@ python3 ${SRCDIR}/clients/python/client.py unix & # Wait for client to be ready if [ "${LAYER}" = "unix" ]; then - while [ ! -S "${REMOTE}" ]; do - sleep 1 - done + while [ ! -S "${REMOTE}" ]; do + sleep 1 + done fi sleep 1 diff --git a/tests/integration/relay.sh b/tests/integration/relay.sh index bff41f2df..99e4a603c 100755 --- a/tests/integration/relay.sh +++ b/tests/integration/relay.sh @@ -15,9 +15,9 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} - kill ${PID_RELAY} + popd + rm -rf ${DIR} + kill ${PID_RELAY} } trap finish EXIT @@ -25,25 +25,25 @@ NUM_SAMPLES=100 cat > config.json << EOF { - "nodes": { - "relay1": { - "type": "websocket", + "nodes": { + "relay1": { + "type": "websocket", - "wait_connected": true, + "wait_connected": true, "destinations": [ "http://localhost:8123/node" ] - }, + }, "relay2": { - "type": "websocket", + "type": "websocket", - "wait_connected": true, + "wait_connected": true, "destinations": [ "http://localhost:8123/node" ] - } - } + } + } } EOF diff --git a/tests/integration/signal.sh b/tests/integration/signal.sh index 7778bed64..5743256ec 100755 --- a/tests/integration/signal.sh +++ b/tests/integration/signal.sh @@ -12,8 +12,8 @@ DIR=$(mktemp -d) pushd ${DIR} function finish { - popd - rm -rf ${DIR} + popd + rm -rf ${DIR} } trap finish EXIT diff --git a/tests/integration/test-config.sh b/tests/integration/test-config.sh index 2041289fb..fb4e0e79c 100755 --- a/tests/integration/test-config.sh +++ b/tests/integration/test-config.sh @@ -17,7 +17,7 @@ for CONFIG in ${CONFIGS}; do [ "$(basename ${CONFIG})" == "paths.conf" ] || [ "$(basename ${CONFIG})" == "tricks.json" ] || [ "$(basename ${CONFIG})" == "tricks.conf" ] || - [ "$(basename ${CONFIG})" == "vc707_ips.conf" ] || + [ "$(basename ${CONFIG})" == "vc707_ips.conf" ] || [ "$(basename ${CONFIG})" == "infiniband.conf" ] || [ "$(basename ${CONFIG})" == "global.conf" ]; then echo "=== Skipping config: ${CONFIG}" diff --git a/tools/integration-tests.sh b/tools/integration-tests.sh index 2f61eda39..d42925ae8 100755 --- a/tools/integration-tests.sh +++ b/tools/integration-tests.sh @@ -26,30 +26,30 @@ TIMEOUT=${TIMEOUT:-1m} # Parse command line arguments while getopts ":f:l:t:vg" OPT; do - case ${OPT} in - f) - FILTER=${OPTARG} - ;; - v) - VERBOSE=1 - ;; - l) - NUM_SAMPLES=${OPTARG} - ;; - t) - TIMEOUT=${OPTARG} - ;; - g) - FAIL_FAST=1 - ;; - \?) - echo "Invalid option: -${OPTARG}" >&2 - ;; - :) - echo "Option -$OPTARG requires an argument." >&2 - exit 1 - ;; - esac + case ${OPT} in + f) + FILTER=${OPTARG} + ;; + v) + VERBOSE=1 + ;; + l) + NUM_SAMPLES=${OPTARG} + ;; + t) + TIMEOUT=${OPTARG} + ;; + g) + FAIL_FAST=1 + ;; + \?) + echo "Invalid option: -${OPTARG}" >&2 + ;; + :) + echo "Option -$OPTARG requires an argument." >&2 + exit 1 + ;; + esac done export VERBOSE @@ -69,64 +69,64 @@ TIMEDOUT=0 echo -e "Starting integration tests for VILLASnode:\n" for TEST in ${TESTS}; do - TESTNAME=$(basename -s .sh ${TEST}) + TESTNAME=$(basename -s .sh ${TEST}) - # Start time measurement - START=$(date +%s.%N) + # Start time measurement + START=$(date +%s.%N) - # Run test - if (( ${VERBOSE} == 0 )); then - timeout ${TIMEOUT} ${TEST} &> ${LOGDIR}/${TESTNAME}.log - RC=$? - else - timeout ${TIMEOUT} ${TEST} | tee ${LOGDIR}/${TESTNAME}.log - RC=${PIPESTATUS[0]} - fi + # Run test + if (( ${VERBOSE} == 0 )); then + timeout ${TIMEOUT} ${TEST} &> ${LOGDIR}/${TESTNAME}.log + RC=$? + else + timeout ${TIMEOUT} ${TEST} | tee ${LOGDIR}/${TESTNAME}.log + RC=${PIPESTATUS[0]} + fi - END=$(date +%s.%N) - DIFF=$(echo "$END - $START" | bc) - - # Show full log in case of an error - if (( ${VERBOSE} == 0 )); then - if (( $RC != 99 )) && (( $RC != 0 )); then - cat ${LOGDIR}/${TESTNAME}.log - fi - fi + END=$(date +%s.%N) + DIFF=$(echo "$END - $START" | bc) - case $RC in - 0) - echo -e "\e[32m[PASS] \e[39m ${TESTNAME} (ran for ${DIFF}s)" - PASSED=$((${PASSED} + 1)) - ;; - 99) - echo -e "\e[93m[SKIP] \e[39m ${TESTNAME}: $(head -n1 ${LOGDIR}/${TESTNAME}.log)" - SKIPPED=$((${SKIPPED} + 1)) - ;; - 124) - echo -e "\e[33m[TIME] \e[39m ${TESTNAME} (ran for more then ${TIMEOUT})" - TIMEDOUT=$((${TIMEDOUT} + 1)) - FAILED=$((${FAILED} + 1)) - ;; - *) - echo -e "\e[31m[FAIL] \e[39m ${TESTNAME} (exited with code $RC, ran for ${DIFF}s)" - FAILED=$((${FAILED} + 1)) - ;; - esac + # Show full log in case of an error + if (( ${VERBOSE} == 0 )); then + if (( $RC != 99 )) && (( $RC != 0 )); then + cat ${LOGDIR}/${TESTNAME}.log + fi + fi - TOTAL=$((${TOTAL} + 1)) + case $RC in + 0) + echo -e "\e[32m[PASS] \e[39m ${TESTNAME} (ran for ${DIFF}s)" + PASSED=$((${PASSED} + 1)) + ;; + 99) + echo -e "\e[93m[SKIP] \e[39m ${TESTNAME}: $(head -n1 ${LOGDIR}/${TESTNAME}.log)" + SKIPPED=$((${SKIPPED} + 1)) + ;; + 124) + echo -e "\e[33m[TIME] \e[39m ${TESTNAME} (ran for more then ${TIMEOUT})" + TIMEDOUT=$((${TIMEDOUT} + 1)) + FAILED=$((${FAILED} + 1)) + ;; + *) + echo -e "\e[31m[FAIL] \e[39m ${TESTNAME} (exited with code $RC, ran for ${DIFF}s)" + FAILED=$((${FAILED} + 1)) + ;; + esac - if (( ${RC} != 0 && ${RC} != 99 && ${FAIL_FAST} > 0 )); then - break - fi + TOTAL=$((${TOTAL} + 1)) + + if (( ${RC} != 0 && ${RC} != 99 && ${FAIL_FAST} > 0 )); then + break + fi done # Show summary if (( ${FAILED} > 0 )); then - echo -e "\nSummary: ${FAILED} of ${TOTAL} tests failed." - echo -e " Timedout: ${TIMEDOUT}" - echo -e " Skipped: ${SKIPPED}" - exit 1 + echo -e "\nSummary: ${FAILED} of ${TOTAL} tests failed." + echo -e " Timedout: ${TIMEDOUT}" + echo -e " Skipped: ${SKIPPED}" + exit 1 else - echo -e "\nSummary: all tests passed!" - exit 0 + echo -e "\nSummary: all tests passed!" + exit 0 fi diff --git a/tools/pci-rebind-device.sh b/tools/pci-rebind-device.sh index be89c5fb7..e10982b4b 100755 --- a/tools/pci-rebind-device.sh +++ b/tools/pci-rebind-device.sh @@ -7,8 +7,8 @@ # SPDX-License-Identifier: Apache-2.0 if [ "$#" -ne 2 ]; then - echo "usage: $0 BUS:DEV:FNC DRIVER" - exit 1 + echo "usage: $0 BUS:DEV:FNC DRIVER" + exit 1 fi BDF=$1 @@ -23,7 +23,7 @@ SYSFS_DRIVER=/sys/bus/pci/drivers/${DRIVER} echo "Device: $VENDOR $DEVICE $BDF" if [ -L "${SYSFS_DEVICE}/driver" ] && [ -d "${SYSFS_DEVICE}/driver" ]; then - echo ${BDF} > ${SYSFS_DEVICE}/driver/unbind + echo ${BDF} > ${SYSFS_DEVICE}/driver/unbind fi echo "${VENDOR} ${DEVICE}" > ${SYSFS_DRIVER}/new_id diff --git a/tools/tc-dump.sh b/tools/tc-dump.sh index 3dd6777b5..9201d0b0b 100755 --- a/tools/tc-dump.sh +++ b/tools/tc-dump.sh @@ -9,6 +9,6 @@ IF=$1 for cmd in qdisc filter class; do - echo "======= $IF: $cmd ========" - tc -s -d -p $cmd show dev $IF + echo "======= $IF: $cmd ========" + tc -s -d -p $cmd show dev $IF done diff --git a/tools/tc-netem.sh b/tools/tc-netem.sh index 36ec7144c..b8241feda 100755 --- a/tools/tc-netem.sh +++ b/tools/tc-netem.sh @@ -35,9 +35,9 @@ NETEM_REV=$NETEM # Tools TC=/sbin/tc if [ "$LAYER" -eq "2" ]; then - NF=/sbin/ebtables + NF=/sbin/ebtables elif [ "$LAYER" -eq "3" ]; then - NF=/sbin/iptables + NF=/sbin/iptables fi # Test permissions @@ -72,40 +72,40 @@ $TC qdisc add dev $DST_IF parent 4000:3 handle 4020 netem $NETEM $TC filter add dev $DST_IF protocol ip handle 123 fw flowid 4000:3 if (( $REVERSE )); then - $NF -t nat -I PREROUTING $FILTER_REV -j mark --mark-set 124 --mark-target CONTINUE - $NF -t nat -I PREROUTING $FILTER_REV -j dnat --to-dst $SRC --dnat-target CONTINUE + $NF -t nat -I PREROUTING $FILTER_REV -j mark --mark-set 124 --mark-target CONTINUE + $NF -t nat -I PREROUTING $FILTER_REV -j dnat --to-dst $SRC --dnat-target CONTINUE - $NF -t nat -I POSTROUTING --mark 123 -j snat --to-src $MY + $NF -t nat -I POSTROUTING --mark 123 -j snat --to-src $MY - # Add classful qdisc to egress (outgoing) network device - $TC qdisc replace dev $SRC_IF root handle 4000 prio bands 4 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1 - $TC qdisc add dev $SRC_IF parent 4000:4 handle 4021 netem $NETEM_REV - $TC filter add dev $SRC_IF protocol ip handle 124 fw flowid 4000:4 + # Add classful qdisc to egress (outgoing) network device + $TC qdisc replace dev $SRC_IF root handle 4000 prio bands 4 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1 + $TC qdisc add dev $SRC_IF parent 4000:4 handle 4021 netem $NETEM_REV + $TC filter add dev $SRC_IF protocol ip handle 124 fw flowid 4000:4 fi echo -e "Successfully configured network emulation:\n" echo -e "Netem Settings for $SRC ($SRC_IF) => $DST ($DST_IF):" echo -e " $NETEM\n" if (( $REVERSE )); then - echo -e "Netem Settings for $DST ($DST_IF) => $SRC ($SRC_IF):" - echo -e " $NETEM_REV" + echo -e "Netem Settings for $DST ($DST_IF) => $SRC ($SRC_IF):" + echo -e " $NETEM_REV" fi # Some debug and status output if [ -n $DEBUG ]; then - if [ "$SRC_IF" == "$DST_IF" ]; then - IFNS="$SRC_IF" - else - IFNS="$SRC_IF $DST_IF" - fi + if [ "$SRC_IF" == "$DST_IF" ]; then + IFNS="$SRC_IF" + else + IFNS="$SRC_IF $DST_IF" + fi - for inf in $IFNS; do - for cmd in qdisc filter class; do - echo -e "\nTC ==> $if: $cmd" - tc -d -p $cmd show dev $inf - done - done + for inf in $IFNS; do + for cmd in qdisc filter class; do + echo -e "\nTC ==> $if: $cmd" + tc -d -p $cmd show dev $inf + done + done - echo -e "\nTABLES ==>" - $NF -t nat -L + echo -e "\nTABLES ==>" + $NF -t nat -L fi diff --git a/tools/tc-netem2.sh b/tools/tc-netem2.sh index 517ebb651..e4f59592c 100755 --- a/tools/tc-netem2.sh +++ b/tools/tc-netem2.sh @@ -37,9 +37,9 @@ MARK=$RANDOM # Tools TC=/sbin/tc if [ "$LAYER" -eq "2" ]; then - NF=/sbin/ebtables + NF=/sbin/ebtables elif [ "$LAYER" -eq "3" ]; then - NF=/sbin/iptables + NF=/sbin/iptables fi # Test permissions @@ -82,24 +82,24 @@ echo -e "Successfully configured network emulation:" echo -e "Netem Settings for $SRC ($SRC_IF) => $DST ($DST_IF):" echo -e " $NETEM" if (( $REVERSE )); then - echo -e "Netem Settings for $DST ($DST_IF) => $SRC ($SRC_IF):" - echo -e " $NETEM_REV" + echo -e "Netem Settings for $DST ($DST_IF) => $SRC ($SRC_IF):" + echo -e " $NETEM_REV" fi if [ -n $DEBUG ]; then - if [ "$SRC_IF" == "$DST_IF" ]; then - IFNS="$SRC_IF" - else - IFNS="$SRC_IF $DST_IF" - fi + if [ "$SRC_IF" == "$DST_IF" ]; then + IFNS="$SRC_IF" + else + IFNS="$SRC_IF $DST_IF" + fi - for inf in $IFNS; do - for cmd in qdisc filter class; do - echo -e "\nTC ==> $if: $cmd" - tc -d -p $cmd show dev $inf - done - done + for inf in $IFNS; do + for cmd in qdisc filter class; do + echo -e "\nTC ==> $if: $cmd" + tc -d -p $cmd show dev $inf + done + done - echo -e "\nTABLES ==>" - $NF -t nat -L + echo -e "\nTABLES ==>" + $NF -t nat -L fi diff --git a/tools/tune-realtime.sh b/tools/tune-realtime.sh index 1eca0ca87..acb172d81 100755 --- a/tools/tune-realtime.sh +++ b/tools/tune-realtime.sh @@ -3,16 +3,16 @@ # SPDX-License-Identifier: Apache-2.0 dnf -y --refresh install \ - tuned-utils \ - tuned-profiles-realtime + tuned-utils \ + tuned-profiles-realtime # Isolate half of the available cores by default if [ -z "${ISOLATED_CORES}" ]; then - PROC=$(nproc) - ISOLATED_CORES= - if ((PROC > 4)); then - ISOLATED_CORES+=$(seq -s, $((PROC/2)) $((PROC-1))) - fi + PROC=$(nproc) + ISOLATED_CORES= + if ((PROC > 4)); then + ISOLATED_CORES+=$(seq -s, $((PROC/2)) $((PROC-1))) + fi fi echo isolated_cores=${ISOLATED_CORES} >> /etc/tuned/realtime-variables.conf diff --git a/tools/villas-helper.sh b/tools/villas-helper.sh index 700e70580..bd1867e5d 100755 --- a/tools/villas-helper.sh +++ b/tools/villas-helper.sh @@ -7,33 +7,33 @@ # SPDX-License-Identifier: Apache-2.0 function villas_format_supports_vectorize() { - local FORMAT=$1 + local FORMAT=$1 - case ${FORMAT} in - raw*) return 1 ;; - gtnet*) return 1 ;; - esac + case ${FORMAT} in + raw*) return 1 ;; + gtnet*) return 1 ;; + esac - return 0 + return 0 } function villas_format_supports_header() { - local FORMAT=$1 + local FORMAT=$1 - case $FORMAT in - raw*) return 1 ;; - gtnet) return 1 ;; - esac + case $FORMAT in + raw*) return 1 ;; + gtnet) return 1 ;; + esac - return 0 + return 0 } function colorize() { - RANDOM=${BASHPID} - echo -e "\x1b[0;$((31 + ${RANDOM} % 7))m$1\x1b[0m" + RANDOM=${BASHPID} + echo -e "\x1b[0;$((31 + ${RANDOM} % 7))m$1\x1b[0m" } function villas() { - VILLAS_LOG_PREFIX=${VILLAS_LOG_PREFIX:-$(colorize "[$1-$((${RANDOM} % 100))} ")} \ - command villas $@ + VILLAS_LOG_PREFIX=${VILLAS_LOG_PREFIX:-$(colorize "[$1-$((${RANDOM} % 100))} ")} \ + command villas $@ }