This is an archive of the discontinued LLVM Phabricator instance.

[libc] Add strtoint32 and strtoint64 tests
ClosedPublic

Authored by michaelrj on Jun 1 2023, 2:05 PM.

Details

Summary

There were regressions in the testing framework due to none of the
functioning buildbots having a 32 bit long. This allowed the 32 bit
version of the strtointeger function to go untested. This patch adds
tests for strtoint32 and strtoint64, which are internal testing
functions that use constant integer sizes. It also fixes the tests to
properly handle these situations.

Diff Detail

Event Timeline

michaelrj created this revision.Jun 1 2023, 2:05 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 1 2023, 2:05 PM
michaelrj requested review of this revision.Jun 1 2023, 2:05 PM
sivachandra accepted this revision.Jun 1 2023, 2:59 PM
sivachandra added inline comments.
libc/test/src/stdlib/strtoint64_test.cpp
34

Nit: Not sure if we want to call the internal function or if we should do something like:

if constexpr (cpp::is_same_v<int64_t, long>)
  result = __llvm_libc::strtol(...);
else
  result = __llvm_libc::strtoll(...);
This revision is now accepted and ready to land.Jun 1 2023, 2:59 PM
michaelrj marked an inline comment as done.Jun 1 2023, 3:03 PM
michaelrj added inline comments.
libc/test/src/stdlib/strtoint64_test.cpp
34

Neither long nor long long are guaranteed to be 64 bits, so I think it's safer to just template this with the specific bits we want.

This revision was automatically updated to reflect the committed changes.
michaelrj marked an inline comment as done.