From 11ec3148c4722005808b3c7dce108cc07b2ad6c6 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 27 Mar 2019 13:46:33 +0100 Subject: [PATCH] tests: add new test for chained hooks in villas-node --- tests/integration/hook-average.sh | 6 +- tests/integration/node-hook.sh | 98 +++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+), 5 deletions(-) create mode 100755 tests/integration/node-hook.sh diff --git a/tests/integration/hook-average.sh b/tests/integration/hook-average.sh index aca7d593a..50de2cbf2 100755 --- a/tests/integration/hook-average.sh +++ b/tests/integration/hook-average.sh @@ -54,16 +54,12 @@ cat < ${EXPECT_FILE} EOF # Average over first and third signal (mask = 0b101 = 5) -villas-hook -o mask=5 -o offset=0 -o signals=0,1,2,3,4 average < ${INPUT_FILE} > ${OUTPUT_FILE} +villas-hook -o offset=0 -o signals=0,1,2,3,4 average < ${INPUT_FILE} > ${OUTPUT_FILE} # Compare only the data values villas-test-cmp ${OUTPUT_FILE} ${EXPECT_FILE} RC=$? -cat ${INPUT_FILE} -echo -cat ${OUTPUT_FILE} - rm -f ${INPUT_FILE} ${OUTPUT_FILE} ${EXPECT_FILE} exit $RC diff --git a/tests/integration/node-hook.sh b/tests/integration/node-hook.sh new file mode 100755 index 000000000..b8eea6368 --- /dev/null +++ b/tests/integration/node-hook.sh @@ -0,0 +1,98 @@ +#!/bin/bash +# +# Test hooks in villas-node +# +# @author Steffen Vogel +# @copyright 2014-2019, Institute for Automation of Complex Power Systems, EONERC +# @license GNU General Public License (version 3) +# +# VILLASnode +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +################################################################################## + +SCRIPT=$(realpath $0) +SCRIPTPATH=$(dirname ${SCRIPT}) +source ${SCRIPTPATH}/../../tools/villas-helper.sh + +CONFIG_FILE=$(mktemp) +OUTPUT_FILE=$(mktemp) +EXPECT_FILE=$(mktemp) + +cat < ${EXPECT_FILE} +1553690684.041211800-4.313770e-02(5) 6.303265 0.492616 0.309017 -1.000000 0.800000 0.050000 +1553690684.051211800-5.287260e-02(6) 5.673902 0.148827 0.368125 -1.000000 0.760000 0.060000 +1553690684.061211800-6.266780e-02(7) 5.896198 0.232320 0.425779 -1.000000 0.720000 0.070000 +1553690684.071211800-7.256350e-02(8) 5.788125 0.152309 0.481754 -1.000000 0.680000 0.080000 +1553690684.081211800-8.251890e-02(9) 6.748635 0.608491 0.535827 -1.000000 0.640000 0.090000 +EOF + +cat > ${CONFIG_FILE} <