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

Use _Exit() on test failure, to avoid LeakSanitizer spam #1088

Merged
merged 2 commits into from
Feb 9, 2024
Merged

Conversation

graebm
Copy link
Contributor

@graebm graebm commented Feb 8, 2024

Cut down on unrelated spam when a test fails.

_Exit() is in C99. It avoids running cleanup functions on program termination.

This does prevent us from running multiple tests via the aws-c-common-tests executable, but we never ever do that. We always use ctest, which launches each test in its own process. I literally only learned today that you can pass -A to run all tests.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@@ -478,7 +481,8 @@ static inline int s_aws_run_test_case(struct aws_test_harness *harness) {
const size_t leaked_bytes = aws_mem_tracer_bytes(allocator);
if (leaked_bytes) {
aws_mem_tracer_dump(allocator);
PRINT_FAIL_INTERNAL0("Test leaked memory: %zu bytes %zu allocations", leaked_bytes, leaked_allocations);
PRINT_FAIL_WITHOUT_LOCATION(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It always annoyed me how the final "test leaked" and "test failed" messages printed their file location and line no. It made it look like the aws_test_runner.h code is what had bugs

@graebm graebm merged commit 7f55a9c into main Feb 9, 2024
52 checks passed
@graebm graebm deleted the asan-noise branch February 9, 2024 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants