1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

Fix shebangs of bash scripts to work under NixOS

Signed-off-by: Steffen Vogel <post@steffenvogel.de>
This commit is contained in:
Steffen Vogel 2024-02-29 20:03:12 +01:00
parent d2da4e5849
commit 4db21c6ec2
79 changed files with 143 additions and 139 deletions

View file

@ -1,4 +1,7 @@
#!/bin/bash
#!/usr/bin/env bash
#
# A shell script to install various dependencies required by VILLASnode
#
# SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
# SPDX-License-Identifier: Apache-2.0

View file

@ -1,4 +1,5 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Ensure that we have at least two usable loop devices inside our Docker container
#
# Source: https://github.com/jpetazzo/dind/issues/19#issuecomment-48859883

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration Infiniband test using villas-node.
#
@ -90,7 +90,7 @@ for NODETYPE in "${NODETYPES[@]}"
do
# CREATE PATH CONFIG FILES
# Set target and source config file, which is the same for both runs
cat > ${CONFIG_SOURCE} <<EOF
@include "${CONFIG//\/tmp\/}"
@ -116,13 +116,13 @@ paths = (
)
EOF
# SPECIAL TREATMENT FOR SOME NODES
# Some nodes require special treatment:
# * loopback node: target_node is identical to source_node
# * infiniband node: one node must be executed in a namespace
# loopback
if [ "${NODETYPE}" == "loopback" ]; then
if [ "${NODETYPE}" == "loopback" ]; then
cat > ${CONFIG_TARGET} <<EOF
@include "${CONFIG//\/tmp\/}"
@ -140,9 +140,9 @@ paths = (
)
EOF
fi
# infiniband
if [ "${NODETYPE}" == "infiniband" ]; then
if [ "${NODETYPE}" == "infiniband" ]; then
NAMESPACE_CMD='ip netns exec namespace0'
else
NAMESPACE_CMD=''
@ -153,20 +153,20 @@ EOF
for IB_MODE in "${IB_MODES[@]}"
do
LOG_DIR=$(date +%Y%m%d_%H-%M-%S)_benchmark_${NODETYPE}_${IB_MODE}
for NUM_VALUE in "${NUM_VALUES[@]}"
do
for RATE_SAMPLE in "${RATE_SAMPLES[@]}"
do
NUM_SAMPLE=$((${RATE_SAMPLE} * ${TIME_TO_RUN}))
#TIME_TO_RUN=$((${NUM_SAMPLE} / ${RATE_SAMPLE}))
echo "#####"
echo "## START ${IB_MODE}"
echo "## NUM_VALUES: ${NUM_VALUE}"
echo "## RATE_SAMPLES: ${RATE_SAMPLE}"
echo "## NUM_SAMPLES: ${NUM_SAMPLE}"
# Set wrapper of config file
cat > ${CONFIG} <<EOF
logging = {
@ -210,7 +210,7 @@ nodes = {
},
EOF
cat configs/${NODETYPE}.conf | sed -e "s/\${NUM_VALUE}/${NUM_VALUE}/" -e "s/\${IB_MODE}/${IB_MODE}/" >> ${CONFIG}
cat configs/${NODETYPE}.conf | sed -e "s/\${NUM_VALUE}/${NUM_VALUE}/" -e "s/\${IB_MODE}/${IB_MODE}/" >> ${CONFIG}
cat >> ${CONFIG} <<EOF
}
@ -220,39 +220,39 @@ EOF
VILLAS_LOG_PREFIX=$(colorize "[target] ") \
cset proc --set=real-time-0 --exec ../../build/src/villas-node -- ${CONFIG_TARGET} &
target_node_proc=$!
# Wait for node to complete init
sleep 2
if [ ! "${NODETYPE}" == "loopback" ]; then
if [ ! "${NODETYPE}" == "loopback" ]; then
# Start sending pipe
VILLAS_LOG_PREFIX=$(colorize "[source] ") \
${NAMESPACE_CMD} cset proc --set=real-time-1 --exec ../../build/src/villas-node -- ${CONFIG_SOURCE} &
source_node_proc=$!
fi
sleep $((${TIME_TO_RUN} + 5))
# Stop node
kill $target_node_proc
sleep 1
echo "## STOP ${IB_MODE}-${NUM_VALUE}-${RATE_SAMPLE}-${NUM_SAMPLE}"
echo ""
((COUNT++))
sleep 1
done
done
# Since this script will be executed as sudo we should chmod the
# log dir 777. Otherwise too many unnecessary 'sudo rm -rf' will be invoked.
chmod -R 777 ${LOG_DIR}
done
done
rm ${CONFIG} ${CONFIG_TARGET} ${CONFIG_SOURCE}
rm ${CONFIG} ${CONFIG_TARGET} ${CONFIG_SOURCE}
exit 0

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for remote API
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for remote API
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for remote API
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for remote API
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for remote API
#
@ -35,7 +35,7 @@ cat > local.json <<EOF
"node1": {
"type" : "socket",
"format": "csv",
"in": {
"address" : "*:12000"
},

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for remote API
#
@ -28,7 +28,7 @@ EOF
# Start without a configuration
timeout -s SIGKILL 3 \
villas node config.json &
villas node config.json &
# Wait for node to complete init
sleep 1

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Stress test for remote API
#
@ -46,11 +46,11 @@ for J in $(seq 1 ${RUNS}); do
trap "echo error-trap >> ${FIFO}" ERR
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=$?
if [ "$RC" -eq "0" ]; then
echo success >&5
else
@ -69,7 +69,7 @@ wait %1
echo "Check return codes"
for J in $(seq 1 ${RUNS}); do
read -t 10 -u 5 STATUS
if [ "${STATUS}" == "success" ]; then
let ++SUCCESS
else

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for villas compare.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for villas convert tool
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for average hook.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for cast hook.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for decimate hook.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for digest hook.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for drop hook.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for frame hook.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for gate hook.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for limit_rate hook.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for scale hook.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for scale hook.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for print hook.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for reorder_ts hook.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for scale hook.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for shift_seq hook.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for shift_ts hook.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for skip_first hook.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for skip_first hook.
#

View file

@ -1,5 +1,5 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Test example configurations
#

View file

@ -1,11 +1,11 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration can test using villas node.
#
# Author: Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
# SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
# SPDX-License-Identifier: Apache-2.0
# To set up vcan interface use the following commands
# To set up vcan interface use the following commands
# sudo modprobe vcan
# sudo ip link add dev vcan0 type vcan
# sudo ip link set vcan0 up

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Test for the example node-type
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Test hooks in villas node
#
@ -49,13 +49,13 @@ cat > config.json <<EOF
"hooks": [
{
"type": "average",
"signals": [ "random", "sine", "square", "triangle", "ramp" ],
"offset": 0
},
{
"type": "skip_first",
"samples": 5
},
{

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration Infiniband test using villas node.
#
@ -111,43 +111,43 @@ for MODE in "${MODES[@]}"; do
echo "## Start ${MODE}"
sed -i -e 's/MODE/'${MODE}'/g' config.json
sed -i -e 's/MODE/'${MODE}'/g' config.json
# Start receiving node
villas node target.json &
PID_PROC=$!
# Wait for node to complete init
sleep 1
# Preprare fifo
FIFO=$(mktemp -p ${DIR} -t)
if [[ ! -p ${FIFO} ]]; then
mkfifo ${FIFO}
fi
# Start sending pipe
ip netns exec namespace0 \
villas pipe -l ${NUM_SAMPLES} config.json ib_node_source >output.dat <${FIFO} &
villas pipe -l ${NUM_SAMPLES} config.json ib_node_source >output.dat <${FIFO} &
PID_PIPE=$!
# Keep pipe alive
sleep 5 >${FIFO} &
# Wait for pipe to connect to node
sleep 3
# Write data to pipe
cat input.dat >${FIFO} &
# Wait for node to handle samples
sleep 2
# Stop node
kill ${PID_PIPE}
kill ${PID_PIPE}
kill ${PID_PROC}
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

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test using villas node.
#
@ -14,7 +14,7 @@ pushd ${DIR}
function finish {
popd
rm -rf ${DIR}
kill -SIGTERM 0 # kill all decendants
}
trap finish EXIT

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test using villas node.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test using villas node.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test using villas node.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test using villas node.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test using villas node.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test using villas node.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test using villas node.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test for villas pipe.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test for villas pipe.
#
@ -18,7 +18,7 @@ function finish {
trap finish EXIT
NUM_SAMPLES=${NUM_SAMPLES:-100}
FORMAT="villas.human"
FORMAT="villas.human"
cat > config.json << EOF
{

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test for villas pipe.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test for villas pipe.
#
@ -27,9 +27,9 @@ cat > config.json << EOF
"nodes": {
"node1": {
"type": "iec61850-9-2",
"interface": "lo",
"out": {
"svid": "1234",
"signals": [

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test for villas pipe.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test for villas pipe.
#
@ -18,7 +18,7 @@ function finish {
trap finish EXIT
NUM_SAMPLES=${NUM_SAMPLES:-100}
FORMAT="protobuf"
FORMAT="protobuf"
VECTORIZE="10"
HOST="localhost"
@ -40,7 +40,7 @@ cat > config.json << EOF
"password": "guest",
"host": "${HOST}",
"port": 1883,
"out": {
"publish": "test-topic"
},

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test for villas pipe.
#
@ -19,7 +19,7 @@ trap finish EXIT
NUM_SAMPLES=${NUM_SAMPLES:-100}
FORMAT="protobuf"
FORMAT="protobuf"
VECTORIZE="10"
cat > config.json << EOF
@ -27,7 +27,7 @@ cat > config.json << EOF
"nodes": {
"node1": {
"type": "nanomsg",
"format": "${FORMAT}",
"vectorize": ${VECTORIZE},

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test for villas pipe.
#
@ -34,7 +34,7 @@ cat > config.json << EOF
"type": "redis",
"format": "protobuf",
"vectorize": 10,
"uri": "tcp://${HOST}:6379/0"
}
}

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test for villas pipe.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test for villas pipe.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test for villas pipe.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test for villas pipe.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test for villas pipe.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test for villas pipe.
#
@ -28,7 +28,7 @@ cat > config.json << EOF
"in": {
"address": "*:12000",
"multicast": {
"enabled": true,

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test for villas pipe.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test for villas pipe.
#
@ -46,7 +46,7 @@ case ${LAYER} in
LOCAL="00:00:00:00:00:00%lo:34997"
REMOTE="00:00:00:00:00:00%lo:34997"
;;
unix)
LOCAL=$(mktemp)
REMOTE=${LOCAL}
@ -58,7 +58,7 @@ cat > config.json << EOF
"nodes": {
"node1": {
"type": "socket",
"vectorize": ${VECTORIZE},
"format": "${FORMAT}",
"layer": "${LAYER}",

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test for villas pipe.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration loopback test for villas pipe.
#
@ -18,7 +18,7 @@ function finish {
trap finish EXIT
NUM_SAMPLES=${NUM_SAMPLES:-10}
VECTORIZE="10"
FORMAT="protobuf"

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Test protobuf serialization with Python client
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for villas relay
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Integration test for villas signal tool
#

View file

@ -1,5 +1,5 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Test example configurations
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Start a Docker based development environment
#

View file

@ -1,5 +1,5 @@
#!/bin/bash
#
#!/usr/bin/env bash
#
# Author: Niklas Eiling <niklas.eiling@rwth-aachen.de>
# SPDX-FileCopyrightText: 2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
# SPDX-License-Identifier: Apache-2.0

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Setup VFIO for non-root users
#

View file

@ -1,5 +1,5 @@
#!/bin/bash
#
#!/usr/bin/env bash
#
# Author: Niklas Eiling <niklas.eiling@rwth-aachen.de>
# SPDX-FileCopyrightText: 2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
# SPDX-License-Identifier: Apache-2.0

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Run GDB as sudo for VS Code debugger
# See: .vscode directory

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Detach and rebind a PCI device to a PCI kernel driver
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Reset PCI devices like FPGAs after a reflash
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
# SPDX-License-Identifier: Apache-2.0

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Dump Linux traffic control state to screen.
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Transparent Network Emulation Proxy for Layer 2 & 3
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Transparent Network Emulation Proxy for Layer 2 & 3
#

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
# SPDX-License-Identifier: Apache-2.0

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Wrapper to start tool of the VILLASnode suite
#
# This allows you to use VILLASnode tools like this:

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
# SPDX-License-Identifier: Apache-2.0

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
#
# Some helper functions for our integration test suite
#
@ -8,12 +8,12 @@
function villas_format_supports_vectorize() {
local FORMAT=$1
case ${FORMAT} in
raw*) return 1 ;;
gtnet*) return 1 ;;
esac
return 0
}
@ -24,7 +24,7 @@ function villas_format_supports_header() {
raw*) return 1 ;;
gtnet) return 1 ;;
esac
return 0
}