From 7eaa93cd367ee4da116613ab5b03e9fc887e4937 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Thu, 3 Aug 2017 00:21:56 +0200 Subject: [PATCH] migrate integration tests to new config format --- tests/integration/api-nodes.sh | 24 +++++++------- tests/integration/hook-convert.sh | 6 ++-- tests/integration/hook-decimate.sh | 6 ++-- tests/integration/hook-drop.sh | 4 +-- tests/integration/hook-map.sh | 6 ++-- tests/integration/hook-shift_seq.sh | 9 ++++-- tests/integration/hook-shift_ts.sh | 4 ++- tests/integration/hook-skip_first.sh | 6 ++-- tests/integration/hook-skip_first2.sh | 6 ++-- tests/integration/pipe-file-advio.sh | 34 +++++++++++--------- tests/integration/pipe-loopback-file.sh | 32 +++++++++--------- tests/integration/pipe-loopback-loopback.sh | 10 +++--- tests/integration/pipe-loopback-multicast.sh | 30 +++++++++-------- tests/integration/pipe-loopback-nanomsg.sh | 14 ++++---- tests/integration/pipe-loopback-shmem.sh | 26 ++++++++------- tests/integration/pipe-loopback-socket.sh | 32 +++++++++--------- tests/integration/pipe-loopback-zeromq.sh | 16 +++++---- 17 files changed, 145 insertions(+), 120 deletions(-) diff --git a/tests/integration/api-nodes.sh b/tests/integration/api-nodes.sh index 5886b5822..f010b7b2e 100755 --- a/tests/integration/api-nodes.sh +++ b/tests/integration/api-nodes.sh @@ -28,17 +28,19 @@ CONFIG_FILE=$(mktemp) FETCHED_NODES=$(mktemp) cat > ${CONFIG_FILE} < ${EXPECT_FILE} 1490500400.676379108(9) -0.587785 -58 -58 -0.587785 EOF -villas-hook convert 'mode="fixed" scale=100 mask=0x6' < ${INPUT_FILE} > ${OUTPUT_FILE} +villas-hook convert -o mode=fixed -o scale=100 -o mask=0x6 < ${INPUT_FILE} > ${OUTPUT_FILE} # Compare only the data values -diff -u <(cut -f2- ${OUTPUT_FILE}) <(cut -f2- ${EXPECT_FILE}) +villas-test-cmp ${OUTPUT_FILE} ${EXPECT_FILE} RC=$? rm -f ${INPUT_FILE} ${OUTPUT_FILE} ${EXPECT_FILE} -exit $RC \ No newline at end of file +exit $RC diff --git a/tests/integration/hook-decimate.sh b/tests/integration/hook-decimate.sh index 7a85cc42e..e92a6743d 100755 --- a/tests/integration/hook-decimate.sh +++ b/tests/integration/hook-decimate.sh @@ -46,13 +46,13 @@ cat < ${EXPECT_FILE} 1490500400.676379108(9) -0.587785 -0.587785 -0.587785 -0.587785 EOF -villas-hook decimate 'ratio=3' < ${INPUT_FILE} > ${OUTPUT_FILE} +villas-hook decimate -o ratio=3 < ${INPUT_FILE} > ${OUTPUT_FILE} # Compare only the data values -diff -u <(cut -f2- ${OUTPUT_FILE}) <(cut -f2- ${EXPECT_FILE}) +villas-test-cmp ${OUTPUT_FILE} ${EXPECT_FILE} RC=$? rm -f ${INPUT_FILE} ${OUTPUT_FILE} ${EXPECT_FILE} -exit $RC \ No newline at end of file +exit $RC diff --git a/tests/integration/hook-drop.sh b/tests/integration/hook-drop.sh index 29959949e..2684ec9c5 100755 --- a/tests/integration/hook-drop.sh +++ b/tests/integration/hook-drop.sh @@ -55,10 +55,10 @@ EOF villas-hook drop < ${INPUT_FILE} > ${OUTPUT_FILE} # Compare only the data values -diff -u <(cut -f2- ${OUTPUT_FILE}) <(cut -f2- ${EXPECT_FILE}) +villas-test-cmp ${OUTPUT_FILE} ${EXPECT_FILE} RC=$? rm -f ${INPUT_FILE} ${OUTPUT_FILE} ${EXPECT_FILE} -exit $RC \ No newline at end of file +exit $RC diff --git a/tests/integration/hook-map.sh b/tests/integration/hook-map.sh index 1a52a8c20..2b6f64d72 100755 --- a/tests/integration/hook-map.sh +++ b/tests/integration/hook-map.sh @@ -52,13 +52,13 @@ cat < ${EXPECT_FILE} 1490500400.676379108(9) -0.587785 9 1490500400 676379108 -0.587785 -0.587785 EOF -villas-hook map 'mapping = [ "data[3]", "hdr.sequence", "ts.origin", "data[1-2]" ]' < ${INPUT_FILE} > ${OUTPUT_FILE} +villas-hook map -o map=data[3] -o map=hdr.sequence -o map=ts.origin -o map=data[1-2] < ${INPUT_FILE} > ${OUTPUT_FILE} # Compare only the data values -diff -u <(cut -f2- ${OUTPUT_FILE}) <(cut -f2- ${EXPECT_FILE}) +villas-test-cmp ${OUTPUT_FILE} ${EXPECT_FILE} RC=$? rm -f ${INPUT_FILE} ${OUTPUT_FILE} ${EXPECT_FILE} -exit $RC \ No newline at end of file +exit $RC diff --git a/tests/integration/hook-shift_seq.sh b/tests/integration/hook-shift_seq.sh index 8aedc9e20..40dc842d9 100755 --- a/tests/integration/hook-shift_seq.sh +++ b/tests/integration/hook-shift_seq.sh @@ -23,18 +23,21 @@ ################################################################################## OUTPUT_FILE=$(mktemp) +INPUT_FILE=$(mktemp) OFFSET=100 -villas-signal random -l ${NUM_SAMPLES} -n | villas-hook shift_seq offset=${OFFSET} > ${OUTPUT_FILE} +villas-signal random -l ${NUM_SAMPLES} -n > ${INPUT_FILE} + +villas-hook shift_seq -o offset=${OFFSET} > ${OUTPUT_FILE} < ${INPUT_FILE} # Compare shifted sequence no diff -u \ - <(sed -re 's/^[0-9]+\.[0-9]+([\+\-][0-9]+\.[0-9]+(e[\+\-][0-9]+)?)?\(([0-9]+)\).*/\3/g' ${OUTPUT_FILE}) \ + <(sed -re '/^#/d;s/^[0-9]+\.[0-9]+([\+\-][0-9]+\.[0-9]+(e[\+\-][0-9]+)?)?\(([0-9]+)\).*/\3/g' ${OUTPUT_FILE}) \ <(seq ${OFFSET} $((${NUM_SAMPLES}+${OFFSET}-1))) RC=$? -rm -f ${OUTPUT_FILE} +rm -f ${OUTPUT_FILE} ${INPUT_FILE} exit $RC diff --git a/tests/integration/hook-shift_ts.sh b/tests/integration/hook-shift_ts.sh index 03aacf002..76090176f 100755 --- a/tests/integration/hook-shift_ts.sh +++ b/tests/integration/hook-shift_ts.sh @@ -29,7 +29,9 @@ NUM_SAMPLES=${NUM_SAMPLES:-10} OFFSET=-10 EPSILON=0.05 -villas-signal random -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 50 | \ +villas-hook shift_ts offset=${OFFSET} | \ +villas-hook stats -o format=json -o output="${STATS_FILE}" > /dev/null jq .owd ${STATS_FILE} diff --git a/tests/integration/hook-skip_first.sh b/tests/integration/hook-skip_first.sh index 7b0892c53..734824590 100755 --- a/tests/integration/hook-skip_first.sh +++ b/tests/integration/hook-skip_first.sh @@ -28,11 +28,11 @@ SKIP=10 echo ${OUTPUT_FILE} -villas-signal random -r 1 -l ${NUM_SAMPLES} -n | villas-hook skip_first seconds=${SKIP} > ${OUTPUT_FILE} +villas-signal random -r 1 -l ${NUM_SAMPLES} -n | villas-hook skip_first -o seconds=${SKIP} > ${OUTPUT_FILE} -LINES=$(wc -l < ${OUTPUT_FILE}) +LINES=$(sed -re '/^#/d' ${OUTPUT_FILE} | wc -l) rm ${OUTPUT_FILE} # Test condition -(( ${LINES} == ${NUM_SAMPLES} - ${SKIP} )) \ No newline at end of file +(( ${LINES} == ${NUM_SAMPLES} - ${SKIP} )) diff --git a/tests/integration/hook-skip_first2.sh b/tests/integration/hook-skip_first2.sh index 4ea001ffb..5d8e4f637 100755 --- a/tests/integration/hook-skip_first2.sh +++ b/tests/integration/hook-skip_first2.sh @@ -26,11 +26,11 @@ OUTPUT_FILE=$(mktemp) SKIP=50 -villas-signal random -r 1 -l ${NUM_SAMPLES} -n | villas-hook skip_first samples=${SKIP} > ${OUTPUT_FILE} +villas-signal random -r 1 -l ${NUM_SAMPLES} -n | villas-hook skip_first -o samples=${SKIP} > ${OUTPUT_FILE} -LINES=$(wc -l < ${OUTPUT_FILE}) +LINES=$(sed -re '/^#/d' ${OUTPUT_FILE} | wc -l) rm ${OUTPUT_FILE} # Test condition -(( ${LINES} == ${NUM_SAMPLES} - ${SKIP} )) \ No newline at end of file +(( ${LINES} == ${NUM_SAMPLES} - ${SKIP} )) diff --git a/tests/integration/pipe-file-advio.sh b/tests/integration/pipe-file-advio.sh index 97b1885d7..b0f38b7c6 100755 --- a/tests/integration/pipe-file-advio.sh +++ b/tests/integration/pipe-file-advio.sh @@ -30,24 +30,28 @@ NUM_SAMPLES=${NUM_SAMPLES:-10} URI=https://1Nrd46fZX8HbggT:badpass@rwth-aachen.sciebo.de/public.php/webdav/node/tests/pipe +# WebDav / OwnCloud / Sciebo do not support partial upload +# So we disable flusing the output cat > ${CONFIG_FILE} < ${CONFIG_FILE} << EOF -nodes = { - node1 = { - type = "file"; - - in = { - uri = "${NODE_FILE}", - mode = "w+", +{ + "nodes" : { + "node1" : { + "type" : "file", - epoch_mode = "original", - eof = "wait" - }, - out = { - uri = "${NODE_FILE}" - mode = "w+" - flush = true /* we need to flush / upload the new samples continously for a loopback */ + "in" : { + "uri" : "${NODE_FILE}", + "mode" : "w+", + + "epoch_mode" : "original", + "eof" : "wait" + }, + "out" : { + "uri" : "${NODE_FILE}", + "mode" : "w+", + "flush" : true + } } } } @@ -62,4 +64,4 @@ RC=$? rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} ${NODE_FILE} -exit $RC \ No newline at end of file +exit $RC diff --git a/tests/integration/pipe-loopback-loopback.sh b/tests/integration/pipe-loopback-loopback.sh index c1622e056..d057f640d 100755 --- a/tests/integration/pipe-loopback-loopback.sh +++ b/tests/integration/pipe-loopback-loopback.sh @@ -29,9 +29,11 @@ OUTPUT_FILE=$(mktemp) NUM_SAMPLES=${NUM_SAMPLES:-10} cat > ${CONFIG_FILE} << EOF -nodes = { - node1 = { - type = "loopback" +{ + "nodes" : { + "node1" : { + "type" : "loopback" + } } } EOF @@ -48,7 +50,7 @@ cat ${OUTPUT_FILE} # Comapre data villas-test-cmp ${INPUT_FILE} ${OUTPUT_FILE} -RC=$? +RC:$? rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} diff --git a/tests/integration/pipe-loopback-multicast.sh b/tests/integration/pipe-loopback-multicast.sh index 91339e168..c7e82e815 100755 --- a/tests/integration/pipe-loopback-multicast.sh +++ b/tests/integration/pipe-loopback-multicast.sh @@ -29,19 +29,21 @@ OUTPUT_FILE=$(mktemp) NUM_SAMPLES=${NUM_SAMPLES:-10} cat > ${CONFIG_FILE} << EOF -nodes = { - node1 = { - type = "socket"; - layer = "udp"; +{ + "nodes" : { + "node1" : { + "type" : "socket"; + "layer" : "udp"; - local = "*:12000"; - remote = "224.1.2.3:12000"; - - multicast = { # IGMP multicast is only support for layer = (ip|udp) - enabled = true, - - group = "224.1.2.3", # The multicast group. Must be within 224.0.0.0/4 - loop = true # Whether or not to loopback outgoing multicast packets to the local host. + "local" : "*:12000"; + "remote" : "224.1.2.3:12000"; + + "multicast" : { + "enabled" : true, + + "group" : "224.1.2.3", + "loop" : true + } } } } @@ -55,8 +57,8 @@ villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < ${INPUT_FI # Comapre data villas-test-cmp ${INPUT_FILE} ${OUTPUT_FILE} -RC=$? +RC:$? rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} -exit $RC \ No newline at end of file +exit $RC diff --git a/tests/integration/pipe-loopback-nanomsg.sh b/tests/integration/pipe-loopback-nanomsg.sh index c63be12d1..e080ee5ce 100755 --- a/tests/integration/pipe-loopback-nanomsg.sh +++ b/tests/integration/pipe-loopback-nanomsg.sh @@ -29,12 +29,14 @@ OUTPUT_FILE=$(mktemp) NUM_SAMPLES=${NUM_SAMPLES:-10} cat > ${CONFIG_FILE} << EOF -nodes = { - node1 = { - type = "nanomsg"; +{ + "nodes" : { + "node1" : { + "type" : "nanomsg", - subscribe = "tcp://127.0.0.1:12000"; - publish = "tcp://127.0.0.1:12000" + "subscribe" : "tcp://127.0.0.1:12000", + "publish" : "tcp://127.0.0.1:12000" + } } } EOF @@ -55,4 +57,4 @@ RC=$? rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} -exit $RC \ No newline at end of file +exit $RC diff --git a/tests/integration/pipe-loopback-shmem.sh b/tests/integration/pipe-loopback-shmem.sh index d0cada19c..32545fc67 100755 --- a/tests/integration/pipe-loopback-shmem.sh +++ b/tests/integration/pipe-loopback-shmem.sh @@ -33,18 +33,20 @@ for POLLING in true false; 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 = ${SAMPLELEN}; - queuelen = 1024, - polling = ${POLLING}; - vectorize = ${VECTORIZE}; +{ + "logging" : { + "level" : 2 + }, + "nodes" : { + "node1" : { + "type" : "shmem", + "out_name" : "/villas-test", + "in_name" : "/villas-test", + "samplelen" : ${SAMPLELEN}, + "queuelen" : 1024, + "polling" : ${POLLING}, + "vectorize" : ${VECTORIZE} + } } } EOF diff --git a/tests/integration/pipe-loopback-socket.sh b/tests/integration/pipe-loopback-socket.sh index 2df6c163f..5cf4d6ec5 100755 --- a/tests/integration/pipe-loopback-socket.sh +++ b/tests/integration/pipe-loopback-socket.sh @@ -42,13 +42,13 @@ case ${LAYER} in LOCAL="*:12000" REMOTE="127.0.0.1:12000" ;; - + ip) # We use IP protocol number 253 which is reserved for experimentation and testing according to RFC 3692 LOCAL="127.0.0.1:254" REMOTE="127.0.0.1:254" ;; - + eth) # We use IP protocol number 253 which is reserved for experimentation and testing according to RFC 7042 LOCAL="00:00:00:00:00:00%lo:34997" @@ -58,17 +58,19 @@ case ${LAYER} in cat > ${CONFIG_FILE} << EOF -nodes = { - node1 = { - type = "socket"; +{ + "nodes" : { + "node1" : { + "type" : "socket", - layer = "${LAYER}"; - header = "${HEADER}"; - endian = "${ENDIAN}"; - verify_source = ${VERIFY_SOURCE}; + "layer" : "${LAYER}", + "header" : "${HEADER}", + "endian" : "${ENDIAN}", + "verify_source" : ${VERIFY_SOURCE}, - local = "${LOCAL}"; - remote = "${REMOTE}"; + "local" : "${LOCAL}", + "remote" : "${REMOTE}" + } } } EOF @@ -78,10 +80,10 @@ villas-pipe -l ${NUM_SAMPLES} ${CONFIG_FILE} node1 > ${OUTPUT_FILE} < ${INPUT_FI # Compare data villas-test-cmp ${INPUT_FILE} ${OUTPUT_FILE} -RC=$? +RC:$? if (( ${RC} != 0 )); then - echo "=========== Sub-test failed for: layer=${LAYER}, header=${HEADER}, endian=${ENDIAN} verify_source=${VERIFY_SOURCE}" + echo "=========== Sub-test failed for: layer=${LAYER}, header=${HEADER}, endian=${ENDIAN}, verify_source=${VERIFY_SOURCE}" cat ${CONFIG_FILE} echo cat ${INPUT_FILE} @@ -89,11 +91,11 @@ if (( ${RC} != 0 )); then cat ${OUTPUT_FILE} exit ${RC} else - echo "=========== Sub-test succeeded for: layer=${LAYER}, header=${HEADER}, endian=${ENDIAN} verify_source=${VERIFY_SOURCE}" + echo "=========== Sub-test succeeded for: layer=${LAYER}, header=${HEADER}, endian=${ENDIAN}, verify_source=${VERIFY_SOURCE}" fi done; done; done; done rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} ${THEORIES} -exit $RC \ No newline at end of file +exit $RC diff --git a/tests/integration/pipe-loopback-zeromq.sh b/tests/integration/pipe-loopback-zeromq.sh index 448077ae7..b3ff05594 100755 --- a/tests/integration/pipe-loopback-zeromq.sh +++ b/tests/integration/pipe-loopback-zeromq.sh @@ -29,13 +29,15 @@ OUTPUT_FILE=$(mktemp) NUM_SAMPLES=${NUM_SAMPLES:-10} cat > ${CONFIG_FILE} << EOF -nodes = { - node1 = { - type = "zeromq"; +{ + "nodes" : { + "node1" : { + "type" : "zeromq", - pattern = "pubsub"; - subscribe = "tcp://127.0.0.1:12000"; - publish = "tcp://127.0.0.1:12000" + "pattern" : "pubsub", + "subscribe" : "tcp://127.0.0.1:12000", + "publish" : "tcp://127.0.0.1:12000" + } } } EOF @@ -52,4 +54,4 @@ RC=$? rm ${OUTPUT_FILE} ${INPUT_FILE} ${CONFIG_FILE} -exit $RC \ No newline at end of file +exit $RC