Fix tests on Arch Linux (#1218)
Summary:
Compiling folly on Arch Linux triggered a few platform-specific behaviors that were not covered correctly by tests.
- Fix F14{Map,Set} maxSize test cases
The maximum size of `F14Table` is dependent of its allocator's max_size:
```
max_size() -> std::min<std::size_t>(
(std::numeric_limits<InternalSizeType>::max)(),
AllocTraits::max_size(a)
)
```
This commit fixes the `F14{Map,Set}` maxSize tests, so they won't fail
on platforms where the standard allocator's `max_size()` is based on
`ptrdiff_t` (signed).
- Fix TestUtilTest
If glog is compiled without gflags support, `SetCommandLineOptionWithMode()`
can't force glog to use stderr.
glog has its own compatibility layer for `FLAGS_*` in case gflags is missing,
that's why `FLAGS_logtostderr` is always available.
- Skip AsyncIOTest tests if O_DIRECT is not supported by the file system
`fs::temp_directory_path()` returns `"/tmp"` on Linux.
When using systemd, the /tmp directory is mounted by default as tmpfs;
and tmpfs does not support the `O_DIRECT` flag.
This commit skips tests in case the file can't be opened with `O_DIRECT`.
Pull Request resolved: https://github.com/facebook/folly/pull/1218
Reviewed By: nbronson
Differential Revision: D17160597
Pulled By: yfeldblum
fbshipit-source-id: 00274d1f8770079e35559ee9bd8426402e949abd
Showing
Please register or sign in to comment