Skip to content

Commit

Permalink
fix(ci): avoid designated initializers since they require c++20
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Terzolo <[email protected]>
  • Loading branch information
Andreagit97 committed Dec 17, 2024
1 parent 63beb96 commit 1f6a81c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 32 deletions.
25 changes: 5 additions & 20 deletions userspace/libsinsp/test/events_net.ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,7 @@ TEST_F(sinsp_with_test_input, net_ipv6_multiple_connects) {
open_inspector();
sinsp_evt* evt = NULL;

generate_socket_x_event(sinsp_test_input::socket_params{
.domain = PPM_AF_INET6,
.type = SOCK_DGRAM,
});
generate_socket_x_event(sinsp_test_input::socket_params(PPM_AF_INET6, SOCK_DGRAM));

sockaddr_in6 client =
test_utils::fill_sockaddr_in6(DEFAULT_CLIENT_PORT, DEFAULT_IPV6_CLIENT_STRING);
Expand Down Expand Up @@ -424,10 +421,7 @@ TEST_F(sinsp_with_test_input, net_bind_listen_accept_ipv6) {
open_inspector();
sinsp_evt* evt = NULL;

generate_socket_x_event(sinsp_test_input::socket_params{
.domain = PPM_AF_INET6,
.type = SOCK_STREAM,
});
generate_socket_x_event(sinsp_test_input::socket_params(PPM_AF_INET6, SOCK_STREAM));

add_event_advance_ts(increasing_ts(),
1,
Expand Down Expand Up @@ -602,10 +596,7 @@ TEST_F(sinsp_with_test_input, net_connect_enter_event_is_empty) {
sinsp_fdinfo* fdinfo = NULL;
char ipv4_string[DEFAULT_IP_STRING_SIZE];

generate_socket_x_event(sinsp_test_input::socket_params{
.domain = PPM_AF_INET,
.type = SOCK_DGRAM,
});
generate_socket_x_event(sinsp_test_input::socket_params(PPM_AF_INET, SOCK_DGRAM));

sockaddr_in client =
test_utils::fill_sockaddr_in(DEFAULT_CLIENT_PORT, DEFAULT_IPV4_CLIENT_STRING);
Expand Down Expand Up @@ -703,10 +694,7 @@ TEST_F(sinsp_with_test_input, net_connect_enter_event_is_missing) {
sinsp_fdinfo* fdinfo = NULL;
char ipv4_string[DEFAULT_IP_STRING_SIZE];

generate_socket_x_event(sinsp_test_input::socket_params{
.domain = PPM_AF_INET,
.type = SOCK_DGRAM,
});
generate_socket_x_event(sinsp_test_input::socket_params(PPM_AF_INET, SOCK_DGRAM));

int port_client = 12;
std::string ipv4_client = "80.9.11.45";
Expand Down Expand Up @@ -768,10 +756,7 @@ TEST_F(sinsp_with_test_input, net_connect_enter_event_is_missing_wo_fd_param_exi
open_inspector();
sinsp_evt* evt = NULL;

generate_socket_x_event(sinsp_test_input::socket_params{
.domain = PPM_AF_INET,
.type = SOCK_DGRAM,
});
generate_socket_x_event(sinsp_test_input::socket_params(PPM_AF_INET, SOCK_DGRAM));

int port_client = 12;
std::string ipv4_client = "80.9.11.45";
Expand Down
5 changes: 1 addition & 4 deletions userspace/libsinsp/test/events_param.ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,10 +406,7 @@ TEST_F(sinsp_with_test_input, enumparams) {
sinsp_evt* evt = NULL;

/* `PPME_SOCKET_SOCKET_X` is a simple event that uses a PT_ENUMFLAGS32 (param 1) */
evt = generate_socket_x_event(sinsp_test_input::socket_params{
.domain = PPM_AF_UNIX,
.type = SOCK_DGRAM,
});
generate_socket_x_event(sinsp_test_input::socket_params(PPM_AF_INET, SOCK_DGRAM));

ASSERT_EQ(evt->get_param(1)->as<uint32_t>(), PPM_AF_UNIX);

Expand Down
5 changes: 1 addition & 4 deletions userspace/libsinsp/test/filterchecks/mock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,7 @@ TEST_F(sinsp_with_test_input, check_some_fd_fields) {
open_inspector();

// Prepare the setup to extract something from the filter checks `fd.cip`.
generate_socket_x_event(sinsp_test_input::socket_params{
.domain = PPM_AF_INET6,
.type = SOCK_DGRAM,
});
generate_socket_x_event(sinsp_test_input::socket_params(PPM_AF_INET6, SOCK_DGRAM));

sockaddr_in6 client =
test_utils::fill_sockaddr_in6(DEFAULT_CLIENT_PORT, DEFAULT_IPV6_CLIENT_STRING);
Expand Down
6 changes: 2 additions & 4 deletions userspace/libsinsp/test/parsers/parse_connect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ TEST_F(sinsp_with_test_input, CONNECT_parse_unix_socket) {
add_default_init_thread();
open_inspector();

auto evt = generate_socket_x_event(sinsp_test_input::socket_params{
.domain = PPM_AF_UNIX,
.type = SOCK_STREAM,
});
generate_socket_x_event(sinsp_test_input::socket_params(PPM_AF_UNIX, SOCK_STREAM));

auto fdinfo = evt->get_fd_info();
ASSERT_TRUE(fdinfo);
ASSERT_TRUE(fdinfo->is_unix_socket());
Expand Down
12 changes: 12 additions & 0 deletions userspace/libsinsp/test/sinsp_with_test_input.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ struct socket_params {
uint32_t domain = PPM_AF_INET;
uint32_t type = SOCK_STREAM;
uint32_t proto = 0;

socket_params() {
domain = PPM_AF_INET;
type = SOCK_STREAM;
proto = 0;
};

socket_params(uint32_t d, uint32_t t): domain(d), type(t) {
domain = d;
type = t;
proto = 0;
};
};

struct fd_info_fields {
Expand Down

0 comments on commit 1f6a81c

Please sign in to comment.