[PATCH] D25483: [libcxx] [test] Fix non-Standard assumptions about how many elements are allocated

Stephan T. Lavavej via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 11 11:53:46 PDT 2016


STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.

The recently-added limited_allocator is much more conformant than the evil old stack_allocator. However, limited_allocator encodes non-Standard assumptions about how many allocations containers perform, which don't hold for MSVC. Specifically, MSVC's STL dynamically allocates sentinel nodes and "container proxies" (for debug mode checking), and its vector famously grows by 1.5x instead of 2x. I would like to retain the limited_allocator coverage, but tweak things so that they pass for both libc++ and MSVC.

test/std/containers/sequences/deque/deque.cons/size.pass.cpp
test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp
deque is too weird. (MSVC's deque reallocates its blockmap several times while doing this.) Just mark the tests as LIBCPP_ONLY, the coward's way out.

test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp
test/std/containers/sequences/list/list.cons/size_type.pass.cpp
test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp
"Add 2 for implementations that dynamically allocate a sentinel node and container proxy."

test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp
test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp
test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp
test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp
"Add 1 for implementations that dynamically allocate a container proxy."

test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
Ditto. The (InIt, InIt) ctor is unchanged at 63 elements allocated (MSVC's 1.5x results in fewer element allocations, enough to make room for the container proxy).

test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp
test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp
Adjust numbers for container proxy and 1.5x growth, with the calculations in the comments.


https://reviews.llvm.org/D25483

Files:
  test/std/containers/sequences/deque/deque.cons/size.pass.cpp
  test/std/containers/sequences/deque/deque.cons/size_value.pass.cpp
  test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp
  test/std/containers/sequences/list/list.cons/size_type.pass.cpp
  test/std/containers/sequences/list/list.cons/size_value_alloc.pass.cpp
  test/std/containers/sequences/vector/vector.capacity/reserve.pass.cpp
  test/std/containers/sequences/vector/vector.capacity/resize_size.pass.cpp
  test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp
  test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp
  test/std/containers/sequences/vector/vector.cons/construct_size_value.pass.cpp
  test/std/containers/sequences/vector/vector.modifiers/push_back.pass.cpp
  test/std/containers/sequences/vector/vector.modifiers/push_back_rvalue.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25483.74280.patch
Type: text/x-patch
Size: 10288 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161011/379ddff3/attachment.bin>


More information about the cfe-commits mailing list