From c59e0948c3e9d02a0d05efa788f2ba466cf5d541 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Mon, 9 Apr 2018 08:28:54 +0200 Subject: [PATCH] io: use dots instead of hyphens in format names --- CHANGELOG.md | 7 ++++++ etc/example.conf | 4 ++-- lib/hooks/print.c | 2 +- lib/io/raw.c | 21 +++++++++-------- lib/io/villas_binary.c | 4 ++-- lib/io/villas_human.c | 2 +- lib/nodes/mqtt.c | 2 +- lib/nodes/socket.c | 2 +- lib/nodes/test_rtt.c | 2 +- src/hook.c | 2 +- src/signal.c | 2 +- src/test-cmp.c | 2 +- tests/integration/hook-print.sh | 2 +- tests/integration/pipe-loopback-amqp.sh | 2 +- tests/integration/pipe-loopback-nanomsg.sh | 2 +- tests/integration/pipe-loopback-socket.sh | 2 +- tests/integration/pipe-loopback-zeromq.sh | 2 +- tests/unit/io.c | 26 +++++++++++----------- tools/integration-tests-helper.sh | 4 ++-- 19 files changed, 49 insertions(+), 43 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1b4beeac..35f3ef637 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [0.6.2] - Unreleased + +### Changed + +- Format identifiers such as `raw-flt32` now use dots instead of hyphens in their name. + Please update your configuration files accordingly. + ## [0.6.1] - 2018-02-17 ### Added diff --git a/etc/example.conf b/etc/example.conf index df91d2434..e80d971b4 100644 --- a/etc/example.conf +++ b/etc/example.conf @@ -62,7 +62,7 @@ nodes = { # - ip Send / receive L3 IP packets # - eth Send / receive L2 Ethernet frames (IEEE802.3) - format = "gtnet-fake", # For a list of available node-types run: 'villas-node -h' + format = "gtnet.fake", # For a list of available node-types run: 'villas-node -h' verify_source = true, # Check if source address of incoming packets matches the remote address. @@ -233,7 +233,7 @@ nodes = { prefix = "test_rtt", # An optional prefix in the filename output = "/tmp/results/testA", # The output directory for all results # The results of each test case will be written to a seperate file. - format = "villas-human", # The output format of the result files. + format = "villas.human", # The output format of the result files. cases = ( # The list of test cases # Each test case can specify a single or an array of rates and values diff --git a/lib/hooks/print.c b/lib/hooks/print.c index 4a0cafa1b..91e7005a1 100644 --- a/lib/hooks/print.c +++ b/lib/hooks/print.c @@ -41,7 +41,7 @@ static int print_init(struct hook *h) struct print *p = (struct print *) h->_vd; p->uri = NULL; - p->format = io_format_lookup("villas-human"); + p->format = io_format_lookup("villas.human"); return 0; } diff --git a/lib/io/raw.c b/lib/io/raw.c index 02fac8238..7f3e26042 100644 --- a/lib/io/raw.c +++ b/lib/io/raw.c @@ -252,15 +252,14 @@ static struct plugin i = { \ REGISTER_PLUGIN(& i); /* Feel free to add additional format identifiers here to suit your needs */ -REGISTER_FORMAT_RAW(p, "raw", "", 0) -REGISTER_FORMAT_RAW(p_f32, "raw-flt32", "Raw single precision floating point", RAW_32 | RAW_FLT) -REGISTER_FORMAT_RAW(p_f64, "raw-flt64", "Raw double precision floating point", RAW_64 | RAW_FLT) -REGISTER_FORMAT_RAW(p_i8, "raw-int8", "Raw 8 bit, signed integer", RAW_8) -REGISTER_FORMAT_RAW(p_i16be, "raw-int16-be", "Raw 16 bit, signed integer, big endian byte-order", RAW_16 | RAW_BE) -REGISTER_FORMAT_RAW(p_i16le, "raw-int16-le", "Raw 16 bit, signed integer, little endian byte-order", RAW_16) -REGISTER_FORMAT_RAW(p_i32be, "raw-int32-be", "Raw 32 bit, signed integer, big endian byte-order", RAW_32 | RAW_BE) -REGISTER_FORMAT_RAW(p_i32le, "raw-int32-le", "Raw 32 bit, signed integer, little endian byte-order", RAW_32) -REGISTER_FORMAT_RAW(p_i64be, "raw-int64-be", "Raw 64 bit, signed integer, bit endian byte-order", RAW_64 | RAW_BE) -REGISTER_FORMAT_RAW(p_i64le, "raw-int64-le", "Raw 64 bit, signed integer, little endian byte-order", RAW_64) +REGISTER_FORMAT_RAW(p_f32, "raw.flt32", "Raw single precision floating point", RAW_32 | RAW_FLT) +REGISTER_FORMAT_RAW(p_f64, "raw.flt64", "Raw double precision floating point", RAW_64 | RAW_FLT) +REGISTER_FORMAT_RAW(p_i8, "raw.int8", "Raw 8 bit, signed integer", RAW_8) +REGISTER_FORMAT_RAW(p_i16be, "raw.int16.be", "Raw 16 bit, signed integer, big endian byte-order", RAW_16 | RAW_BE) +REGISTER_FORMAT_RAW(p_i16le, "raw.int16.le", "Raw 16 bit, signed integer, little endian byte-order", RAW_16) +REGISTER_FORMAT_RAW(p_i32be, "raw.int32.be", "Raw 32 bit, signed integer, big endian byte-order", RAW_32 | RAW_BE) +REGISTER_FORMAT_RAW(p_i32le, "raw.int32.le", "Raw 32 bit, signed integer, little endian byte-order", RAW_32) +REGISTER_FORMAT_RAW(p_i64be, "raw.int64.be", "Raw 64 bit, signed integer, bit endian byte-order", RAW_64 | RAW_BE) +REGISTER_FORMAT_RAW(p_i64le, "raw.int64.le", "Raw 64 bit, signed integer, little endian byte-order", RAW_64) REGISTER_FORMAT_RAW(p_gtnet, "gtnet", "RTDS GTNET", RAW_32 | RAW_FLT | RAW_BE) -REGISTER_FORMAT_RAW(p_gtnef, "gtnet-fake", "RTDS GTNET with fake header", RAW_32 | RAW_FLT | RAW_BE | RAW_FAKE) +REGISTER_FORMAT_RAW(p_gtnef, "gtnet.fake", "RTDS GTNET with fake header", RAW_32 | RAW_FLT | RAW_BE | RAW_FAKE) diff --git a/lib/io/villas_binary.c b/lib/io/villas_binary.c index 87c63880b..73f4a7251 100644 --- a/lib/io/villas_binary.c +++ b/lib/io/villas_binary.c @@ -113,7 +113,7 @@ int villas_binary_sscan(char *buf, size_t len, size_t *rbytes, struct sample *sm } static struct plugin p1 = { - .name = "villas-binary", + .name = "villas.binary", .description = "VILLAS binary network format", .type = PLUGIN_TYPE_IO, .io = { @@ -126,7 +126,7 @@ static struct plugin p1 = { /** The WebSocket node-type usually uses little endian byte order intead of network byte order */ static struct plugin p2 = { - .name = "villas-web", + .name = "villas.web", .description = "VILLAS binary network format for WebSockets", .type = PLUGIN_TYPE_IO, .io = { diff --git a/lib/io/villas_human.c b/lib/io/villas_human.c index 3f4e47aa3..44b8a18af 100644 --- a/lib/io/villas_human.c +++ b/lib/io/villas_human.c @@ -290,7 +290,7 @@ void villas_human_rewind(struct io *io) } static struct plugin p = { - .name = "villas-human", + .name = "villas.human", .description = "VILLAS human readable format", .type = PLUGIN_TYPE_IO, .io = { diff --git a/lib/nodes/mqtt.c b/lib/nodes/mqtt.c index c21eccc04..305c8f253 100644 --- a/lib/nodes/mqtt.c +++ b/lib/nodes/mqtt.c @@ -213,7 +213,7 @@ int mqtt_parse(struct node *n, json_t *cfg) struct mqtt *m = (struct mqtt *) n->_vd; const char *host; - const char *format = "villas-human"; + const char *format = "villas.human"; const char *publish = NULL; const char *subscribe = NULL; const char *username = NULL; diff --git a/lib/nodes/socket.c b/lib/nodes/socket.c index 15e0412f2..0ccb7d51d 100644 --- a/lib/nodes/socket.c +++ b/lib/nodes/socket.c @@ -449,7 +449,7 @@ int socket_parse(struct node *n, json_t *cfg) const char *local, *remote; const char *layer = NULL; - const char *format = "villas-binary"; + const char *format = "villas.binary"; int ret; diff --git a/lib/nodes/test_rtt.c b/lib/nodes/test_rtt.c index 5294c9a49..0f2c677b8 100644 --- a/lib/nodes/test_rtt.c +++ b/lib/nodes/test_rtt.c @@ -73,7 +73,7 @@ int test_rtt_parse(struct node *n, json_t *cfg) int ret; struct test_rtt *t = (struct test_rtt *) n->_vd; - const char *format = "villas-human"; + const char *format = "villas.human"; const char *output = "."; const char *prefix = node_name_short(n); diff --git a/src/hook.c b/src/hook.c index f89614300..93e3426ab 100644 --- a/src/hook.c +++ b/src/hook.c @@ -105,7 +105,7 @@ static void usage() int main(int argc, char *argv[]) { int ret, recv, sent; - char *format = "villas-human"; + char *format = "villas.human"; /* Default values */ cnt = 1; diff --git a/src/signal.c b/src/signal.c index 29925c525..274136951 100644 --- a/src/signal.c +++ b/src/signal.c @@ -110,7 +110,7 @@ int main(int argc, char *argv[]) int ret; struct plugin *p; - char *format = "villas-human"; /** @todo hardcoded for now */ + char *format = "villas.human"; /** @todo hardcoded for now */ ret = log_init(&l, l.level, LOG_ALL); if (ret) diff --git a/src/test-cmp.c b/src/test-cmp.c index d4f1e786a..b7f6cb9eb 100644 --- a/src/test-cmp.c +++ b/src/test-cmp.c @@ -74,7 +74,7 @@ int main(int argc, char *argv[]) /* Default values */ double epsilon = 1e-9; - char *format = "villas-human"; + char *format = "villas.human"; int flags = SAMPLE_HAS_SEQUENCE | SAMPLE_HAS_VALUES | SAMPLE_HAS_ORIGIN; struct pool pool = { .state = STATE_DESTROYED }; diff --git a/tests/integration/hook-print.sh b/tests/integration/hook-print.sh index 297e4978b..86a332be2 100755 --- a/tests/integration/hook-print.sh +++ b/tests/integration/hook-print.sh @@ -31,7 +31,7 @@ NUM_SAMPLES=${NUM_SAMPLES:-100} # Prepare some test data villas-signal random -v 1 -r 10 -l ${NUM_SAMPLES} -n > ${INPUT_FILE} -villas-hook print -o format=villas-human -o output=${OUTPUT_FILE1} < ${INPUT_FILE} > ${OUTPUT_FILE2} +villas-hook print -o format=villas.human -o output=${OUTPUT_FILE1} < ${INPUT_FILE} > ${OUTPUT_FILE2} # Compare only the data values villas-test-cmp ${OUTPUT_FILE1} ${INPUT_FILE} && \ diff --git a/tests/integration/pipe-loopback-amqp.sh b/tests/integration/pipe-loopback-amqp.sh index 275841efd..607990d97 100755 --- a/tests/integration/pipe-loopback-amqp.sh +++ b/tests/integration/pipe-loopback-amqp.sh @@ -38,7 +38,7 @@ NUM_SAMPLES=${NUM_SAMPLES:-100} # Generate test data villas-signal random -l ${NUM_SAMPLES} -n > ${INPUT_FILE} -for FORMAT in villas-human villas-binary villas-web csv json gtnet-fake raw-flt32; do +for FORMAT in villas.human villas.binary villas.web csv json gtnet.fake raw.flt32; do VECTORIZES="1" diff --git a/tests/integration/pipe-loopback-nanomsg.sh b/tests/integration/pipe-loopback-nanomsg.sh index dbbcf7335..7a468ac9e 100755 --- a/tests/integration/pipe-loopback-nanomsg.sh +++ b/tests/integration/pipe-loopback-nanomsg.sh @@ -35,7 +35,7 @@ NUM_SAMPLES=${NUM_SAMPLES:-100} # Generate test data villas-signal random -l ${NUM_SAMPLES} -n > ${INPUT_FILE} -for FORMAT in villas-human villas-binary villas-web csv json gtnet-fake raw-flt32; do +for FORMAT in villas.human villas.binary villas.web csv json gtnet.fake raw.flt32; do VECTORIZES="1" diff --git a/tests/integration/pipe-loopback-socket.sh b/tests/integration/pipe-loopback-socket.sh index ed4489b52..eb1cedb5c 100755 --- a/tests/integration/pipe-loopback-socket.sh +++ b/tests/integration/pipe-loopback-socket.sh @@ -37,7 +37,7 @@ NUM_VALUES=${NUM_VALUES:-4} # Generate test data villas-signal random -v ${NUM_VALUES} -l ${NUM_SAMPLES} -n > ${INPUT_FILE} -for FORMAT in villas-human villas-binary villas-web csv json gtnet-fake raw-flt32 protobuf; do +for FORMAT in villas.human villas.binary villas.web csv json gtnet.fake raw.flt32 protobuf; do for LAYER in udp ip eth unix; do for VERIFY_SOURCE in true false; do diff --git a/tests/integration/pipe-loopback-zeromq.sh b/tests/integration/pipe-loopback-zeromq.sh index 2e67c133a..294703d60 100755 --- a/tests/integration/pipe-loopback-zeromq.sh +++ b/tests/integration/pipe-loopback-zeromq.sh @@ -35,7 +35,7 @@ NUM_SAMPLES=${NUM_SAMPLES:-10} # Generate test data villas-signal random -l ${NUM_SAMPLES} -n -v 10 > ${INPUT_FILE} -for FORMAT in villas-human villas-binary villas-web csv json gtnet-fake raw-flt32; do +for FORMAT in villas.human villas.binary villas.web csv json gtnet.fake raw.flt32; do VECTORIZES="1" diff --git a/tests/unit/io.c b/tests/unit/io.c index 4fef0c13c..110e154c4 100644 --- a/tests/unit/io.c +++ b/tests/unit/io.c @@ -45,21 +45,21 @@ static char formats[][32] = { #ifdef WITH_FORMAT_PROTOBUF "protobuf", #endif - "raw-int8", - "raw-int16-be", - "raw-int16-le", - "raw-int32-be", - "raw-int32-le", - "raw-int64-be", - "raw-int64-le", - "raw-flt32", - "raw-flt64", - "villas-human", - "villas-binary", + "raw.int8", + "raw.int16.be", + "raw.int16.le", + "raw.int32.be", + "raw.int32.le", + "raw.int64.be", + "raw.int64.le", + "raw.flt32", + "raw.flt64", + "villas.human", + "villas.binary", "csv", "json", "gtnet", - "gtnet-fake" + "gtnet.fake" }; void generate_samples(struct pool *p, struct sample *smps[], struct sample *smpt[], unsigned cnt, unsigned values) @@ -259,7 +259,7 @@ ParameterizedTest(char *fmt, io, highlevel) #if 0 /* Show the file contents */ char cmd[128]; - if (!strcmp(fmt, "json") || !strcmp(fmt, "villas-human")) + if (!strcmp(fmt, "json") || !strcmp(fmt, "villas.human")) snprintf(cmd, sizeof(cmd), "cat %s", fn); else snprintf(cmd, sizeof(cmd), "hexdump -C %s", fn); diff --git a/tools/integration-tests-helper.sh b/tools/integration-tests-helper.sh index eabe7e625..68e1c4535 100755 --- a/tools/integration-tests-helper.sh +++ b/tools/integration-tests-helper.sh @@ -26,9 +26,9 @@ function villas_format_supports_vectorize() { local FORMAT=$1 case $FORMAT in - raw-*) ;& + raw.*) ;& gtnet) ;& - gtnet-fake) return 1 ;; + gtnet.fake) return 1 ;; esac return 0