2017-08-20 09:48:20 +02:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Some helper functions for our integration test suite
|
|
|
|
#
|
2022-12-14 17:41:58 +01:00
|
|
|
# @author Steffen Vogel <post@steffenvogel.de>
|
2022-03-15 09:28:57 -04:00
|
|
|
# @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
|
2022-07-04 18:20:03 +02:00
|
|
|
# @license Apache 2.0
|
2017-08-20 09:48:20 +02:00
|
|
|
##################################################################################
|
|
|
|
|
|
|
|
function villas_format_supports_vectorize() {
|
|
|
|
local FORMAT=$1
|
|
|
|
|
2018-10-22 11:11:08 +01:00
|
|
|
case ${FORMAT} in
|
|
|
|
raw*) return 1 ;;
|
|
|
|
gtnet*) return 1 ;;
|
2017-08-20 09:48:20 +02:00
|
|
|
esac
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
function villas_format_supports_header() {
|
|
|
|
local FORMAT=$1
|
|
|
|
|
|
|
|
case $FORMAT in
|
2018-10-22 11:11:08 +01:00
|
|
|
raw*) return 1 ;;
|
2017-08-20 09:48:20 +02:00
|
|
|
gtnet) return 1 ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
function colorize() {
|
2021-09-22 10:27:01 +02:00
|
|
|
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 $@
|
2017-09-03 10:55:04 +02:00
|
|
|
}
|