Commit Graph

83 Commits

Author SHA1 Message Date
Jonas Hahnfeld
29d52a28e4 Fix last_write_time tests for filesystems that don't support negative and very large times
Seems to be the case for NFS.

Original patch by Eric Fiselier!
Differential Revision: https://reviews.llvm.org/D22452

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292013 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-14 11:35:15 +00:00
Eric Fiselier
0e5ebbc77c Fix unused parameters and variables
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290459 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-23 23:37:52 +00:00
Eric Fiselier
a2cd270943 Enable the -Wsign-compare warning to better support MSVC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289363 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-11 05:31:00 +00:00
Eric Fiselier
efc48515b4 Enable warnings by default for C++ >= 11 and fix -Wshadow occurances
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@288557 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-03 00:27:13 +00:00
Eric Fiselier
c4a7e9177a Fix non-portable tests for temp_directory_path(...)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285020 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-24 20:40:35 +00:00
Eric Fiselier
6547b4fa2b Fix libc++ specific assertion in permissions(...) tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284945 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-23 19:14:58 +00:00
Eric Fiselier
1e1bbc7437 Implement LWG 2712 and update other issues status
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284318 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-16 00:47:59 +00:00
Eric Fiselier
451f34db16 Implement LWG 2681 and 2682
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284316 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-16 00:29:22 +00:00
Eric Fiselier
25dc5bdb88 Implement LWG 2672.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284314 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-15 23:05:04 +00:00
Eric Fiselier
620a9a5ecf Implement modified LWG 2665
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284313 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-15 22:37:42 +00:00
Eric Fiselier
508f208ae9 Fix LWG2683 - filesystem::copy() should always clear the user-provided error_code
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283951 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-11 22:18:09 +00:00
Eric Fiselier
113315b9a4 Implement LWG 2711. Constrain path members.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@279945 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-28 21:26:01 +00:00
Adhemerval Zanella
ea714e73a6 libcxx: Fix path.compare.pass expected result
The expected 'filesystem::path::compare' result states that for different
path only result sign contains the information about passed arguments
(not its integer value).  This is due it uses the output of other compare
functions (basic_string_view and char_traits) without further handling and
char_traits uses memcmp for final buffer comparison.

However for GLIBC on AArch64 the code:

  int ret = memcmp ("b/a/c", "a/b/c", 1);

Results in '64' where for x86_64 it results in '1'.

This patch fixes the expected 'filesystem::path::compare' by normalizing
all the results before assert comparison.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@278745 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-15 21:24:50 +00:00
Saleem Abdulrasool
1f6a37d63e test: relax the FS test a slight bit to be more reliable
Some filesystems track atime always.  This relaxes the test to accept either a
filesystem which does not accurately track atime or does track the atime
accurately.  This allows the test to pass on filesystems mounted with
`strictatime` on Linux or on macOS.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@278357 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-11 16:58:12 +00:00
Matthias Braun
3df1df14bf test/hard_link_count(): Fix test on darwin
The hard link count that stat reports are different between normal hfs and the
case sensitive variant. Accept both.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@278191 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-10 01:02:28 +00:00
Eric Fiselier
2645dbe87f Implement P0392r0. Integrate filesystem::path and string_view.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@276511 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-23 03:10:56 +00:00
Jonas Hahnfeld
b9c20327ac [libcxx][filesystem] Remove setgid from parent before testing permissions
man page for mkdir says: "If the parent directory has the set-group-ID bit set,
then so will the newly created directory."

Differential Revision: https://reviews.llvm.org/D22265

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@275760 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-18 06:06:50 +00:00
Eric Fiselier
7c96ddb563 Implement LWG issue 2720. Replace perms::resolve_symlinks with perms::symlink_nofollow.
This changes how filesystem::permissions(p, perms) handles symlinks. Previously
symlinks were not resolved by default instead only getting resolved when
"perms::resolve_symlinks" was used. After this change symlinks are resolved
by default and perms::symlink_nofollow must be given to change this.

This issue has not yet been moved to Ready status, and I will revert if it
doesn't get moved at the current meeting. However I feel confident that it
will and it's nice to have implementations when moving issues.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273328 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-21 22:42:42 +00:00
Eric Fiselier
756a6bd177 Implement LWG issue 2725. The issue should move this meeting
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273325 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-21 22:11:16 +00:00
Eric Fiselier
70f7afec38 Fix bugs in last_write_time implementation.
* Fix passing a negative number as either tv_usec or tv_nsec. When file_time_type
  is negative and has a non-zero sub-second value we subtract 1 from tv_sec
  and make the sub-second duration positive.

* Detect and report when 'file_time_type' cannot be represented by time_t. This
  happens when using large/small file_time_type values with a 32 bit time_t.

There is more work to be done in the implementation. It should start to use
stat's st_mtim or st_mtimeval if it's provided as an extension. That way
we can provide a better resolution.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273103 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-19 02:04:49 +00:00
Eric Fiselier
880e38b206 Fix 3 bugs in filesystem tests and implementation.
This patch fixes the following bugs, all of which were discovered while
testing a 32 bit build on a 64 bit machine.

* path.itr/iterator.pass.cpp has undefined behavior.
  'path::iterator' stashes the value of the element inside the iterator.
  This violates the BiDirIterator requirements but is allowed for path::iterator.
  However this means that using reverse_iterator<path::iterator> has undefined
  behavior because it assumes that 'Iter tmp = it; return *tmp' will not create
  a dangling reference. However it does, and this caused this particular test
  to fail.

* path.native.obs/string_alloc.pass.cpp tested the SSO with a long string.
  On 32 bit builds std::wstring only has the SSO for strings of size 2. The
  test was using a string of size 4.

* fs.op.space/space.pass.cpp had overflows while calculating the expected values.
  The fix here is to convert the statvfs data members to std::uintmax_t before
  multiplying them. The internal implementation already does this but the tests
  needed to do it as well.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273078 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-18 04:10:23 +00:00
Eric Fiselier
591e18f6aa Add additional tests in an attempt to diagnose ARM test failures.
Currently 4 tests are failing on the ARM buildbot. To try and diagnose each
of the failures this patch does the following:

1) path.itr/iterator.pass.cpp
   * Temporarily print iteration sequence to see where its failing.

2) path.native.obs/string_alloc.pass.cpp
   * Remove test that ::new is not called when constructing a short string
     that requires a conversion. Since during the conversion global locale
     objects might be constructed.

3) fs.op.funcs/space.pass.cpp
   * Explicitly use uintmax_t in the implementation of space, hopefully
     preventing possible overflows.
   * Add additional tests that check for overflow is the calculation of the
     space_info values.
   * Add additional tests for the values returned from statfvs.

4) fs.op.funcs/last_write_time.pass.cpp
   * No changes made yet.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273075 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-18 02:11:48 +00:00
Eric Fiselier
63a5b248d7 Add checkpoints to string allocation test to help with debugging arm failures.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273072 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-18 00:23:13 +00:00
Eric Fiselier
f1bc722d8c Fix bugs in recursive_directory_iterator::increment(ec) implementation and tests.
r273060 didn't completely fix the issues in recursive_directory_iterator and
the tests. This patch follows up with more fixes

* Fix bug where recursive_directory_iterator::increment(ec) did not reset
  the error code if no failure occurred.

* Fix bad assertion in the recursive_directory_iterator::increment(ec) test
  that would only fire for certain iteration orders.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273070 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 23:57:16 +00:00
Eric Fiselier
a730ec37a9 Work around GCC bug in tests. The bug has been fixed in GCC 6.0
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273068 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 23:30:40 +00:00
Eric Fiselier
5c8a3688be Fix initialization of test case array in C++11
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273065 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 22:36:47 +00:00
Eric Fiselier
6f3b01af9c Fix bugs in recursive_directory_iterator implementation and tests.
There are two fixes in this patch:

* Fix bug where the constructor of recursive_directory_iterator did not reset
  the error code if no failure occurred.

* Fix tests were dependent on the iteration order of the test directories.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273060 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 22:22:37 +00:00
Eric Fiselier
40d9e09d89 Get filesystem tests passing for single-threaded configurations.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273054 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 21:44:26 +00:00
Eric Fiselier
841798ce01 Update status of filesystem issues, and add tests for LWG issue 2683
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273051 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 21:24:11 +00:00
Eric Fiselier
0c75540ba2 Reorder permissions test so they are not dependent on the processes umask
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273049 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 21:00:27 +00:00
Eric Fiselier
0354eb7228 Respect the processes umask in the create_directory test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273048 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 20:54:25 +00:00
Eric Fiselier
05761e6861 Fix a couple of warnings present in the filesystem tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273035 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 19:57:54 +00:00
Eric Fiselier
6e9a694dce Add Filesystem TS -- Complete
Add the completed std::experimental::filesystem implementation and tests.
The implementation supports C++11 or newer.

The TS is built as part of 'libc++experimental.a'. Users of the TS need to
manually link this library. Building and testing the TS can be disabled using
the CMake option '-DLIBCXX_ENABLE_FILESYSTEM=OFF'.

Currently 'libc++experimental.a' is not installed by default. To turn on the
installation of the library use '-DLIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=ON'.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273034 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 19:46:40 +00:00