summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBui Nguyen Quoc Thanh <thanh.buinguyenquoc@vn.bosch.com>2020-05-18 16:21:26 +0700
committerSaya Sugiura <39760799+ssugiura@users.noreply.github.com>2020-07-06 10:04:07 +0900
commit16b8a01b258b2132015accbd395f377fe7dc2acf (patch)
tree17734891c70409a77ccb4786e50b4d6d50d4f0f4 /tests
parentacbbc6b23d6694ee940ad384bf882a4c4ab47af7 (diff)
downloadDLT-daemon-16b8a01b258b2132015accbd395f377fe7dc2acf.tar.gz
unittest: Update according to API's changes
Updates for two changed API: - dlt_logstorage_open_log_file - dlt_logstorage_prepare_on_msg Signed-off-by: Bui Nguyen Quoc Thanh <thanh.buinguyenquoc@vn.bosch.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/gtest_dlt_daemon_offline_log.cpp30
1 files changed, 20 insertions, 10 deletions
diff --git a/tests/gtest_dlt_daemon_offline_log.cpp b/tests/gtest_dlt_daemon_offline_log.cpp
index aec3e96..80f7e53 100644
--- a/tests/gtest_dlt_daemon_offline_log.cpp
+++ b/tests/gtest_dlt_daemon_offline_log.cpp
@@ -453,8 +453,8 @@ TEST(t_dlt_logstorage_store_filters, normal)
handle.connection_type = DLT_OFFLINE_LOGSTORAGE_DEVICE_CONNECTED;
handle.config_status = 0;
handle.write_errors = 0;
-
handle.config_list = NULL;
+ handle.newest_file_list = NULL;
EXPECT_EQ(DLT_RETURN_OK, dlt_logstorage_store_filters(&handle, config_file_name));
EXPECT_EQ(DLT_RETURN_OK, dlt_logstorage_list_destroy(&handle.config_list, &file_config, path, 0));
@@ -475,6 +475,7 @@ TEST(t_dlt_logstorage_load_config, normal)
handle.config_status = 0;
handle.write_errors = 0;
handle.config_list = NULL;
+ handle.newest_file_list = NULL;
strncpy(handle.device_mount_point, "/tmp", DLT_MOUNT_PATH_MAX);
EXPECT_EQ(DLT_RETURN_OK, dlt_logstorage_load_config(&handle));
@@ -494,6 +495,7 @@ TEST(t_dlt_logstorage_device_connected, normal)
handle.config_status = 0;
handle.write_errors = 0;
handle.config_list = NULL;
+ handle.newest_file_list = NULL;
strncpy(handle.device_mount_point, "/tmp", DLT_MOUNT_PATH_MAX);
EXPECT_EQ(DLT_RETURN_OK, dlt_logstorage_device_connected(&handle, handle.device_mount_point));
@@ -529,6 +531,7 @@ TEST(t_dlt_logstorage_get_loglevel_by_key, normal)
handle.connection_type = DLT_OFFLINE_LOGSTORAGE_DEVICE_CONNECTED;
handle.config_status = DLT_OFFLINE_LOGSTORAGE_CONFIG_DONE;
handle.config_list = NULL;
+ handle.newest_file_list = NULL;
int num_keys = 1;
config = (DltLogStorageFilterConfig *)calloc(1, sizeof(DltLogStorageFilterConfig));
@@ -611,6 +614,7 @@ TEST(t_dlt_logstorage_filter, normal)
handle.connection_type = DLT_OFFLINE_LOGSTORAGE_DEVICE_CONNECTED;
handle.config_status = DLT_OFFLINE_LOGSTORAGE_CONFIG_DONE;
handle.config_list = NULL;
+ handle.newest_file_list = NULL;
int num_keys = 1;
EXPECT_EQ(DLT_RETURN_OK, dlt_logstorage_list_add(key0, num_keys, &value, &(handle.config_list)));
@@ -647,6 +651,7 @@ TEST(t_dlt_logstorage_write, normal)
handle.connection_type = DLT_OFFLINE_LOGSTORAGE_DEVICE_CONNECTED;
handle.config_status = DLT_OFFLINE_LOGSTORAGE_CONFIG_DONE;
handle.config_list = NULL;
+ handle.newest_file_list = NULL;
DltLogStorageFilterConfig value;
value.apids = apid;
value.ctids = ctid;
@@ -876,12 +881,13 @@ TEST(t_dlt_logstorage_open_log_file, normal)
config.ctids = &ctids;
config.file_name = (char *)"Test";
config.records = NULL;
+ config.working_file_name = NULL;
- EXPECT_EQ(DLT_RETURN_OK, dlt_logstorage_open_log_file(&config, &file_config, path, 1));
+ EXPECT_EQ(DLT_RETURN_OK, dlt_logstorage_open_log_file(&config, &file_config, path, 1, true));
}
TEST(t_dlt_logstorage_open_log_file, null)
{
- EXPECT_EQ(DLT_RETURN_ERROR, dlt_logstorage_open_log_file(NULL, NULL, NULL, 0));
+ EXPECT_EQ(DLT_RETURN_ERROR, dlt_logstorage_open_log_file(NULL, NULL, NULL, 0, true));
}
/* Begin Method: dlt_logstorage::t_dlt_logstorage_prepare_on_msg*/
@@ -901,13 +907,14 @@ TEST(t_dlt_logstorage_prepare_on_msg, normal)
config.file_name = (char *)"Test";
config.records = NULL;
config.log = NULL;
+ config.working_file_name = NULL;
- EXPECT_EQ(DLT_RETURN_OK, dlt_logstorage_prepare_on_msg(&config, &file_config, path, 1));
+ EXPECT_EQ(DLT_RETURN_OK, dlt_logstorage_prepare_on_msg(&config, &file_config, path, 1, NULL));
}
TEST(t_dlt_logstorage_prepare_on_msg, null)
{
- EXPECT_EQ(DLT_RETURN_ERROR, dlt_logstorage_prepare_on_msg(NULL, NULL, NULL, 0));
+ EXPECT_EQ(DLT_RETURN_ERROR, dlt_logstorage_prepare_on_msg(NULL, NULL, NULL, 0, NULL));
}
/* Begin Method: dlt_logstorage::t_dlt_logstorage_write_on_msg*/
@@ -927,12 +934,13 @@ TEST(t_dlt_logstorage_write_on_msg, normal)
config.file_name = (char *)"Test";
config.records = NULL;
config.log = NULL;
+ config.working_file_name = NULL;
unsigned int size = 8;
unsigned char data1[] = "dlt_data";
unsigned char data2[] = "dlt_data";
unsigned char data3[] = "dlt_data";
- EXPECT_EQ(DLT_RETURN_OK, dlt_logstorage_prepare_on_msg(&config, &file_config, path, 1));
+ EXPECT_EQ(DLT_RETURN_OK, dlt_logstorage_prepare_on_msg(&config, &file_config, path, 1, NULL));
EXPECT_EQ(DLT_RETURN_OK, dlt_logstorage_write_on_msg(&config, &file_config, path,
data1, size, data2, size, data3, size));
}
@@ -955,6 +963,7 @@ TEST(t_dlt_logstorage_sync_on_msg, normal)
config.file_name = (char *)"Test";
config.records = NULL;
config.log = NULL;
+ config.working_file_name = NULL;
char *path = NULL;
EXPECT_EQ(DLT_RETURN_OK, dlt_logstorage_sync_on_msg(&config, &file_config, path, DLT_LOGSTORAGE_SYNC_ON_MSG));
@@ -985,16 +994,17 @@ TEST(t_dlt_logstorage_prepare_msg_cache, normal)
config.cache = NULL;
config.file_size = 0;
config.sync = DLT_LOGSTORAGE_SYNC_ON_DEMAND;
+ config.working_file_name = NULL;
g_logstorage_cache_max = 16;
- EXPECT_EQ(DLT_RETURN_OK, dlt_logstorage_prepare_msg_cache(&config, &file_config, path, 1));
+ EXPECT_EQ(DLT_RETURN_OK, dlt_logstorage_prepare_msg_cache(&config, &file_config, path, 1, NULL));
free(config.cache);
}
TEST(t_dlt_logstorage_prepare_msg_cache, null)
{
- EXPECT_EQ(DLT_RETURN_ERROR, dlt_logstorage_prepare_msg_cache(NULL, NULL, NULL, 0));
+ EXPECT_EQ(DLT_RETURN_ERROR, dlt_logstorage_prepare_msg_cache(NULL, NULL, NULL, 0, NULL));
}
/* Begin Method: dlt_logstorage::t_dlt_logstorage_write_msg_cache*/
@@ -1572,7 +1582,7 @@ TEST(t_dlt_logstorage_sync_to_file, normal)
config.cache = calloc(1, config.file_size + sizeof(DltLogStorageCacheFooter));
if (config.cache != NULL) {
- EXPECT_EQ(DLT_RETURN_OK, dlt_logstorage_prepare_msg_cache(&config, &file_config, path, 1));
+ EXPECT_EQ(DLT_RETURN_OK, dlt_logstorage_prepare_msg_cache(&config, &file_config, path, 1, NULL));
EXPECT_EQ(DLT_RETURN_OK, dlt_logstorage_write_msg_cache(&config, &file_config, path,
data1, size, data2, size, data3, size));
@@ -1625,7 +1635,7 @@ TEST(t_dlt_logstorage_sync_msg_cache, normal)
config.cache = calloc(1, 50 + sizeof(DltLogStorageCacheFooter));
if (config.cache != NULL) {
- EXPECT_EQ(DLT_RETURN_OK, dlt_logstorage_prepare_msg_cache(&config, &file_config, path, 1));
+ EXPECT_EQ(DLT_RETURN_OK, dlt_logstorage_prepare_msg_cache(&config, &file_config, path, 1, NULL));
EXPECT_EQ(DLT_RETURN_OK, dlt_logstorage_write_msg_cache(&config, &file_config, path, data1, size, data2, size, data3, size));
EXPECT_EQ(DLT_RETURN_OK,
dlt_logstorage_sync_msg_cache(&config, &file_config, path, DLT_LOGSTORAGE_SYNC_ON_DEMAND));