This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] [test] Remove non-portable assertions from filebuf tests
ClosedPublic

Authored by BillyONeal on Apr 4 2018, 3:40 PM.

Details

Summary

seekoff.pass.cpp:

libc++'s tests are asserting things about the buffer passed to pubsetbuf. [filebuf.virtuals]/12 says that what the filebuf does with the buffer you give it is completely implementation defined. The MSVC++ implementation takes that buffer and hands it off to the CRT (by calling ::setvbuf) and the CRT doesn't necessarily follow the pattern this test wants.

This change simply makes asserts against the buffer's contents use LIBCPP_ASSERT instead of assert.

pbackfail.pass.cpp:
libc++'s tests are asserting about what characters will and will not be available in the putback area. [filebuf.virtuals]/9 says "The function can alter the number of putback positions available as a result of any call." This change LIBCPP_ASSERTS libc++'s behavior, but checks invariants of the putback area independently.

Diff Detail

Event Timeline

BillyONeal created this revision.Apr 4 2018, 3:40 PM
BillyONeal updated this revision to Diff 141433.Apr 6 2018, 3:01 PM
BillyONeal retitled this revision from [libcxx] [test] Remove non-portable assertions from filebuf's seekoff.pass.cpp test to [libcxx] [test] Remove non-portable assertions from filebuf tests.
BillyONeal edited the summary of this revision. (Show Details)

Added pbackfail.pass.cpp changes.

@mclow.lists Are you OK with this one? It's conceptually similar to the previous review.

mclow.lists accepted this revision.Apr 25 2018, 6:46 AM

This looks OK to me.

This revision is now accepted and ready to land.Apr 25 2018, 6:46 AM
BillyONeal closed this revision.Apr 26 2018, 3:22 PM

D:\msvc\src\qa\VC\Libs\libcxx\upstream>git svn dcommit
Committing to https://llvm.org/svn/llvm-project/libcxx/trunk ...
Use of uninitialized value $rec in scalar chomp at /mingw64/share/perl5/Git.pm line 557, <$fh> chunk 4.
Authentication realm: https://llvm.org:443 LLVM Subversion repository
Password for 'bion':

M       test/std/input.output/file.streams/fstreams/filebuf.virtuals/pbackfail.pass.cpp
M       test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp

Committed r330999

M       test/std/input.output/file.streams/fstreams/filebuf.virtuals/pbackfail.pass.cpp
M       test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp

r330999 = dc3bb72e3c9a47ef62d6288f73d164d3ba5fe941 (refs/remotes/llvm/master)
No changes between 706a727f5b068a7b5c6f43028cdbaf6ea610abe6 and refs/remotes/llvm/master
Resetting to the latest refs/remotes/llvm/master

D:\msvc\src\qa\VC\Libs\libcxx\upstream>