1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-06 13:17:44 +03:00

test-dhcp-client: utilize log_info instead of printf

log_info appears to be the preferred method to convey information from
tests. Convert all the printfs to log_info to follow this standard.

(cherry picked from commit 38557d9ffbc6351b8980faf90d54619790436d43)
(cherry picked from commit 4ea84288480115f7175a8cfc61d03e3a712396b8)
(cherry picked from commit cfa083d450)
(cherry picked from commit 6dda2e10a0)
This commit is contained in:
Colin Foster 2024-11-01 15:39:11 -05:00 committed by Luca Boccassi
parent 617136c95c
commit b9caa340e8

View File

@ -42,7 +42,7 @@ static void test_request_basic(sd_event *e) {
sd_dhcp_client *client;
if (verbose)
printf("* %s\n", __func__);
log_info("* %s", __func__);
/* Initialize client without Anonymize settings. */
r = sd_dhcp_client_new(&client, false);
@ -102,7 +102,7 @@ static void test_request_anonymize(sd_event *e) {
sd_dhcp_client *client;
if (verbose)
printf("* %s\n", __func__);
log_info("* %s", __func__);
/* Initialize client with Anonymize settings. */
r = sd_dhcp_client_new(&client, true);
@ -134,7 +134,7 @@ static void test_checksum(void) {
};
if (verbose)
printf("* %s\n", __func__);
log_info("* %s", __func__);
assert_se(dhcp_packet_checksum((uint8_t*)&buf, 20) == be16toh(0x78ae));
}
@ -267,7 +267,7 @@ static int test_discover_message_verify(size_t size, struct DHCPMessage *dhcp) {
assert_se(res == DHCP_DISCOVER);
if (verbose)
printf(" recv DHCP Discover 0x%08x\n", be32toh(dhcp->xid));
log_info(" recv DHCP Discover 0x%08x", be32toh(dhcp->xid));
return 0;
}
@ -277,7 +277,7 @@ static void test_discover_message(sd_event *e) {
int res, r;
if (verbose)
printf("* %s\n", __func__);
log_info("* %s", __func__);
r = sd_dhcp_client_new(&client, false);
assert_se(r >= 0);
@ -422,7 +422,7 @@ static int test_addr_acq_acquired(sd_dhcp_client *client, int event,
sizeof(addrs[0].s_addr)) == 0);
if (verbose)
printf(" DHCP address acquired\n");
log_info(" DHCP address acquired");
sd_event_exit(e, 0);
@ -441,7 +441,7 @@ static int test_addr_acq_recv_request(size_t size, DHCPMessage *request) {
assert_se(msg_bytes[size - 1] == SD_DHCP_OPTION_END);
if (verbose)
printf(" recv DHCP Request 0x%08x\n", be32toh(xid));
log_info(" recv DHCP Request 0x%08x", be32toh(xid));
memcpy(&test_addr_acq_ack[26], &udp_check, sizeof(udp_check));
memcpy(&test_addr_acq_ack[32], &xid, sizeof(xid));
@ -454,7 +454,7 @@ static int test_addr_acq_recv_request(size_t size, DHCPMessage *request) {
assert_se(res == sizeof(test_addr_acq_ack));
if (verbose)
printf(" send DHCP Ack\n");
log_info(" send DHCP Ack");
return 0;
};
@ -472,7 +472,7 @@ static int test_addr_acq_recv_discover(size_t size, DHCPMessage *discover) {
xid = discover->xid;
if (verbose)
printf(" recv DHCP Discover 0x%08x\n", be32toh(xid));
log_info(" recv DHCP Discover 0x%08x", be32toh(xid));
memcpy(&test_addr_acq_offer[26], &udp_check, sizeof(udp_check));
memcpy(&test_addr_acq_offer[32], &xid, sizeof(xid));
@ -485,7 +485,7 @@ static int test_addr_acq_recv_discover(size_t size, DHCPMessage *discover) {
assert_se(res == sizeof(test_addr_acq_offer));
if (verbose)
printf(" sent DHCP Offer\n");
log_info(" sent DHCP Offer");
return 0;
}
@ -495,7 +495,7 @@ static void test_addr_acq(sd_event *e) {
int res, r;
if (verbose)
printf("* %s\n", __func__);
log_info("* %s", __func__);
r = sd_dhcp_client_new(&client, false);
assert_se(r >= 0);