summaryrefslogtreecommitdiff
path: root/src/shared/dlt_common.c
diff options
context:
space:
mode:
authorStefan Held <stefan_held@mentor.com>2015-04-28 15:35:19 +0200
committerAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2015-06-17 08:49:30 +0200
commit96c169761a27f40f6df1c541d200df470e9b176a (patch)
treefcad2c16f00fe061349e487516022ef85108b8f0 /src/shared/dlt_common.c
parent86b2c5978345ecf1b2efc7a3f7a5fc0fa5bab020 (diff)
downloadDLT-daemon-96c169761a27f40f6df1c541d200df470e9b176a.tar.gz
added dlt_log_* unit tests rework of dlt_buffer_* and dlt_messages_* unit tests
Signed-off-by: Stefan Held <stefan_held@mentor.com> Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
Diffstat (limited to 'src/shared/dlt_common.c')
-rwxr-xr-xsrc/shared/dlt_common.c53
1 files changed, 52 insertions, 1 deletions
diff --git a/src/shared/dlt_common.c b/src/shared/dlt_common.c
index dce48c6..8672c03 100755
--- a/src/shared/dlt_common.c
+++ b/src/shared/dlt_common.c
@@ -1960,6 +1960,11 @@ void dlt_log_set_level(int level)
logging_level = level;
}
+int get_test_dlt_log_set_level()
+{
+ return logging_level;
+}
+
void dlt_log_set_filename(const char *filename)
{
strncpy(logging_filename,filename,NAME_MAX);
@@ -1967,6 +1972,11 @@ void dlt_log_set_filename(const char *filename)
}
+char * get_test_dlt_log_set_filename()
+{
+ return logging_filename;
+}
+
void dlt_log_init(int mode)
{
logging_mode = mode;
@@ -1983,6 +1993,11 @@ void dlt_log_init(int mode)
}
}
+int get_test_dlt_log_init()
+{
+ return logging_mode;
+}
+
void dlt_log_free(void)
{
if(logging_mode == DLT_LOG_TO_FILE) {
@@ -1990,6 +2005,14 @@ void dlt_log_free(void)
}
}
+int get_test_dlt_log_free()
+{
+ if(logging_mode == DLT_LOG_TO_FILE)
+ return logging_handle;
+ else
+ return logging_mode;
+}
+
int dlt_log(int prio, char *s)
{
static const char asSeverity[LOG_DEBUG+2][11] = {"EMERGENCY", "ALERT ", "CRITICAL ", "ERROR ", "WARNING ", "NOTICE ", "INFO ", "DEBUG ", " "};
@@ -2377,6 +2400,13 @@ void dlt_buffer_write_block(DltBuffer *buf,int *write, const unsigned char *data
}
}
+int get_test_dlt_buffer_write_block(DltBuffer *buf, int *write, const unsigned char *data, unsigned int size)
+{
+ // Get-Method for gtest. Test dlt_buffer_write_block
+ dlt_buffer_write_block(buf, write, data, size);
+ return *write;
+}
+
void dlt_buffer_read_block(DltBuffer *buf,int *read,unsigned char *data,unsigned int size)
{
if((int)(*read+size) <= buf->size) {
@@ -2390,7 +2420,14 @@ void dlt_buffer_read_block(DltBuffer *buf,int *read,unsigned char *data,unsigned
memcpy(data+buf->size-*read, buf->mem, size-buf->size+*read);
*read += size-buf->size;
}
-}
+}
+
+int get_test_dlt_buffer_read_block(DltBuffer *buf, int *read,unsigned char *data,unsigned int size)
+{
+ // Get-Method for gtest. Test dlt_buffer_read_block
+ dlt_buffer_read_block(buf, read, data, size);
+ return *read;
+}
int dlt_buffer_increase_size(DltBuffer *buf)
{
@@ -2713,6 +2750,13 @@ void dlt_buffer_info(DltBuffer *buf)
}
+int get_test_dlt_buffer_info(DltBuffer *buf)
+{
+ // Get-Method for gtest. Test dlt_buffer_info
+ dlt_buffer_info(buf);
+ return 0;
+}
+
void dlt_buffer_status(DltBuffer *buf)
{
int write, read, count;
@@ -2734,6 +2778,13 @@ void dlt_buffer_status(DltBuffer *buf)
dlt_log(LOG_DEBUG, str);
}
+int get_test_dlt_buffer_status(DltBuffer *buf)
+{
+ // Get-Method for gtest. Test dlt_buffer_status
+ dlt_buffer_status(buf);
+ return 0;
+}
+
int dlt_buffer_get_total_size(DltBuffer *buf)
{
return buf->max_size;