feat: add rsync stderr output modes
CI / lint (pull_request) Successful in 11s
CI / sanitizers (address) (pull_request) Successful in 38s
CI / sanitizers (undefined) (pull_request) Successful in 38s
CI / fuzz-build (pull_request) Successful in 15s
CI / coverage (pull_request) Successful in 31s
CI / build-and-test (pull_request) Successful in 1m15s
CI / valgrind (pull_request) Successful in 33s
CI / lint (pull_request) Successful in 11s
CI / sanitizers (address) (pull_request) Successful in 38s
CI / sanitizers (undefined) (pull_request) Successful in 38s
CI / fuzz-build (pull_request) Successful in 15s
CI / coverage (pull_request) Successful in 31s
CI / build-and-test (pull_request) Successful in 1m15s
CI / valgrind (pull_request) Successful in 33s
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "test_client_cli.h"
|
||||
#include "client_validation.h"
|
||||
#include "config.h"
|
||||
#include "log.h"
|
||||
#include "test_utils.h"
|
||||
#include "utils.h"
|
||||
#include <stdlib.h>
|
||||
@@ -339,6 +340,34 @@ static void test_parse_args_archive() {
|
||||
config_delete(cfg);
|
||||
}
|
||||
|
||||
static void test_parse_args_stderr_modes() {
|
||||
static const char* const modes[] = {"errors", "all", "client", "e", "a", "c"};
|
||||
static const LogStderrMode expected[] = {LOG_STDERR_ERRORS, LOG_STDERR_ALL, LOG_STDERR_CLIENT,
|
||||
LOG_STDERR_ERRORS, LOG_STDERR_ALL, LOG_STDERR_CLIENT};
|
||||
for (size_t i = 0; i < sizeof(modes) / sizeof(modes[0]); i++) {
|
||||
Config* cfg = config_create();
|
||||
char option[32];
|
||||
snprintf(option, sizeof(option), "--stderr=%s", modes[i]);
|
||||
char* argv[] = {"fastsync", option, "/src", "/dst"};
|
||||
int positional_args[2];
|
||||
int positional_count = 0;
|
||||
EXPECT_EQ_INT(parse_args(cfg, 4, argv, positional_args, &positional_count), 0);
|
||||
EXPECT_EQ_INT(log_get_stderr_mode(), expected[i]);
|
||||
config_delete(cfg);
|
||||
}
|
||||
log_set_stderr_mode(LOG_STDERR_ERRORS);
|
||||
}
|
||||
|
||||
static void test_parse_args_rejects_invalid_stderr_mode() {
|
||||
Config* cfg = config_create();
|
||||
char* argv[] = {"fastsync", "--stderr=invalid", "/src", "/dst"};
|
||||
int positional_args[2];
|
||||
int positional_count = 0;
|
||||
EXPECT_EQ_INT(parse_args(cfg, 4, argv, positional_args, &positional_count), -1);
|
||||
config_delete(cfg);
|
||||
log_set_stderr_mode(LOG_STDERR_ERRORS);
|
||||
}
|
||||
|
||||
void test_client_cli() {
|
||||
test_validate_config_required_paths();
|
||||
test_validate_config_incompatible_options();
|
||||
@@ -360,4 +389,6 @@ void test_client_cli() {
|
||||
test_parse_args_unknown_option();
|
||||
test_parse_args_rejects_unimplemented_options();
|
||||
test_parse_args_archive();
|
||||
test_parse_args_stderr_modes();
|
||||
test_parse_args_rejects_invalid_stderr_mode();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user