Merge remote-tracking branch 'origin/feat/ignore-times' into dev
# Conflicts: # src/shared/config.c # tests/integration/test_features.py # tests/test_client_cli.c # tests/test_config.c
This commit is contained in:
@@ -331,6 +331,26 @@ class TestIncremental:
|
||||
with open(received_file, "rb") as f:
|
||||
assert f.read() == b"hello world\n"
|
||||
|
||||
def test_ignore_times_transfers_same_size_and_mtime(self, shared_server):
|
||||
clean_dir(DEST_DIR)
|
||||
result, _ = run_client(SOURCE_DIR, DEST_DIR, flags=["-M"], port=shared_server.port)
|
||||
assert result.returncode == 0
|
||||
|
||||
received = get_dest_received_dir(DEST_DIR, SOURCE_DIR)
|
||||
source_file = os.path.join(SOURCE_DIR, "small.txt")
|
||||
received_file = os.path.join(received, "small.txt")
|
||||
source_stat = os.stat(source_file)
|
||||
with open(received_file, "wb") as f:
|
||||
f.write(b"stale data!\n")
|
||||
os.utime(received_file, (source_stat.st_atime, source_stat.st_mtime))
|
||||
|
||||
result, _ = run_client(SOURCE_DIR, DEST_DIR,
|
||||
flags=["-M", "--incremental", "--ignore-times"],
|
||||
port=shared_server.port)
|
||||
assert result.returncode == 0, f"Ignore-times sync failed: {result.stderr[:200]}"
|
||||
with open(received_file, "rb") as f:
|
||||
assert f.read() == b"hello world\n"
|
||||
|
||||
def test_whole_file_disables_delta_and_keeps_compression(self, shared_server):
|
||||
clean_dir(DEST_DIR)
|
||||
result, _ = run_client(SOURCE_DIR, DEST_DIR, flags=["-M"], port=shared_server.port)
|
||||
|
||||
@@ -441,6 +441,24 @@ static void test_parse_args_fsync() {
|
||||
config_delete(cfg);
|
||||
}
|
||||
|
||||
static void test_parse_args_ignore_times() {
|
||||
Config* cfg = config_create();
|
||||
char* argv[] = {"fastsync", "-I", "/src", "/dst"};
|
||||
int positional_args[2];
|
||||
int positional_count = 0;
|
||||
|
||||
EXPECT_EQ_INT(parse_args(cfg, 4, argv, positional_args, &positional_count), 0);
|
||||
EXPECT_TRUE(cfg->ignore_times);
|
||||
config_delete(cfg);
|
||||
|
||||
cfg = config_create();
|
||||
char* long_argv[] = {"fastsync", "--ignore-times", "/src", "/dst"};
|
||||
positional_count = 0;
|
||||
EXPECT_EQ_INT(parse_args(cfg, 4, long_argv, positional_args, &positional_count), 0);
|
||||
EXPECT_TRUE(cfg->ignore_times);
|
||||
config_delete(cfg);
|
||||
}
|
||||
|
||||
/* --secluded-args is accepted for compatibility but has no effect. */
|
||||
static void test_parse_args_secluded_args() {
|
||||
Config* cfg = config_create();
|
||||
@@ -564,6 +582,7 @@ void test_client_cli() {
|
||||
test_parse_args_human_readable();
|
||||
test_parse_args_archive();
|
||||
test_parse_args_fsync();
|
||||
test_parse_args_ignore_times();
|
||||
test_parse_args_8_bit_output();
|
||||
test_parse_args_stderr_modes();
|
||||
test_parse_args_rejects_unsupported_stderr_modes();
|
||||
|
||||
@@ -127,6 +127,7 @@ static void test_config_send_receive() {
|
||||
send_cfg->use_fsync = true;
|
||||
send_cfg->use_delta = true;
|
||||
send_cfg->whole_file = true;
|
||||
send_cfg->ignore_times = true;
|
||||
send_cfg->compression_level = 5;
|
||||
send_cfg->chunk_size = 1024;
|
||||
send_cfg->eight_bit_output = true;
|
||||
@@ -160,6 +161,8 @@ static void test_config_send_receive() {
|
||||
ok = false;
|
||||
if (!recv_cfg->use_chunk_serialization)
|
||||
ok = false;
|
||||
if (!recv_cfg->ignore_times)
|
||||
ok = false;
|
||||
if (recv_cfg->compression_level != 5)
|
||||
ok = false;
|
||||
if (recv_cfg->chunk_size != 1024)
|
||||
|
||||
Reference in New Issue
Block a user