feat: add quiet client option
CI / lint (pull_request) Successful in 11s
CI / sanitizers (address) (pull_request) Successful in 37s
CI / sanitizers (undefined) (pull_request) Successful in 36s
CI / fuzz-build (pull_request) Successful in 15s
CI / coverage (pull_request) Successful in 32s
CI / build-and-test (pull_request) Successful in 1m16s
CI / valgrind (pull_request) Successful in 33s
CI / lint (pull_request) Successful in 11s
CI / sanitizers (address) (pull_request) Successful in 37s
CI / sanitizers (undefined) (pull_request) Successful in 36s
CI / fuzz-build (pull_request) Successful in 15s
CI / coverage (pull_request) Successful in 32s
CI / build-and-test (pull_request) Successful in 1m16s
CI / valgrind (pull_request) Successful in 33s
This commit is contained in:
@@ -35,6 +35,23 @@ class TestDryRun:
|
||||
assert result.returncode == 0, f"Exit {result.returncode}: {result.stderr[:100]}"
|
||||
assert "Dry run:" in result.stdout, f"No dry run output: {result.stdout[:200]}"
|
||||
|
||||
def test_quiet_suppresses_dry_run_output(self):
|
||||
result, dur = run_client(
|
||||
SOURCE_DIR, DEST_DIR,
|
||||
flags=["-q", "-n", "--progress", "--stats"],
|
||||
)
|
||||
assert result.returncode == 0, f"Exit {result.returncode}: {result.stderr[:100]}"
|
||||
assert result.stdout == ""
|
||||
assert result.stderr == ""
|
||||
|
||||
def test_quiet_preserves_errors(self):
|
||||
result, dur = run_client(
|
||||
SOURCE_DIR, DEST_DIR,
|
||||
flags=["--quiet", "--server-port", "1"],
|
||||
)
|
||||
assert result.returncode != 0
|
||||
assert result.stderr != ""
|
||||
|
||||
|
||||
class TestArchiveMode:
|
||||
def test_archive_mode(self, shared_server):
|
||||
|
||||
+17
-3
@@ -262,9 +262,7 @@ static void test_parse_args_unknown_option() {
|
||||
|
||||
/* Parsed-but-unimplemented options must fail instead of being silently accepted. */
|
||||
static void test_parse_args_rejects_unimplemented_options() {
|
||||
static const char* const options[] = {"-q",
|
||||
"--quiet",
|
||||
"--silent",
|
||||
static const char* const options[] = {"--silent",
|
||||
"--queue-size",
|
||||
"-H",
|
||||
"--hard-links",
|
||||
@@ -323,6 +321,21 @@ static void test_parse_args_rejects_unimplemented_options() {
|
||||
}
|
||||
}
|
||||
|
||||
/* Test both rsync-compatible quiet spellings. */
|
||||
static void test_parse_args_quiet() {
|
||||
static const char* const options[] = {"-q", "--quiet"};
|
||||
for (size_t i = 0; i < sizeof(options) / sizeof(options[0]); i++) {
|
||||
Config* cfg = config_create();
|
||||
char* argv[] = {"fastsync", (char*)options[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->quiet);
|
||||
config_delete(cfg);
|
||||
}
|
||||
}
|
||||
|
||||
/* Test parse_args with --archive flag */
|
||||
static void test_parse_args_archive() {
|
||||
Config* cfg = config_create();
|
||||
@@ -359,5 +372,6 @@ void test_client_cli() {
|
||||
test_parse_args_valid_compression_level();
|
||||
test_parse_args_unknown_option();
|
||||
test_parse_args_rejects_unimplemented_options();
|
||||
test_parse_args_quiet();
|
||||
test_parse_args_archive();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user