feat(API): Add trace data functions
The trace data in the RMr header can now be set and
retrieved by the user programme with the new functions.
Change-Id: Ie00381d3671f906c703ca7d9048cf4a1a6d6194d
Signed-off-by: E. Scott Daniels <daniels@research.att.com>
Finish trace functions for nng
Change-Id: Ie7dda5d13d0d53e57347655cbb27d0fc13173d28
Signed-off-by: E. Scott Daniels <daniels@research.att.com>
Switch to address macro from offset
Change-Id: I560d696a7e5e743437b14d2737a3dde8d12c2aa9
Signed-off-by: E. Scott Daniels <daniels@research.att.com>
Set version manually
The CI process _should_ set a tag when the code is merged
and we will pull that tag and use it as the maj.min.patch
version. However, the CI process is not doing this, so
we are forced to mantain the version number in the CMake
file for now. This commit sets that version to 1.0.17.
Change-Id: I577efbd64bc0711244a1dbc1ae27eb9581b6d7d6
Signed-off-by: E. Scott Daniels <daniels@research.att.com>
Add trace functions for nanomsg
Change-Id: If640b7ee8a4996d8c324bbdd2cb4a85f68a3cc73
Signed-off-by: E. Scott Daniels <daniels@research.att.com>
diff --git a/test/mbuf_api_test.c b/test/mbuf_api_test.c
index 858efdc..30427b1 100644
--- a/test/mbuf_api_test.c
+++ b/test/mbuf_api_test.c
@@ -22,6 +22,10 @@
/*
Mnemonic: mbuf_api_test.c
Abstract: Unit tests for the mbuf common API functions.
+ To allow the mbuf functions to be tested without the bulk of the
+ RMr mechanics, we dummy up a couple of functions that are in
+ rmr[_nng].c.
+
Author: E. Scott Daniels
Date: 2 April 2019
*/
@@ -45,6 +49,47 @@
#include "test_support.c" // our private library of test tools
#include "mbuf_api_static_test.c" // test functions
+// --- dummies -------------------------------------------------------------------
+
+/*
+ This will leak, but we're not here to test free.
+*/
+extern void rmr_free_msg( rmr_mbuf_t* mbuf ) {
+ return;
+}
+
+/*
+ Minimal buffer realloc to allow api to be tested without coverage hit if
+ we actually pulled in the sr static set.
+
+ WARNING: this is NOT a complete realloc. We assume that we are testing
+ just the trace length adjustment portion of the set_trace()
+ API and are not striving to test the real realloc function. That
+ will be tested when the mbuf_api_static_test code is used by the
+ more generic RMr test. So, not all fields in the realloc'd buffer
+ can be used.
+*/
+extern rmr_mbuf_t* rmr_realloc_msg( rmr_mbuf_t* msg, int new_tr_size ) {
+ rmr_mbuf_t* new_msg;
+ uta_mhdr_t* hdr;
+
+ new_msg = (rmr_mbuf_t *) malloc( sizeof *new_msg );
+ new_msg->tp_buf = (void *) malloc( 2048 );
+ memset( new_msg->tp_buf, 0, 2048 );
+ hdr = (uta_mhdr_t*) new_msg->tp_buf;
+ SET_HDR_LEN( hdr );
+ SET_HDR_TR_LEN( hdr, new_tr_size );
+
+ new_msg->payload = new_msg->tp_buf + new_tr_size;
+ new_msg->header = new_msg->tp_buf;
+ new_msg->alloc_len = 2048;
+ new_msg->len = msg->len;
+
+ return new_msg;
+}
+
+// --------------------------------------------------------------------------------
+
int main( ) {
int errors = 0;