summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorLutz Helwing <lutz_helwing@mentor.com>2015-07-15 14:14:19 +0200
committerAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2015-10-07 10:40:33 +0200
commit1236195e9b93aeb6bfa625956fa027f96003756d (patch)
tree07b08c892a486f9f97c1674e0d253099eb3388f3 /src/tests
parent033a69218af3490f6be409f66f350c1568655f61 (diff)
downloadDLT-daemon-1236195e9b93aeb6bfa625956fa027f96003756d.tar.gz
DLT daemon improvement - dlt_init()-check
DLT daemon improvement - parameter value range check Adapt unit tests to check for enum return values Changed C version to gnu99 and C++ version to gnu++0c Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/dlt-test-client.c344
-rw-r--r--src/tests/dlt-test-filetransfer.c560
-rw-r--r--src/tests/dlt-test-multi-process-client.c340
-rw-r--r--src/tests/dlt-test-multi-process.c398
-rw-r--r--src/tests/dlt-test-stress-client.c214
-rw-r--r--src/tests/dlt-test-stress-user.c74
-rw-r--r--src/tests/dlt-test-stress.c10
-rw-r--r--src/tests/dlt-test-user.c1212
8 files changed, 1576 insertions, 1576 deletions
diff --git a/src/tests/dlt-test-client.c b/src/tests/dlt-test-client.c
index 645b0e1..a3a79d9 100644
--- a/src/tests/dlt-test-client.c
+++ b/src/tests/dlt-test-client.c
@@ -82,7 +82,7 @@
#define DLT_TESTCLIENT_TEXTBUFSIZE 10024 /* Size of buffer for text output */
#define DLT_TESTCLIENT_ECU_ID "ECU1"
-#define DLT_TESTCLIENT_NUM_TESTS 9
+#define DLT_TESTCLIENT_NUM_TESTS 9
/* Function prototypes */
int dlt_testclient_message_callback(DltMessage *message, void *data);
@@ -308,7 +308,7 @@ int main(int argc, char* argv[])
return -1;
}
- dlt_client_setbaudrate(&dltclient,dltdata.bvalue);
+ dlt_client_setbaudrate(&dltclient,dltdata.bvalue);
}
/* initialise structure to use DLT file */
@@ -319,7 +319,7 @@ int main(int argc, char* argv[])
if (dltdata.fvalue)
{
- if (dlt_filter_load(&(dltdata.filter),dltdata.fvalue,dltdata.vflag)<0)
+ if (dlt_filter_load(&(dltdata.filter),dltdata.fvalue,dltdata.vflag) < DLT_RETURN_OK)
{
dlt_file_free(&(dltdata.file),dltdata.vflag);
return -1;
@@ -351,7 +351,7 @@ int main(int argc, char* argv[])
}
/* Connect to TCP socket or open serial device */
- if (dlt_client_connect(&dltclient, dltdata.vflag)!=-1)
+ if (dlt_client_connect(&dltclient, dltdata.vflag) != DLT_RETURN_ERROR)
{
dltdata.sock = dltclient.sock;
@@ -381,18 +381,18 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
int mtin;
DltTestclientData *dltdata;
- uint32_t type_info, type_info_tmp;
- int16_t length,length_tmp; /* the macro can set this variable to -1 */
- uint32_t length_tmp32 = 0;
- uint8_t *ptr;
- int32_t datalength;
+ uint32_t type_info, type_info_tmp;
+ int16_t length,length_tmp; /* the macro can set this variable to -1 */
+ uint32_t length_tmp32 = 0;
+ uint8_t *ptr;
+ int32_t datalength;
- uint32_t id,id_tmp;
- int slen;
- int tc_old;
+ uint32_t id,id_tmp;
+ int slen;
+ int tc_old;
- struct iovec iov[2];
- int bytes_written;
+ struct iovec iov[2];
+ int bytes_written;
if ((message==0) || (data==0))
{
@@ -411,7 +411,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
dlt_set_storageheader(message->storageheader,dltdata->ecuid);
}
- if ((dltdata->fvalue==0) || (dltdata->fvalue && dlt_message_filter_check(message,&(dltdata->filter),dltdata->vflag)==1))
+ if ((dltdata->fvalue==0) || (dltdata->fvalue && dlt_message_filter_check(message,&(dltdata->filter),dltdata->vflag) == DLT_RETURN_TRUE))
{
dlt_message_header(message,text,sizeof(text),dltdata->vflag);
@@ -865,7 +865,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
ptr+=slen;
if (datalength==sizeof(uint16_t))
{
- dltdata->test_counter_macro[2]++;
+ dltdata->test_counter_macro[2]++;
}
break;
}
@@ -1122,16 +1122,16 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
}
else if (dltdata->running_test==6)
{
- if (strcmp(text,"Message (visible: locally printed)")==0)
- {
- printf("Message (visible: locally printed)\n");
- dltdata->test_counter_macro[5]++;
- }
- if (strcmp(text,"Message (invisible: not locally printed)")==0)
- {
- printf("Message (invisible: not locally printed)\n");
- dltdata->test_counter_macro[5]++;
- }
+ if (strcmp(text,"Message (visible: locally printed)")==0)
+ {
+ printf("Message (visible: locally printed)\n");
+ dltdata->test_counter_macro[5]++;
+ }
+ if (strcmp(text,"Message (invisible: not locally printed)")==0)
+ {
+ printf("Message (invisible: not locally printed)\n");
+ dltdata->test_counter_macro[5]++;
+ }
}
/* check test 7m */
@@ -1167,19 +1167,19 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
if (mtin==DLT_NW_TRACE_IPC)
{
- dltdata->test_counter_macro[6]++;
+ dltdata->test_counter_macro[6]++;
}
if (mtin==DLT_NW_TRACE_CAN)
{
- dltdata->test_counter_macro[6]++;
+ dltdata->test_counter_macro[6]++;
}
if (mtin==DLT_NW_TRACE_FLEXRAY)
{
- dltdata->test_counter_macro[6]++;
+ dltdata->test_counter_macro[6]++;
}
if (mtin==DLT_NW_TRACE_MOST)
{
- dltdata->test_counter_macro[6]++;
+ dltdata->test_counter_macro[6]++;
}
/* Check payload, must be two arguments (2 raw data blocks) */
@@ -1266,19 +1266,19 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
if (mtin==DLT_NW_TRACE_IPC)
{
- dltdata->test_counter_macro[7]++;
+ dltdata->test_counter_macro[7]++;
}
if (mtin==DLT_NW_TRACE_CAN)
{
- dltdata->test_counter_macro[7]++;
+ dltdata->test_counter_macro[7]++;
}
if (mtin==DLT_NW_TRACE_FLEXRAY)
{
- dltdata->test_counter_macro[7]++;
+ dltdata->test_counter_macro[7]++;
}
if (mtin==DLT_NW_TRACE_MOST)
{
- dltdata->test_counter_macro[7]++;
+ dltdata->test_counter_macro[7]++;
}
/* Check payload, must be two arguments (2 raw data blocks) */
@@ -1296,41 +1296,41 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_STRG)
{
- // Read NWTR
- char chdr[10];
+ // Read NWTR
+ char chdr[10];
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
if(strcmp((char *)chdr, "NWTR")==0)
{
- dltdata->test_counter_macro[7]++;
+ dltdata->test_counter_macro[7]++;
}
DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_RAWD)
{
- char hdr[2048];
+ char hdr[2048];
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
DLT_MSG_READ_STRING(hdr, ptr, datalength, length);
if(length == 16 && hdr[15] == 15)
{
- dltdata->test_counter_macro[7]++;
+ dltdata->test_counter_macro[7]++;
}
DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_UINT)
{
- uint32_t orig_size;
+ uint32_t orig_size;
DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
orig_size=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
if(orig_size == 1024*5)
{
- dltdata->test_counter_macro[7]++;
+ dltdata->test_counter_macro[7]++;
}
DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
@@ -1342,7 +1342,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
// Size of the truncated message after headers
if(length == 2001)
{
- dltdata->test_counter_macro[7]++;
+ dltdata->test_counter_macro[7]++;
}
}
}
@@ -1363,7 +1363,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
}
else if (strcmp(text,"Test9: (Macro IF) finished")==0)
{
- /* (Interface types) * (results per packet)*/
+ /* (Interface types) * (results per packet)*/
if (dltdata->test_counter_macro[8]==4*35)
{
printf("Test9m PASSED\n");
@@ -1388,19 +1388,19 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
if (mtin==DLT_NW_TRACE_IPC)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
if (mtin==DLT_NW_TRACE_CAN)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
if (mtin==DLT_NW_TRACE_FLEXRAY)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
if (mtin==DLT_NW_TRACE_MOST)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
/* Payload for first segmented message */
@@ -1419,13 +1419,13 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_STRG)
{
- char chdr[10];
+ char chdr[10];
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
if(strcmp((char *)chdr, "NWST")==0)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
/* Streahandle */
@@ -1433,12 +1433,12 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_UINT)
{
- uint32_t handle;
+ uint32_t handle;
DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
handle=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
if(handle > 0)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
/* Header */
@@ -1452,7 +1452,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
// Test packet header size 16
if(length == 16)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
/* Skip data */
ptr+=length;
@@ -1463,14 +1463,14 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_UINT)
{
- uint32_t pl_sz;
+ uint32_t pl_sz;
DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
pl_sz=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
// Test packet payload size.
if(pl_sz == 5120)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
/* Segmentcount */
@@ -1478,14 +1478,14 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_UINT)
{
- uint16_t scount;
+ uint16_t scount;
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
scount=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
/* Test packet segment count 5 */
if(scount == 5)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
/* Segment length */
@@ -1493,13 +1493,13 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_UINT)
{
- uint16_t slen;
+ uint16_t slen;
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
slen=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
/* Default segment size 1024 */
if(slen == 1024)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
}
}
@@ -1524,13 +1524,13 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_STRG)
{
- char chdr[10];
+ char chdr[10];
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
if(strcmp((char *)chdr, "NWCH")==0)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
/* handle */
@@ -1538,12 +1538,12 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_UINT)
{
- uint32_t handle;
+ uint32_t handle;
DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
handle=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
if(handle > 0)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
/* Sequence */
@@ -1554,7 +1554,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
//uint16_t seq;
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
//seq=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
/* Data */
DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
@@ -1567,7 +1567,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
// Segment size by default, 1024
if(length == 1024)
{
- dltdata->test_counter_macro[8]++;
+ dltdata->test_counter_macro[8]++;
}
}
}
@@ -1585,33 +1585,33 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
ptr = message->databuffer;
datalength = message->datasize;
- /* NWEN */
- DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
- type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
- if(type_info & DLT_TYPE_INFO_STRG)
- {
- char chdr[10];
- DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
- length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
- DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
- if(strcmp((char *)chdr, "NWEN")==0)
- {
- dltdata->test_counter_macro[8]++;
- }
-
- /* handle */
- DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
- type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
- if(type_info & DLT_TYPE_INFO_UINT)
- {
- uint32_t handle;
- DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
- handle=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
- if(handle > 0)
- {
- dltdata->test_counter_macro[8]++;
- }
- }
+ /* NWEN */
+ DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
+ type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
+ if(type_info & DLT_TYPE_INFO_STRG)
+ {
+ char chdr[10];
+ DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
+ length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
+ DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
+ if(strcmp((char *)chdr, "NWEN")==0)
+ {
+ dltdata->test_counter_macro[8]++;
+ }
+
+ /* handle */
+ DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
+ type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
+ if(type_info & DLT_TYPE_INFO_UINT)
+ {
+ uint32_t handle;
+ DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
+ handle=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
+ if(handle > 0)
+ {
+ dltdata->test_counter_macro[8]++;
+ }
+ }
}
}
}
@@ -1650,27 +1650,27 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
if (mtin==DLT_LOG_FATAL)
{
- dltdata->test_counter_function[0]++;
+ dltdata->test_counter_function[0]++;
}
if (mtin==DLT_LOG_ERROR)
{
- dltdata->test_counter_function[0]++;
+ dltdata->test_counter_function[0]++;
}
if (mtin==DLT_LOG_WARN)
{
- dltdata->test_counter_function[0]++;
+ dltdata->test_counter_function[0]++;
}
if (mtin==DLT_LOG_INFO)
{
- dltdata->test_counter_function[0]++;
+ dltdata->test_counter_function[0]++;
}
if (mtin==DLT_LOG_DEBUG)
{
- dltdata->test_counter_function[0]++;
+ dltdata->test_counter_function[0]++;
}
if (mtin==DLT_LOG_VERBOSE)
{
- dltdata->test_counter_function[0]++;
+ dltdata->test_counter_function[0]++;
}
}
}
@@ -1789,7 +1789,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
{
case DLT_TYLE_8BIT:
{
- if (datalength==sizeof(uint8_t))
+ if (datalength==sizeof(uint8_t))
{
dltdata->test_counter_function[1]++;
}
@@ -2276,16 +2276,16 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
}
else if (dltdata->running_test==15)
{
- if (strcmp(text,"Message (visible: locally printed)")==0)
- {
- printf("Message (visible: locally printed)\n");
- dltdata->test_counter_function[5]++;
- }
- if (strcmp(text,"Message (invisible: not locally printed)")==0)
- {
- printf("Message (invisible: not locally printed)\n");
- dltdata->test_counter_function[5]++;
- }
+ if (strcmp(text,"Message (visible: locally printed)")==0)
+ {
+ printf("Message (visible: locally printed)\n");
+ dltdata->test_counter_function[5]++;
+ }
+ if (strcmp(text,"Message (invisible: not locally printed)")==0)
+ {
+ printf("Message (invisible: not locally printed)\n");
+ dltdata->test_counter_function[5]++;
+ }
}
/* check test 7f */
@@ -2321,19 +2321,19 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
if (mtin==DLT_NW_TRACE_IPC)
{
- dltdata->test_counter_function[6]++;
+ dltdata->test_counter_function[6]++;
}
if (mtin==DLT_NW_TRACE_CAN)
{
- dltdata->test_counter_function[6]++;
+ dltdata->test_counter_function[6]++;
}
if (mtin==DLT_NW_TRACE_FLEXRAY)
{
- dltdata->test_counter_function[6]++;
+ dltdata->test_counter_function[6]++;
}
if (mtin==DLT_NW_TRACE_MOST)
{
- dltdata->test_counter_function[6]++;
+ dltdata->test_counter_function[6]++;
}
/* Check payload, must be two arguments (2 raw data blocks) */
@@ -2421,19 +2421,19 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
if (mtin==DLT_NW_TRACE_IPC)
{
- dltdata->test_counter_function[7]++;
+ dltdata->test_counter_function[7]++;
}
if (mtin==DLT_NW_TRACE_CAN)
{
- dltdata->test_counter_function[7]++;
+ dltdata->test_counter_function[7]++;
}
if (mtin==DLT_NW_TRACE_FLEXRAY)
{
- dltdata->test_counter_function[7]++;
+ dltdata->test_counter_function[7]++;
}
if (mtin==DLT_NW_TRACE_MOST)
{
- dltdata->test_counter_function[7]++;
+ dltdata->test_counter_function[7]++;
}
/* Check payload, must be two arguments (2 raw data blocks) */
@@ -2451,41 +2451,41 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_STRG)
{
- // Read NWTR
- char chdr[10];
+ // Read NWTR
+ char chdr[10];
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
if(strcmp((char *)chdr, "NWTR")==0)
{
- dltdata->test_counter_function[7]++;
+ dltdata->test_counter_function[7]++;
}
DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_RAWD)
{
- char hdr[2048];
+ char hdr[2048];
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
DLT_MSG_READ_STRING(hdr, ptr, datalength, length);
if(length == 16 && hdr[15] == 15)
{
- dltdata->test_counter_function[7]++;
+ dltdata->test_counter_function[7]++;
}
DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_UINT)
{
- uint32_t orig_size;
+ uint32_t orig_size;
DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
orig_size=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
if(orig_size == 1024*5)
{
- dltdata->test_counter_function[7]++;
+ dltdata->test_counter_function[7]++;
}
DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
@@ -2497,7 +2497,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
// Size of the truncated message after headers
if(length == 2001)
{
- dltdata->test_counter_function[7]++;
+ dltdata->test_counter_function[7]++;
}
}
}
@@ -2517,7 +2517,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
}
else if (strcmp(text,"Test9: (Function IF) finished")==0)
{
- /* (Interface types) * (number of messages per complete message) */
+ /* (Interface types) * (number of messages per complete message) */
if (dltdata->test_counter_function[8]==4*35)
{
printf("Test9f PASSED\n");
@@ -2542,19 +2542,19 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
if (mtin==DLT_NW_TRACE_IPC)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
if (mtin==DLT_NW_TRACE_CAN)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
if (mtin==DLT_NW_TRACE_FLEXRAY)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
if (mtin==DLT_NW_TRACE_MOST)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
/* Payload for first segmented message */
@@ -2573,13 +2573,13 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_STRG)
{
- char chdr[10];
+ char chdr[10];
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
if(strcmp((char *)chdr, "NWST")==0)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
/* Streahandle */
@@ -2587,12 +2587,12 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_UINT)
{
- uint32_t handle;
+ uint32_t handle;
DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
handle=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
if(handle > 0)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
/* Header */
@@ -2606,7 +2606,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
// Test packet header size 16
if(length == 16)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
/* Skip data */
ptr+=length;
@@ -2617,14 +2617,14 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_UINT)
{
- uint32_t pl_sz;
+ uint32_t pl_sz;
DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
pl_sz=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
// Test packet payload size.
if(pl_sz == 5120)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
/* Segmentcount */
@@ -2632,14 +2632,14 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_UINT)
{
- uint16_t scount;
+ uint16_t scount;
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
scount=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
/* Test packet segment count 5 */
if(scount == 5)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
/* Segment length */
@@ -2647,13 +2647,13 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_UINT)
{
- uint16_t slen;
+ uint16_t slen;
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
slen=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
/* Default segment size 1024 */
if(slen == 1024)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
}
}
@@ -2678,13 +2678,13 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_STRG)
{
- char chdr[10];
+ char chdr[10];
DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
if(strcmp((char *)chdr, "NWCH")==0)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
/* handle */
@@ -2692,12 +2692,12 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
if(type_info & DLT_TYPE_INFO_UINT)
{
- uint32_t handle;
+ uint32_t handle;
DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
handle=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
if(handle > 0)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
/* Sequence */
@@ -2721,7 +2721,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
// Segment size by default, 1024
if(length == 1024)
{
- dltdata->test_counter_function[8]++;
+ dltdata->test_counter_function[8]++;
}
}
}
@@ -2739,33 +2739,33 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
ptr = message->databuffer;
datalength = message->datasize;
- /* NWEN */
- DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
- type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
- if(type_info & DLT_TYPE_INFO_STRG)
- {
- char chdr[10];
- DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
- length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
- DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
- if(strcmp((char *)chdr, "NWEN")==0)
- {
- dltdata->test_counter_function[8]++;
- }
-
- /* handle */
- DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
- type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
- if(type_info & DLT_TYPE_INFO_UINT)
- {
- uint32_t handle;
- DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
- handle=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
- if(handle > 0)
- {
- dltdata->test_counter_function[8]++;
- }
- }
+ /* NWEN */
+ DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
+ type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
+ if(type_info & DLT_TYPE_INFO_STRG)
+ {
+ char chdr[10];
+ DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
+ length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
+ DLT_MSG_READ_STRING(chdr, ptr, datalength, length);
+ if(strcmp((char *)chdr, "NWEN")==0)
+ {
+ dltdata->test_counter_function[8]++;
+ }
+
+ /* handle */
+ DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
+ type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
+ if(type_info & DLT_TYPE_INFO_UINT)
+ {
+ uint32_t handle;
+ DLT_MSG_READ_VALUE(length_tmp32,ptr,datalength,uint32_t);
+ handle=DLT_ENDIAN_GET_32(message->standardheader->htyp, length_tmp32);
+ if(handle > 0)
+ {
+ dltdata->test_counter_function[8]++;
+ }
+ }
}
}
}
diff --git a/src/tests/dlt-test-filetransfer.c b/src/tests/dlt-test-filetransfer.c
index 46a6845..8c4b5c3 100644
--- a/src/tests/dlt-test-filetransfer.c
+++ b/src/tests/dlt-test-filetransfer.c
@@ -55,8 +55,8 @@
*******************************************************************************/
-#include <dlt_filetransfer.h> /*Needed for transferring files with the dlt protocol*/
-#include <dlt.h> /*Needed for dlt logging*/
+#include <dlt_filetransfer.h> /*Needed for transferring files with the dlt protocol*/
+#include <dlt.h> /*Needed for dlt logging*/
//!Declare some context for the main program. It's a must have to do this, when you want to log with dlt.
DLT_DECLARE_CONTEXT(mainContext);
@@ -80,326 +80,326 @@ int i,countPackages, transferResult;
//!Prints the test result
void printTestResultPositiveExpected(const char *function, int result){
- if(result >= 0){
- printf("%s successful\n",function);
- }
- else
- {
- printf("%s failed\n",function);
- }
+ if(result >= 0){
+ printf("%s successful\n",function);
+ }
+ else
+ {
+ printf("%s failed\n",function);
+ }
}
//!Prints the test result
void printTestResultNegativeExpected(const char *function, int result){
- if(result < 0){
- printf("%s successful\n",function);
- }
- else
- {
- printf("%s failed\n",function);
- }
+ if(result < 0){
+ printf("%s successful\n",function);
+ }
+ else
+ {
+ printf("%s failed\n",function);
+ }
}
//!Test the file transfer with the condition that the transferred file is smaller as the file transfer buffer using dlt_user_log_file_complete.
int testFile1Run1(){
- //Just some log to the main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF1P1 - dlt_user_log_file_complete"),DLT_STRING(file1));
-
- //Here's the line where the dlt file transfer is called. The method call needs a context, the absolute file path, will the file be deleted after transfer and the timeout between the packages
- transferResult = dlt_user_log_file_complete(&fileContext,file1,0,20);
- if(transferResult < 0 )
- {
- printf("Error: dlt_user_log_file_complete\n");
- return transferResult;
- }
- //Just some log to the main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF1P1"),DLT_STRING(file1));
-
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
-
- return transferResult;
+ //Just some log to the main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF1P1 - dlt_user_log_file_complete"),DLT_STRING(file1));
+
+ //Here's the line where the dlt file transfer is called. The method call needs a context, the absolute file path, will the file be deleted after transfer and the timeout between the packages
+ transferResult = dlt_user_log_file_complete(&fileContext,file1,0,20);
+ if(transferResult < 0 )
+ {
+ printf("Error: dlt_user_log_file_complete\n");
+ return transferResult;
+ }
+ //Just some log to the main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF1P1"),DLT_STRING(file1));
+
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+
+ return transferResult;
}
//!Test the file transfer with the condition that the transferred file is smaller as the file transfer buffer using single package transfer
int testFile1Run2(){
- int total_size, used_size;
-
- //Get the information how many packages have the file
- countPackages = dlt_user_log_file_packagesCount(&fileContext,file1);
- if(countPackages < 0 )
- {
- printf("Error: dlt_user_log_file_packagesCount\n");
- printTestResultPositiveExpected(__FUNCTION__,countPackages);
- return -1;
- }
- //Just some log to the main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF1P2 - transfer single package"),DLT_STRING(file1));
-
- //Logs the header of the file transfer. For more details see Mainpage.c.
- //The header gives information about the file serial number, filename (with absolute path), filesize, packages of file, buffer size
- transferResult = dlt_user_log_file_header(&fileContext,file1);
- if(transferResult >= 0)
- {
- //Loop to log all packages
- for(i=1;i<=countPackages;i++)
- {
- dlt_user_check_buffer(&total_size, &used_size);
- if((total_size - used_size) < (total_size/2))
- {
- printf("Error: dlt_user_log_file_data\n");
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
- break;
- }
-
- //Logs one single package to the file context
- transferResult = dlt_user_log_file_data(&fileContext,file1,i,20);
- if(transferResult < 0)
- {
- printf("Error: dlt_user_log_file_data\n");
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
- return transferResult;
- }
- }
-
- //Logs the end of the file transfer. For more details see Mainpage.c
- //The end gives just information about the file serial number but is needed to signal that the file transfer has correctly finished and needed for the file transfer plugin of the dlt viewer.
- transferResult = dlt_user_log_file_end(&fileContext,file1,0);
- if(transferResult < 0)
- {
- printf("Error: dlt_user_log_file_end\n");
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
- return transferResult;
- }
- }
- else
- {
- printf("Error: dlt_user_log_file_header\n");
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
- return transferResult;
- }
-
- //Just some log to main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF1P2 - transfer single package"),DLT_STRING(file1));
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
- return 0;
+ int total_size, used_size;
+
+ //Get the information how many packages have the file
+ countPackages = dlt_user_log_file_packagesCount(&fileContext,file1);
+ if(countPackages < 0 )
+ {
+ printf("Error: dlt_user_log_file_packagesCount\n");
+ printTestResultPositiveExpected(__FUNCTION__,countPackages);
+ return -1;
+ }
+ //Just some log to the main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF1P2 - transfer single package"),DLT_STRING(file1));
+
+ //Logs the header of the file transfer. For more details see Mainpage.c.
+ //The header gives information about the file serial number, filename (with absolute path), filesize, packages of file, buffer size
+ transferResult = dlt_user_log_file_header(&fileContext,file1);
+ if(transferResult >= 0)
+ {
+ //Loop to log all packages
+ for(i=1;i<=countPackages;i++)
+ {
+ dlt_user_check_buffer(&total_size, &used_size);
+ if((total_size - used_size) < (total_size/2))
+ {
+ printf("Error: dlt_user_log_file_data\n");
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ break;
+ }
+
+ //Logs one single package to the file context
+ transferResult = dlt_user_log_file_data(&fileContext,file1,i,20);
+ if(transferResult < 0)
+ {
+ printf("Error: dlt_user_log_file_data\n");
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ return transferResult;
+ }
+ }
+
+ //Logs the end of the file transfer. For more details see Mainpage.c
+ //The end gives just information about the file serial number but is needed to signal that the file transfer has correctly finished and needed for the file transfer plugin of the dlt viewer.
+ transferResult = dlt_user_log_file_end(&fileContext,file1,0);
+ if(transferResult < 0)
+ {
+ printf("Error: dlt_user_log_file_end\n");
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ return transferResult;
+ }
+ }
+ else
+ {
+ printf("Error: dlt_user_log_file_header\n");
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ return transferResult;
+ }
+
+ //Just some log to main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF1P2 - transfer single package"),DLT_STRING(file1));
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ return 0;
}
//!Test the file transfer with the condition that the transferred file is bigger as the file transfer buffer using dlt_user_log_file_complete.
int testFile2Run1(){
- //Just some log to main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF2P1 - dlt_user_log_file_complete"),DLT_STRING(file2));
-
- //Here's the line where the dlt file transfer is called. The method call needs a context, the absolute file path, will the file be deleted after transfer and the timeout between the packages
- transferResult = dlt_user_log_file_complete(&fileContext,file2,0,20);
- if(transferResult < 0)
- {
- printf("Error: dlt_user_log_file_complete\n");
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
- return transferResult;
- }
- //Just some log to main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF2P1"),DLT_STRING(file2));
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
- return transferResult;
+ //Just some log to main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF2P1 - dlt_user_log_file_complete"),DLT_STRING(file2));
+
+ //Here's the line where the dlt file transfer is called. The method call needs a context, the absolute file path, will the file be deleted after transfer and the timeout between the packages
+ transferResult = dlt_user_log_file_complete(&fileContext,file2,0,20);
+ if(transferResult < 0)
+ {
+ printf("Error: dlt_user_log_file_complete\n");
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ return transferResult;
+ }
+ //Just some log to main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF2P1"),DLT_STRING(file2));
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ return transferResult;
}
//!Test the file transfer with the condition that the transferred file is bigger as the file transfer buffer using single package transfer
int testFile2Run2(){
- int total_size, used_size;
-
- //Get the information how many packages have the file
- countPackages = dlt_user_log_file_packagesCount(&fileContext,file2);
- if(countPackages < 0 )
- {
- printf("Error: dlt_user_log_file_packagesCount\n");
- printTestResultPositiveExpected(__FUNCTION__,countPackages);
- return -1;
- }
-
- //Just some log to the main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF2P2 - transfer single package"),DLT_STRING(file2));
-
- //Logs the header of the file transfer. For more details see Mainpage.c.
- //The header gives information about the file serial number, filename (with absolute path), filesize, packages of file, buffer size
- transferResult = dlt_user_log_file_header(&fileContext,file2);
- if( transferResult >= 0){
-
- //Loop to log all packages
- for(i=1;i<=countPackages;i++)
- {
- dlt_user_check_buffer(&total_size, &used_size);
- if((total_size - used_size) < (total_size/2))
- {
- printf("Error: dlt_user_log_file_data\n");
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
- break;
- }
-
- //Logs one single package to the file context
- transferResult = dlt_user_log_file_data(&fileContext,file2,i,20);
- if(transferResult < 0)
- {
- printf("Error: dlt_user_log_file_data\n");
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
- return transferResult;
- }
- }
-
- //Logs the end of the file transfer. For more details see Mainpage.c
- //The end gives just information about the file serial number but is needed to signal that the file transfer has correctly finished and needed for the file transfer plugin of the dlt viewer.
- transferResult = dlt_user_log_file_end(&fileContext,file2,0);
- if(transferResult < 0)
- {
- printf("Error: dlt_user_log_file_end\n");
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
- return transferResult;
- }
- }
- else
- {
- printf("Error: dlt_user_log_file_header\n");
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
- return transferResult;
- }
- //Just some log to the main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF2P2"),DLT_STRING(file2));
- printTestResultPositiveExpected(__FUNCTION__,transferResult);
- return 0;
+ int total_size, used_size;
+
+ //Get the information how many packages have the file
+ countPackages = dlt_user_log_file_packagesCount(&fileContext,file2);
+ if(countPackages < 0 )
+ {
+ printf("Error: dlt_user_log_file_packagesCount\n");
+ printTestResultPositiveExpected(__FUNCTION__,countPackages);
+ return -1;
+ }
+
+ //Just some log to the main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF2P2 - transfer single package"),DLT_STRING(file2));
+
+ //Logs the header of the file transfer. For more details see Mainpage.c.
+ //The header gives information about the file serial number, filename (with absolute path), filesize, packages of file, buffer size
+ transferResult = dlt_user_log_file_header(&fileContext,file2);
+ if( transferResult >= 0){
+
+ //Loop to log all packages
+ for(i=1;i<=countPackages;i++)
+ {
+ dlt_user_check_buffer(&total_size, &used_size);
+ if((total_size - used_size) < (total_size/2))
+ {
+ printf("Error: dlt_user_log_file_data\n");
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ break;
+ }
+
+ //Logs one single package to the file context
+ transferResult = dlt_user_log_file_data(&fileContext,file2,i,20);
+ if(transferResult < 0)
+ {
+ printf("Error: dlt_user_log_file_data\n");
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ return transferResult;
+ }
+ }
+
+ //Logs the end of the file transfer. For more details see Mainpage.c
+ //The end gives just information about the file serial number but is needed to signal that the file transfer has correctly finished and needed for the file transfer plugin of the dlt viewer.
+ transferResult = dlt_user_log_file_end(&fileContext,file2,0);
+ if(transferResult < 0)
+ {
+ printf("Error: dlt_user_log_file_end\n");
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ return transferResult;
+ }
+ }
+ else
+ {
+ printf("Error: dlt_user_log_file_header\n");
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ return transferResult;
+ }
+ //Just some log to the main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF2P2"),DLT_STRING(file2));
+ printTestResultPositiveExpected(__FUNCTION__,transferResult);
+ return 0;
}
//!Test the file transfer with the condition that the transferred file does not exist using dlt_user_log_file_complete.
int testFile3Run1(){
- //Just some log to the main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF3P1"),DLT_STRING(file3_1));
-
- //Here's the line where the dlt file transfer is called. The method call needs a context, the absolute file path, will the file be deleted after transfer and the timeout between the packages
- transferResult = dlt_user_log_file_complete(&fileContext,file3_1,0,20);
- if(transferResult < 0)
- {
- //Error expected because file doesn't exist
- //printf("Error: dlt_user_log_file_complete\n");
- //Just some log to the main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF3P1"),DLT_STRING(file3_1));
- printTestResultNegativeExpected(__FUNCTION__,transferResult);
- return transferResult;
- }
- printTestResultNegativeExpected(__FUNCTION__,transferResult);
- return transferResult;
+ //Just some log to the main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF3P1"),DLT_STRING(file3_1));
+
+ //Here's the line where the dlt file transfer is called. The method call needs a context, the absolute file path, will the file be deleted after transfer and the timeout between the packages
+ transferResult = dlt_user_log_file_complete(&fileContext,file3_1,0,20);
+ if(transferResult < 0)
+ {
+ //Error expected because file doesn't exist
+ //printf("Error: dlt_user_log_file_complete\n");
+ //Just some log to the main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF3P1"),DLT_STRING(file3_1));
+ printTestResultNegativeExpected(__FUNCTION__,transferResult);
+ return transferResult;
+ }
+ printTestResultNegativeExpected(__FUNCTION__,transferResult);
+ return transferResult;
}
//!Test the file transfer with the condition that the transferred file does not exist using single package transfer
int testFile3Run2(){
- //Get the information how many packages have the file
- countPackages = dlt_user_log_file_packagesCount(&fileContext,file3_2);
- if(countPackages < 0 )
- {
- //Error expected because file doesn't exist
- //printf("Error: dlt_user_log_file_packagesCount\n");
- //Just some log to the main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF3P1"),DLT_STRING(file3_2));
- printTestResultNegativeExpected(__FUNCTION__,countPackages);
- return -1;
- }
- //Just some log to the main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF3P1"),DLT_STRING(file3_2));
-
- //Logs the header of the file transfer. For more details see Mainpage.c.
- //The header gives information about the file serial number, filename (with absolute path), filesize, packages of file, buffer size
- transferResult = dlt_user_log_file_header(&fileContext,file3_2);
- if( transferResult >= 0){
-
- //Loop to log all packages
- for(i=1;i<=countPackages;i++)
- {
- //Logs one single package to the file context
- transferResult = dlt_user_log_file_data(&fileContext,file3_2,i,20);
- if(transferResult < 0)
- {
- printf("Error: dlt_user_log_file_data\n");
- printTestResultNegativeExpected(__FUNCTION__,transferResult);
- return transferResult;
- }
- }
-
- //Logs the end of the file transfer. For more details see Mainpage.c
- //The end gives just information about the file serial number but is needed to signal that the file transfer has correctly finished and needed for the file transfer plugin of the dlt viewer.
- transferResult = dlt_user_log_file_end(&fileContext,file3_2,0);
- if(transferResult < 0)
- {
- printf("Error: dlt_user_log_file_end\n");
- printTestResultNegativeExpected(__FUNCTION__,transferResult);
- return transferResult;
- }
- }
- printTestResultNegativeExpected(__FUNCTION__,transferResult);
- return 0;
+ //Get the information how many packages have the file
+ countPackages = dlt_user_log_file_packagesCount(&fileContext,file3_2);
+ if(countPackages < 0 )
+ {
+ //Error expected because file doesn't exist
+ //printf("Error: dlt_user_log_file_packagesCount\n");
+ //Just some log to the main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF3P1"),DLT_STRING(file3_2));
+ printTestResultNegativeExpected(__FUNCTION__,countPackages);
+ return -1;
+ }
+ //Just some log to the main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF3P1"),DLT_STRING(file3_2));
+
+ //Logs the header of the file transfer. For more details see Mainpage.c.
+ //The header gives information about the file serial number, filename (with absolute path), filesize, packages of file, buffer size
+ transferResult = dlt_user_log_file_header(&fileContext,file3_2);
+ if( transferResult >= 0){
+
+ //Loop to log all packages
+ for(i=1;i<=countPackages;i++)
+ {
+ //Logs one single package to the file context
+ transferResult = dlt_user_log_file_data(&fileContext,file3_2,i,20);
+ if(transferResult < 0)
+ {
+ printf("Error: dlt_user_log_file_data\n");
+ printTestResultNegativeExpected(__FUNCTION__,transferResult);
+ return transferResult;
+ }
+ }
+
+ //Logs the end of the file transfer. For more details see Mainpage.c
+ //The end gives just information about the file serial number but is needed to signal that the file transfer has correctly finished and needed for the file transfer plugin of the dlt viewer.
+ transferResult = dlt_user_log_file_end(&fileContext,file3_2,0);
+ if(transferResult < 0)
+ {
+ printf("Error: dlt_user_log_file_end\n");
+ printTestResultNegativeExpected(__FUNCTION__,transferResult);
+ return transferResult;
+ }
+ }
+ printTestResultNegativeExpected(__FUNCTION__,transferResult);
+ return 0;
}
//!Logs some information about the file.
int testFile3Run3(){
- //Just some log to the main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF3P2"),DLT_STRING(file3_3));
-
- //Here's the line where the dlt file file info is called. The method call logs some information to dlt about the file, filesize, file serial number and number of packages
- transferResult = dlt_user_log_file_infoAbout(&fileContext,file3_3);
- if(transferResult < 0)
- {
- //Error expected because file doesn't exist
- //printf("Error: dlt_user_log_file_infoAbout\n");
- //Just some log to the main context
- DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF3P2"),DLT_STRING(file3_3));
- printTestResultNegativeExpected(__FUNCTION__,transferResult);
- return transferResult;
- }
- printTestResultNegativeExpected(__FUNCTION__,transferResult);
- return 0;
+ //Just some log to the main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Started testF3P2"),DLT_STRING(file3_3));
+
+ //Here's the line where the dlt file file info is called. The method call logs some information to dlt about the file, filesize, file serial number and number of packages
+ transferResult = dlt_user_log_file_infoAbout(&fileContext,file3_3);
+ if(transferResult < 0)
+ {
+ //Error expected because file doesn't exist
+ //printf("Error: dlt_user_log_file_infoAbout\n");
+ //Just some log to the main context
+ DLT_LOG(mainContext,DLT_LOG_INFO,DLT_STRING("Finished testF3P2"),DLT_STRING(file3_3));
+ printTestResultNegativeExpected(__FUNCTION__,transferResult);
+ return transferResult;
+ }
+ printTestResultNegativeExpected(__FUNCTION__,transferResult);
+ return 0;
}
//!Main program dlt-test-filestransfer starts here
int main(void)
{
- //First file contains some text
- file1 = "/usr/share/dlt-filetransfer/dlt-test-filetransfer-file";
- //Second file is a picture
- file2 = "/usr/share/dlt-filetransfer/dlt-test-filetransfer-image.png";
- //Third file doesn't exist. Just to test the reaction when the file isn't available.
- file3_1 = "dlt-test-filetransfer-doesntExist_1";
- //Third file doesn't exist. Just to test the reaction when the file isn't available.
- file3_2 = "dlt-test-filetransfer-doesntExist_2";
- //Third file doesn't exist. Just to test the reaction when the file isn't available.
- file3_3 = "dlt-test-filetransfer-doesntExist_3";
-
- //Register the application at the dlt-daemon
- DLT_REGISTER_APP("FLTR","Test Application filetransfer");
-
- //Register the context of the main program at the dlt-daemon
- DLT_REGISTER_CONTEXT(mainContext,"MAIN","Main context for filetransfer test");
-
- //Register the context in which the file transfer will be logged at the dlt-daemon
- DLT_REGISTER_CONTEXT(fileContext,"FLTR","Test Context for filetransfer");
-
- //More details in corresponding methods
- testFile1Run1();
- testFile1Run2();
- testFile2Run1();
- testFile2Run2();
- testFile3Run1();
- testFile3Run2();
- testFile3Run3();
-
- //Unregister the context in which the file transfer happened from the dlt-daemon
- DLT_UNREGISTER_CONTEXT(fileContext);
- //Unregister the context of the main program from the dlt-daemon
- DLT_UNREGISTER_CONTEXT(mainContext);
- //Unregister the app from the dlt-daemon
- DLT_UNREGISTER_APP();
-
- return(0);
+ //First file contains some text
+ file1 = "/usr/share/dlt-filetransfer/dlt-test-filetransfer-file";
+ //Second file is a picture
+ file2 = "/usr/share/dlt-filetransfer/dlt-test-filetransfer-image.png";
+ //Third file doesn't exist. Just to test the reaction when the file isn't available.
+ file3_1 = "dlt-test-filetransfer-doesntExist_1";
+ //Third file doesn't exist. Just to test the reaction when the file isn't available.
+ file3_2 = "dlt-test-filetransfer-doesntExist_2";
+ //Third file doesn't exist. Just to test the reaction when the file isn't available.
+ file3_3 = "dlt-test-filetransfer-doesntExist_3";
+
+ //Register the application at the dlt-daemon
+ DLT_REGISTER_APP("FLTR","Test Application filetransfer");
+
+ //Register the context of the main program at the dlt-daemon
+ DLT_REGISTER_CONTEXT(mainContext,"MAIN","Main context for filetransfer test");
+
+ //Register the context in which the file transfer will be logged at the dlt-daemon
+ DLT_REGISTER_CONTEXT(fileContext,"FLTR","Test Context for filetransfer");
+
+ //More details in corresponding methods
+ testFile1Run1();
+ testFile1Run2();
+ testFile2Run1();
+ testFile2Run2();
+ testFile3Run1();
+ testFile3Run2();
+ testFile3Run3();
+
+ //Unregister the context in which the file transfer happened from the dlt-daemon
+ DLT_UNREGISTER_CONTEXT(fileContext);
+ //Unregister the context of the main program from the dlt-daemon
+ DLT_UNREGISTER_CONTEXT(mainContext);
+ //Unregister the app from the dlt-daemon
+ DLT_UNREGISTER_APP();
+
+ return(0);
}
diff --git a/src/tests/dlt-test-multi-process-client.c b/src/tests/dlt-test-multi-process-client.c
index fdd0307..c943578 100644
--- a/src/tests/dlt-test-multi-process-client.c
+++ b/src/tests/dlt-test-multi-process-client.c
@@ -63,22 +63,22 @@
// Local data structures
typedef struct {
- int max_messages;
- int verbose;
- int serial;
- int baudrate;
- char *output;
- int output_handle;
- int messages_left;
- DltClient *client_ref;
+ int max_messages;
+ int verbose;
+ int serial;
+ int baudrate;
+ char *output;
+ int output_handle;
+ int messages_left;
+ DltClient *client_ref;
} s_parameters;
typedef struct {
- int messages_received;
- int broken_messages_received;
- int bytes_received;
- int first_message_time;
- int output_bytes;
+ int messages_received;
+ int broken_messages_received;
+ int bytes_received;
+ int first_message_time;
+ int output_bytes;
} s_statistics;
// Forward declarations
@@ -88,17 +88,17 @@ int receive(DltMessage *msg, void *data);
* Print usage information
*/
void usage(char *name) {
- char version[255];
- dlt_get_version(version,255);
-
- printf("Usage: %s [options] <remote address|serial device>\n", name);
- printf("Receive messages from dlt-test-multi-process.\n");
- printf("%s", version);
- printf("Options:\n");
- printf(" -m Total messages to receive. (Default: 10000)\n");
+ char version[255];
+ dlt_get_version(version,255);
+
+ printf("Usage: %s [options] <remote address|serial device>\n", name);
+ printf("Receive messages from dlt-test-multi-process.\n");
+ printf("%s", version);
+ printf("Options:\n");
+ printf(" -m Total messages to receive. (Default: 10000)\n");
printf(" -y Serial device mode.\n");
printf(" -b baudrate Serial device baudrate. (Default: 115200)\n");
- printf(" -v Verbose. Increases the verbosity level of dlt client library.\n");
+ printf(" -v Verbose. Increases the verbosity level of dlt client library.\n");
printf(" -o filename Output messages in new DLT file.\n");
}
@@ -106,106 +106,106 @@ void usage(char *name) {
* Initialize reasonable default parameters.
*/
void init_params(s_parameters *params) {
- params->max_messages = 10000;
- params->verbose = 0;
- params->serial = 0;
- params->output = NULL;
- params->output_handle = -1;
- params->baudrate = 115200;
+ params->max_messages = 10000;
+ params->verbose = 0;
+ params->serial = 0;
+ params->output = NULL;
+ params->output_handle = -1;
+ params->baudrate = 115200;
}
/**
* Read the command line parameters
*/
int read_params(s_parameters *params, int argc, char *argv[]) {
- init_params(params);
- int c;
- opterr = 0;
- while ((c = getopt(argc, argv, "m:yb:vo:")) != -1) {
- switch (c) {
- case 'm':
- params->max_messages = atoi(optarg);
- break;
- case 'y':
- params->serial = 1;
- break;
- case 'b':
- params->baudrate = atoi(optarg);
- break;
- case 'v':
- params->verbose = 1;
- break;
- case 'o':
- params->output = optarg;
- break;
- case '?':
- if(optopt == 'm' || optopt == 'b' || optopt == 'o')
- {
- fprintf(stderr, "Option -%c requires an argument.\n", optopt);
- }
- if (isprint(optopt)) {
- fprintf(stderr, "Unknown option '-%c'.\n", optopt);
- } else {
- fprintf(stderr, "Unknown option character '\\x%x'.\n", optopt);
- }
- return -1;
- break;
- default:
- return -1;
- }
- }
- return 0;
+ init_params(params);
+ int c;
+ opterr = 0;
+ while ((c = getopt(argc, argv, "m:yb:vo:")) != -1) {
+ switch (c) {
+ case 'm':
+ params->max_messages = atoi(optarg);
+ break;
+ case 'y':
+ params->serial = 1;
+ break;
+ case 'b':
+ params->baudrate = atoi(optarg);
+ break;
+ case 'v':
+ params->verbose = 1;
+ break;
+ case 'o':
+ params->output = optarg;
+ break;
+ case '?':
+ if(optopt == 'm' || optopt == 'b' || optopt == 'o')
+ {
+ fprintf(stderr, "Option -%c requires an argument.\n", optopt);
+ }
+ if (isprint(optopt)) {
+ fprintf(stderr, "Unknown option '-%c'.\n", optopt);
+ } else {
+ fprintf(stderr, "Unknown option character '\\x%x'.\n", optopt);
+ }
+ return -1;
+ break;
+ default:
+ return -1;
+ }
+ }
+ return 0;
}
/**
* Set the connection parameters for dlt client
*/
int init_dlt_connect(DltClient *client, const s_parameters *params, int argc, char *argv[]) {
- char id[4];
- if (argc < 2)
- return -1;
- if(params->serial > 0)
- {
- client->serial_mode = 1;
- client->serialDevice = argv[argc - 1];
- dlt_client_setbaudrate(client, params->baudrate);
- }
- else
- {
- client->servIP = argv[argc - 1];
- }
- dlt_set_id(id, ECUID);
- return 0;
+ char id[4];
+ if (argc < 2)
+ return -1;
+ if(params->serial > 0)
+ {
+ client->serial_mode = 1;
+ client->serialDevice = argv[argc - 1];
+ dlt_client_setbaudrate(client, params->baudrate);
+ }
+ else
+ {
+ client->servIP = argv[argc - 1];
+ }
+ dlt_set_id(id, ECUID);
+ return 0;
}
/**
* Entry point
*/
int main(int argc, char *argv[]) {
- s_parameters params;
- DltClient client;
- params.client_ref = &client;
- int err = read_params(&params, argc, argv);
-
- if (err != 0) {
- usage(argv[0]);
- return err;
- }
-
- dlt_client_init(&client, params.verbose);
- dlt_client_register_message_callback(receive);
-
- err = init_dlt_connect(&client, &params, argc, argv);
- if (err != 0) {
- usage(argv[0]);
- return err;
- }
-
- err = dlt_client_connect(&client, params.verbose);
- if (err != 0) {
- printf("Failed to connect %s.\n", client.serial_mode > 0 ? client.serialDevice : client.servIP);
- return err;
- }
+ s_parameters params;
+ DltClient client;
+ params.client_ref = &client;
+ int err = read_params(&params, argc, argv);
+
+ if (err != 0) {
+ usage(argv[0]);
+ return err;
+ }
+
+ dlt_client_init(&client, params.verbose);
+ dlt_client_register_message_callback(receive);
+
+ err = init_dlt_connect(&client, &params, argc, argv);
+ if (err != 0) {
+ usage(argv[0]);
+ return err;
+ }
+
+ err = dlt_client_connect(&client, params.verbose);
+ if (err != DLT_RETURN_OK) {
+ printf("Failed to connect %s.\n", client.serial_mode > 0 ? client.serialDevice : client.servIP);
+ return err;
+ }
if(params.output)
{
@@ -220,13 +220,13 @@ int main(int argc, char *argv[]) {
params.messages_left = params.max_messages;
- dlt_client_main_loop(&client, &params, params.verbose);
+ dlt_client_main_loop(&client, &params, params.verbose);
- if(params.output_handle > 0)
- {
- close(params.output_handle);
- }
- return 0;
+ if(params.output_handle > 0)
+ {
+ close(params.output_handle);
+ }
+ return 0;
}
/**
@@ -234,79 +234,79 @@ int main(int argc, char *argv[]) {
*/
void print_stats(s_statistics stats, s_parameters params)
{
- static int last_print_time;
- if(last_print_time >= time(NULL) && // Only print once a second
- (stats.messages_received+stats.broken_messages_received) % 1000 != 0 &&
- params.messages_left != 0) // Print also every 1000th message
- {
- return;
- }
- printf("\033[2J\033[1;1H"); // Clear screen.
- printf("Statistics:\n");
- printf(" Messages received : %d\n", stats.messages_received);
- printf(" Broken messages received : %d\n", stats.broken_messages_received);
- printf(" Bytes received : %d\n", stats.bytes_received);
- printf(" Time running (seconds) : %ld\n", time(NULL)-stats.first_message_time);
- printf(" Throughput (msgs/sec)/(B/sec) : %ld/%ld\n",
- stats.messages_received/((time(NULL)-stats.first_message_time)+1),
- (stats.bytes_received)/((time(NULL)-stats.first_message_time)+1));
- if(params.messages_left == 0)
- {
- if(stats.broken_messages_received == 0)
- printf("All messages received succesfully!\n");
- else
- printf("Test failure! There were %d broken messages.", stats.broken_messages_received);
-
- }
- fflush(stdout);
- last_print_time = time(NULL);
+ static int last_print_time;
+ if(last_print_time >= time(NULL) && // Only print once a second
+ (stats.messages_received+stats.broken_messages_received) % 1000 != 0 &&
+ params.messages_left != 0) // Print also every 1000th message
+ {
+ return;
+ }
+ printf("\033[2J\033[1;1H"); // Clear screen.
+ printf("Statistics:\n");
+ printf(" Messages received : %d\n", stats.messages_received);
+ printf(" Broken messages received : %d\n", stats.broken_messages_received);
+ printf(" Bytes received : %d\n", stats.bytes_received);
+ printf(" Time running (seconds) : %ld\n", time(NULL)-stats.first_message_time);
+ printf(" Throughput (msgs/sec)/(B/sec) : %ld/%ld\n",
+ stats.messages_received/((time(NULL)-stats.first_message_time)+1),
+ (stats.bytes_received)/((time(NULL)-stats.first_message_time)+1));
+ if(params.messages_left == 0)
+ {
+ if(stats.broken_messages_received == 0)
+ printf("All messages received succesfully!\n");
+ else
+ printf("Test failure! There were %d broken messages.", stats.broken_messages_received);
+
+ }
+ fflush(stdout);
+ last_print_time = time(NULL);
}
/**
* Callback for dlt client
*/
int receive(DltMessage *msg, void *data) {
- static s_statistics stats;
- char apid[5];
- struct iovec iov[2];
- s_parameters *params = (s_parameters *)data;
+ static s_statistics stats;
+ char apid[5];
+ struct iovec iov[2];
+ s_parameters *params = (s_parameters *)data;
- memset(apid, 0, 5);
- memcpy(apid, msg->extendedheader->apid, 4);
+ memset(apid, 0, 5);
+ memcpy(apid, msg->extendedheader->apid, 4);
- if(apid[0] != 'M' || apid[1] != 'T') // TODO: Check through the app description
- return 0;
+ if(apid[0] != 'M' || apid[1] != 'T') // TODO: Check through the app description
+ return 0;
params->messages_left--;
- if(stats.first_message_time == 0)
- {
- stats.first_message_time = time(NULL);
- }
+ if(stats.first_message_time == 0)
+ {
+ stats.first_message_time = time(NULL);
+ }
- int buflen = msg->datasize + 1;
- char *buf = malloc(buflen);
- if(buf==0)
- {
- printf("Out of memory\n");
- return -1;
- }
- memset(buf, 0, buflen);
+ int buflen = msg->datasize + 1;
+ char *buf = malloc(buflen);
+ if(buf==0)
+ {
+ printf("Out of memory\n");
+ return -1;
+ }
+ memset(buf, 0, buflen);
- dlt_message_payload(msg,buf,buflen-1,DLT_OUTPUT_ASCII,0);
+ dlt_message_payload(msg,buf,buflen-1,DLT_OUTPUT_ASCII,0);
- if(strcmp(buf, PAYLOAD_DATA) == 0)
- {
- stats.messages_received++;
- }
- else
- {
- stats.broken_messages_received++;
- }
- stats.bytes_received += msg->datasize+msg->headersize-sizeof(DltStorageHeader);;
+ if(strcmp(buf, PAYLOAD_DATA) == 0)
+ {
+ stats.messages_received++;
+ }
+ else
+ {
+ stats.broken_messages_received++;
+ }
+ stats.bytes_received += msg->datasize+msg->headersize-sizeof(DltStorageHeader);;
- free(buf);
+ free(buf);
- print_stats(stats, *params);
+ print_stats(stats, *params);
if (params->output_handle > 0)
{
@@ -319,7 +319,7 @@ int receive(DltMessage *msg, void *data) {
}
if(params->messages_left < 1)
{
- dlt_client_cleanup(params->client_ref, params->verbose);
+ dlt_client_cleanup(params->client_ref, params->verbose);
}
- return 0;
+ return 0;
}
diff --git a/src/tests/dlt-test-multi-process.c b/src/tests/dlt-test-multi-process.c
index 93fd069..c5c8ddd 100644
--- a/src/tests/dlt-test-multi-process.c
+++ b/src/tests/dlt-test-multi-process.c
@@ -64,16 +64,16 @@
// Structs
typedef struct {
- int nmsgs; // Number of messages to send
- int nprocs; // Number of processes to start
- int nthreads; // Number of threads to start
- int delay; // Delay between logs messages for each process
- int delay_fudge; // Fudge the delay by 0-n to cause desynchronization
+ int nmsgs; // Number of messages to send
+ int nprocs; // Number of processes to start
+ int nthreads; // Number of threads to start
+ int delay; // Delay between logs messages for each process
+ int delay_fudge; // Fudge the delay by 0-n to cause desynchronization
} s_parameters;
typedef struct {
- s_parameters params;
- DltContext ctx;
+ s_parameters params;
+ DltContext ctx;
} s_thread_data;
// Forward declarations
@@ -97,31 +97,31 @@ unsigned int pidcount = 0;
*/
void usage(char *prog_name)
{
- char version[255];
- dlt_get_version(version,255);
- s_parameters defaults;
- init_params(&defaults);
-
- printf("Usage: %s [options]\n", prog_name);
- printf("Test application for stress testing the daemon with multiple processes and threads.\n");
- printf("%s\n", version);
- printf("Options (Default):\n");
- printf(" -m number Number of messages per thread to send. (%d)\n", defaults.nmsgs);
- printf(" -p number Number of processes to start. (%d), Max %d.\n", defaults.nprocs, MAX_PROCS);
- printf(" -t number Number of threads per process. (%d), Max %d.\n", defaults.nthreads, MAX_THREADS);
- printf(" -d delay Delay in milliseconds to wait between log messages. (%d)\n", defaults.delay);
- printf(" -f delay Random fudge in milliseconds to add to delay. (%d)\n", defaults.delay_fudge);
+ char version[255];
+ dlt_get_version(version,255);
+ s_parameters defaults;
+ init_params(&defaults);
+
+ printf("Usage: %s [options]\n", prog_name);
+ printf("Test application for stress testing the daemon with multiple processes and threads.\n");
+ printf("%s\n", version);
+ printf("Options (Default):\n");
+ printf(" -m number Number of messages per thread to send. (%d)\n", defaults.nmsgs);
+ printf(" -p number Number of processes to start. (%d), Max %d.\n", defaults.nprocs, MAX_PROCS);
+ printf(" -t number Number of threads per process. (%d), Max %d.\n", defaults.nthreads, MAX_THREADS);
+ printf(" -d delay Delay in milliseconds to wait between log messages. (%d)\n", defaults.delay);
+ printf(" -f delay Random fudge in milliseconds to add to delay. (%d)\n", defaults.delay_fudge);
}
/**
* Set nice default values for parameters
*/
void init_params(s_parameters * params) {
- params->nmsgs = 100;
- params->nprocs = 10;
- params->nthreads = 2;
- params->delay = 1000;
- params->delay_fudge = 100;
+ params->nmsgs = 100;
+ params->nprocs = 10;
+ params->nthreads = 2;
+ params->delay = 1000;
+ params->delay_fudge = 100;
}
/**
@@ -129,58 +129,58 @@ void init_params(s_parameters * params) {
*/
int read_cli(s_parameters *params, int argc, char **argv)
{
- int c;
- opterr = 0;
+ int c;
+ opterr = 0;
while ((c = getopt (argc, argv, "m:p:t:d:f:")) != -1)
- {
- switch(c)
- {
- case 'm':
- params->nmsgs = atoi(optarg);
- break;
- case 'p':
- params->nprocs = atoi(optarg);
- if(params->nprocs > MAX_PROCS)
- {
- fprintf(stderr, "Too many processes selected.\n");
- return -1;
- }
- break;
- case 't':
- params->nthreads = atoi(optarg);
- if(params->nprocs > MAX_PROCS)
- {
- fprintf(stderr, "Too many threads selected.\n");
- return -1;
- }
- break;
- case 'd':
- params->delay = atoi(optarg);
- break;
- case 'f':
- params->delay_fudge = atoi(optarg);
- break;
- case '?':
- if(optopt == 'n' || optopt == 'd' || optopt == 'f')
- {
- fprintf(stderr, "Option -%c requires an argument.\n", optopt);
- }
- else if(isprint(optopt))
- {
- fprintf(stderr, "Unknown option '-%c'.\n", optopt);
- }
- else
- {
- fprintf(stderr, "Unknown option character '\\x%x'.\n", optopt);
- }
- return -1;
- break;
- default:
- abort();
+ {
+ switch(c)
+ {
+ case 'm':
+ params->nmsgs = atoi(optarg);
+ break;
+ case 'p':
+ params->nprocs = atoi(optarg);
+ if(params->nprocs > MAX_PROCS)
+ {
+ fprintf(stderr, "Too many processes selected.\n");
+ return -1;
+ }
+ break;
+ case 't':
+ params->nthreads = atoi(optarg);
+ if(params->nprocs > MAX_PROCS)
+ {
+ fprintf(stderr, "Too many threads selected.\n");
+ return -1;
+ }
+ break;
+ case 'd':
+ params->delay = atoi(optarg);
+ break;
+ case 'f':
+ params->delay_fudge = atoi(optarg);
+ break;
+ case '?':
+ if(optopt == 'n' || optopt == 'd' || optopt == 'f')
+ {
+ fprintf(stderr, "Option -%c requires an argument.\n", optopt);
+ }
+ else if(isprint(optopt))
+ {
+ fprintf(stderr, "Unknown option '-%c'.\n", optopt);
+ }
+ else
+ {
+ fprintf(stderr, "Unknown option character '\\x%x'.\n", optopt);
+ }
+ return -1;
+ break;
+ default:
+ abort();
return -1;//for parasoft
- }
- }
- return 0;
+ }
+ }
+ return 0;
}
/**
@@ -188,31 +188,31 @@ int read_cli(s_parameters *params, int argc, char **argv)
*/
int main(int argc, char **argv)
{
- // Prepare parameters
- s_parameters params;
- init_params(&params);
- if(read_cli(&params, argc, argv) != 0) {
- usage(argv[0]);
- exit(-1);
- }
-
- // Launch the child processes
- do_forks(params);
-
- // Register signal handlers
- if(signal(SIGINT, quit_handler) == SIG_IGN)
- signal(SIGINT, SIG_IGN); // C-c
- if(signal(SIGHUP, quit_handler) == SIG_IGN)
- signal(SIGHUP, SIG_IGN); // Terminal closed
- if(signal(SIGTERM, quit_handler) == SIG_IGN)
- signal(SIGTERM, SIG_IGN); // kill (nice)
-
- printf("Setup done. Listening. My pid: %d\n", getpid());
- fflush(stdout);
-
- int err = wait_for_death();
- cleanup();
- return err;
+ // Prepare parameters
+ s_parameters params;
+ init_params(&params);
+ if(read_cli(&params, argc, argv) != 0) {
+ usage(argv[0]);
+ exit(-1);
+ }
+
+ // Launch the child processes
+ do_forks(params);
+
+ // Register signal handlers
+ if(signal(SIGINT, quit_handler) == SIG_IGN)
+ signal(SIGINT, SIG_IGN); // C-c
+ if(signal(SIGHUP, quit_handler) == SIG_IGN)
+ signal(SIGHUP, SIG_IGN); // Terminal closed
+ if(signal(SIGTERM, quit_handler) == SIG_IGN)
+ signal(SIGTERM, SIG_IGN); // kill (nice)
+
+ printf("Setup done. Listening. My pid: %d\n", getpid());
+ fflush(stdout);
+
+ int err = wait_for_death();
+ cleanup();
+ return err;
}
/**
@@ -223,34 +223,34 @@ void do_forks(s_parameters params)
{
int i;
- // Launch child processes
- for(i=0;i<params.nprocs;i++)
- {
- pid_t pid = fork();
- switch(pid)
- {
- case -1: // An error occured
- if(errno == EAGAIN)
- {
- fprintf(stderr, "Could not allocate resources for child process.\n");
- cleanup();
- abort();
- }
- if(errno == ENOMEM)
- {
- fprintf(stderr, "Could not allocate memory for child process' kernel structure.\n");
- cleanup();
- abort();
- }
- break;
- case 0: // Child process, start threads
- run_threads(params);
- break;
- default: // Parent process, store the childs pid
- pids[pidcount++] = pid;
- break;
- }
- }
+ // Launch child processes
+ for(i=0;i<params.nprocs;i++)
+ {
+ pid_t pid = fork();
+ switch(pid)
+ {
+ case -1: // An error occured
+ if(errno == EAGAIN)
+ {
+ fprintf(stderr, "Could not allocate resources for child process.\n");
+ cleanup();
+ abort();
+ }
+ if(errno == ENOMEM)
+ {
+ fprintf(stderr, "Could not allocate memory for child process' kernel structure.\n");
+ cleanup();
+ abort();
+ }
+ break;
+ case 0: // Child process, start threads
+ run_threads(params);
+ break;
+ default: // Parent process, store the childs pid
+ pids[pidcount++] = pid;
+ break;
+ }
+ }
}
/**
@@ -259,14 +259,14 @@ void do_forks(s_parameters params)
*/
void quit_handler(int signum)
{
- if(in_handler)
- raise(signum);
- in_handler = 1;
+ if(in_handler)
+ raise(signum);
+ in_handler = 1;
- cleanup();
+ cleanup();
- signal(signum, SIG_DFL);
- raise(signum);
+ signal(signum, SIG_DFL);
+ raise(signum);
}
/**
@@ -274,11 +274,11 @@ void quit_handler(int signum)
*/
void cleanup()
{
- unsigned int i;
- for(i=0;i<pidcount;i++)
- {
- kill(pids[i], SIGINT);
- }
+ unsigned int i;
+ for(i=0;i<pidcount;i++)
+ {
+ kill(pids[i], SIGINT);
+ }
}
/**
@@ -297,22 +297,22 @@ time_t mksleep_time(int delay, int fudge)
*/
void do_logging(s_thread_data *data)
{
- DltContext mycontext;
- char ctid[5];
- char ctid_name[256];
+ DltContext mycontext;
+ char ctid[5];
+ char ctid_name[256];
snprintf(ctid,5,"%.2x", rand() & 0x0000ffff);
- snprintf(ctid_name,256, "Child %s in dlt-test-multi-process", ctid);
- DLT_REGISTER_CONTEXT(mycontext, ctid, ctid_name);
-
- int msgs_left = data->params.nmsgs;
- while(msgs_left-- > 0)
- {
- DLT_LOG(mycontext, DLT_LOG_INFO, DLT_STRING(PAYLOAD_DATA));
- usleep(mksleep_time(data->params.delay, data->params.delay_fudge));
- }
- DLT_UNREGISTER_CONTEXT(mycontext);
+ snprintf(ctid_name,256, "Child %s in dlt-test-multi-process", ctid);
+ DLT_REGISTER_CONTEXT(mycontext, ctid, ctid_name);
+
+ int msgs_left = data->params.nmsgs;
+ while(msgs_left-- > 0)
+ {
+ DLT_LOG(mycontext, DLT_LOG_INFO, DLT_STRING(PAYLOAD_DATA));
+ usleep(mksleep_time(data->params.delay, data->params.delay_fudge));
+ }
+ DLT_UNREGISTER_CONTEXT(mycontext);
}
/**
@@ -320,39 +320,39 @@ void do_logging(s_thread_data *data)
*/
void run_threads(s_parameters params)
{
- pthread_t thread[params.nthreads];
- s_thread_data thread_data;
- char apid[5];
- char apid_name[256];
- int i;
+ pthread_t thread[params.nthreads];
+ s_thread_data thread_data;
+ char apid[5];
+ char apid_name[256];
+ int i;
- srand(getpid());
+ srand(getpid());
snprintf(apid,5,"MT%02u", pidcount);
snprintf(apid_name,256, "Apps %s.", apid);
- DLT_REGISTER_APP(apid, apid_name);
+ DLT_REGISTER_APP(apid, apid_name);
- thread_data.params = params;
+ thread_data.params = params;
- for(i=0;i<params.nthreads;i++)
- {
- if(pthread_create(&(thread[i]), NULL, (void *) &do_logging, &thread_data) != 0)
- {
- printf("Error creating thread.\n");
- abort();
- }
- }
+ for(i=0;i<params.nthreads;i++)
+ {
+ if(pthread_create(&(thread[i]), NULL, (void *) &do_logging, &thread_data) != 0)
+ {
+ printf("Error creating thread.\n");
+ abort();
+ }
+ }
- for(i=0;i<params.nthreads;i++)
- {
- pthread_join(thread[i], NULL);
- }
+ for(i=0;i<params.nthreads;i++)
+ {
+ pthread_join(thread[i], NULL);
+ }
- DLT_UNREGISTER_APP();
- // We can exit now
- exit(0);
+ DLT_UNREGISTER_APP();
+ // We can exit now
+ exit(0);
}
/**
@@ -360,27 +360,27 @@ void run_threads(s_parameters params)
*/
int wait_for_death()
{
- int pids_left = pidcount;
- while(pids_left > 0)
- {
- int status;
- pid_t w = waitpid(WAIT_ANY, &status, 0);
- if(status < 0)
- {
- return -1;
- }
- else
- {
- unsigned int i;
- for(i=0;i<pidcount;i++)
- {
- if(pids[i] == w)
- {
- pids_left--;
- break;
- }
- }
- }
- }
- return 0;
+ int pids_left = pidcount;
+ while(pids_left > 0)
+ {
+ int status;
+ pid_t w = waitpid(WAIT_ANY, &status, 0);
+ if(status < 0)
+ {
+ return -1;
+ }
+ else
+ {
+ unsigned int i;
+ for(i=0;i<pidcount;i++)
+ {
+ if(pids[i] == w)
+ {
+ pids_left--;
+ break;
+ }
+ }
+ }
+ }
+ return 0;
}
diff --git a/src/tests/dlt-test-stress-client.c b/src/tests/dlt-test-stress-client.c
index 28c2c9e..fc62230 100644
--- a/src/tests/dlt-test-stress-client.c
+++ b/src/tests/dlt-test-stress-client.c
@@ -81,7 +81,7 @@
#define DLT_TESTCLIENT_TEXTBUFSIZE 10024 /* Size of buffer for text output */
#define DLT_TESTCLIENT_ECU_ID "ECU1"
-#define DLT_TESTCLIENT_NUM_TESTS 7
+#define DLT_TESTCLIENT_NUM_TESTS 7
/* Function prototypes */
int dlt_testclient_message_callback(DltMessage *message, void *data);
@@ -188,8 +188,8 @@ int main(int argc, char* argv[])
dltdata.tests_passed = 0;
dltdata.tests_failed = 0;
- dltdata.bytes_received = 0;
- dltdata.time_elapsed = dlt_uptime();
+ dltdata.bytes_received = 0;
+ dltdata.time_elapsed = dlt_uptime();
dltdata.last_value = 0;
dltdata.count_received_messages = 0;
@@ -331,7 +331,7 @@ int main(int argc, char* argv[])
return -1;
}
- dlt_client_setbaudrate(&dltclient,dltdata.bvalue);
+ dlt_client_setbaudrate(&dltclient,dltdata.bvalue);
}
/* initialise structure to use DLT file */
@@ -342,7 +342,7 @@ int main(int argc, char* argv[])
if (dltdata.fvalue)
{
- if (dlt_filter_load(&(dltdata.filter),dltdata.fvalue,dltdata.vflag)<0)
+ if (dlt_filter_load(&(dltdata.filter),dltdata.fvalue,dltdata.vflag) < DLT_RETURN_OK)
{
dlt_file_free(&(dltdata.file),dltdata.vflag);
return -1;
@@ -374,7 +374,7 @@ int main(int argc, char* argv[])
}
/* Connect to TCP socket or open serial device */
- if (dlt_client_connect(&dltclient, dltdata.vflag)!=-1)
+ if (dlt_client_connect(&dltclient, dltdata.vflag) != DLT_RETURN_ERROR)
{
dltdata.sock = dltclient.sock;
@@ -403,15 +403,15 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
static char text[DLT_TESTCLIENT_TEXTBUFSIZE];
DltTestclientData *dltdata;
- uint32_t type_info, type_info_tmp;
- int16_t length,length_tmp; /* the macro can set this variable to -1 */
- uint8_t *ptr;
- int32_t datalength;
- int32_t value;
- uint32_t value_tmp = 0;
+ uint32_t type_info, type_info_tmp;
+ int16_t length,length_tmp; /* the macro can set this variable to -1 */
+ uint8_t *ptr;
+ int32_t datalength;
+ int32_t value;
+ uint32_t value_tmp = 0;
- struct iovec iov[2];
- int bytes_written;
+ struct iovec iov[2];
+ int bytes_written;
if ((message==0) || (data==0))
{
@@ -430,7 +430,7 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
dlt_set_storageheader(message->storageheader,dltdata->ecuid);
}
- if ((dltdata->fvalue==0) || (dltdata->fvalue && dlt_message_filter_check(message,&(dltdata->filter),dltdata->vflag)==1))
+ if ((dltdata->fvalue==0) || (dltdata->fvalue && dlt_message_filter_check(message,&(dltdata->filter),dltdata->vflag) == DLT_RETURN_TRUE))
{
//dlt_message_header(message,text,sizeof(text),dltdata->vflag);
@@ -444,98 +444,98 @@ int dlt_testclient_message_callback(DltMessage *message, void *data)
//printf("[%s]\n",text);
}
- /* do something here */
-
- // Count number of received bytes
- dltdata->bytes_received += message->datasize+message->headersize-sizeof(DltStorageHeader);
-
- // print number of received bytes
- if((dlt_uptime() - dltdata->time_elapsed) > 10000)
- {
- printf("Received %lu Bytes/s\n",dltdata->bytes_received/**10000/(dlt_uptime()-dltdata->time_elapsed)*/);
- //printf("Received %lu Bytes received\n",dltdata->bytes_received);
- dltdata->time_elapsed = dlt_uptime();
- dltdata->bytes_received = 0;
- }
-
- /* Extended header */
- if (DLT_IS_HTYP_UEH(message->standardheader->htyp))
- {
- /* Log message */
- if ((DLT_GET_MSIN_MSTP(message->extendedheader->msin))==DLT_TYPE_LOG)
- {
- /* Verbose */
- if (DLT_IS_MSIN_VERB(message->extendedheader->msin))
- {
- /* 2 arguments */
- if (message->extendedheader->noar==2)
- {
- /* verbose mode */
- type_info=0;
- type_info_tmp=0;
- length=0;
- length_tmp=0; /* the macro can set this variable to -1 */
-
- ptr = message->databuffer;
- datalength = message->datasize;
-
- /* first read the type info of the first argument: must be string */
- DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
- type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
-
- if (type_info & DLT_TYPE_INFO_SINT)
- {
- /* read value */
- DLT_MSG_READ_VALUE(value_tmp,ptr,datalength,int32_t);
- value=DLT_ENDIAN_GET_32(message->standardheader->htyp, value_tmp);
- //printf("%d\n",value);
-
- if(value < dltdata->last_value)
- {
- if(dltdata->nvalue == dltdata->count_received_messages)
- printf("PASSED: %d Msg received, %d not received\n",dltdata->count_received_messages,dltdata->count_not_received_messages);
- else
- printf("FAILED: %d Msg received, %d not received\n",dltdata->count_received_messages,dltdata->count_not_received_messages);
-
- dltdata->last_value = 0;
- dltdata->count_received_messages = 0;
- dltdata->count_not_received_messages = value -1;
- }
- else
- {
- dltdata->count_not_received_messages += value - dltdata->last_value -1;
- }
- dltdata->last_value = value;
- dltdata->count_received_messages++;
-
- if (length>=0)
- {
- ptr+=length;
- datalength-=length;
-
- /* read type of second argument: must be raw */
- DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
- type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
-
- if (type_info & DLT_TYPE_INFO_RAWD)
- {
- /* get length of raw data block */
- DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
- length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
-
- if ((length>=0) && (length==datalength))
- {
- //printf("Raw data found in payload, length=");
- //printf("%d, datalength=%d \n", length, datalength);
- dltdata->test_counter_macro[3]++;
- }
- }
- }
- }
- }
- }
- }
- }
+ /* do something here */
+
+ // Count number of received bytes
+ dltdata->bytes_received += message->datasize+message->headersize-sizeof(DltStorageHeader);
+
+ // print number of received bytes
+ if((dlt_uptime() - dltdata->time_elapsed) > 10000)
+ {
+ printf("Received %lu Bytes/s\n",dltdata->bytes_received/**10000/(dlt_uptime()-dltdata->time_elapsed)*/);
+ //printf("Received %lu Bytes received\n",dltdata->bytes_received);
+ dltdata->time_elapsed = dlt_uptime();
+ dltdata->bytes_received = 0;
+ }
+
+ /* Extended header */
+ if (DLT_IS_HTYP_UEH(message->standardheader->htyp))
+ {
+ /* Log message */
+ if ((DLT_GET_MSIN_MSTP(message->extendedheader->msin))==DLT_TYPE_LOG)
+ {
+ /* Verbose */
+ if (DLT_IS_MSIN_VERB(message->extendedheader->msin))
+ {
+ /* 2 arguments */
+ if (message->extendedheader->noar==2)
+ {
+ /* verbose mode */
+ type_info=0;
+ type_info_tmp=0;
+ length=0;
+ length_tmp=0; /* the macro can set this variable to -1 */
+
+ ptr = message->databuffer;
+ datalength = message->datasize;
+
+ /* first read the type info of the first argument: must be string */
+ DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
+ type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
+
+ if (type_info & DLT_TYPE_INFO_SINT)
+ {
+ /* read value */
+ DLT_MSG_READ_VALUE(value_tmp,ptr,datalength,int32_t);
+ value=DLT_ENDIAN_GET_32(message->standardheader->htyp, value_tmp);
+ //printf("%d\n",value);
+
+ if(value < dltdata->last_value)
+ {
+ if(dltdata->nvalue == dltdata->count_received_messages)
+ printf("PASSED: %d Msg received, %d not received\n",dltdata->count_received_messages,dltdata->count_not_received_messages);
+ else
+ printf("FAILED: %d Msg received, %d not received\n",dltdata->count_received_messages,dltdata->count_not_received_messages);
+
+ dltdata->last_value = 0;
+ dltdata->count_received_messages = 0;
+ dltdata->count_not_received_messages = value -1;
+ }
+ else
+ {
+ dltdata->count_not_received_messages += value - dltdata->last_value -1;
+ }
+ dltdata->last_value = value;
+ dltdata->count_received_messages++;
+
+ if (length>=0)
+ {
+ ptr+=length;
+ datalength-=length;
+
+ /* read type of second argument: must be raw */
+ DLT_MSG_READ_VALUE(type_info_tmp,ptr,datalength,uint32_t);
+ type_info=DLT_ENDIAN_GET_32(message->standardheader->htyp, type_info_tmp);
+
+ if (type_info & DLT_TYPE_INFO_RAWD)
+ {
+ /* get length of raw data block */
+ DLT_MSG_READ_VALUE(length_tmp,ptr,datalength,uint16_t);
+ length=DLT_ENDIAN_GET_16(message->standardheader->htyp, length_tmp);
+
+ if ((length>=0) && (length==datalength))
+ {
+ //printf("Raw data found in payload, length=");
+ //printf("%d, datalength=%d \n", length, datalength);
+ dltdata->test_counter_macro[3]++;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
/* if no filter set or filter is matching display message */
if (dltdata->xflag)
diff --git a/src/tests/dlt-test-stress-user.c b/src/tests/dlt-test-stress-user.c
index 355f510..dcd7555 100644
--- a/src/tests/dlt-test-stress-user.c
+++ b/src/tests/dlt-test-stress-user.c
@@ -100,20 +100,20 @@ DltContextData context_data;
*/
void usage()
{
- char version[255];
-
- dlt_get_version(version,255);
-
- printf("Usage: dlt-test-stress-user [options]\n");
- printf("Test user application providing Test messages.\n");
- printf("%s \n", version);
- printf("Options:\n");
- printf(" -v Verbose mode\n");
- printf(" -f filename Use local log file instead of sending to daemon\n");
- printf(" -n count Number of messages to be sent per test (Default: 10000)\n");
- printf(" -r repeat How often test is repeated (Default: 100)\n");
- printf(" -d delay Delay between sent messages in uSec (Default: 1000)\n");
- printf(" -s size Size of extra message data in bytes (Default: 100)\n");
+ char version[255];
+
+ dlt_get_version(version,255);
+
+ printf("Usage: dlt-test-stress-user [options]\n");
+ printf("Test user application providing Test messages.\n");
+ printf("%s \n", version);
+ printf("Options:\n");
+ printf(" -v Verbose mode\n");
+ printf(" -f filename Use local log file instead of sending to daemon\n");
+ printf(" -n count Number of messages to be sent per test (Default: 10000)\n");
+ printf(" -r repeat How often test is repeated (Default: 100)\n");
+ printf(" -d delay Delay between sent messages in uSec (Default: 1000)\n");
+ printf(" -s size Size of extra message data in bytes (Default: 100)\n");
}
/**
@@ -133,7 +133,7 @@ int main(int argc, char* argv[])
opterr = 0;
while ((c = getopt (argc, argv, "vf:n:r:d:s:")) != -1)
- {
+ {
switch (c)
{
case 'v':
@@ -190,7 +190,7 @@ int main(int argc, char* argv[])
return -1;//for parasoft
}
}
- }
+ }
if (fvalue)
{
@@ -201,11 +201,11 @@ int main(int argc, char* argv[])
}
}
- /* Register APP */
- DLT_REGISTER_APP("DIFT","DLT Interface Test");
+ /* Register APP */
+ DLT_REGISTER_APP("DIFT","DLT Interface Test");
- /* Register CONTEXTS... */
- DLT_REGISTER_CONTEXT(context_info,"INFO","Information context");
+ /* Register CONTEXTS... */
+ DLT_REGISTER_CONTEXT(context_info,"INFO","Information context");
/* Tests starting */
printf("Tests starting\n");
@@ -214,7 +214,7 @@ int main(int argc, char* argv[])
/* wait 3 seconds before starting */
//sleep(3);
- testall(nvalue,rvalue,dvalue,svalue);
+ testall(nvalue,rvalue,dvalue,svalue);
/* Tests finished */
printf("Tests finished\n");
@@ -223,10 +223,10 @@ int main(int argc, char* argv[])
/* wait 3 seconds before terminating application */
//sleep(3);
- /* Unregister CONTEXTS... */
- DLT_UNREGISTER_CONTEXT(context_info);
+ /* Unregister CONTEXTS... */
+ DLT_UNREGISTER_CONTEXT(context_info);
- /* Unregister APP */
+ /* Unregister APP */
DLT_UNREGISTER_APP();
return 0;
@@ -238,7 +238,7 @@ int main(int argc, char* argv[])
int testall(int count,int repeat,int delay,int size)
{
- char buffer[size];
+ char buffer[size];
int num,rnum;
for(num=0;num< size;num++)
@@ -246,24 +246,24 @@ int testall(int count,int repeat,int delay,int size)
buffer[num] = num;
}
- /* Test All: Test all start */
+ /* Test All: Test all start */
//printf("Test1: Test all\n");
//DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test1: Test all"));
- for(rnum=0;rnum<repeat;rnum++)
- {
- for(num=1;num<=count;num++)
- {
- DLT_LOG(context_info,DLT_LOG_INFO,DLT_INT(num),DLT_RAW(buffer, size));
- usleep(delay);
- }
- }
+ for(rnum=0;rnum<repeat;rnum++)
+ {
+ for(num=1;num<=count;num++)
+ {
+ DLT_LOG(context_info,DLT_LOG_INFO,DLT_INT(num),DLT_RAW(buffer, size));
+ usleep(delay);
+ }
+ }
- /* wait 5 seconds after test */
+ /* wait 5 seconds after test */
//sleep(5);
- //DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test1: finished"));
+ //DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test1: finished"));
- return 0;
+ return 0;
}
diff --git a/src/tests/dlt-test-stress.c b/src/tests/dlt-test-stress.c
index 59e11f7..14067f1 100644
--- a/src/tests/dlt-test-stress.c
+++ b/src/tests/dlt-test-stress.c
@@ -221,15 +221,15 @@ int main(int argc, char* argv[])
if (test[0])
{
- stress1();
+ stress1();
}
if (test[1])
{
- stress2();
+ stress2();
}
if (test[2])
{
- stress3();
+ stress3();
}
DLT_UNREGISTER_APP();
@@ -301,7 +301,7 @@ void stress2(void)
ret=pthread_create(&(thread[index]), NULL, (void *) &thread_function, (void *) &(thread_data[index]));
if (ret!=0)
{
- printf("Error creating thread %d: %s \n", index, strerror(errno));
+ printf("Error creating thread %d: %s \n", index, strerror(errno));
}
usleep(1000);
@@ -309,7 +309,7 @@ void stress2(void)
for (index=0;index<STRESS2_MAX_NUM_THREADS;index++)
{
- pthread_join(thread[index], NULL);
+ pthread_join(thread[index], NULL);
}
printf("Finished stress test2 \n\n");
diff --git a/src/tests/dlt-test-user.c b/src/tests/dlt-test-user.c
index 282832f..3abe9d8 100644
--- a/src/tests/dlt-test-user.c
+++ b/src/tests/dlt-test-user.c
@@ -124,36 +124,36 @@ DltContextData context_data;
*/
void usage()
{
- char version[255];
-
- dlt_get_version(version,255);
-
- printf("Usage: dlt-test-user [options]\n");
- printf("Test user application providing several Tests.\n");
- printf("%s \n", version);
- printf("Options:\n");
- printf(" -v Verbose mode\n");
- printf(" -f filename Use local log file instead of sending to daemon\n");
- printf(" -n count Repeats of tests (Default: 1)\n");
- printf("Tests:\n");
- printf(" 1m: (Macro IF) Test all log levels\n");
- printf(" 2m: (Macro IF) Test all variable types (verbose) \n");
- printf(" 3m: (Macro IF) Test all variable types (non-verbose) \n");
- printf(" 4m: (Macro IF) Test different message sizes\n");
- printf(" 5m: (Macro IF) Test high-level API\n");
- printf(" 6m: (Macro IF) Test local printing\n");
- printf(" 7m: (Macro IF) Test network trace\n");
- printf(" 8m: (Macro IF) Test truncated network trace\n");
- printf(" 9m: (Macro IF) Test segmented network trace\n");
- printf(" 1f: (Function IF) Test all log levels\n");
- printf(" 2f: (Function IF) Test all variable types (verbose) \n");
- printf(" 3f: (Function IF) Test all variable types (non-verbose) \n");
- printf(" 4f: (Function IF) Test different message sizes\n");
- printf(" 5f: (Function IF) Test high-level API\n");
- printf(" 6f: (Function IF) Test local printing\n");
- printf(" 7f: (Function IF) Test network trace\n");
- printf(" 8f: (Function IF) Test truncated network trace\n");
- printf(" 9f: (Function IF) Test segmented network trace\n");
+ char version[255];
+
+ dlt_get_version(version,255);
+
+ printf("Usage: dlt-test-user [options]\n");
+ printf("Test user application providing several Tests.\n");
+ printf("%s \n", version);
+ printf("Options:\n");
+ printf(" -v Verbose mode\n");
+ printf(" -f filename Use local log file instead of sending to daemon\n");
+ printf(" -n count Repeats of tests (Default: 1)\n");
+ printf("Tests:\n");
+ printf(" 1m: (Macro IF) Test all log levels\n");
+ printf(" 2m: (Macro IF) Test all variable types (verbose) \n");
+ printf(" 3m: (Macro IF) Test all variable types (non-verbose) \n");
+ printf(" 4m: (Macro IF) Test different message sizes\n");
+ printf(" 5m: (Macro IF) Test high-level API\n");
+ printf(" 6m: (Macro IF) Test local printing\n");
+ printf(" 7m: (Macro IF) Test network trace\n");
+ printf(" 8m: (Macro IF) Test truncated network trace\n");
+ printf(" 9m: (Macro IF) Test segmented network trace\n");
+ printf(" 1f: (Function IF) Test all log levels\n");
+ printf(" 2f: (Function IF) Test all variable types (verbose) \n");
+ printf(" 3f: (Function IF) Test all variable types (non-verbose) \n");
+ printf(" 4f: (Function IF) Test different message sizes\n");
+ printf(" 5f: (Function IF) Test high-level API\n");
+ printf(" 6f: (Function IF) Test local printing\n");
+ printf(" 7f: (Function IF) Test network trace\n");
+ printf(" 8f: (Function IF) Test truncated network trace\n");
+ printf(" 9f: (Function IF) Test segmented network trace\n");
}
/**
@@ -167,15 +167,15 @@ int main(int argc, char* argv[])
int c;
- int i;
- char ctid[4], ctdesc[255];
+ int i;
+ char ctid[4], ctdesc[255];
- int num,maxnum;
+ int num,maxnum;
opterr = 0;
while ((c = getopt (argc, argv, "vf:n:")) != -1)
- {
+ {
switch (c)
{
case 'v':
@@ -217,7 +217,7 @@ int main(int argc, char* argv[])
return -1;//for parasoft
}
}
- }
+ }
if (fvalue)
{
@@ -237,43 +237,43 @@ int main(int argc, char* argv[])
maxnum = 1;
}
- /* Register APP */
- DLT_REGISTER_APP("DIFT","DLT Interface Test");
+ /* Register APP */
+ DLT_REGISTER_APP("DIFT","DLT Interface Test");
- /* Register CONTEXTS... */
- DLT_REGISTER_CONTEXT(context_info,"INFO","Information context");
+ /* Register CONTEXTS... */
+ DLT_REGISTER_CONTEXT(context_info,"INFO","Information context");
- /* used for macro interface tests */
- DLT_REGISTER_CONTEXT(context_macro_callback,"CBM","Callback Test context for macro interface");
- for (i=0;i<DLT_TEST_NUM_CONTEXT;i++)
- {
- snprintf(ctid,4,"TM%d",i+1);
- snprintf(ctdesc,255,"Test %d context for macro interface",i+1);
- DLT_REGISTER_CONTEXT(context_macro_test[i],ctid,ctdesc);
- }
+ /* used for macro interface tests */
+ DLT_REGISTER_CONTEXT(context_macro_callback,"CBM","Callback Test context for macro interface");
+ for (i=0;i<DLT_TEST_NUM_CONTEXT;i++)
+ {
+ snprintf(ctid,4,"TM%d",i+1);
+ snprintf(ctdesc,255,"Test %d context for macro interface",i+1);
+ DLT_REGISTER_CONTEXT(context_macro_test[i],ctid,ctdesc);
+ }
- /* used for function interface tests */
- dlt_register_context(&context_function_callback,"CBF","Callback Test context for function interface");
- for (i=0;i<DLT_TEST_NUM_CONTEXT;i++)
- {
- snprintf(ctid,4,"TF%d",i+1);
- snprintf(ctdesc,255,"Test %d context for function interface",i+1);
- dlt_register_context(&(context_function_test[i]),ctid,ctdesc);
- }
+ /* used for function interface tests */
+ dlt_register_context(&context_function_callback,"CBF","Callback Test context for function interface");
+ for (i=0;i<DLT_TEST_NUM_CONTEXT;i++)
+ {
+ snprintf(ctid,4,"TF%d",i+1);
+ snprintf(ctdesc,255,"Test %d context for function interface",i+1);
+ dlt_register_context(&(context_function_test[i]),ctid,ctdesc);
+ }
- /* Register callbacks... */
+ /* Register callbacks... */
- /* with macro interface */
- DLT_LOG(context_macro_callback,DLT_LOG_INFO,DLT_STRING("Register callback (Macro Interface) for Injection ID: 0xFFF"));
- DLT_REGISTER_INJECTION_CALLBACK(context_macro_callback, 0xFFF, test_injection_macro_callback);
+ /* with macro interface */
+ DLT_LOG(context_macro_callback,DLT_LOG_INFO,DLT_STRING("Register callback (Macro Interface) for Injection ID: 0xFFF"));
+ DLT_REGISTER_INJECTION_CALLBACK(context_macro_callback, 0xFFF, test_injection_macro_callback);
- /* with function interface */
- if (dlt_user_log_write_start(&context_function_callback,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Register callback (Function Interface) for Injection ID: 0xFFF");
- dlt_user_log_write_finish(&context_data);
+ /* with function interface */
+ if (dlt_user_log_write_start(&context_function_callback,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Register callback (Function Interface) for Injection ID: 0xFFF");
+ dlt_user_log_write_finish(&context_data);
}
- dlt_register_injection_callback(&context_function_callback, 0xFFF, test_injection_function_callback);
+ dlt_register_injection_callback(&context_function_callback, 0xFFF, test_injection_function_callback);
/* Tests starting */
printf("Tests starting\n");
@@ -284,31 +284,31 @@ int main(int argc, char* argv[])
for (num=0;num<maxnum;num++)
{
- /* Execute tests... */
-
- /* with macro interface */
- test1m();
- test2m();
- test3m();
- test4m();
- test5m();
- test6m();
- test7m();
- test8m();
- test9m();
-
- /* with function interface */
- test1f();
- test2f();
- test3f();
- test4f();
- test5f();
- test6f();
- test7f();
- test8f();
- test9f();
-
- /* wait 1 second before next repeat of tests */
+ /* Execute tests... */
+
+ /* with macro interface */
+ test1m();
+ test2m();
+ test3m();
+ test4m();
+ test5m();
+ test6m();
+ test7m();
+ test8m();
+ test9m();
+
+ /* with function interface */
+ test1f();
+ test2f();
+ test3f();
+ test4f();
+ test5f();
+ test6f();
+ test7f();
+ test8f();
+ test9f();
+
+ /* wait 1 second before next repeat of tests */
sleep(1);
}
@@ -319,24 +319,24 @@ int main(int argc, char* argv[])
/* wait 3 seconds before terminating application */
sleep(3);
- /* Unregister CONTEXTS... */
- DLT_UNREGISTER_CONTEXT(context_info);
+ /* Unregister CONTEXTS... */
+ DLT_UNREGISTER_CONTEXT(context_info);
- /* used for macro interface tests */
- for (i=0;i<DLT_TEST_NUM_CONTEXT;i++)
- {
- DLT_UNREGISTER_CONTEXT(context_macro_test[i]);
- }
- DLT_UNREGISTER_CONTEXT(context_macro_callback);
+ /* used for macro interface tests */
+ for (i=0;i<DLT_TEST_NUM_CONTEXT;i++)
+ {
+ DLT_UNREGISTER_CONTEXT(context_macro_test[i]);
+ }
+ DLT_UNREGISTER_CONTEXT(context_macro_callback);
- /* used for function interface tests */
- for (i=0;i<DLT_TEST_NUM_CONTEXT;i++)
- {
- dlt_unregister_context(&(context_function_test[i]));
- }
- dlt_unregister_context(&context_function_callback);
+ /* used for function interface tests */
+ for (i=0;i<DLT_TEST_NUM_CONTEXT;i++)
+ {
+ dlt_unregister_context(&(context_function_test[i]));
+ }
+ dlt_unregister_context(&context_function_callback);
- /* Unregister APP */
+ /* Unregister APP */
DLT_UNREGISTER_APP();
return 0;
@@ -348,7 +348,7 @@ int main(int argc, char* argv[])
int test1m(void)
{
- /* Test 1: (Macro IF) Test all log levels */
+ /* Test 1: (Macro IF) Test all log levels */
printf("Test1m: (Macro IF) Test all log levels\n");
DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test1: (Macro IF) Test all log levels"));
@@ -359,19 +359,19 @@ int test1m(void)
DLT_LOG(context_macro_test[0],DLT_LOG_DEBUG,DLT_STRING("debug"));
DLT_LOG(context_macro_test[0],DLT_LOG_VERBOSE,DLT_STRING("verbose"));
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test1: (Macro IF) finished"));
- return 0;
+ return 0;
}
int test2m(void)
{
- char buffer[10];
+ char buffer[10];
int num2;
- /* Test 2: (Macro IF) Test all variable types (verbose) */
+ /* Test 2: (Macro IF) Test all variable types (verbose) */
printf("Test2m: (Macro IF) Test all variable types (verbose)\n");
DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test2: (Macro IF) Test all variable types (verbose)"));
@@ -398,23 +398,23 @@ int test2m(void)
DLT_LOG(context_macro_test[1],DLT_LOG_INFO,DLT_STRING("raw"),DLT_RAW(buffer,10));
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test2: (Macro IF) finished"));
+ DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test2: (Macro IF) finished"));
- return 0;
+ return 0;
}
int test3m(void)
{
- char buffer[10];
+ char buffer[10];
int num2;
- /* Test 3: (Macro IF) Test all variable types (non-verbose) */
+ /* Test 3: (Macro IF) Test all variable types (non-verbose) */
printf("Test3m: (Macro IF) Test all variable types (non-verbose)\n");
DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test3: (Macro IF) Test all variable types (non-verbose)"));
- DLT_NONVERBOSE_MODE();
+ DLT_NONVERBOSE_MODE();
DLT_LOG_ID(context_macro_test[2],DLT_LOG_INFO,1,DLT_STRING("string"),DLT_STRING("Hello world"));
DLT_LOG_ID(context_macro_test[2],DLT_LOG_INFO,2,DLT_STRING("utf8"),DLT_UTF8("Hello world"));
@@ -439,18 +439,18 @@ int test3m(void)
}
DLT_LOG_ID(context_macro_test[2],DLT_LOG_INFO,14,DLT_STRING("raw"),DLT_RAW(buffer,10));
- DLT_VERBOSE_MODE();
+ DLT_VERBOSE_MODE();
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test3: (Macro IF) finished"));
+ DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test3: (Macro IF) finished"));
- return 0;
+ return 0;
}
int test4m(void)
{
- char buffer[1024];
+ char buffer[1024];
int num;
for(num=0;num<1024;num++)
@@ -458,7 +458,7 @@ int test4m(void)
buffer[num] = num;
}
- /* Test 4: (Macro IF) Message size test */
+ /* Test 4: (Macro IF) Message size test */
printf("Test4m: (Macro IF) Test different message sizes\n");
DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test4: (Macro IF) Test different message sizes"));
@@ -467,16 +467,16 @@ int test4m(void)
DLT_LOG(context_macro_test[3],DLT_LOG_INFO,DLT_STRING("256"),DLT_RAW(buffer,256));
DLT_LOG(context_macro_test[3],DLT_LOG_INFO,DLT_STRING("1024"),DLT_RAW(buffer,1024));
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test4: (Macro IF) finished"));
+ DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test4: (Macro IF) finished"));
- return 0;
+ return 0;
}
int test5m(void)
{
- char buffer[32];
+ char buffer[32];
int num;
for(num=0;num<32;num++)
@@ -484,57 +484,57 @@ int test5m(void)
buffer[num] = num;
}
- /* Test 5: (Macro IF) Test high-level API */
+ /* Test 5: (Macro IF) Test high-level API */
printf("Test5m: (Macro IF) Test high-level API\n");
DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test5: (Macro IF) Test high-level API"));
- DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_INT"));
- DLT_LOG_INT(context_macro_test[4], DLT_LOG_INFO, -42);
+ DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_INT"));
+ DLT_LOG_INT(context_macro_test[4], DLT_LOG_INFO, -42);
- DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_UINT"));
- DLT_LOG_UINT(context_macro_test[4], DLT_LOG_INFO, 42);
+ DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_UINT"));
+ DLT_LOG_UINT(context_macro_test[4], DLT_LOG_INFO, 42);
- DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_STRING"));
- DLT_LOG_STRING(context_macro_test[4], DLT_LOG_INFO, "String output");
+ DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_STRING"));
+ DLT_LOG_STRING(context_macro_test[4], DLT_LOG_INFO, "String output");
- DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_RAW"));
- DLT_LOG_RAW(context_macro_test[4],DLT_LOG_INFO, buffer,16);
+ DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_RAW"));
+ DLT_LOG_RAW(context_macro_test[4],DLT_LOG_INFO, buffer,16);
- DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_STRING_INT"));
- DLT_LOG_STRING_INT(context_macro_test[4], DLT_LOG_INFO, "String output: ", -42);
+ DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_STRING_INT"));
+ DLT_LOG_STRING_INT(context_macro_test[4], DLT_LOG_INFO, "String output: ", -42);
- DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_STRING_UINT"));
- DLT_LOG_STRING_UINT(context_macro_test[4], DLT_LOG_INFO,"String output: ", 42);
+ DLT_LOG(context_macro_test[4],DLT_LOG_INFO,DLT_STRING("Next line: DLT_LOG_STRING_UINT"));
+ DLT_LOG_STRING_UINT(context_macro_test[4], DLT_LOG_INFO,"String output: ", 42);
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test5: (Macro IF) finished"));
+ DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test5: (Macro IF) finished"));
- return 0;
+ return 0;
}
int test6m(void)
{
- /* Test 6: (Macro IF) Test local printing */
- printf("Test6m: (Macro IF) Test local printing\n");
+ /* Test 6: (Macro IF) Test local printing */
+ printf("Test6m: (Macro IF) Test local printing\n");
DLT_LOG_STRING(context_info, DLT_LOG_INFO, "Test 6: (Macro IF) Test local printing");
- DLT_ENABLE_LOCAL_PRINT();
- DLT_LOG_STRING(context_macro_test[5], DLT_LOG_INFO, "Message (visible: locally printed)");
+ DLT_ENABLE_LOCAL_PRINT();
+ DLT_LOG_STRING(context_macro_test[5], DLT_LOG_INFO, "Message (visible: locally printed)");
- DLT_DISABLE_LOCAL_PRINT();
- DLT_LOG_STRING(context_macro_test[5], DLT_LOG_INFO, "Message (invisible: not locally printed)");
+ DLT_DISABLE_LOCAL_PRINT();
+ DLT_LOG_STRING(context_macro_test[5], DLT_LOG_INFO, "Message (invisible: not locally printed)");
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test6: (Macro IF) finished"));
+ DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test6: (Macro IF) finished"));
- return 0;
+ return 0;
}
int test7m(void)
{
- char buffer[32];
+ char buffer[32];
int num;
for(num=0;num<32;num++)
@@ -542,32 +542,32 @@ int test7m(void)
buffer[num] = num;
}
- /* Show all log messages and traces */
- DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON);
+ /* Show all log messages and traces */
+ DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON);
- /* Test 7: (Macro IF) Test network trace */
- printf("Test7m: (Macro IF) Test network trace\n");
+ /* Test 7: (Macro IF) Test network trace */
+ printf("Test7m: (Macro IF) Test network trace\n");
DLT_LOG_STRING(context_info, DLT_LOG_INFO, "Test 7: (Macro IF) Test network trace");
- /* Dummy messages: 16 byte header, 32 byte payload */
- DLT_TRACE_NETWORK(context_macro_test[6], DLT_NW_TRACE_IPC, 16, buffer, 32, buffer);
- DLT_TRACE_NETWORK(context_macro_test[6], DLT_NW_TRACE_CAN, 16, buffer, 32, buffer);
- DLT_TRACE_NETWORK(context_macro_test[6], DLT_NW_TRACE_FLEXRAY, 16, buffer, 32, buffer);
- DLT_TRACE_NETWORK(context_macro_test[6], DLT_NW_TRACE_MOST, 16, buffer, 32, buffer);
+ /* Dummy messages: 16 byte header, 32 byte payload */
+ DLT_TRACE_NETWORK(context_macro_test[6], DLT_NW_TRACE_IPC, 16, buffer, 32, buffer);
+ DLT_TRACE_NETWORK(context_macro_test[6], DLT_NW_TRACE_CAN, 16, buffer, 32, buffer);
+ DLT_TRACE_NETWORK(context_macro_test[6], DLT_NW_TRACE_FLEXRAY, 16, buffer, 32, buffer);
+ DLT_TRACE_NETWORK(context_macro_test[6], DLT_NW_TRACE_MOST, 16, buffer, 32, buffer);
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test7: (Macro IF) finished"));
+ DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test7: (Macro IF) finished"));
- DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT);
- sleep(2);
+ DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT);
+ sleep(2);
- return 0;
+ return 0;
}
int test8m(void)
{
- char buffer[1024*5];
+ char buffer[1024*5];
int num;
for(num=0;num<1024*5;num++)
@@ -575,32 +575,32 @@ int test8m(void)
buffer[num] = num;
}
- /* Show all log messages and traces */
- DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON);
+ /* Show all log messages and traces */
+ DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON);
- /* Test 8: (Macro IF) Test truncated network trace*/
- printf("Test8m: (Macro IF) Test truncated network trace\n");
+ /* Test 8: (Macro IF) Test truncated network trace*/
+ printf("Test8m: (Macro IF) Test truncated network trace\n");
DLT_LOG_STRING(context_info, DLT_LOG_INFO, "Test 8: (Macro IF) Test truncated network trace");
- /* Dummy messages: 16 byte header, 5k payload */
- DLT_TRACE_NETWORK_TRUNCATED(context_macro_test[7], DLT_NW_TRACE_IPC, 16, buffer, 1024*5, buffer);
- DLT_TRACE_NETWORK_TRUNCATED(context_macro_test[7], DLT_NW_TRACE_CAN, 16, buffer, 1024*5, buffer);
- DLT_TRACE_NETWORK_TRUNCATED(context_macro_test[7], DLT_NW_TRACE_FLEXRAY, 16, buffer, 1024*5, buffer);
- DLT_TRACE_NETWORK_TRUNCATED(context_macro_test[7], DLT_NW_TRACE_MOST, 16, buffer, 1024*5, buffer);
+ /* Dummy messages: 16 byte header, 5k payload */
+ DLT_TRACE_NETWORK_TRUNCATED(context_macro_test[7], DLT_NW_TRACE_IPC, 16, buffer, 1024*5, buffer);
+ DLT_TRACE_NETWORK_TRUNCATED(context_macro_test[7], DLT_NW_TRACE_CAN, 16, buffer, 1024*5, buffer);
+ DLT_TRACE_NETWORK_TRUNCATED(context_macro_test[7], DLT_NW_TRACE_FLEXRAY, 16, buffer, 1024*5, buffer);
+ DLT_TRACE_NETWORK_TRUNCATED(context_macro_test[7], DLT_NW_TRACE_MOST, 16, buffer, 1024*5, buffer);
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test8: (Macro IF) finished"));
+ DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test8: (Macro IF) finished"));
- DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT);
- sleep(2);
+ DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT);
+ sleep(2);
- return 0;
+ return 0;
}
int test9m(void)
{
- char buffer[1024*5];
+ char buffer[1024*5];
int num;
for(num=0;num<1024*5;num++)
@@ -608,176 +608,176 @@ int test9m(void)
buffer[num] = num;
}
- /* Show all log messages and traces */
- DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON);
+ /* Show all log messages and traces */
+ DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON);
- /* Test 9: (Macro IF) Test segmented network trace*/
- printf("Test9m: (Macro IF) Test segmented network trace\n");
+ /* Test 9: (Macro IF) Test segmented network trace*/
+ printf("Test9m: (Macro IF) Test segmented network trace\n");
DLT_LOG_STRING(context_info, DLT_LOG_INFO, "Test 9: (Macro IF) Test segmented network trace");
- /* Dummy messages: 16 byte header, 5k payload */
- DLT_TRACE_NETWORK_SEGMENTED(context_macro_test[8], DLT_NW_TRACE_IPC, 16, buffer, 1024*5, buffer);
- DLT_TRACE_NETWORK_SEGMENTED(context_macro_test[8], DLT_NW_TRACE_CAN, 16, buffer, 1024*5, buffer);
- DLT_TRACE_NETWORK_SEGMENTED(context_macro_test[8], DLT_NW_TRACE_FLEXRAY, 16, buffer, 1024*5, buffer);
- DLT_TRACE_NETWORK_SEGMENTED(context_macro_test[8], DLT_NW_TRACE_MOST, 16, buffer, 1024*5, buffer);
+ /* Dummy messages: 16 byte header, 5k payload */
+ DLT_TRACE_NETWORK_SEGMENTED(context_macro_test[8], DLT_NW_TRACE_IPC, 16, buffer, 1024*5, buffer);
+ DLT_TRACE_NETWORK_SEGMENTED(context_macro_test[8], DLT_NW_TRACE_CAN, 16, buffer, 1024*5, buffer);
+ DLT_TRACE_NETWORK_SEGMENTED(context_macro_test[8], DLT_NW_TRACE_FLEXRAY, 16, buffer, 1024*5, buffer);
+ DLT_TRACE_NETWORK_SEGMENTED(context_macro_test[8], DLT_NW_TRACE_MOST, 16, buffer, 1024*5, buffer);
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test9: (Macro IF) finished"));
+ DLT_LOG(context_info,DLT_LOG_INFO,DLT_STRING("Test9: (Macro IF) finished"));
- DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT);
- sleep(2);
+ DLT_SET_APPLICATION_LL_TS_LIMIT(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT);
+ sleep(2);
- return 0;
+ return 0;
}
int test1f(void)
{
- /* Test 1: (Function IF) Test all log levels */
+ /* Test 1: (Function IF) Test all log levels */
printf("Test1f: (Function IF) Test all log levels\n");
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test1: (Function IF) Test all log levels");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test1: (Function IF) Test all log levels");
+ dlt_user_log_write_finish(&context_data);
}
- if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_FATAL)>0)
- {
- dlt_user_log_write_string(&context_data,"fatal");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_FATAL)>0)
+ {
+ dlt_user_log_write_string(&context_data,"fatal");
+ dlt_user_log_write_finish(&context_data);
}
- if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_ERROR)>0)
- {
- dlt_user_log_write_string(&context_data,"error");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_ERROR)>0)
+ {
+ dlt_user_log_write_string(&context_data,"error");
+ dlt_user_log_write_finish(&context_data);
}
- if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_WARN)>0)
- {
- dlt_user_log_write_string(&context_data,"warn");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_WARN)>0)
+ {
+ dlt_user_log_write_string(&context_data,"warn");
+ dlt_user_log_write_finish(&context_data);
}
- if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"info");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"info");
+ dlt_user_log_write_finish(&context_data);
}
- if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_DEBUG)>0)
- {
- dlt_user_log_write_string(&context_data,"debug");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_DEBUG)>0)
+ {
+ dlt_user_log_write_string(&context_data,"debug");
+ dlt_user_log_write_finish(&context_data);
}
- if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_VERBOSE)>0)
- {
- dlt_user_log_write_string(&context_data,"verbose");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&(context_function_test[0]),&context_data,DLT_LOG_VERBOSE)>0)
+ {
+ dlt_user_log_write_string(&context_data,"verbose");
+ dlt_user_log_write_finish(&context_data);
}
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test1: (Function IF) finished");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test1: (Function IF) finished");
+ dlt_user_log_write_finish(&context_data);
}
- return 0;
+ return 0;
}
int test2f(void)
{
- char buffer[10];
+ char buffer[10];
int num2;
- /* Test 2: (Function IF) Test all variable types (verbose) */
+ /* Test 2: (Function IF) Test all variable types (verbose) */
printf("Test2f: (Function IF) Test all variable types (verbose)\n");
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test2: (Function IF) Test all variable types (verbose)");
- dlt_user_log_write_finish(&context_data);
- }
-
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"bool");
- dlt_user_log_write_bool(&context_data,1);
- dlt_user_log_write_finish(&context_data);
- }
-
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"int");
- dlt_user_log_write_int(&context_data,INT32_MIN); /* (-2147483647-1) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"int8");
- dlt_user_log_write_int8(&context_data,INT8_MIN); /* (-128) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"int16");
- dlt_user_log_write_int16(&context_data,INT16_MIN); /* (-32767-1) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"int32");
- dlt_user_log_write_int32(&context_data,INT32_MIN); /* (-2147483647-1) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"int64");
- dlt_user_log_write_int64(&context_data,INT64_MIN); /* (-__INT64_C(9223372036854775807)-1) */
- dlt_user_log_write_finish(&context_data);
- }
-
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"uint");
- dlt_user_log_write_uint(&context_data,UINT32_MAX); /* (4294967295U) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"uint8");
- dlt_user_log_write_uint8(&context_data,UINT8_MAX); /* (255) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"uint16");
- dlt_user_log_write_uint16(&context_data,UINT16_MAX); /* (65535) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"uint32");
- dlt_user_log_write_uint32(&context_data,UINT32_MAX); /* (4294967295U) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"uint64");
- dlt_user_log_write_uint64(&context_data,UINT64_MAX); /* (__UINT64_C(18446744073709551615)) */
- dlt_user_log_write_finish(&context_data);
- }
-
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"float32");
- dlt_user_log_write_float32(&context_data,FLT_MIN);
- dlt_user_log_write_float32(&context_data,FLT_MAX);
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"float64");
- dlt_user_log_write_float64(&context_data,DBL_MIN);
- dlt_user_log_write_float64(&context_data,DBL_MAX);
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test2: (Function IF) Test all variable types (verbose)");
+ dlt_user_log_write_finish(&context_data);
+ }
+
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"bool");
+ dlt_user_log_write_bool(&context_data,1);
+ dlt_user_log_write_finish(&context_data);
+ }
+
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"int");
+ dlt_user_log_write_int(&context_data,INT32_MIN); /* (-2147483647-1) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"int8");
+ dlt_user_log_write_int8(&context_data,INT8_MIN); /* (-128) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"int16");
+ dlt_user_log_write_int16(&context_data,INT16_MIN); /* (-32767-1) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"int32");
+ dlt_user_log_write_int32(&context_data,INT32_MIN); /* (-2147483647-1) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"int64");
+ dlt_user_log_write_int64(&context_data,INT64_MIN); /* (-__INT64_C(9223372036854775807)-1) */
+ dlt_user_log_write_finish(&context_data);
+ }
+
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"uint");
+ dlt_user_log_write_uint(&context_data,UINT32_MAX); /* (4294967295U) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"uint8");
+ dlt_user_log_write_uint8(&context_data,UINT8_MAX); /* (255) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"uint16");
+ dlt_user_log_write_uint16(&context_data,UINT16_MAX); /* (65535) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"uint32");
+ dlt_user_log_write_uint32(&context_data,UINT32_MAX); /* (4294967295U) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"uint64");
+ dlt_user_log_write_uint64(&context_data,UINT64_MAX); /* (__UINT64_C(18446744073709551615)) */
+ dlt_user_log_write_finish(&context_data);
+ }
+
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"float32");
+ dlt_user_log_write_float32(&context_data,FLT_MIN);
+ dlt_user_log_write_float32(&context_data,FLT_MAX);
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"float64");
+ dlt_user_log_write_float64(&context_data,DBL_MIN);
+ dlt_user_log_write_float64(&context_data,DBL_MAX);
+ dlt_user_log_write_finish(&context_data);
}
for(num2=0;num2<10;num2++)
@@ -785,151 +785,151 @@ int test2f(void)
buffer[num2] = num2;
}
- if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"raw");
- dlt_user_log_write_raw(&context_data,buffer,10);
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&(context_function_test[1]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"raw");
+ dlt_user_log_write_raw(&context_data,buffer,10);
+ dlt_user_log_write_finish(&context_data);
}
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test2: (Function IF) finished");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test2: (Function IF) finished");
+ dlt_user_log_write_finish(&context_data);
}
- return 0;
+ return 0;
}
int test3f(void)
{
- char buffer[10];
+ char buffer[10];
int num2;
- /* Test 3: (Function IF) Test all variable types (non-verbose) */
+ /* Test 3: (Function IF) Test all variable types (non-verbose) */
printf("Test3f: (Function IF) Test all variable types (non-verbose)\n");
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test3: (Function IF) Test all variable types (non-verbose)");
- dlt_user_log_write_finish(&context_data);
- }
-
- dlt_nonverbose_mode();
-
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,1)>0) // bug mb: we have to compare against >0. in case of error -1 is returned!
- {
- dlt_user_log_write_string(&context_data,"bool");
- dlt_user_log_write_bool(&context_data,1);
- dlt_user_log_write_finish(&context_data);
- }
-
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,2)>0)
- {
- dlt_user_log_write_string(&context_data,"int");
- dlt_user_log_write_int(&context_data,INT32_MIN); /* (-2147483647-1) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,3)>0)
- {
- dlt_user_log_write_string(&context_data,"int8");
- dlt_user_log_write_int8(&context_data,INT8_MIN); /* (-128) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,4)>0)
- {
- dlt_user_log_write_string(&context_data,"int16");
- dlt_user_log_write_int16(&context_data,INT16_MIN); /* (-32767-1) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,5)>0)
- {
- dlt_user_log_write_string(&context_data,"int32");
- dlt_user_log_write_int32(&context_data,INT32_MIN); /* (-2147483647-1) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,6)>0)
- {
- dlt_user_log_write_string(&context_data,"int64");
- dlt_user_log_write_int64(&context_data,INT64_MIN); /* (-__INT64_C(9223372036854775807)-1) */
- dlt_user_log_write_finish(&context_data);
- }
-
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,7)>0)
- {
- dlt_user_log_write_string(&context_data,"uint");
- dlt_user_log_write_uint(&context_data,UINT32_MAX); /* (4294967295U) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,8)>0)
- {
- dlt_user_log_write_string(&context_data,"uint8");
- dlt_user_log_write_uint8(&context_data,UINT8_MAX); /* (255) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,9)>0)
- {
- dlt_user_log_write_string(&context_data,"uint16");
- dlt_user_log_write_uint16(&context_data,UINT16_MAX); /* (65535) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,10)>0)
- {
- dlt_user_log_write_string(&context_data,"uint32");
- dlt_user_log_write_uint32(&context_data,UINT32_MAX); /* (4294967295U) */
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,11)>0)
- {
- dlt_user_log_write_string(&context_data,"uint64");
- dlt_user_log_write_uint64(&context_data,UINT64_MAX); /* (__UINT64_C(18446744073709551615)) */
- dlt_user_log_write_finish(&context_data);
- }
-
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,12)>0)
- {
- dlt_user_log_write_string(&context_data,"float32");
- dlt_user_log_write_float32(&context_data,FLT_MIN);
- dlt_user_log_write_float32(&context_data,FLT_MAX);
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,13)>0)
- {
- dlt_user_log_write_string(&context_data,"float64");
- dlt_user_log_write_float64(&context_data,DBL_MIN);
- dlt_user_log_write_float64(&context_data,DBL_MAX);
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test3: (Function IF) Test all variable types (non-verbose)");
+ dlt_user_log_write_finish(&context_data);
+ }
+
+ dlt_nonverbose_mode();
+
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,1)>0) // bug mb: we have to compare against >0. in case of error -1 is returned!
+ {
+ dlt_user_log_write_string(&context_data,"bool");
+ dlt_user_log_write_bool(&context_data,1);
+ dlt_user_log_write_finish(&context_data);
+ }
+
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,2)>0)
+ {
+ dlt_user_log_write_string(&context_data,"int");
+ dlt_user_log_write_int(&context_data,INT32_MIN); /* (-2147483647-1) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,3)>0)
+ {
+ dlt_user_log_write_string(&context_data,"int8");
+ dlt_user_log_write_int8(&context_data,INT8_MIN); /* (-128) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,4)>0)
+ {
+ dlt_user_log_write_string(&context_data,"int16");
+ dlt_user_log_write_int16(&context_data,INT16_MIN); /* (-32767-1) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,5)>0)
+ {
+ dlt_user_log_write_string(&context_data,"int32");
+ dlt_user_log_write_int32(&context_data,INT32_MIN); /* (-2147483647-1) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,6)>0)
+ {
+ dlt_user_log_write_string(&context_data,"int64");
+ dlt_user_log_write_int64(&context_data,INT64_MIN); /* (-__INT64_C(9223372036854775807)-1) */
+ dlt_user_log_write_finish(&context_data);
+ }
+
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,7)>0)
+ {
+ dlt_user_log_write_string(&context_data,"uint");
+ dlt_user_log_write_uint(&context_data,UINT32_MAX); /* (4294967295U) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,8)>0)
+ {
+ dlt_user_log_write_string(&context_data,"uint8");
+ dlt_user_log_write_uint8(&context_data,UINT8_MAX); /* (255) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,9)>0)
+ {
+ dlt_user_log_write_string(&context_data,"uint16");
+ dlt_user_log_write_uint16(&context_data,UINT16_MAX); /* (65535) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,10)>0)
+ {
+ dlt_user_log_write_string(&context_data,"uint32");
+ dlt_user_log_write_uint32(&context_data,UINT32_MAX); /* (4294967295U) */
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,11)>0)
+ {
+ dlt_user_log_write_string(&context_data,"uint64");
+ dlt_user_log_write_uint64(&context_data,UINT64_MAX); /* (__UINT64_C(18446744073709551615)) */
+ dlt_user_log_write_finish(&context_data);
+ }
+
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,12)>0)
+ {
+ dlt_user_log_write_string(&context_data,"float32");
+ dlt_user_log_write_float32(&context_data,FLT_MIN);
+ dlt_user_log_write_float32(&context_data,FLT_MAX);
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,13)>0)
+ {
+ dlt_user_log_write_string(&context_data,"float64");
+ dlt_user_log_write_float64(&context_data,DBL_MIN);
+ dlt_user_log_write_float64(&context_data,DBL_MAX);
+ dlt_user_log_write_finish(&context_data);
}
for(num2=0;num2<10;num2++)
{
buffer[num2] = num2;
- }
+ }
- if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,14)>0)
- {
- dlt_user_log_write_string(&context_data,"raw");
- dlt_user_log_write_raw(&context_data,buffer,10);
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start_id(&(context_function_test[2]),&context_data,DLT_LOG_INFO,14)>0)
+ {
+ dlt_user_log_write_string(&context_data,"raw");
+ dlt_user_log_write_raw(&context_data,buffer,10);
+ dlt_user_log_write_finish(&context_data);
}
- dlt_verbose_mode();
+ dlt_verbose_mode();
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test3: (Function IF) finished");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test3: (Function IF) finished");
+ dlt_user_log_write_finish(&context_data);
}
- return 0;
+ return 0;
}
int test4f(void)
{
- char buffer[1024];
+ char buffer[1024];
int num;
for(num=0;num<1024;num++)
@@ -937,53 +937,53 @@ int test4f(void)
buffer[num] = num;
}
- /* Test 4: (Function IF) Message size test */
+ /* Test 4: (Function IF) Message size test */
printf("Test4f: (Function IF) Test different message sizes\n");
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test4: (Function IF) Test different message sizes");
- dlt_user_log_write_finish(&context_data);
- }
-
- if (dlt_user_log_write_start(&(context_function_test[3]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"1");
- dlt_user_log_write_raw(&context_data,buffer,1);
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start(&(context_function_test[3]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"16");
- dlt_user_log_write_raw(&context_data,buffer,16);
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start(&(context_function_test[3]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"256");
- dlt_user_log_write_raw(&context_data,buffer,256);
- dlt_user_log_write_finish(&context_data);
- }
- if (dlt_user_log_write_start(&(context_function_test[3]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"1024");
- dlt_user_log_write_raw(&context_data,buffer,1024);
- dlt_user_log_write_finish(&context_data);
- }
-
- /* wait 2 second before next test */
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test4: (Function IF) Test different message sizes");
+ dlt_user_log_write_finish(&context_data);
+ }
+
+ if (dlt_user_log_write_start(&(context_function_test[3]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"1");
+ dlt_user_log_write_raw(&context_data,buffer,1);
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start(&(context_function_test[3]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"16");
+ dlt_user_log_write_raw(&context_data,buffer,16);
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start(&(context_function_test[3]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"256");
+ dlt_user_log_write_raw(&context_data,buffer,256);
+ dlt_user_log_write_finish(&context_data);
+ }
+ if (dlt_user_log_write_start(&(context_function_test[3]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"1024");
+ dlt_user_log_write_raw(&context_data,buffer,1024);
+ dlt_user_log_write_finish(&context_data);
+ }
+
+ /* wait 2 second before next test */
sleep(2);
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test4: (Function IF) finished");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test4: (Function IF) finished");
+ dlt_user_log_write_finish(&context_data);
}
- return 0;
+ return 0;
}
int test5f(void)
{
- char buffer[32];
+ char buffer[32];
int num;
for(num=0;num<32;num++)
@@ -991,73 +991,73 @@ int test5f(void)
buffer[num] = num;
}
- /* Test 5: (Function IF) Test high-level API */
+ /* Test 5: (Function IF) Test high-level API */
printf("Test5f: (Function IF) Test high-level API\n");
- dlt_log_string(&context_info,DLT_LOG_INFO,"Test5: (Function IF) Test high-level API");
+ dlt_log_string(&context_info,DLT_LOG_INFO,"Test5: (Function IF) Test high-level API");
- dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_int()");
- dlt_log_int(&(context_function_test[4]),DLT_LOG_INFO, -42);
+ dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_int()");
+ dlt_log_int(&(context_function_test[4]),DLT_LOG_INFO, -42);
- dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_uint()");
- dlt_log_uint(&(context_function_test[4]),DLT_LOG_INFO, 42);
+ dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_uint()");
+ dlt_log_uint(&(context_function_test[4]),DLT_LOG_INFO, 42);
- dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_string()");
- dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO, "String output");
+ dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_string()");
+ dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO, "String output");
- dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_raw()");
- dlt_log_raw(&(context_function_test[4]),DLT_LOG_INFO, buffer,16);
+ dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_raw()");
+ dlt_log_raw(&(context_function_test[4]),DLT_LOG_INFO, buffer,16);
- dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_string_int()");
- dlt_log_string_int(&(context_function_test[4]), DLT_LOG_INFO, "String output: ", -42);
+ dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_string_int()");
+ dlt_log_string_int(&(context_function_test[4]), DLT_LOG_INFO, "String output: ", -42);
- dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_string_uint()");
- dlt_log_string_uint(&(context_function_test[4]), DLT_LOG_INFO,"String output: ", 42);
+ dlt_log_string(&(context_function_test[4]),DLT_LOG_INFO,"Next line: dlt_log_string_uint()");
+ dlt_log_string_uint(&(context_function_test[4]), DLT_LOG_INFO,"String output: ", 42);
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- dlt_log_string(&context_info,DLT_LOG_INFO,"Test5: (Function IF) finished");
+ dlt_log_string(&context_info,DLT_LOG_INFO,"Test5: (Function IF) finished");
- return 0;
+ return 0;
}
int test6f(void)
{
- /* Test 6: (Function IF) Test local printing */
- printf("Test6f: (Function IF) Test local printing\n");
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test 6: (Function IF) Test local printing");
- dlt_user_log_write_finish(&context_data);
+ /* Test 6: (Function IF) Test local printing */
+ printf("Test6f: (Function IF) Test local printing\n");
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test 6: (Function IF) Test local printing");
+ dlt_user_log_write_finish(&context_data);
}
- dlt_enable_local_print();
- if (dlt_user_log_write_start(&(context_function_test[5]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Message (visible: locally printed)");
- dlt_user_log_write_finish(&context_data);
+ dlt_enable_local_print();
+ if (dlt_user_log_write_start(&(context_function_test[5]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Message (visible: locally printed)");
+ dlt_user_log_write_finish(&context_data);
}
- dlt_disable_local_print();
- if (dlt_user_log_write_start(&(context_function_test[5]),&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Message (invisible: not locally printed)");
- dlt_user_log_write_finish(&context_data);
+ dlt_disable_local_print();
+ if (dlt_user_log_write_start(&(context_function_test[5]),&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Message (invisible: not locally printed)");
+ dlt_user_log_write_finish(&context_data);
}
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test6: (Function IF) finished");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test6: (Function IF) finished");
+ dlt_user_log_write_finish(&context_data);
}
- return 0;
+ return 0;
}
int test7f(void)
{
- char buffer[32];
+ char buffer[32];
int num;
for(num=0;num<32;num++)
@@ -1065,40 +1065,40 @@ int test7f(void)
buffer[num] = num;
}
- /* Show all log messages and traces */
- dlt_set_application_ll_ts_limit(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON);
+ /* Show all log messages and traces */
+ dlt_set_application_ll_ts_limit(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON);
- /* Test 7: (Function IF) Test network trace */
- printf("Test7f: (Function IF) Test network trace\n");
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test 7: (Function IF) Test network trace");
- dlt_user_log_write_finish(&context_data);
+ /* Test 7: (Function IF) Test network trace */
+ printf("Test7f: (Function IF) Test network trace\n");
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test 7: (Function IF) Test network trace");
+ dlt_user_log_write_finish(&context_data);
}
- /* Dummy message: 16 byte header, 32 byte payload */
- dlt_user_trace_network(&(context_function_test[6]), DLT_NW_TRACE_IPC, 16, buffer, 32, buffer);
- dlt_user_trace_network(&(context_function_test[6]), DLT_NW_TRACE_CAN, 16, buffer, 32, buffer);
- dlt_user_trace_network(&(context_function_test[6]), DLT_NW_TRACE_FLEXRAY, 16, buffer, 32, buffer);
- dlt_user_trace_network(&(context_function_test[6]), DLT_NW_TRACE_MOST, 16, buffer, 32, buffer);
+ /* Dummy message: 16 byte header, 32 byte payload */
+ dlt_user_trace_network(&(context_function_test[6]), DLT_NW_TRACE_IPC, 16, buffer, 32, buffer);
+ dlt_user_trace_network(&(context_function_test[6]), DLT_NW_TRACE_CAN, 16, buffer, 32, buffer);
+ dlt_user_trace_network(&(context_function_test[6]), DLT_NW_TRACE_FLEXRAY, 16, buffer, 32, buffer);
+ dlt_user_trace_network(&(context_function_test[6]), DLT_NW_TRACE_MOST, 16, buffer, 32, buffer);
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test7: (Function IF) finished");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test7: (Function IF) finished");
+ dlt_user_log_write_finish(&context_data);
}
- dlt_set_application_ll_ts_limit(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT);
- sleep(2);
+ dlt_set_application_ll_ts_limit(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT);
+ sleep(2);
- return 0;
+ return 0;
}
int test8f(void)
{
- char buffer[1024*5];
+ char buffer[1024*5];
int num;
for(num=0;num<1024*5;num++)
@@ -1106,40 +1106,40 @@ int test8f(void)
buffer[num] = num;
}
- /* Show all log messages and traces */
- dlt_set_application_ll_ts_limit(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON);
+ /* Show all log messages and traces */
+ dlt_set_application_ll_ts_limit(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON);
- /* Test 8: (Function IF) Test truncated network trace */
- printf("Test8f: (Function IF) Test truncated network trace\n");
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test 8: (Function IF) Test truncated network trace");
- dlt_user_log_write_finish(&context_data);
+ /* Test 8: (Function IF) Test truncated network trace */
+ printf("Test8f: (Function IF) Test truncated network trace\n");
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test 8: (Function IF) Test truncated network trace");
+ dlt_user_log_write_finish(&context_data);
}
- /* Dummy message: 16 byte header, 32 byte payload */
- dlt_user_trace_network_truncated(&(context_function_test[7]), DLT_NW_TRACE_IPC, 16, buffer, 1024*5, buffer, 1);
- dlt_user_trace_network_truncated(&(context_function_test[7]), DLT_NW_TRACE_CAN, 16, buffer, 1024*5, buffer, 1);
- dlt_user_trace_network_truncated(&(context_function_test[7]), DLT_NW_TRACE_FLEXRAY, 16, buffer, 1024*5, buffer, 1);
- dlt_user_trace_network_truncated(&(context_function_test[7]), DLT_NW_TRACE_MOST, 16, buffer, 1024*5, buffer, 1);
+ /* Dummy message: 16 byte header, 32 byte payload */
+ dlt_user_trace_network_truncated(&(context_function_test[7]), DLT_NW_TRACE_IPC, 16, buffer, 1024*5, buffer, 1);
+ dlt_user_trace_network_truncated(&(context_function_test[7]), DLT_NW_TRACE_CAN, 16, buffer, 1024*5, buffer, 1);
+ dlt_user_trace_network_truncated(&(context_function_test[7]), DLT_NW_TRACE_FLEXRAY, 16, buffer, 1024*5, buffer, 1);
+ dlt_user_trace_network_truncated(&(context_function_test[7]), DLT_NW_TRACE_MOST, 16, buffer, 1024*5, buffer, 1);
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test8: (Function IF) finished");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test8: (Function IF) finished");
+ dlt_user_log_write_finish(&context_data);
}
- dlt_set_application_ll_ts_limit(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT);
- sleep(2);
+ dlt_set_application_ll_ts_limit(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT);
+ sleep(2);
- return 0;
+ return 0;
}
int test9f(void)
{
- char buffer[1024*5];
+ char buffer[1024*5];
int num;
for(num=0;num<1024*5;num++)
@@ -1147,74 +1147,74 @@ int test9f(void)
buffer[num] = num;
}
- /* Show all log messages and traces */
- dlt_set_application_ll_ts_limit(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON);
+ /* Show all log messages and traces */
+ dlt_set_application_ll_ts_limit(DLT_LOG_VERBOSE, DLT_TRACE_STATUS_ON);
- /* Test 9: (Function IF) Test segmented network trace */
- printf("Test9f: (Function IF) Test segmented network trace\n");
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test 9: (Function IF) Test segmented network trace");
- dlt_user_log_write_finish(&context_data);
+ /* Test 9: (Function IF) Test segmented network trace */
+ printf("Test9f: (Function IF) Test segmented network trace\n");
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test 9: (Function IF) Test segmented network trace");
+ dlt_user_log_write_finish(&context_data);
}
- /* Dummy message: 16 byte header, 5k payload */
- dlt_user_trace_network_segmented(&(context_function_test[8]), DLT_NW_TRACE_IPC, 16, buffer, 1024*5, buffer);
- dlt_user_trace_network_segmented(&(context_function_test[8]), DLT_NW_TRACE_CAN, 16, buffer, 1024*5, buffer);
- dlt_user_trace_network_segmented(&(context_function_test[8]), DLT_NW_TRACE_FLEXRAY, 16, buffer, 1024*5, buffer);
- dlt_user_trace_network_segmented(&(context_function_test[8]), DLT_NW_TRACE_MOST, 16, buffer, 1024*5, buffer);
+ /* Dummy message: 16 byte header, 5k payload */
+ dlt_user_trace_network_segmented(&(context_function_test[8]), DLT_NW_TRACE_IPC, 16, buffer, 1024*5, buffer);
+ dlt_user_trace_network_segmented(&(context_function_test[8]), DLT_NW_TRACE_CAN, 16, buffer, 1024*5, buffer);
+ dlt_user_trace_network_segmented(&(context_function_test[8]), DLT_NW_TRACE_FLEXRAY, 16, buffer, 1024*5, buffer);
+ dlt_user_trace_network_segmented(&(context_function_test[8]), DLT_NW_TRACE_MOST, 16, buffer, 1024*5, buffer);
- /* wait 2 second before next test */
+ /* wait 2 second before next test */
sleep(2);
- if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
- {
- dlt_user_log_write_string(&context_data,"Test9: (Function IF) finished");
- dlt_user_log_write_finish(&context_data);
+ if (dlt_user_log_write_start(&context_info,&context_data,DLT_LOG_INFO)>0)
+ {
+ dlt_user_log_write_string(&context_data,"Test9: (Function IF) finished");
+ dlt_user_log_write_finish(&context_data);
}
- dlt_set_application_ll_ts_limit(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT);
- sleep(2);
+ dlt_set_application_ll_ts_limit(DLT_LOG_DEFAULT, DLT_TRACE_STATUS_DEFAULT);
+ sleep(2);
- return 0;
+ return 0;
}
int test_injection_macro_callback(uint32_t service_id, void *data, uint32_t length)
{
- char text[1024];
+ char text[1024];
- memset(text,0,1024);
- snprintf(text,1024,"Injection received (macro IF). ID: 0x%.4x, Length: %d",service_id,length);
- printf("%s \n", text);
- DLT_LOG(context_macro_callback, DLT_LOG_INFO, DLT_STRING("Injection received (macro IF). ID: "), DLT_UINT32(service_id),DLT_STRING("Data:"),DLT_STRING(text));
- memset(text,0,1024);
+ memset(text,0,1024);
+ snprintf(text,1024,"Injection received (macro IF). ID: 0x%.4x, Length: %d",service_id,length);
+ printf("%s \n", text);
+ DLT_LOG(context_macro_callback, DLT_LOG_INFO, DLT_STRING("Injection received (macro IF). ID: "), DLT_UINT32(service_id),DLT_STRING("Data:"),DLT_STRING(text));
+ memset(text,0,1024);
- if (length>0)
- {
- dlt_print_mixed_string(text,1024,data,length,0);
- printf("%s \n", text);
- }
+ if (length>0)
+ {
+ dlt_print_mixed_string(text,1024,data,length,0);
+ printf("%s \n", text);
+ }
- return 0;
+ return 0;
}
int test_injection_function_callback(uint32_t service_id, void *data, uint32_t length)
{
- char text[1024];
+ char text[1024];
- memset(text,0,1024);
+ memset(text,0,1024);
- snprintf(text,1024,"Injection received (function IF). ID: 0x%.4x, Length: %d",service_id,length);
- printf("%s \n", text);
- DLT_LOG(context_function_callback, DLT_LOG_INFO, DLT_STRING("Injection received (function IF). ID: "), DLT_UINT32(service_id),DLT_STRING("Data:"),DLT_STRING(text));
- memset(text,0,1024);
+ snprintf(text,1024,"Injection received (function IF). ID: 0x%.4x, Length: %d",service_id,length);
+ printf("%s \n", text);
+ DLT_LOG(context_function_callback, DLT_LOG_INFO, DLT_STRING("Injection received (function IF). ID: "), DLT_UINT32(service_id),DLT_STRING("Data:"),DLT_STRING(text));
+ memset(text,0,1024);
- if (length>0)
- {
- dlt_print_mixed_string(text,1024,data,length,0);
- printf("%s \n", text);
- }
+ if (length>0)
+ {
+ dlt_print_mixed_string(text,1024,data,length,0);
+ printf("%s \n", text);
+ }
- return 0;
+ return 0;
}