79 #define DLT_TEST_NUM_CONTEXT 9 143 printf(
"Usage: dlt-test-user [options]\n");
144 printf(
"Test user application providing several Tests.\n");
145 printf(
"%s \n", version);
146 printf(
"Options:\n");
147 printf(
" -v Verbose mode\n");
148 printf(
" -f filename Use local log file instead of sending to daemon\n");
149 printf(
" -n count Repeats of tests (Default: 1)\n");
151 printf(
" 1m: (Macro IF) Test all log levels\n");
152 printf(
" 2m: (Macro IF) Test all variable types (verbose) \n");
153 printf(
" 3m: (Macro IF) Test all variable types (non-verbose) \n");
154 printf(
" 4m: (Macro IF) Test different message sizes\n");
155 printf(
" 5m: (Macro IF) Test high-level API\n");
156 printf(
" 6m: (Macro IF) Test local printing\n");
157 printf(
" 7m: (Macro IF) Test network trace\n");
158 printf(
" 8m: (Macro IF) Test truncated network trace\n");
159 printf(
" 9m: (Macro IF) Test segmented network trace\n");
160 printf(
" 1f: (Function IF) Test all log levels\n");
161 printf(
" 2f: (Function IF) Test all variable types (verbose) \n");
162 printf(
" 3f: (Function IF) Test all variable types (non-verbose) \n");
163 printf(
" 4f: (Function IF) Test different message sizes\n");
164 printf(
" 5f: (Function IF) Test high-level API\n");
165 printf(
" 6f: (Function IF) Test local printing\n");
166 printf(
" 7f: (Function IF) Test network trace\n");
167 printf(
" 8f: (Function IF) Test truncated network trace\n");
168 printf(
" 9f: (Function IF) Test segmented network trace\n");
174 int main(
int argc,
char* argv[])
183 char ctid[4], ctdesc[255];
189 while ((c = getopt (argc, argv,
"vf:n:")) != -1)
210 if (optopt ==
'd' || optopt ==
'f' || optopt ==
'n')
212 fprintf (stderr,
"Option -%c requires an argument.\n", optopt);
214 else if (isprint (optopt))
216 fprintf (stderr,
"Unknown option `-%c'.\n", optopt);
220 fprintf (stderr,
"Unknown option character `\\x%x'.\n",optopt);
245 maxnum = atoi(nvalue);
262 snprintf(ctid,4,
"TM%d",i+1);
263 snprintf(ctdesc,255,
"Test %d context for macro interface",i+1);
268 dlt_register_context(&context_function_callback,
"CBF",
"Callback Test context for function interface");
271 snprintf(ctid,4,
"TF%d",i+1);
272 snprintf(ctdesc,255,
"Test %d context for function interface",i+1);
291 printf(
"Tests starting\n");
297 for (num=0;num<maxnum;num++)
328 printf(
"Tests finished\n");
364 printf(
"Test1m: (Macro IF) Test all log levels\n");
387 printf(
"Test2m: (Macro IF) Test all variable types (verbose)\n");
406 for(num2=0;num2<10;num2++)
426 printf(
"Test3m: (Macro IF) Test all variable types (non-verbose)\n");
448 for(num2=0;num2<10;num2++)
468 for(num=0;num<1024;num++)
474 printf(
"Test4m: (Macro IF) Test different message sizes\n");
495 void *ptr = malloc(
sizeof(
int));
497 for(num=0;num<32;num++)
503 printf(
"Test5m: (Macro IF) Test high-level API\n");
557 printf(
"Test6m: (Macro IF) Test local printing\n");
578 for(num=0;num<32;num++)
587 printf(
"Test7m: (Macro IF) Test network trace\n");
611 for(num=0;num<1024*5;num++)
620 printf(
"Test8m: (Macro IF) Test truncated network trace\n");
644 for(num=0;num<1024*5;num++)
653 printf(
"Test9m: (Macro IF) Test segmented network trace\n");
675 printf(
"Test1f: (Function IF) Test all log levels\n");
730 printf(
"Test2f: (Function IF) Test all variable types (verbose)\n");
821 for(num2=0;num2<10;num2++)
850 printf(
"Test3f: (Function IF) Test all variable types (non-verbose)\n");
943 for(num2=0;num2<10;num2++)
973 for(num=0;num<1024;num++)
979 printf(
"Test4f: (Function IF) Test different message sizes\n");
1029 for(num=0;num<32;num++)
1035 printf(
"Test5f: (Function IF) Test high-level API\n");
1081 printf(
"Test6f: (Function IF) Test local printing\n");
1118 for(num=0;num<32;num++)
1127 printf(
"Test7f: (Function IF) Test network trace\n");
1159 for(num=0;num<1024*5;num++)
1168 printf(
"Test8f: (Function IF) Test truncated network trace\n");
1200 for(num=0;num<1024*5;num++)
1209 printf(
"Test9f: (Function IF) Test segmented network trace\n");
1240 memset(text,0,1024);
1241 snprintf(text,1024,
"Injection received (macro IF). ID: 0x%.4x, Length: %d",service_id,length);
1242 printf(
"%s \n", text);
1244 memset(text,0,1024);
1249 printf(
"%s \n", text);
1259 memset(text,0,1024);
1261 snprintf(text,1024,
"Injection received (function IF). ID: 0x%.4x, Length: %d",service_id,length);
1262 printf(
"%s \n", text);
1264 memset(text,0,1024);
1269 printf(
"%s \n", text);
int test_injection_function_callback(uint32_t service_id, void *data, uint32_t length)
#define DLT_RAW(BUF, LEN)
DltReturnValue dlt_user_log_write_float32(DltContextData *log, float32_t data)
DltReturnValue dlt_user_log_write_int16(DltContextData *log, int16_t data)
DltReturnValue dlt_user_log_write_string(DltContextData *log, const char *text)
#define DLT_UNREGISTER_APP()
#define DLT_INT8(INT_VAR)
DltReturnValue dlt_verbose_mode(void)
#define DLT_UINT16(UINT_VAR)
DLT_DECLARE_CONTEXT(context_info)
#define DLT_LOG_STRING(CONTEXT, LOGLEVEL, TEXT)
#define DLT_LOG_INT(CONTEXT, LOGLEVEL, INT_VAR)
DltReturnValue dlt_user_log_write_int(DltContextData *log, int data)
#define DLT_TRACE_NETWORK_TRUNCATED(CONTEXT, TYPE, HEADERLEN, HEADER, PAYLOADLEN, PAYLOAD)
#define DLT_UINT64(UINT_VAR)
#define DLT_NONVERBOSE_MODE()
#define DLT_REGISTER_INJECTION_CALLBACK(CONTEXT, SERVICEID, CALLBACK)
DltReturnValue dlt_print_mixed_string(char *text, int textlength, uint8_t *ptr, int size, int html)
DltReturnValue dlt_register_context(DltContext *handle, const char *contextid, const char *description)
#define DLT_DISABLE_LOCAL_PRINT()
DltReturnValue dlt_user_log_write_int32(DltContextData *log, int32_t data)
#define DLT_IS_LOG_LEVEL_ENABLED(CONTEXT, LOGLEVEL)
#define DLT_TRACE_NETWORK(CONTEXT, TYPE, HEADERLEN, HEADER, PAYLOADLEN, PAYLOAD)
DltReturnValue dlt_init_file(const char *name)
static const char * loglevelstr[DLT_LOG_MAX]
DltReturnValue dlt_enable_local_print(void)
#define DLT_BOOL(BOOL_VAR)
#define DLT_FLOAT32(FLOAT32_VAR)
#define DLT_INT64(INT_VAR)
int test_injection_macro_callback(uint32_t service_id, void *data, uint32_t length)
static char * service_id[]
DltReturnValue dlt_log_uint(DltContext *handle, DltLogLevelType loglevel, unsigned int data)
static char data[kDataSize]
#define DLT_LOG_UINT(CONTEXT, LOGLEVEL, UINT_VAR)
#define DLT_LOG_ID(CONTEXT, LOGLEVEL, MSGID, ARGS...)
#define DLT_SET_APPLICATION_LL_TS_LIMIT(LOGLEVEL, TRACESTATUS)
#define DLT_INT32(INT_VAR)
#define DLT_REGISTER_APP(APPID, DESCRIPTION)
DltReturnValue dlt_user_log_write_int64(DltContextData *log, int64_t data)
#define DLT_FLOAT64(FLOAT64_VAR)
unsigned char buffer[BUFFER_SIZE]
Buffer for dlt file transfer. The size is defined by BUFFER_SIZE.
DltReturnValue dlt_user_log_write_uint8(DltContextData *log, uint8_t data)
#define DLT_LOG_STRING_INT(CONTEXT, LOGLEVEL, TEXT, INT_VAR)
#define DLT_REGISTER_CONTEXT(CONTEXT, CONTEXTID, DESCRIPTION)
DltReturnValue dlt_log_int(DltContext *handle, DltLogLevelType loglevel, int data)
DltReturnValue dlt_disable_local_print(void)
#define DLT_TRACE_NETWORK_SEGMENTED(CONTEXT, TYPE, HEADERLEN, HEADER, PAYLOADLEN, PAYLOAD)
#define DLT_UNREGISTER_CONTEXT(CONTEXT)
#define DLT_VERBOSE_MODE()
#define DLT_UINT8(UINT_VAR)
#define DLT_ENABLE_LOCAL_PRINT()
int main(int argc, char *argv[])
DltReturnValue dlt_user_log_write_uint(DltContextData *log, unsigned int data)
DltReturnValue dlt_user_log_write_uint32(DltContextData *log, uint32_t data)
DltReturnValue dlt_user_trace_network_segmented(DltContext *handle, DltNetworkTraceType nw_trace_type, uint16_t header_len, void *header, uint16_t payload_len, void *payload)
#define DLT_LOG(CONTEXT, LOGLEVEL, ARGS...)
#define DLT_UINT(UINT_VAR)
DltReturnValue dlt_user_log_write_start_id(DltContext *handle, DltContextData *log, DltLogLevelType loglevel, uint32_t messageid)
DltReturnValue dlt_user_trace_network_truncated(DltContext *handle, DltNetworkTraceType nw_trace_type, uint16_t header_len, void *header, uint16_t payload_len, void *payload, int allow_truncate)
DltReturnValue dlt_log_string(DltContext *handle, DltLogLevelType loglevel, const char *text)
DltReturnValue dlt_set_application_ll_ts_limit(DltLogLevelType loglevel, DltTraceStatusType tracestatus)
DltReturnValue dlt_log_string_int(DltContext *handle, DltLogLevelType loglevel, const char *text, int data)
#define DLT_LOG_RAW(CONTEXT, LOGLEVEL, BUF, LEN)
#define DLT_TEST_NUM_CONTEXT
void dlt_get_version(char *buf, size_t size)
DltReturnValue dlt_user_log_write_int8(DltContextData *log, int8_t data)
static DltReturnValue dlt_user_is_logLevel_enabled(DltContext *handle, DltLogLevelType loglevel)
#define DLT_USER_BUF_MAX_SIZE
DltReturnValue dlt_log_string_uint(DltContext *handle, DltLogLevelType loglevel, const char *text, unsigned int data)
DltReturnValue dlt_register_injection_callback(DltContext *handle, uint32_t service_id, int(*dlt_injection_callback)(uint32_t service_id, void *data, uint32_t length))
DltReturnValue dlt_user_log_write_uint64(DltContextData *log, uint64_t data)
DltReturnValue dlt_user_log_write_uint16(DltContextData *log, uint16_t data)
DltReturnValue dlt_nonverbose_mode(void)
#define DLT_UINT32(UINT_VAR)
DltReturnValue dlt_user_trace_network(DltContext *handle, DltNetworkTraceType nw_trace_type, uint16_t header_len, void *header, uint16_t payload_len, void *payload)
DltReturnValue dlt_unregister_context(DltContext *handle)
DltReturnValue dlt_log_raw(DltContext *handle, DltLogLevelType loglevel, void *data, uint16_t length)
#define DLT_LOG_STRING_UINT(CONTEXT, LOGLEVEL, TEXT, UINT_VAR)
DltReturnValue dlt_user_log_write_bool(DltContextData *log, uint8_t data)
DltReturnValue dlt_user_log_write_raw(DltContextData *log, void *data, uint16_t length)
DltReturnValue dlt_user_log_write_finish(DltContextData *log)
DltReturnValue dlt_user_log_write_float64(DltContextData *log, float64_t data)
#define DLT_INT16(INT_VAR)
DltReturnValue dlt_user_log_write_start(DltContext *handle, DltContextData *log, DltLogLevelType loglevel)