cleanup: remove dead code, fix bugs, refactor SSH dest parsing
- Remove debug printf calls from file.c - Remove dead code: chunk_print, chunk_format, chunk_data_create/delete - Remove unused config.use_single_send_per_file field - Fix server_delete() no-op (double-pointer) - Fix double cast (long)(long) -> ptrdiff_t in chunk.c - Fix thread return value: thrd_error instead of 1 - Remove unused config param from receive_chunk_enqueue() - Make queue_double_capacity() static - Move SSH dest parsing into config.c as config_parse_ssh_dest() - Fix test_config_ssh_dest to test parsing round-trip - Remove chunk_format test (obsolete format) - Replace chunk_data_delete with data_destroy in tests
This commit is contained in:
+28
-3
@@ -26,12 +26,35 @@ static void test_config_lifecycle() {
|
||||
static void test_config_ssh_dest() {
|
||||
Config *cfg = config_create(str_dup("1.0"), str_dup("/src"), str_dup("user@host:/dst"),
|
||||
true, false, false, false, false, 1, 4, false);
|
||||
cfg->transport = TRANSPORT_SSH;
|
||||
cfg->ssh_destination = str_dup("user@host:/dst");
|
||||
EXPECT_NOT_NULL(cfg);
|
||||
EXPECT_EQ_INT(cfg->transport, TRANSPORT_TCP);
|
||||
EXPECT_NULL(cfg->ssh_destination);
|
||||
EXPECT_EQ_STR(cfg->receive_root_directory, "user@host:/dst");
|
||||
|
||||
config_parse_ssh_dest(cfg);
|
||||
EXPECT_EQ_INT(cfg->transport, TRANSPORT_SSH);
|
||||
EXPECT_EQ_STR(cfg->ssh_destination, "user@host:/dst");
|
||||
EXPECT_EQ_STR(cfg->receive_root_directory, "user@host:/dst");
|
||||
EXPECT_EQ_STR(cfg->receive_root_directory, "/dst");
|
||||
config_delete(cfg);
|
||||
}
|
||||
|
||||
static void test_config_ssh_dest_local_path() {
|
||||
Config *cfg = config_create(str_dup("1.0"), str_dup("/src"), str_dup("/local/path"),
|
||||
true, false, false, false, false, 1, 4, false);
|
||||
config_parse_ssh_dest(cfg);
|
||||
EXPECT_EQ_INT(cfg->transport, TRANSPORT_TCP);
|
||||
EXPECT_NULL(cfg->ssh_destination);
|
||||
EXPECT_EQ_STR(cfg->receive_root_directory, "/local/path");
|
||||
config_delete(cfg);
|
||||
}
|
||||
|
||||
static void test_config_ssh_dest_no_user() {
|
||||
Config *cfg = config_create(str_dup("1.0"), str_dup("/src"), str_dup("host:/remote"),
|
||||
true, false, false, false, false, 1, 4, false);
|
||||
config_parse_ssh_dest(cfg);
|
||||
EXPECT_EQ_INT(cfg->transport, TRANSPORT_SSH);
|
||||
EXPECT_EQ_STR(cfg->ssh_destination, "host:/remote");
|
||||
EXPECT_EQ_STR(cfg->receive_root_directory, "/remote");
|
||||
config_delete(cfg);
|
||||
}
|
||||
|
||||
@@ -70,6 +93,8 @@ static void test_pipeline_receiver_lifecycle() {
|
||||
void test_config() {
|
||||
test_config_lifecycle();
|
||||
test_config_ssh_dest();
|
||||
test_config_ssh_dest_local_path();
|
||||
test_config_ssh_dest_no_user();
|
||||
test_pipeline_sender_lifecycle();
|
||||
test_pipeline_receiver_lifecycle();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user