Ensure that struct tm pointer is not nullptr, and verify that all (not any) fields match
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Ate these test changes enough to catch this? It seems a bit magical with the numbers. Should there be an explicit test that tests matching more than one field?
Thanks for the above fix (facepalm). In the following CL, jeff and I reworked the test code to make it more readable.
In https://reviews.llvm.org/D130405, https://reviews.llvm.org/differential/changeset/?ref=3574155
I'm not sure I understand the question. There were three issues with the tests that this commit fixes:
- The tests don't check that the pointer tm_data is not NULL before dereferencing it
- The test matcher only checked that at least one field of struct tm matches, and not that all fields match.
- Multiple testcases contained incorrect values for the tm_yday field.
I've been running the llvm-libc tests against a different libc, which is what led me to identify these testcase issues. After these above fixes, the tests against that libc no longer fail. I haven't manually tested these changes against the llvm-libc implementation itself, but from looking at the CI build output they seem fine.
As for the formatting changes, that looks good to me.