From 11ecb81ca86c4eb842a5e135139f00a31a65d43c Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sat, 1 Jul 2017 21:18:50 +0200 Subject: [PATCH] tests: make number of samples configurable with -l switch --- tests/integration-tests.sh | 5 ++++- tests/integration/hook-shift_ts.sh | 4 +++- tests/integration/node-loopback-socket.sh | 3 ++- tests/integration/pipe-file-advio.sh | 4 +++- tests/integration/pipe-loopback-file.sh | 4 +++- tests/integration/pipe-loopback-multicast.sh | 4 +++- tests/integration/pipe-loopback-nanomsg.sh | 4 +++- tests/integration/pipe-loopback-shmem.sh | 4 +++- tests/integration/pipe-loopback-socket.sh | 4 +++- tests/integration/pipe-loopback-zeromq.sh | 4 +++- 10 files changed, 30 insertions(+), 10 deletions(-) diff --git a/tests/integration-tests.sh b/tests/integration-tests.sh index b6f30ecc7..96769f8c6 100755 --- a/tests/integration-tests.sh +++ b/tests/integration-tests.sh @@ -37,7 +37,7 @@ FILTER='*' export NUM_SAMPLES=100 # Parse command line arguments -while getopts ":f:v" OPT; do +while getopts ":f:l:v" OPT; do case ${OPT} in f) FILTER=${OPTARG} @@ -45,6 +45,9 @@ while getopts ":f:v" OPT; do v) VERBOSE=1 ;; + l) + NUM_SAMPLES=${OPTARG} + ;; \?) echo "Invalid option: -${OPTARG}" >&2 ;; diff --git a/tests/integration/hook-shift_ts.sh b/tests/integration/hook-shift_ts.sh index 503d17da0..a5d1e8c97 100755 --- a/tests/integration/hook-shift_ts.sh +++ b/tests/integration/hook-shift_ts.sh @@ -24,10 +24,12 @@ STATS_FILE=$(mktemp) +NUM_SAMPLES=${NUM_SAMPLES:-10} + OFFSET=-10 EPSILON=0.05 -villas-signal sine -l 10 -r 10 | villas-hook shift_ts offset=${OFFSET} | villas-hook stats format=\"json\" output=\"${STATS_FILE}\" > /dev/null +villas-signal sine -l ${NUM_SAMPLES} -r 10 | villas-hook shift_ts offset=${OFFSET} | villas-hook stats format=\"json\" output=\"${STATS_FILE}\" > /dev/null jq .owd ${STATS_FILE} diff --git a/tests/integration/node-loopback-socket.sh b/tests/integration/node-loopback-socket.sh index 01472c547..d9dd8059a 100755 --- a/tests/integration/node-loopback-socket.sh +++ b/tests/integration/node-loopback-socket.sh @@ -35,6 +35,7 @@ function prefix() { sed -e "s/^/$P/" } +NUM_SAMPLES=${NUM_SAMPLES:-10} cat > ${CONFIG_FILE} < ${INPUT_FILE} +villas-signal random -l ${NUM_SAMPLES} -n > ${INPUT_FILE} # Start node villas-node ${CONFIG_FILE} 2>&1 | prefix node & diff --git a/tests/integration/pipe-file-advio.sh b/tests/integration/pipe-file-advio.sh index 75c177aa1..409d28e6f 100755 --- a/tests/integration/pipe-file-advio.sh +++ b/tests/integration/pipe-file-advio.sh @@ -26,6 +26,8 @@ CONFIG_FILE=$(mktemp) INPUT_FILE=$(mktemp) OUTPUT_FILE=$(mktemp) +NUM_SAMPLES=${NUM_SAMPLES:-10} + URI=https://1Nrd46fZX8HbggT:badpass@rwth-aachen.sciebo.de/public.php/webdav/node/tests/pipe cat > ${CONFIG_FILE} < ${INPUT_FILE} +villas-signal sine -n -l ${NUM_SAMPLES} > ${INPUT_FILE} villas-pipe -s ${CONFIG_FILE} remote_file_out < ${INPUT_FILE} diff --git a/tests/integration/pipe-loopback-file.sh b/tests/integration/pipe-loopback-file.sh index f2a1922e9..6cec53f96 100755 --- a/tests/integration/pipe-loopback-file.sh +++ b/tests/integration/pipe-loopback-file.sh @@ -27,6 +27,8 @@ INPUT_FILE=$(mktemp) OUTPUT_FILE=$(mktemp) NODE_FILE=$(mktemp) +NUM_SAMPLES=${NUM_SAMPLES:-10} + cat > ${CONFIG_FILE} << EOF nodes = { node1 = { @@ -48,7 +50,7 @@ nodes = { EOF # Generate test data -villas-signal random -l 10 -n > ${INPUT_FILE} +villas-signal random -l ${NUM_SAMPLES} -n > ${INPUT_FILE} # We delay EOF of the INPUT_FILE by 1 second in order to wait for incoming data to be received villas-pipe ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < <(cat ${INPUT_FILE}; sleep 0.5; echo -n) diff --git a/tests/integration/pipe-loopback-multicast.sh b/tests/integration/pipe-loopback-multicast.sh index 94ad637ee..8bea74593 100755 --- a/tests/integration/pipe-loopback-multicast.sh +++ b/tests/integration/pipe-loopback-multicast.sh @@ -26,6 +26,8 @@ CONFIG_FILE=$(mktemp) INPUT_FILE=$(mktemp) OUTPUT_FILE=$(mktemp) +NUM_SAMPLES=${NUM_SAMPLES:-10} + cat > ${CONFIG_FILE} << EOF nodes = { node1 = { @@ -46,7 +48,7 @@ nodes = { EOF # Generate test data -villas-signal random -l 10 -n > ${INPUT_FILE} +villas-signal random -l ${NUM_SAMPLES} -n > ${INPUT_FILE} # We delay EOF of the INPUT_FILE by 1 second in order to wait for incoming data to be received villas-pipe ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < <(sleep 0.5; cat ${INPUT_FILE}; sleep 0.5; echo -n) diff --git a/tests/integration/pipe-loopback-nanomsg.sh b/tests/integration/pipe-loopback-nanomsg.sh index 555ce2eb8..6a8a17c49 100755 --- a/tests/integration/pipe-loopback-nanomsg.sh +++ b/tests/integration/pipe-loopback-nanomsg.sh @@ -26,6 +26,8 @@ CONFIG_FILE=$(mktemp) INPUT_FILE=$(mktemp) OUTPUT_FILE=$(mktemp) +NUM_SAMPLES=${NUM_SAMPLES:-10} + cat > ${CONFIG_FILE} << EOF nodes = { node1 = { @@ -38,7 +40,7 @@ nodes = { EOF # Generate test data -villas-signal random -l 10 -n > ${INPUT_FILE} +villas-signal random -l ${NUM_SAMPLES} -n > ${INPUT_FILE} # We delay EOF of the INPUT_FILE by 1 second in order to wait for incoming data to be received villas-pipe ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < <(sleep 0.5; cat ${INPUT_FILE}; sleep 0.5; echo -n) diff --git a/tests/integration/pipe-loopback-shmem.sh b/tests/integration/pipe-loopback-shmem.sh index 81db13082..3219af374 100755 --- a/tests/integration/pipe-loopback-shmem.sh +++ b/tests/integration/pipe-loopback-shmem.sh @@ -26,6 +26,8 @@ CONFIG_FILE=$(mktemp) INPUT_FILE=$(mktemp) OUTPUT_FILE=$(mktemp) +NUM_SAMPLES=${NUM_SAMPLES:-10} + for POLLING in true false; do for VECTORIZE in 1 5 20; do @@ -44,7 +46,7 @@ nodes = { EOF # Generate test data -villas-signal random -l 20 -n > ${INPUT_FILE} +villas-signal random -l ${NUM_SAMPLES} -n > ${INPUT_FILE} # We delay EOF of the INPUT_FILE by 1 second in order to wait for incoming data to be received villas-pipe ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < <(cat ${INPUT_FILE}; sleep 1; echo -n) diff --git a/tests/integration/pipe-loopback-socket.sh b/tests/integration/pipe-loopback-socket.sh index c68804314..bdd17a6c1 100755 --- a/tests/integration/pipe-loopback-socket.sh +++ b/tests/integration/pipe-loopback-socket.sh @@ -27,8 +27,10 @@ INPUT_FILE=$(mktemp) OUTPUT_FILE=$(mktemp) THEORIES=$(mktemp) +NUM_SAMPLES=${NUM_SAMPLES:-10} + # Generate test data -villas-signal random -l 10 -n > ${INPUT_FILE} +villas-signal random -l ${NUM_SAMPLES} -n > ${INPUT_FILE} for LAYER in udp ip eth; do for HEADER in none default; do diff --git a/tests/integration/pipe-loopback-zeromq.sh b/tests/integration/pipe-loopback-zeromq.sh index 594b060bf..1d1bf7558 100755 --- a/tests/integration/pipe-loopback-zeromq.sh +++ b/tests/integration/pipe-loopback-zeromq.sh @@ -26,6 +26,8 @@ CONFIG_FILE=$(mktemp) INPUT_FILE=$(mktemp) OUTPUT_FILE=$(mktemp) +NUM_SAMPLES=${NUM_SAMPLES:-10} + cat > ${CONFIG_FILE} << EOF nodes = { node1 = { @@ -39,7 +41,7 @@ nodes = { EOF # Generate test data -villas-signal random -l 10 -n > ${INPUT_FILE} +villas-signal random -l ${NUM_SAMPLES} -n > ${INPUT_FILE} # We delay EOF of the INPUT_FILE by 1 second in order to wait for incoming data to be received villas-pipe ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < <(sleep 0.5; cat ${INPUT_FILE}; sleep 0.5; echo -n)