From ce4fabb537e5e6afe9b6eda8bf418f10744307a3 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sat, 1 Jul 2017 20:45:45 +0200 Subject: [PATCH 01/17] pipe: simplify code by eliminating redundant variable --- src/pipe.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/pipe.c b/src/pipe.c index eb93e5428..2931907ab 100644 --- a/src/pipe.c +++ b/src/pipe.c @@ -49,7 +49,6 @@ struct dir { struct pool pool; pthread_t thread; bool enabled; - bool started; } sendd, recvv; bool reverse = false; @@ -60,13 +59,13 @@ pthread_t ptid; /**< Parent thread id */ static void quit(int signal, siginfo_t *sinfo, void *ctx) { - if (recvv.started) { + if (recvv.enabled) { pthread_cancel(recvv.thread); pthread_join(recvv.thread, NULL); pool_destroy(&recvv.pool); } - if (sendd.started) { + if (sendd.enabled) { pthread_cancel(sendd.thread); pthread_join(sendd.thread, NULL); pool_destroy(&sendd.pool); @@ -105,11 +104,6 @@ static void * send_loop(void *ctx) int ret; struct sample *smps[node->vectorize]; - if (!sendd.enabled) - return NULL; - - sendd.started = true; - /* Initialize memory */ ret = pool_init(&sendd.pool, LOG2_CEIL(node->vectorize), SAMPLE_LEN(DEFAULT_SAMPLELEN), &memtype_hugepage); if (ret < 0) @@ -152,11 +146,6 @@ static void * recv_loop(void *ctx) int ret; struct sample *smps[node->vectorize]; - if (!recvv.enabled) - return NULL; - - recvv.started = true; - /* Initialize memory */ ret = pool_init(&recvv.pool, LOG2_CEIL(node->vectorize), SAMPLE_LEN(DEFAULT_SAMPLELEN), &memtype_hugepage); if (ret < 0) @@ -264,8 +253,11 @@ int main(int argc, char *argv[]) error("Failed to start node: %s", node_name(node)); /* Start threads */ - pthread_create(&recvv.thread, NULL, recv_loop, NULL); - pthread_create(&sendd.thread, NULL, send_loop, NULL); + if (recvv.enabled) + pthread_create(&recvv.thread, NULL, recv_loop, NULL); + + if (sendd.enabled) + pthread_create(&sendd.thread, NULL, send_loop, NULL); for (;;) sleep(1); From f7cf76d4d31e5ee6f4392ff4f39d5eb5e539c9dc Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sat, 1 Jul 2017 20:46:47 +0200 Subject: [PATCH 02/17] pipe: check if command line arguments are malformed --- src/pipe.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pipe.c b/src/pipe.c index 2931907ab..a42125c06 100644 --- a/src/pipe.c +++ b/src/pipe.c @@ -200,13 +200,19 @@ int main(int argc, char *argv[]) sendd.enabled = false; // receive only break; case 'd': - level = atoi(optarg); - break; + level = strtoul(optarg, &endptr, 10); + goto check; case 'h': case '?': usage(); exit(c == '?' ? EXIT_FAILURE : EXIT_SUCCESS); } + + continue; + +check: if (optarg == endptr) + error("Failed to parse parse option argument '-%c %s'", c, optarg); + } if (argc != optind + 2) { From 35f6d162a026657fcf4d3dedd3d8be13f8b052b8 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sat, 1 Jul 2017 21:12:44 +0200 Subject: [PATCH 03/17] pipe: add -l and -L switches to limit the number of samples received / sent --- src/pipe.c | 68 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 18 deletions(-) diff --git a/src/pipe.c b/src/pipe.c index a42125c06..714b93824 100644 --- a/src/pipe.c +++ b/src/pipe.c @@ -49,10 +49,9 @@ struct dir { struct pool pool; pthread_t thread; bool enabled; + int limit; } sendd, recvv; -bool reverse = false; - struct node *node; pthread_t ptid; /**< Parent thread id */ @@ -92,16 +91,16 @@ static void usage() printf(" -d LVL set debug log level to LVL\n"); printf(" -x swap read / write endpoints\n"); printf(" -s only read data from stdin and send it to node\n"); - printf(" -r only read data from node and write it to stdout\n\n"); + printf(" -r only read data from node and write it to stdout\n"); + printf(" -L NUM terminate after NUM samples sent\n"); + printf(" -l NUM terminate after NUM samples received\n\n"); print_copyright(); - - exit(EXIT_FAILURE); } static void * send_loop(void *ctx) { - int ret; + int ret, cnt = 0; struct sample *smps[node->vectorize]; /* Initialize memory */ @@ -118,11 +117,14 @@ static void * send_loop(void *ctx) for (len = 0; len < node->vectorize; len++) { struct sample *s = smps[len]; int reason; + + if (sendd.limit > 0 && cnt >= sendd.limit) + break; retry: reason = sample_io_villas_fscan(stdin, s, NULL); if (reason < 0) { if (feof(stdin)) - goto exit; + goto leave; else { warn("Skipped invalid message message: reason=%d", reason); goto retry; @@ -130,20 +132,31 @@ retry: reason = sample_io_villas_fscan(stdin, s, NULL); } } - node_write(node, smps, len); + cnt += node_write(node, smps, len); + + if (sendd.limit > 0 && cnt >= sendd.limit) + goto leave2; + pthread_testcancel(); } - /* We reached EOF on stdin here. Lets kill the process */ -exit: info("Reached end-of-file. Terminating..."); +leave2: info("Reached send limit. Terminating..."); pthread_kill(ptid, SIGINT); return NULL; + + /* We reached EOF on stdin here. Lets kill the process */ +leave: if (recvv.limit < 0) { + info("Reached end-of-file. Terminating..."); + pthread_kill(ptid, SIGINT); + } + + return NULL; } static void * recv_loop(void *ctx) { - int ret; + int ret, cnt = 0; struct sample *smps[node->vectorize]; /* Initialize memory */ @@ -162,6 +175,7 @@ static void * recv_loop(void *ctx) for (;;) { int recv = node_read(node, smps, node->vectorize); struct timespec now = time_now(); + for (int i = 0; i < recv; i++) { struct sample *s = smps[i]; @@ -171,24 +185,36 @@ static void * recv_loop(void *ctx) sample_io_villas_fprint(stdout, s, SAMPLE_IO_ALL); fflush(stdout); } + + cnt += recv; + if (recvv.limit > 0 && cnt >= recvv.limit) + goto leave; + pthread_testcancel(); } +leave: info("Reached receive limit. Terminating..."); + pthread_kill(ptid, SIGINT); + return NULL; + return NULL; } int main(int argc, char *argv[]) { int ret, level = V; - char c; + + bool reverse = false; + + sendd = recvv = (struct dir) { + .enabled = true, + .limit = -1 + }; ptid = pthread_self(); - - /* Default values */ - sendd.enabled = true; - recvv.enabled = true; - - while ((c = getopt(argc, argv, "hxrsd:")) != -1) { + + char c, *endptr; + while ((c = getopt(argc, argv, "hxrsd:l:L:")) != -1) { switch (c) { case 'x': reverse = true; @@ -202,6 +228,12 @@ int main(int argc, char *argv[]) case 'd': level = strtoul(optarg, &endptr, 10); goto check; + case 'l': + recvv.limit = strtoul(optarg, &endptr, 10); + goto check; + case 'L': + sendd.limit = strtoul(optarg, &endptr, 10); + goto check; case 'h': case '?': usage(); From 11ecb81ca86c4eb842a5e135139f00a31a65d43c Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sat, 1 Jul 2017 21:18:50 +0200 Subject: [PATCH 04/17] 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) From 2ec2859b6f5c476e7bb621afb1d5d91eeac69d76 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sat, 1 Jul 2017 21:21:19 +0200 Subject: [PATCH 05/17] tests: use new -l switch of villas-pipe --- tests/integration/pipe-loopback-file.sh | 2 +- tests/integration/pipe-loopback-multicast.sh | 2 +- tests/integration/pipe-loopback-nanomsg.sh | 2 +- tests/integration/pipe-loopback-shmem.sh | 2 +- tests/integration/pipe-loopback-socket.sh | 2 +- tests/integration/pipe-loopback-zeromq.sh | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/integration/pipe-loopback-file.sh b/tests/integration/pipe-loopback-file.sh index 6cec53f96..3361980bb 100755 --- a/tests/integration/pipe-loopback-file.sh +++ b/tests/integration/pipe-loopback-file.sh @@ -53,7 +53,7 @@ EOF 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) +villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < ${INPUT_FILE} # Comapre data villas-test-cmp ${INPUT_FILE} ${OUTPUT_FILE} diff --git a/tests/integration/pipe-loopback-multicast.sh b/tests/integration/pipe-loopback-multicast.sh index 8bea74593..91339e168 100755 --- a/tests/integration/pipe-loopback-multicast.sh +++ b/tests/integration/pipe-loopback-multicast.sh @@ -51,7 +51,7 @@ EOF 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) +villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < ${INPUT_FILE} # Comapre data villas-test-cmp ${INPUT_FILE} ${OUTPUT_FILE} diff --git a/tests/integration/pipe-loopback-nanomsg.sh b/tests/integration/pipe-loopback-nanomsg.sh index 6a8a17c49..c63be12d1 100755 --- a/tests/integration/pipe-loopback-nanomsg.sh +++ b/tests/integration/pipe-loopback-nanomsg.sh @@ -43,7 +43,7 @@ EOF 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) +villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < ${INPUT_FILE} cat ${INPUT_FILE} echo diff --git a/tests/integration/pipe-loopback-shmem.sh b/tests/integration/pipe-loopback-shmem.sh index 3219af374..c0a72d3c5 100755 --- a/tests/integration/pipe-loopback-shmem.sh +++ b/tests/integration/pipe-loopback-shmem.sh @@ -49,7 +49,7 @@ EOF 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) +villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < ${INPUT_FILE} # Comapre data villas-test-cmp ${INPUT_FILE} ${OUTPUT_FILE} diff --git a/tests/integration/pipe-loopback-socket.sh b/tests/integration/pipe-loopback-socket.sh index bdd17a6c1..2df6c163f 100755 --- a/tests/integration/pipe-loopback-socket.sh +++ b/tests/integration/pipe-loopback-socket.sh @@ -74,7 +74,7 @@ nodes = { EOF # 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) +villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < ${INPUT_FILE} # Compare data villas-test-cmp ${INPUT_FILE} ${OUTPUT_FILE} diff --git a/tests/integration/pipe-loopback-zeromq.sh b/tests/integration/pipe-loopback-zeromq.sh index 1d1bf7558..448077ae7 100755 --- a/tests/integration/pipe-loopback-zeromq.sh +++ b/tests/integration/pipe-loopback-zeromq.sh @@ -44,7 +44,7 @@ EOF 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) +villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < ${INPUT_FILE} # Comapre data villas-test-cmp ${INPUT_FILE} ${OUTPUT_FILE} From 9b5e69bb1b81455801900bd74bb9984579a3f5a4 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sat, 1 Jul 2017 21:25:43 +0200 Subject: [PATCH 06/17] tests: add configurable timeout for tests --- tests/integration-tests.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tests/integration-tests.sh b/tests/integration-tests.sh index 96769f8c6..f6582874d 100755 --- a/tests/integration-tests.sh +++ b/tests/integration-tests.sh @@ -34,10 +34,11 @@ export PATH=${BUILDDIR}:${PATH} VERBOSE=0 FILTER='*' -export NUM_SAMPLES=100 +NUM_SAMPLES=100 +TIMEOUT=1m # Parse command line arguments -while getopts ":f:l:v" OPT; do +while getopts ":f:l:t:v" OPT; do case ${OPT} in f) FILTER=${OPTARG} @@ -48,6 +49,9 @@ while getopts ":f:l:v" OPT; do l) NUM_SAMPLES=${OPTARG} ;; + t) + TIMEOUT=${OPTARG} + ;; \?) echo "Invalid option: -${OPTARG}" >&2 ;; @@ -58,6 +62,9 @@ while getopts ":f:l:v" OPT; do esac done +export VERBOSE +export NUM_SAMPLES + TESTS=${SRCDIR}/tests/integration/${FILTER}.sh # Preperations @@ -74,11 +81,10 @@ for TEST in ${TESTS}; do # Run test if (( ${VERBOSE} == 0 )); then - ${TEST} &> ${LOGDIR}/${TESTNAME}.log + timeout ${TIMEOUT} ${TEST} &> ${LOGDIR}/${TESTNAME}.log else - ${TEST} + timeout ${TIMEOUT} ${TEST} fi - RC=$? case $RC in @@ -90,6 +96,9 @@ for TEST in ${TESTS}; do echo -e "\e[93m[Skip] \e[39m ${TESTNAME}" NUM_SKIP=$((${NUM_SKIP} + 1)) ;; + 124) + echo -e "\e[31m[Timeout] \e[39m ${TESTNAME}" + ;; *) echo -e "\e[31m[Fail] \e[39m ${TESTNAME} with code $RC" NUM_FAIL=$((${NUM_FAIL} + 1)) From b44289022de582228cf4d6d315c1887bee288d3e Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sat, 1 Jul 2017 21:26:08 +0200 Subject: [PATCH 07/17] tests: remove broken prefixed of node tests --- tests/integration/node-loopback-socket.sh | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/tests/integration/node-loopback-socket.sh b/tests/integration/node-loopback-socket.sh index d9dd8059a..a2ca9f70c 100755 --- a/tests/integration/node-loopback-socket.sh +++ b/tests/integration/node-loopback-socket.sh @@ -26,15 +26,6 @@ CONFIG_FILE=$(mktemp) INPUT_FILE=$(mktemp) OUTPUT_FILE=$(mktemp) -function prefix() { - case $1 in - node) P=$'\\\e[36mnode\\\e[39m: ' ;; - pipe) P=$'\\\e[93mpipe\\\e[39m: ' ;; - cmp) P=$'\\\e[35mcmp\\\e[39m: ' ;; - esac - - sed -e "s/^/$P/" -} NUM_SAMPLES=${NUM_SAMPLES:-10} cat > ${CONFIG_FILE} < ${INPUT_FILE} # Start node -villas-node ${CONFIG_FILE} 2>&1 | prefix node & +villas-node ${CONFIG_FILE} & # Wait for node to complete init sleep 1 # Send / Receive data to node -(villas-pipe ${CONFIG_FILE} node2 > ${OUTPUT_FILE} < <(cat ${INPUT_FILE}; sleep 1; echo -n)) 2>&1 | prefix pipe +villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node2 > ${OUTPUT_FILE} < ${INPUT_FILE} + +# Wait for node to handle samples +sleep 1 # Stop node kill %1 # Compare data -villas-test-cmp ${INPUT_FILE} ${OUTPUT_FILE} 2>&1 | prefix cmp -RC=${PIPESTATUS[0]} +villas-test-cmp ${INPUT_FILE} ${OUTPUT_FILE} +RC=$? rm ${CONFIG_FILE} ${INPUT_FILE} ${OUTPUT_FILE} From 2b7687cc4db6a3efe64a70058404fe8fd5fef773 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 2 Jul 2017 00:13:06 +0200 Subject: [PATCH 08/17] pipe: add -t switch to terminate execution after a given time --- lib/utils.c | 1 + src/pipe.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/utils.c b/lib/utils.c index 27232d0a8..08e451f51 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -309,6 +309,7 @@ void signals_init(void (*cb)(int signal, siginfo_t *sinfo, void *ctx)) sigemptyset(&sa_quit.sa_mask); sigaction(SIGINT, &sa_quit, NULL); sigaction(SIGTERM, &sa_quit, NULL); + sigaction(SIGALRM, &sa_quit, NULL); struct sigaction sa_chld = { .sa_flags = 0, diff --git a/src/pipe.c b/src/pipe.c index 714b93824..f9925ffc5 100644 --- a/src/pipe.c +++ b/src/pipe.c @@ -58,6 +58,9 @@ pthread_t ptid; /**< Parent thread id */ static void quit(int signal, siginfo_t *sinfo, void *ctx) { + if (signal == SIGALRM) + info("Reached timeout. Terminating..."); + if (recvv.enabled) { pthread_cancel(recvv.thread); pthread_join(recvv.thread, NULL); @@ -92,6 +95,7 @@ static void usage() printf(" -x swap read / write endpoints\n"); printf(" -s only read data from stdin and send it to node\n"); printf(" -r only read data from node and write it to stdout\n"); + printf(". -t NUM terminate after NUM seconds\n"); printf(" -L NUM terminate after NUM samples sent\n"); printf(" -l NUM terminate after NUM samples received\n\n"); @@ -205,6 +209,7 @@ int main(int argc, char *argv[]) int ret, level = V; bool reverse = false; + double timeout = 0; sendd = recvv = (struct dir) { .enabled = true, @@ -214,7 +219,7 @@ int main(int argc, char *argv[]) ptid = pthread_self(); char c, *endptr; - while ((c = getopt(argc, argv, "hxrsd:l:L:")) != -1) { + while ((c = getopt(argc, argv, "hxrsd:l:L:t:")) != -1) { switch (c) { case 'x': reverse = true; @@ -234,6 +239,9 @@ int main(int argc, char *argv[]) case 'L': sendd.limit = strtoul(optarg, &endptr, 10); goto check; + case 't': + timeout = strtod(optarg, &endptr); + goto check; case 'h': case '?': usage(); @@ -297,8 +305,10 @@ check: if (optarg == endptr) if (sendd.enabled) pthread_create(&sendd.thread, NULL, send_loop, NULL); + ualarm(timeout * 1e6); + for (;;) - sleep(1); + pause(); return 0; } From e4fc06ed9e40f1e25f1ac242302413f55b0dc195 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 2 Jul 2017 00:14:18 +0200 Subject: [PATCH 09/17] tests: use random data to avoid false positive due to stale data --- tests/integration/hook-shift_ts.sh | 2 +- tests/integration/pipe-file-advio.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/hook-shift_ts.sh b/tests/integration/hook-shift_ts.sh index a5d1e8c97..03aacf002 100755 --- a/tests/integration/hook-shift_ts.sh +++ b/tests/integration/hook-shift_ts.sh @@ -29,7 +29,7 @@ NUM_SAMPLES=${NUM_SAMPLES:-10} OFFSET=-10 EPSILON=0.05 -villas-signal sine -l ${NUM_SAMPLES} -r 10 | villas-hook shift_ts offset=${OFFSET} | villas-hook stats format=\"json\" output=\"${STATS_FILE}\" > /dev/null +villas-signal random -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/pipe-file-advio.sh b/tests/integration/pipe-file-advio.sh index 409d28e6f..68df24daa 100755 --- a/tests/integration/pipe-file-advio.sh +++ b/tests/integration/pipe-file-advio.sh @@ -52,7 +52,7 @@ nodes = { } EOF -villas-signal sine -n -l ${NUM_SAMPLES} > ${INPUT_FILE} +villas-signal random -n -l ${NUM_SAMPLES} > ${INPUT_FILE} villas-pipe -s ${CONFIG_FILE} remote_file_out < ${INPUT_FILE} From a7fcd091d472d10de0bdb40e76e0d18d519f7f7f Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 2 Jul 2017 00:14:42 +0200 Subject: [PATCH 10/17] tests: better summary --- tests/integration-tests.sh | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/tests/integration-tests.sh b/tests/integration-tests.sh index f6582874d..3c09afc5d 100755 --- a/tests/integration-tests.sh +++ b/tests/integration-tests.sh @@ -70,8 +70,10 @@ TESTS=${SRCDIR}/tests/integration/${FILTER}.sh # Preperations mkdir -p ${LOGDIR} -NUM_PASS=0 -NUM_FAIL=0 +PASSED=0 +FAILED=0 +SKIPPED=0 +TIMEDOUT=0 # Preamble echo -e "Starting integration tests for VILLASnode/fpga:\n" @@ -90,25 +92,31 @@ for TEST in ${TESTS}; do case $RC in 0) echo -e "\e[32m[Pass] \e[39m ${TESTNAME}" - NUM_PASS=$((${NUM_PASS} + 1)) + PASSED=$((${PASSED} + 1)) ;; 99) echo -e "\e[93m[Skip] \e[39m ${TESTNAME}" - NUM_SKIP=$((${NUM_SKIP} + 1)) + SKIPPED=$((${SKIPPED} + 1)) ;; 124) - echo -e "\e[31m[Timeout] \e[39m ${TESTNAME}" + echo -e "\e[33m[Time] \e[39m ${TESTNAME}" + TIMEDOUT=$((${TIMEDOUT} + 1)) + FAILED=$((${FAILED} + 1)) ;; *) echo -e "\e[31m[Fail] \e[39m ${TESTNAME} with code $RC" - NUM_FAIL=$((${NUM_FAIL} + 1)) + FAILED=$((${FAILED} + 1)) ;; esac + + TOTAL=$((${TOTAL} + 1)) done # Show summary -if (( ${NUM_FAIL} > 0 )); then - echo -e "\nSummary: ${NUM_FAIL} of $((${NUM_FAIL} + ${NUM_PASS})) tests failed." +if (( ${FAILED} > 0 )); then + 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!" From 14123951ba18c097e91c5da41c9a605e0d7f10d3 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 2 Jul 2017 18:58:07 +0200 Subject: [PATCH 11/17] tests: fix file node-type configuration --- tests/integration/pipe-file-advio.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/pipe-file-advio.sh b/tests/integration/pipe-file-advio.sh index 68df24daa..77359a1d8 100755 --- a/tests/integration/pipe-file-advio.sh +++ b/tests/integration/pipe-file-advio.sh @@ -46,7 +46,7 @@ nodes = { uri = "${URI}" mode = "r" epoch_mode = "original" - rewind = false, + eof = "exit", } } } From 125ce873e7703018776e2c1f4abb6815659a8ad4 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 2 Jul 2017 18:58:30 +0200 Subject: [PATCH 12/17] pipe: ualarm() invocation --- src/pipe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pipe.c b/src/pipe.c index f9925ffc5..acaa4daeb 100644 --- a/src/pipe.c +++ b/src/pipe.c @@ -305,7 +305,7 @@ check: if (optarg == endptr) if (sendd.enabled) pthread_create(&sendd.thread, NULL, send_loop, NULL); - ualarm(timeout * 1e6); + ualarm(timeout * 1e6, 0); for (;;) pause(); From 5f3620e3b4dd37be96295e17e59a405f408c3186 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 2 Jul 2017 18:58:58 +0200 Subject: [PATCH 13/17] add some debug messages --- lib/advio.c | 41 +++++++++++++++++++++++++++++------------ lib/node.c | 17 ++++++++++++----- 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/lib/advio.c b/lib/advio.c index df81d3ab9..33f6441e6 100644 --- a/lib/advio.c +++ b/lib/advio.c @@ -41,19 +41,36 @@ static int advio_trace(CURL *handle, curl_infotype type, char *data, size_t size, void *userp) { - char *nl; + const char *text; switch (type) { case CURLINFO_TEXT: - nl = strchr(data, '\n'); - if (nl) - *nl = 0; - - debug(LOG_ADVIO | 10, "%s", data); + text = "info"; + break; + case CURLINFO_HEADER_OUT: + text = "send header"; + break; + case CURLINFO_DATA_OUT: + text = "send data"; + break; + case CURLINFO_HEADER_IN: + text = "recv header"; + break; + case CURLINFO_DATA_IN: + text = "recv data"; + break; + case CURLINFO_SSL_DATA_IN: + text = "recv SSL data"; + break; + case CURLINFO_SSL_DATA_OUT: + text = "send SSL data"; + break; default: /* in case a new one is introduced to shock us */ return 0; } - + + debug(LOG_ADVIO | 5, "CURL: %s: %.*s", text, (int) size-1, data); + return 0; } @@ -333,9 +350,9 @@ int aupload(AFILE *af, int resume) curl_easy_getinfo(af->curl, CURLINFO_TOTAL_TIME, &total_time); char *total_bytes_human = advio_human_size(total_bytes, buf[0], sizeof(buf[0])); - char *total_time_human = advio_human_time(total_time, buf[1], sizeof(buf[1])); + char *total_time_human = advio_human_time(total_time, buf[1], sizeof(buf[1])); - info("Finished uploaded of %s in %s", total_bytes_human, total_time_human); + info("Finished upload of %s in %s", total_bytes_human, total_time_human); af->uploaded += total_bytes; @@ -376,7 +393,7 @@ int adownload(AFILE *af, int resume) curl_easy_getinfo(af->curl, CURLINFO_TOTAL_TIME, &total_time); char *total_bytes_human = advio_human_size(total_bytes, buf[0], sizeof(buf[0])); - char *total_time_human = advio_human_time(total_time, buf[1], sizeof(buf[1])); + char *total_time_human = advio_human_time(total_time, buf[1], sizeof(buf[1])); info("Finished download of %s in %s", total_bytes_human, total_time_human); @@ -386,7 +403,7 @@ int adownload(AFILE *af, int resume) res = curl_easy_getinfo(af->curl, CURLINFO_RESPONSE_CODE, &code); if (res) return -1; - + switch (code) { case 0: case 200: goto exist; @@ -408,7 +425,7 @@ int adownload(AFILE *af, int resume) return -1; default: - error("ADVIO: Failed to fetch file: %s: %s", af->uri, curl_easy_strerror(res)); + error("ADVIO: Failed to download file: %s: %s", af->uri, curl_easy_strerror(res)); return -1; } diff --git a/lib/node.c b/lib/node.c index 884393f49..6ff8a666b 100644 --- a/lib/node.c +++ b/lib/node.c @@ -157,7 +157,7 @@ int node_destroy(struct node *n) int node_read(struct node *n, struct sample *smps[], unsigned cnt) { - int nread = 0; + int readd, nread = 0; if (!n->_vt->read) return -1; @@ -165,11 +165,14 @@ int node_read(struct node *n, struct sample *smps[], unsigned cnt) /* Send in parts if vector not supported */ if (n->_vt->vectorize > 0 && n->_vt->vectorize < cnt) { while (cnt - nread > 0) { - nread += n->_vt->read(n, &smps[nread], MIN(cnt - nread, n->_vt->vectorize)); + readd = n->_vt->read(n, &smps[nread], MIN(cnt - nread, n->_vt->vectorize)); + nread += readd; + debug(LOG_NODES | 5, "Received %u samples from node %s", readd, node_name(n)); } } else { nread = n->_vt->read(n, smps, cnt); + debug(LOG_NODES | 5, "Received %u samples from node %s", nread, node_name(n)); } for (int i = 0; i < nread; i++) @@ -180,18 +183,22 @@ int node_read(struct node *n, struct sample *smps[], unsigned cnt) int node_write(struct node *n, struct sample *smps[], unsigned cnt) { - int nsent = 0; + int sent, nsent = 0; if (!n->_vt->write) return -1; /* Send in parts if vector not supported */ if (n->_vt->vectorize > 0 && n->_vt->vectorize < cnt) { - while (cnt - nsent > 0) - nsent += n->_vt->write(n, &smps[nsent], MIN(cnt - nsent, n->_vt->vectorize)); + while (cnt - nsent > 0) { + sent = n->_vt->write(n, &smps[nsent], MIN(cnt - nsent, n->_vt->vectorize)); + nsent += sent; + debug(LOG_NODES | 5, "Sent %u samples to node %s", sent, node_name(n)); + } } else { nsent = n->_vt->write(n, smps, cnt); + debug(LOG_NODES | 5, "Sent %u samples to node %s", nsent, node_name(n)); } return nsent; From 16f2b22a12831f2cb05bf793c729b58d62e1a5f5 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 2 Jul 2017 19:00:08 +0200 Subject: [PATCH 14/17] file: make flush() configurable --- include/villas/nodes/file.h | 2 ++ lib/nodes/file.c | 21 +++++++++++++-------- tests/integration/pipe-file-advio.sh | 1 + tests/integration/pipe-loopback-file.sh | 1 + 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/include/villas/nodes/file.h b/include/villas/nodes/file.h index f07e1d905..3b308b888 100644 --- a/include/villas/nodes/file.h +++ b/include/villas/nodes/file.h @@ -50,6 +50,8 @@ struct file { char *uri; /**< Real file name. */ } read, write; + + int flush; /**< Flush / upload file contents after each write. */ enum read_epoch_mode { FILE_EPOCH_DIRECT, diff --git a/lib/nodes/file.c b/lib/nodes/file.c index eb372e413..b0136629f 100644 --- a/lib/nodes/file.c +++ b/lib/nodes/file.c @@ -119,6 +119,9 @@ int file_parse(struct node *n, config_setting_t *cfg) if (cfg_out) { if (file_parse_direction(cfg_out, f, FILE_WRITE)) cerror(cfg_out, "Failed to parse output file for node %s", node_name(n)); + + if (!config_setting_lookup_bool(cfg_out, "flush", &f->flush)) + f->flush = 0; } cfg_in = config_setting_get_member(cfg, "in"); @@ -259,12 +262,12 @@ int file_start(struct node *n) if (f->read_timer < 0) serror("Failed to create timer"); - /* Get timestamp of first line */ - struct sample s; - arewind(f->read.handle); - + + /* Get timestamp of first line */ if (f->read_epoch_mode != FILE_EPOCH_ORIGINAL) { + struct sample s; + ret = sample_io_villas_fscan(f->read.handle->file, &s, NULL); if (ret < 0) error("Failed to read first timestamp of node %s", node_name(n)); @@ -292,9 +295,6 @@ int file_stop(struct node *n) { struct file *f = n->_vd; - free(f->read.uri); - free(f->write.uri); - if (f->read_timer) close(f->read_timer); if (f->read.handle) @@ -302,6 +302,9 @@ int file_stop(struct node *n) if (f->write.handle) afclose(f->write.handle); + free(f->read.uri); + free(f->write.uri); + return 0; } @@ -374,7 +377,9 @@ int file_write(struct node *n, struct sample *smps[], unsigned cnt) assert(cnt == 1); sample_io_villas_fprint(f->write.handle->file, s, SAMPLE_IO_ALL & ~SAMPLE_IO_OFFSET); - afflush(f->write.handle); + + if (f->flush) + afflush(f->write.handle); return 1; } diff --git a/tests/integration/pipe-file-advio.sh b/tests/integration/pipe-file-advio.sh index 77359a1d8..d388e9c42 100755 --- a/tests/integration/pipe-file-advio.sh +++ b/tests/integration/pipe-file-advio.sh @@ -38,6 +38,7 @@ nodes = { out = { uri = "${URI}" mode = "w+" + flush = false /* WebDav / OwnCloud / Sciebo do not support partial upload */ }, }, remote_file_in = { diff --git a/tests/integration/pipe-loopback-file.sh b/tests/integration/pipe-loopback-file.sh index 3361980bb..f8c63e752 100755 --- a/tests/integration/pipe-loopback-file.sh +++ b/tests/integration/pipe-loopback-file.sh @@ -44,6 +44,7 @@ nodes = { out = { uri = "${NODE_FILE}" mode = "w+" + flush = true /* we need to flush / upload the new samples continously for a loopback */ } } } From dab4a4ebfb7d3d4cdbba9c26eee757fdad5a85ef Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 2 Jul 2017 19:35:39 +0200 Subject: [PATCH 15/17] tests: improve pipe-loopback-file --- tests/integration/pipe-file-advio.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/integration/pipe-file-advio.sh b/tests/integration/pipe-file-advio.sh index d388e9c42..97b1885d7 100755 --- a/tests/integration/pipe-file-advio.sh +++ b/tests/integration/pipe-file-advio.sh @@ -53,13 +53,16 @@ nodes = { } EOF +# Delete old file +curl -X DELETE ${URI} + villas-signal random -n -l ${NUM_SAMPLES} > ${INPUT_FILE} villas-pipe -s ${CONFIG_FILE} remote_file_out < ${INPUT_FILE} villas-pipe -r ${CONFIG_FILE} remote_file_in > ${OUTPUT_FILE} -villas-test-cmp -j ${INPUT_FILE} ${OUTPUT_FILE} +villas-test-cmp ${INPUT_FILE} ${OUTPUT_FILE} RC=$? rm -f ${CONFIG_FILE} ${INPUT_FILE} ${OUTPUT_FILE} From b8e6bbed7897a442505419502034e758075d4cd5 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 2 Jul 2017 19:36:03 +0200 Subject: [PATCH 16/17] some cleanup and refactoring --- lib/log_config.c | 14 +++++++++----- tests/integration-tests.sh | 1 - 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/log_config.c b/lib/log_config.c index 1d00cf256..7dd6278ba 100644 --- a/lib/log_config.c +++ b/lib/log_config.c @@ -30,16 +30,20 @@ int log_parse(struct log *l, config_setting_t *cfg) { - const char *facilities; + const char *fac, *pth; + int lvl; if (!config_setting_is_group(cfg)) cerror(cfg, "Setting 'log' must be a group."); - config_setting_lookup_int(cfg, "level", &l->level); - config_setting_lookup_string(cfg, "file", &l->path); + if (config_setting_lookup_int(cfg, "level", &lvl)) + l->level = lvl; - if (config_setting_lookup_string(cfg, "facilities", &facilities)) - log_set_facility_expression(l, facilities); + if (config_setting_lookup_string(cfg, "file", &pth)) + l->path = pth; + + if (config_setting_lookup_string(cfg, "facilities", &fac)) + log_set_facility_expression(l, fac); l->state = STATE_PARSED; diff --git a/tests/integration-tests.sh b/tests/integration-tests.sh index 3c09afc5d..e1c5e4d2e 100755 --- a/tests/integration-tests.sh +++ b/tests/integration-tests.sh @@ -33,7 +33,6 @@ export PATH=${BUILDDIR}:${PATH} # Default values VERBOSE=0 FILTER='*' - NUM_SAMPLES=100 TIMEOUT=1m From d6dec9bc228af248d37a98cba1beb2f7974501ba Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 2 Jul 2017 20:00:10 +0200 Subject: [PATCH 17/17] tests: fix pipe-loopback-shmem --- tests/integration/pipe-loopback-shmem.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/integration/pipe-loopback-shmem.sh b/tests/integration/pipe-loopback-shmem.sh index c0a72d3c5..d0cada19c 100755 --- a/tests/integration/pipe-loopback-shmem.sh +++ b/tests/integration/pipe-loopback-shmem.sh @@ -28,25 +28,29 @@ OUTPUT_FILE=$(mktemp) NUM_SAMPLES=${NUM_SAMPLES:-10} +for SAMPLELEN in 1 10 100; do for POLLING in true false; do -for VECTORIZE in 1 5 20; do +for VECTORIZE in 1 5 25; do cat > ${CONFIG_FILE} << EOF +logging = { + level = 2 +} nodes = { node1 = { type = "shmem"; out_name = "/villas-test"; in_name = "/villas-test"; - samplelen = 4; - queuelen = 32; + samplelen = ${SAMPLELEN}; + queuelen = 1024, polling = ${POLLING}; - vectorize = ${VECTORIZE} + vectorize = ${VECTORIZE}; } } EOF # Generate test data -villas-signal random -l ${NUM_SAMPLES} -n > ${INPUT_FILE} +villas-signal random -l ${NUM_SAMPLES} -v ${SAMPLELEN} -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 -l ${NUM_SAMPLES} ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < ${INPUT_FILE} @@ -56,7 +60,7 @@ villas-test-cmp ${INPUT_FILE} ${OUTPUT_FILE} RC=$? if (( ${RC} != 0 )); then - echo "=========== Sub-test failed for: polling=${POLLING}, vecotrize=${VECTORIZE}" + echo "=========== Sub-test failed for: polling=${POLLING}, vectorize=${VECTORIZE}, samplelen=${SAMPLELEN}" cat ${CONFIG_FILE} echo cat ${INPUT_FILE} @@ -64,10 +68,10 @@ if (( ${RC} != 0 )); then cat ${OUTPUT_FILE} exit ${RC} else - echo "=========== Sub-test succeeded for: polling=${POLLING}, vecotrize=${VECTORIZE}" + echo "=========== Sub-test succeeded for: polling=${POLLING}, vectorize=${VECTORIZE}, samplelen=${SAMPLELEN}" fi -done; done +done; done; done rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE}