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

Merge branch 'feature-pipe-limits' into 'develop'

Feature pipe limits

See merge request !27
This commit is contained in:
Steffen Vogel 2017-07-02 20:05:13 +02:00
commit 762d1a7f7a
17 changed files with 231 additions and 116 deletions

View file

@ -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,

View file

@ -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;
}

View file

@ -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;

View file

@ -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;

View file

@ -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;
}

View file

@ -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,

View file

@ -49,24 +49,25 @@ struct dir {
struct pool pool;
pthread_t thread;
bool enabled;
bool started;
int limit;
} sendd, recvv;
bool reverse = false;
struct node *node;
pthread_t ptid; /**< Parent thread id */
static void quit(int signal, siginfo_t *sinfo, void *ctx)
{
if (recvv.started) {
if (signal == SIGALRM)
info("Reached timeout. Terminating...");
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);
@ -93,23 +94,19 @@ 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(". -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");
print_copyright();
exit(EXIT_FAILURE);
}
static void * send_loop(void *ctx)
{
int ret;
int ret, cnt = 0;
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)
@ -124,11 +121,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;
@ -136,27 +136,33 @@ 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];
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)
@ -173,6 +179,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];
@ -182,24 +189,37 @@ 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;
double timeout = 0;
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:t:")) != -1) {
switch (c) {
case 'x':
reverse = true;
@ -211,13 +231,28 @@ 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 'l':
recvv.limit = strtoul(optarg, &endptr, 10);
goto check;
case 'L':
sendd.limit = strtoul(optarg, &endptr, 10);
goto check;
case 't':
timeout = strtod(optarg, &endptr);
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) {
@ -264,11 +299,16 @@ 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);
ualarm(timeout * 1e6, 0);
for (;;)
sleep(1);
pause();
return 0;
}

View file

@ -33,11 +33,11 @@ export PATH=${BUILDDIR}:${PATH}
# Default values
VERBOSE=0
FILTER='*'
export NUM_SAMPLES=100
NUM_SAMPLES=100
TIMEOUT=1m
# Parse command line arguments
while getopts ":f:v" OPT; do
while getopts ":f:l:t:v" OPT; do
case ${OPT} in
f)
FILTER=${OPTARG}
@ -45,6 +45,12 @@ while getopts ":f:v" OPT; do
v)
VERBOSE=1
;;
l)
NUM_SAMPLES=${OPTARG}
;;
t)
TIMEOUT=${OPTARG}
;;
\?)
echo "Invalid option: -${OPTARG}" >&2
;;
@ -55,13 +61,18 @@ while getopts ":f:v" OPT; do
esac
done
export VERBOSE
export NUM_SAMPLES
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"
@ -71,32 +82,40 @@ 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
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[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!"

View file

@ -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 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}

View file

@ -26,15 +26,7 @@ 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} <<EOF
nodes = {
@ -64,23 +56,26 @@ paths = (
EOF
# Generate test data
villas-signal random -l 10 -n > ${INPUT_FILE}
villas-signal random -l ${NUM_SAMPLES} -n > ${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}

View file

@ -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} <<EOF
@ -36,6 +38,7 @@ nodes = {
out = {
uri = "${URI}"
mode = "w+"
flush = false /* WebDav / OwnCloud / Sciebo do not support partial upload */
},
},
remote_file_in = {
@ -44,19 +47,22 @@ nodes = {
uri = "${URI}"
mode = "r"
epoch_mode = "original"
rewind = false,
eof = "exit",
}
}
}
EOF
villas-signal sine -n -l 10 > ${INPUT_FILE}
# 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}

View file

@ -27,6 +27,8 @@ INPUT_FILE=$(mktemp)
OUTPUT_FILE=$(mktemp)
NODE_FILE=$(mktemp)
NUM_SAMPLES=${NUM_SAMPLES:-10}
cat > ${CONFIG_FILE} << EOF
nodes = {
node1 = {
@ -42,16 +44,17 @@ nodes = {
out = {
uri = "${NODE_FILE}"
mode = "w+"
flush = true /* we need to flush / upload the new samples continously for a loopback */
}
}
}
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)
villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < ${INPUT_FILE}
# Comapre data
villas-test-cmp ${INPUT_FILE} ${OUTPUT_FILE}

View file

@ -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,10 +48,10 @@ 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)
villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < ${INPUT_FILE}
# Comapre data
villas-test-cmp ${INPUT_FILE} ${OUTPUT_FILE}

View file

@ -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,10 +40,10 @@ 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)
villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < ${INPUT_FILE}
cat ${INPUT_FILE}
echo

View file

@ -26,35 +26,41 @@ CONFIG_FILE=$(mktemp)
INPUT_FILE=$(mktemp)
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 20 -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 ${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}
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}
@ -62,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}

View file

@ -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
@ -72,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}

View file

@ -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,10 +41,10 @@ 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)
villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < ${INPUT_FILE}
# Comapre data
villas-test-cmp ${INPUT_FILE} ${OUTPUT_FILE}