Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: ossl x509 parsing #4351

Merged
merged 16 commits into from
Jan 22, 2024
20 changes: 12 additions & 8 deletions tests/unit/s2n_mem_usage_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,21 +254,25 @@ int main(int argc, char **argv)
free(clients);
free(servers);

TEST_DEBUG_PRINT("\n");
goatgoose marked this conversation as resolved.
Show resolved Hide resolved
TEST_DEBUG_PRINT("VmData initial: %10zd\n", vm_data_initial);
TEST_DEBUG_PRINT("VmData after allocations: %10zd\n", vm_data_after_allocation);
TEST_DEBUG_PRINT("VmData after handshakes: %10zd\n", vm_data_after_handshakes);
TEST_DEBUG_PRINT("VmData after free handshake: %10zd\n", vm_data_after_free_handshake);
TEST_DEBUG_PRINT("VmData after release: %10zd\n", vm_data_after_release_buffers);
TEST_DEBUG_PRINT("Max VmData diff allowed: %10zd\n", maxAllowedMemDiff);
TEST_DEBUG_PRINT("Number of connections used: %10zu\n", connectionsToUse);
fprintf(stdout, "\n");
fprintf(stdout, "VmData initial: %10zd\n", vm_data_initial);
fprintf(stdout, "VmData after allocations: %10zd\n", vm_data_after_allocation);
fprintf(stdout, "VmData after handshakes: %10zd\n", vm_data_after_handshakes);
fprintf(stdout, "VmData after free handshake: %10zd\n", vm_data_after_free_handshake);
fprintf(stdout, "VmData after release: %10zd\n", vm_data_after_release_buffers);
fprintf(stdout, "Max VmData diff allowed: %10zd\n", maxAllowedMemDiff);
fprintf(stdout, "Number of connections used: %10zu\n", connectionsToUse);

EXPECT_TRUE(vm_data_after_free_handshake <= vm_data_after_handshakes);
EXPECT_TRUE(vm_data_after_release_buffers <= vm_data_after_free_handshake);

ssize_t handshake_diff = (vm_data_after_handshakes - vm_data_initial);
ssize_t allocation_diff = (vm_data_after_allocation - vm_data_initial);

fprintf(stdout, "handshake diff: %10zd\n", handshake_diff);
fprintf(stdout, "allocation diff: %10zd\n", allocation_diff);
fprintf(stdout, "max allowed diff: %10zd\n", maxAllowedMemDiff);

/*
* get_vm_data_size is required for this test to succeed.
* Any platform that doesn't implement get_vm_data_size should be excluded here.
Expand Down
Loading