Skip to content

Commit

Permalink
Fixing more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maddeleine committed Nov 7, 2024
1 parent 1a85532 commit 340a1e7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions tests/unit/s2n_ktls_io_sendfile_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ int main(int argc, char **argv)

/* Test s2n_sendfile unsupported */
if (!sendfile_supported) {
DEFER_CLEANUP(struct s2n_connection *conn = s2n_connection_new(S2N_SERVER),
s2n_connection_ptr_free);
struct s2n_connection *conn = s2n_connection_new(S2N_SERVER);
EXPECT_NOT_NULL(conn);
conn->ktls_send_enabled = true;

Expand All @@ -86,6 +85,7 @@ int main(int argc, char **argv)
EXPECT_FAILURE_WITH_ERRNO(result, S2N_ERR_UNIMPLEMENTED);

/* We do not run any further tests */
EXPECT_SUCCESS(s2n_connection_free(conn));
END_TEST_EARLY();
};

Expand Down
4 changes: 2 additions & 2 deletions tests/unit/s2n_ktls_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ int main(int argc, char **argv)
BEGIN_TEST();

if (!s2n_ktls_is_supported_on_platform()) {
DEFER_CLEANUP(struct s2n_connection *server_conn = s2n_connection_new(S2N_SERVER),
s2n_connection_ptr_free);
struct s2n_connection *server_conn = s2n_connection_new(S2N_SERVER);
EXPECT_OK(s2n_test_configure_connection_for_ktls(server_conn));

EXPECT_FAILURE_WITH_ERRNO(s2n_connection_ktls_enable_send(server_conn), S2N_ERR_KTLS_UNSUPPORTED_PLATFORM);
EXPECT_FAILURE_WITH_ERRNO(s2n_connection_ktls_enable_recv(server_conn), S2N_ERR_KTLS_UNSUPPORTED_PLATFORM);

EXPECT_SUCCESS(s2n_connection_free(server_conn));
END_TEST_EARLY();
}

Expand Down
19 changes: 10 additions & 9 deletions tests/unit/s2n_self_talk_ktls_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@ int main(int argc, char **argv)

/* Test enabling ktls for sending */
{
struct s2n_test_io_pair io_pair = { 0 };
if (s2n_result_is_error(s2n_new_inet_socket_pair(&io_pair))) {
/* We should be able to setup AF_INET sockets everywhere, but if
* we can't, don't block the build unless the build explicitly expects
* to be able to test ktls.
*/
EXPECT_FALSE(ktls_expected);
EXPECT_SUCCESS(s2n_io_pair_close(&io_pair));
END_TEST_EARLY();
}
DEFER_CLEANUP(struct s2n_connection *client = s2n_connection_new(S2N_CLIENT),
s2n_connection_ptr_free);
EXPECT_NOT_NULL(client);
Expand All @@ -164,15 +174,6 @@ int main(int argc, char **argv)
EXPECT_NOT_NULL(server);
EXPECT_SUCCESS(s2n_connection_set_config(server, config));

DEFER_CLEANUP(struct s2n_test_io_pair io_pair = { 0 }, s2n_io_pair_close);
if (s2n_result_is_error(s2n_new_inet_socket_pair(&io_pair))) {
/* We should be able to setup AF_INET sockets everywhere, but if
* we can't, don't block the build unless the build explicitly expects
* to be able to test ktls.
*/
EXPECT_FALSE(ktls_expected);
END_TEST_EARLY();
}
EXPECT_OK(s2n_setup_connections(server, client, &io_pair));

if (s2n_connection_ktls_enable_send(client) == S2N_SUCCESS) {
Expand Down

0 comments on commit 340a1e7

Please sign in to comment.