summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/input.output
Commit message (Collapse)AuthorAgeFilesLines
* [NFC] Strip trailing whitespace from libc++Louis Dionne2019-10-231-1/+1
|
* [libc++][NFC] Remove excess trailing newlines from most filesCasey Carter2019-10-231-1/+0
| | | | Testing git commit access.
* [libcxx][test][NFC] Fix comment typos.Stephan T. Lavavej2019-10-225-5/+5
| | | | (Testing git commit access.)
* [libc++] Mark iostreams test as XFAIL on older macOSesLouis Dionne2019-09-231-0/+12
| | | | llvm-svn: 372620
* Only initialize the streams cout/wcout/cerr/wcerr etc once, rather than any ↵Marshall Clow2019-09-131-0/+32
| | | | | | time Init::Init is called. Fixes PR#43300 llvm-svn: 371864
* libcxx: Rename last two .hpp files in libcxx to .hNico Weber2019-08-215-6/+6
| | | | | | Differential Revision: https://reviews.llvm.org/D66544 llvm-svn: 369597
* libcxx: Rename .hpp files in libcxx/test/support to .hNico Weber2019-08-21127-332/+332
| | | | | | | | | | | | | | | | | | | | | | | | | | LLVM uses .h as its extension for header files. Files renamed using: for f in libcxx/test/support/*.hpp; do git mv $f ${f%.hpp}.h; done References to the files updated using: for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do a=$(basename $f); echo $a; rg -l $a libcxx | xargs sed -i '' "s/$a/${a%.hpp}.h/"; done HPP include guards updated manually using: for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do echo ${f%.hpp}.h ; done | xargs mvim Differential Revision: https://reviews.llvm.org/D66104 llvm-svn: 369481
* [libc++] Set __file_ to 0 in basic_filebuf::close() even if fclose failsPetr Hosek2019-07-221-0/+56
| | | | | | | | | | | | | | | | | | | | This issue was detected by ASan in one of our tests. This test manually invokes basic_filebuf::cloe(). fclose(__h.release() returned a non-zero exit status, so __file_ wasn't set to 0. Later when basic_filebuf destructor ran, we would enter the if (__file_) block again leading to heap-use-after-free error. The POSIX specification for fclose says that independently of the return value, fclose closes the underlying file descriptor and any further access (including another call to fclose()) to the stream results in undefined behavior. This is exactly what happened in our test case. To avoid this issue, we have to always set __file_ to 0 independently of the fclose return value. Differential Revision: https://reviews.llvm.org/D64979 llvm-svn: 366730
* Implement LWG2221: 'Formatted output for nullptr_t' Reviewed as: ↵Marshall Clow2019-07-011-0/+7
| | | | | | https://reviews.llvm.org/D63053 llvm-svn: 364802
* Add include for 'test_macros.h' to all the tests that were missing them. ↵Marshall Clow2019-05-31303-0/+560
| | | | | | Thanks to Zoe for the (big, but simple) patch. NFC intended. llvm-svn: 362252
* [libc++] Add XFAILs for istream tests that were added in r357775Louis Dionne2019-04-0521-0/+143
| | | | | | | | We fixed incorrect behavior of input streams in r357775 and tests were added accordingly. However, older versions of macOS don't have the change in the dylib yet, so the tests fail on those platforms. llvm-svn: 357794
* [libc++] Fix error flags and exceptions propagated from input stream operationsLouis Dionne2019-04-0535-148/+1712
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is a re-application of r357533 and r357531. They had been reverted because we thought the commits broke the LLDB data formatters, but it turns out this was because only r357531 had been included in the CI run. Before this patch, we would only ever throw an exception if the badbit was set on the stream. The Standard is currently very unclear on how exceptions should be propagated and what error flags should be set by the input stream operations. This commit changes libc++ to behave under a different (but valid) interpretation of the Standard. This interpretation of the Standard matches what other implementations are doing. This effectively implements the wording in p1264r0. It hasn't been voted into the Standard yet, however there is wide agreement that the fix is correct and it's just a matter of time before the fix is standardized. PR21586 PR15949 rdar://problem/15347558 Reviewers: mclow.lists, EricWF Subscribers: christof, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D49863 llvm-svn: 357775
* Revert "[libc++] Fix error flags and exceptions propagated from input stream ↵Louis Dionne2019-04-0235-1712/+148
| | | | | | | | | | operations" This reverts commits r357533 and r357531, which broke the LLDB data formatters. I'll hold off until we know how to fix the data formatters accordingly. llvm-svn: 357536
* [libc++] Fix error flags and exceptions propagated from input stream operationsLouis Dionne2019-04-0235-148/+1712
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Before this patch, we would only ever throw an exception if the badbit was set on the stream. The Standard is currently very unclear on how exceptions should be propagated and what error flags should be set by the input stream operations. This commit changes libc++ to behave under a different (but valid) interpretation of the Standard. This interpretation of the Standard matches what other implementations are doing. I will submit a paper in San Diego to clarify the Standard such that the interpretation used in this commit (and other implementations) is the only possible one. PR21586 PR15949 rdar://problem/15347558 Reviewers: mclow.lists, EricWF Subscribers: christof, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D49863 llvm-svn: 357531
* Allow disabling of filesystem library.Eric Fiselier2019-03-211-0/+3
| | | | | | | | | | | | | | Summary: Filesystem doesn't work on Windows, so we need a mechanism to turn it off for the time being. Reviewers: ldionne, serge-sans-paille, EricWF Reviewed By: EricWF Subscribers: mstorsjo, mgorny, christof, jdoerfert, libcxx-commits Differential Revision: https://reviews.llvm.org/D59619 llvm-svn: 356633
* [libc++] Mark <filesystem> tests as failing when the dylib doesn't support ↵Louis Dionne2019-03-208-0/+10
| | | | | | | | | | | | filesystem This fixes CI for back-deployment testers on platforms that don't have <filesystem> support in the dylib. This is effectively half of https://reviews.llvm.org/D59224. The other half requires fixes in Clang. llvm-svn: 356558
* [libc++] Build <filesystem> support as part of the dylibLouis Dionne2019-03-191-3/+0
| | | | | | | | | | | | | | | | | | | Summary: This patch treats <filesystem> as a first-class citizen of the dylib, like all other sub-libraries (e.g. <chrono>). As such, it also removes all special handling for installing the filesystem library separately or disabling part of the test suite from the lit command line. Unlike the previous attempt (r356500), this doesn't remove all the filesystem tests. Reviewers: mclow.lists, EricWF, serge-sans-paille Subscribers: mgorny, christof, jkorous, dexonsmith, jfb, jdoerfert, libcxx-commits Differential Revision: https://reviews.llvm.org/D59152 llvm-svn: 356518
* Revert "[libc++] Build <filesystem> support as part of the dylib"Louis Dionne2019-03-19147-0/+14173
| | | | | | | | When I applied r356500 (https://reviews.llvm.org/D59152), I somehow deleted all of filesystem's tests. I will revert r356500 and re-apply it properly. llvm-svn: 356505
* [libc++] Build <filesystem> support as part of the dylibLouis Dionne2019-03-19147-14173/+0
| | | | | | | | | | | | | | | | Summary: This patch treats <filesystem> as a first-class citizen of the dylib, like all other sub-libraries (e.g. <chrono>). As such, it also removes all special handling for installing the filesystem library separately or disabling part of the test suite from the lit command line. Reviewers: mclow.lists, EricWF, serge-sans-paille Subscribers: mgorny, christof, jkorous, dexonsmith, jfb, jdoerfert, libcxx-commits Differential Revision: https://reviews.llvm.org/D59152 llvm-svn: 356500
* [libc++] Fix forgotten fclose() in unit testLouis Dionne2019-03-011-0/+1
| | | | | | | Thanks to Andrey Maksimov for the patch. Differential Revision: https://reviews.llvm.org/D58732 llvm-svn: 355162
* [libc++] Increase portability of xalloc testLouis Dionne2019-03-011-5/+3
| | | | | | | | | | Do not assume that xalloc() starts at 0, which is not specified by the Standard. Thanks to Andrey Maksimov for the patch. Differential Revision: https://reviews.llvm.org/D58299 llvm-svn: 355160
* [libc++] Add a test for PR14074Louis Dionne2019-02-271-0/+62
| | | | | | PR14074 was fixed in r165884, but no tests were added. llvm-svn: 354943
* [libc++] Use UNSUPPORTED instead of TEST_STD_VER #ifdefLouis Dionne2019-02-051-11/+3
| | | | | | | | | | | When the whole test only works starting at some version of the Standard, use UNSUPPORTED lit markup instead of #ifdef TEST_STD_VER. This provides more visibility into the test suite. Reviewed as https://reviews.llvm.org/D57704. Thanks to Andrey Maksimov for the patch. llvm-svn: 353206
* Support tests in freestandingJF Bastien2019-02-04426-428/+1270
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Freestanding is *weird*. The standard allows it to differ in a bunch of odd manners from regular C++, and the committee would like to improve that situation. I'd like to make libc++ behave better with what freestanding should be, so that it can be a tool we use in improving the standard. To do that we need to try stuff out, both with "freestanding the language mode" and "freestanding the library subset". Let's start with the super basic: run the libc++ tests in freestanding, using clang as the compiler, and see what works. The easiest hack to do this: In utils/libcxx/test/config.py add: self.cxx.compile_flags += ['-ffreestanding'] Run the tests and they all fail. Why? Because in freestanding `main` isn't special. This "not special" property has two effects: main doesn't get mangled, and main isn't allowed to omit its `return` statement. The first means main gets mangled and the linker can't create a valid executable for us to test. The second means we spew out warnings (ew) and the compiler doesn't insert the `return` we omitted, and main just falls of the end and does whatever undefined behavior (if you're luck, ud2 leading to non-zero return code). Let's start my work with the basics. This patch changes all libc++ tests to declare `main` as `int main(int, char**` so it mangles consistently (enabling us to declare another `extern "C"` main for freestanding which calls the mangled one), and adds `return 0;` to all places where it was missing. This touches 6124 files, and I apologize. The former was done with The Magic Of Sed. The later was done with a (not quite correct but decent) clang tool: https://gist.github.com/jfbastien/793819ff360baa845483dde81170feed This works for most tests, though I did have to adjust a few places when e.g. the test runs with `-x c`, macros are used for main (such as for the filesystem tests), etc. Once this is in we can create a freestanding bot which will prevent further regressions. After that, we can start the real work of supporting C++ freestanding fairly well in libc++. <rdar://problem/47754795> Reviewers: ldionne, mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, arphaman, miyuki, libcxx-commits Differential Revision: https://reviews.llvm.org/D57624 llvm-svn: 353086
* add a test and a couple minor bug fixes for the ↵Marshall Clow2019-02-011-0/+5
| | | | | | implicit-signed-integer-truncation sanitizer. This is PR#40566 llvm-svn: 352926
* [libcxx] Include <cstring> in tests that use strcmpLouis Dionne2019-01-222-2/+4
| | | | | | | Reviewed as https://reviews.llvm.org/D56503. Thanks to Andrey Maksimov for the patch. llvm-svn: 351847
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-19498-1992/+1494
| | | | | | | | | | | | | | | | | | to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
* Filesystem tests: fix fs.op.relativeJF Bastien2019-01-101-43/+83
| | | | | | | | | | | | Summary: The test wasn't using the testing infrastructure properly. Reviewers: ldionne, mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D56519 llvm-svn: 350872
* [NFC] Normalize some test 'main' signaturesJF Bastien2019-01-091-1/+1
| | | | | | There were 3 tests with 'int main(void)', and 6 with the return type on a different line. I'm about to send a patch for main in tests, and this NFC change is unrelated. llvm-svn: 350770
* Fix flaky symlink access time test.Eric Fiselier2019-01-051-5/+7
| | | | | | | | | | | | | | | last_write_time(sym, new_time) changes the modification time of the file referenced by the symlink. But reading through the symlink may change the symlinks's access time. This meant the previous test that checked that the symlinks access time was unchanged was incorrect and made the test flaky. This patch removes this test (there really is no non-flaky way to test that the new access time coorisponds to the time at which the symlink was last dereferenced). This should unflake the test. llvm-svn: 350478
* Fix test case breakages caused by lexically_relative changeEric Fiselier2018-12-211-3/+3
| | | | llvm-svn: 349888
* Implement LWG 3096: path::lexically_relative is confused by trailing slashesEric Fiselier2018-12-211-2/+2
| | | | | | path("/dir/").lexically_relative("/dir"); now returns "." instead of "" llvm-svn: 349885
* Implement LWG 3065: Make path operators friends.Eric Fiselier2018-12-213-1/+63
| | | | | | | | | This prevents things like: using namespace std::filesystem; auto x = L"a/b" == std::string("a/b"); llvm-svn: 349884
* Implement LWG 2936: Path comparison is defined in terms of the generic formatEric Fiselier2018-12-211-1/+54
| | | | | | | | | This patch implements path::compare according to the current spec. The only observable change is the ordering of "/foo" and "foo", which orders the two paths based on having or not having a root directory (instead of lexically comparing "/" to "foo"). llvm-svn: 349881
* Portability fix: add missing includes and static_casts. Reviewed as ↵Marshall Clow2018-12-1812-0/+17
| | | | | | https://reviews.llvm.org/D55777. Thanks to Andrey Maksimov for the patch. llvm-svn: 349566
* [test] [filesystems] NetBSD can do symlink permissions tooMichal Gorny2018-12-121-1/+1
| | | | llvm-svn: 348968
* [test] [filesystems] Extend FreeBSD tv_sec==-1 workaround to NetBSDMichal Gorny2018-12-121-1/+1
| | | | | | | NetBSD also uses tv_sec==-1 as error status indicator, and does not support setting such a value. llvm-svn: 348967
* [libcxx] Mark some tests as failing on macosx 10.14Louis Dionne2018-12-064-0/+4
| | | | llvm-svn: 348437
* [libcxx] Don't depend on availability markup to provide the streams in the dylibLouis Dionne2018-12-0611-25/+8
| | | | | | | | | | | | Whether an explicit instantiation declaration should be provided is not a matter of availability markup. This problem is exemplified by the fact that some tests were incorrectly marked as XFAIL when they should instead have been using the definition of streams from the headers, and hence passing, and that, regardless of whether visibility annotations are enabled. llvm-svn: 348436
* [libcxx] Add XFAIL for test on OS X 10.12 to 10.14Louis Dionne2018-11-221-0/+6
| | | | llvm-svn: 347473
* [libcxx] Remove incorrect XFAIL on macos 10.12Louis Dionne2018-11-221-1/+0
| | | | llvm-svn: 347461
* [libc++] Implement P0487R1 - Fixing operator>>(basic_istream&, CharT*)Zhihao Yuan2018-11-213-0/+77
| | | | | | | | | | | | | | | | | | | Summary: Avoid buffer overflow by replacing the pointer interface with an array reference interface in C++2a. Tentatively ready on Batavia2018. https://wg21.link/lwg2499 https://wg21.link/p0487 Reviewers: mclow.lists, ldionne, EricWF Reviewed By: ldionne Subscribers: libcxx-commits, cfe-commits, christof Differential Revision: https://reviews.llvm.org/D51268 llvm-svn: 347377
* Get tests compiling with -Wunused-local-typedefEric Fiselier2018-11-155-11/+0
| | | | llvm-svn: 346914
* Revert "Implement LWG 2221 - No formatted output operator for nullptr."Volodymyr Sapsai2018-09-191-80/+0
| | | | | | | | | This reverts r342566 as it causes on bots linker errors like > Undefined symbols for architecture i386: > "std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(std::nullptr_t)", referenced from: llvm-svn: 342599
* Implement LWG 2221 - No formatted output operator for nullptr. Reviewed as ↵Marshall Clow2018-09-191-0/+80
| | | | | | https://reviews.llvm.org/D44263 llvm-svn: 342566
* [libcxx] [test] Allow a standard library that implements LWG 1203 in ↵Billy Robert O'Neal III2018-08-081-1/+1
| | | | | | | | istream.rvalue/rvalue.pass.cpp (Still pending review at https://reviews.llvm.org/D47400 which has been open since may; will ask for forgiveness rather than permission :) ) llvm-svn: 339214
* [libcxx] [test] Remove nonportable locale assumption in ↵Billy Robert O'Neal III2018-08-081-3/+3
| | | | | | | | | | basic.ios.members/narrow.pass.cpp I'm not sure if libcxx is asserting UTF-8 here; but on Windows the full char value is always passed through in its entirety, since the default codepage is something like Windows-1252. The replacement character is only used for non-chars there; and that should be a more portable test everywhere. (Still pending review at https://reviews.llvm.org/D47395 which has been open since may; will ask for forgiveness rather than permission :) ) llvm-svn: 339213
* Implement <filesystem>Eric Fiselier2018-07-27152-0/+14432
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements the <filesystem> header and uses that to provide <experimental/filesystem>. Unlike other standard headers, the symbols needed for <filesystem> have not yet been placed in libc++.so. Instead they live in the new libc++fs.a library. Users of filesystem are required to link this library. (Also note that libc++experimental no longer contains the definition of <experimental/filesystem>, which now requires linking libc++fs). The reason for keeping <filesystem> out of the dylib for now is that it's still somewhat experimental, and the possibility of requiring an ABI breaking change is very real. In the future the symbols will likely be moved into the dylib, or the dylib will be made to link libc++fs automagically). Note that moving the symbols out of libc++experimental may break user builds until they update to -lc++fs. This should be OK, because the experimental library provides no stability guarantees. However, I plan on looking into ways we can force libc++experimental to automagically link libc++fs. In order to use a single implementation and set of tests for <filesystem>, it has been placed in a special `__fs` namespace. This namespace is inline in C++17 onward, but not before that. As such implementation is available in C++11 onward, but no filesystem namespace is present "directly", and as such name conflicts shouldn't occur in C++11 or C++14. llvm-svn: 338093
* [libcxx] [test] Fix MSVC x64 truncation warning.Stephan T. Lavavej2018-05-051-1/+1
| | | | | | | | warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data Requesting post-commit review. llvm-svn: 331575
* [libcxx] [test] Remove non-portable assertions from filebuf testsBilly Robert O'Neal III2018-04-262-10/+18
| | | | | | | | | | | 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. llvm-svn: 330999
OpenPOWER on IntegriCloud