tests: replace fake_criterion_tests
section with __attribute__((constructor))
s adding to a linked list, fixing the padding bug
#474
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fake_criterion_tests
iteration is broken due to padding #473.The previous way of appending
struct fake_criterion_test
s by putting them into a section was buggy because extra padding was added between the elements in the section, so iterating through them from__{start,stop}_fake_criterion_tests
didn't work correctly.This new way uses
__attribute__((constructor))
to add eachstruct fake_criterion_test
to a singly linked list. A singly linked list is used for simplicity, though it does mean the tests are run in reverse order within a file, but I don't really think the test order should matter, so this should be okay.I also added the suite and test name to
struct fake_criterion_test
and print them out when running tests, which was helpful in distinguishing which tests were being run.