This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Remove uses of printf in some test support headers
ClosedPublic

Authored by ldionne on Nov 19 2021, 1:47 PM.

Details

Summary

In the test suite, we generally don't use printf or other reporting
utilities. It's not that it wouldn't be useful, it's just that some
platforms don't support IO.

Instead, we try to keep test cases small and self-contained so that
we can reasonably easily reproduce failures locally and debug them.
This patch removes printf in some of the last places in the test suite
that used it. The only remaining places are in a deque test and in the
filesystem tests. The filesystem tests are arguably fine to keep using
IO, since we're testing <filesystem>. The deque test will be handled
separately.

Diff Detail

Event Timeline

ldionne requested review of this revision.Nov 19 2021, 1:47 PM
ldionne created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptNov 19 2021, 1:47 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Quuxplusone added a subscriber: Quuxplusone.

Seems fine. Although I wonder if we could go further: These functions that check a bunch of stuff and return true-or-false, could they instead just assert all that stuff and return void?

nilayvaish accepted this revision.Nov 19 2021, 2:35 PM

Seems fine. Although I wonder if we could go further: These functions that check a bunch of stuff and return true-or-false, could they instead just assert all that stuff and return void?

That would be more difficult since several tests use the return value of these functions to do more than just assert.

ldionne accepted this revision as: Restricted Project.Nov 22 2021, 9:01 AM
This revision is now accepted and ready to land.Nov 22 2021, 9:01 AM