fix: test quality — cppcheck suppressions, TLS test addresses, log test isolation
CI / lint (pull_request) Successful in 8s
CI / sanitizers (address) (pull_request) Successful in 16s
CI / sanitizers (undefined) (pull_request) Successful in 16s
CI / coverage (pull_request) Successful in 9s
CI / fuzz-build (pull_request) Successful in 12s
CI / valgrind (pull_request) Successful in 12s
CI / build-and-test (pull_request) Successful in 53s
CI / lint (pull_request) Successful in 8s
CI / sanitizers (address) (pull_request) Successful in 16s
CI / sanitizers (undefined) (pull_request) Successful in 16s
CI / coverage (pull_request) Successful in 9s
CI / fuzz-build (pull_request) Successful in 12s
CI / valgrind (pull_request) Successful in 12s
CI / build-and-test (pull_request) Successful in 53s
This commit is contained in:
+13
-5
@@ -7,27 +7,30 @@
|
||||
* and that set_log_level changes behavior. */
|
||||
|
||||
static void test_log_message_debug() {
|
||||
/* Default level is WARNING, so DEBUG should be filtered out */
|
||||
set_log_level(LOG_LEVEL_WARNING);
|
||||
log_message(LOG_LEVEL_DEBUG, "debug message: %d", 42);
|
||||
/* No assertion needed - if we reach here without crash, success */
|
||||
/* crash regression test — stderr capture would need infrastructure changes */
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
|
||||
static void test_log_message_info() {
|
||||
/* Default level is WARNING, so INFO should be filtered out */
|
||||
set_log_level(LOG_LEVEL_WARNING);
|
||||
log_message(LOG_LEVEL_INFO, "info message: %s", "test");
|
||||
/* crash regression test — stderr capture would need infrastructure changes */
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
|
||||
static void test_log_message_warning() {
|
||||
/* Default level is WARNING, so WARNING should be shown */
|
||||
set_log_level(LOG_LEVEL_WARNING);
|
||||
log_message(LOG_LEVEL_WARNING, "warning message: %d %s", 1, "test");
|
||||
/* crash regression test — stderr capture would need infrastructure changes */
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
|
||||
static void test_log_message_error() {
|
||||
/* Default level is WARNING, so ERROR should be shown */
|
||||
set_log_level(LOG_LEVEL_WARNING);
|
||||
log_message(LOG_LEVEL_ERROR, "error message: %s", "critical");
|
||||
/* crash regression test — stderr capture would need infrastructure changes */
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
|
||||
@@ -40,6 +43,7 @@ static void test_log_set_level_debug() {
|
||||
log_message(LOG_LEVEL_WARNING, "warning after set");
|
||||
log_message(LOG_LEVEL_ERROR, "error after set");
|
||||
|
||||
/* crash regression test — stderr capture would need infrastructure changes */
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
|
||||
@@ -52,6 +56,7 @@ static void test_log_set_level_info() {
|
||||
log_message(LOG_LEVEL_WARNING, "warning should show");
|
||||
log_message(LOG_LEVEL_ERROR, "error should show");
|
||||
|
||||
/* crash regression test — stderr capture would need infrastructure changes */
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
|
||||
@@ -64,6 +69,7 @@ static void test_log_set_level_error() {
|
||||
log_message(LOG_LEVEL_WARNING, "warning filtered");
|
||||
log_message(LOG_LEVEL_ERROR, "error should show");
|
||||
|
||||
/* crash regression test — stderr capture would need infrastructure changes */
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
|
||||
@@ -80,6 +86,7 @@ static void test_log_filtering() {
|
||||
log_message(LOG_LEVEL_WARNING, "visible warning");
|
||||
log_message(LOG_LEVEL_ERROR, "visible error");
|
||||
|
||||
/* crash regression test — stderr capture would need infrastructure changes */
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
|
||||
@@ -92,6 +99,7 @@ static void test_log_message_formats() {
|
||||
log_message(LOG_LEVEL_WARNING, "string: %s", "hello");
|
||||
log_message(LOG_LEVEL_ERROR, "multiple: %d %s %d", 1, "two", 3);
|
||||
|
||||
/* crash regression test — stderr capture would need infrastructure changes */
|
||||
EXPECT_TRUE(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ static void test_send_receive_str() {
|
||||
|
||||
EXPECT_TRUE(send_str(0, ""));
|
||||
|
||||
/* cppcheck-suppress constVariablePointer */
|
||||
char* received = receive_str(0);
|
||||
EXPECT_NOT_NULL(received);
|
||||
EXPECT_EQ_STR(received, "");
|
||||
@@ -63,6 +64,7 @@ static void test_send_receive_str_normal() {
|
||||
|
||||
EXPECT_TRUE(send_str(0, "Hello, Protocol!"));
|
||||
|
||||
/* cppcheck-suppress constVariablePointer */
|
||||
char* received = receive_str(0);
|
||||
EXPECT_NOT_NULL(received);
|
||||
EXPECT_EQ_STR(received, "Hello, Protocol!");
|
||||
@@ -78,6 +80,7 @@ static void test_send_receive_data() {
|
||||
io_set_fds(p[0], p[1]);
|
||||
io_set_bwlimit(0);
|
||||
|
||||
/* cppcheck-suppress constVariablePointer */
|
||||
unsigned char bin[] = {0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0xFF};
|
||||
void* buf = malloc(sizeof(bin));
|
||||
EXPECT_NOT_NULL(buf);
|
||||
@@ -128,6 +131,7 @@ static void test_send_receive_status() {
|
||||
io_set_fds(p[0], p[1]);
|
||||
io_set_bwlimit(0);
|
||||
|
||||
/* cppcheck-suppress constVariablePointer */
|
||||
Status statuses[] = {STATUS_OK, STATUS_ERROR, STATUS_FINISHED, STATUS_NEXT,
|
||||
STATUS_CHUNK, STATUS_CHECK, STATUS_DELTA_SIGNATURE, STATUS_DELTA_DATA};
|
||||
int count = sizeof(statuses) / sizeof(statuses[0]);
|
||||
|
||||
@@ -34,7 +34,7 @@ static void test_tls_connect_bad_cert() {
|
||||
* client_connect_tls will try to connect first, fail, and return false.
|
||||
* Note: we use an invalid host to ensure connection failure,
|
||||
* which exercises the error path before cert loading. */
|
||||
bool ok = client_connect_tls(client, "192.0.2.1", 12345, "/nonexistent/cert.pem",
|
||||
bool ok = client_connect_tls(client, "127.0.0.1", 1, "/nonexistent/cert.pem",
|
||||
"/nonexistent/key.pem", "/nonexistent/ca.pem");
|
||||
EXPECT_FALSE(ok);
|
||||
|
||||
@@ -51,7 +51,7 @@ static void test_tls_connect_null_paths() {
|
||||
EXPECT_NOT_NULL(client);
|
||||
|
||||
/* Connect to invalid address — will fail at connect() step */
|
||||
bool ok = client_connect_tls(client, "192.0.2.2", 12346, NULL, NULL, NULL);
|
||||
bool ok = client_connect_tls(client, "127.0.0.1", 1, NULL, NULL, NULL);
|
||||
EXPECT_FALSE(ok);
|
||||
|
||||
client_delete(client);
|
||||
|
||||
Reference in New Issue
Block a user