Fix error handling in copy_file and equivalent
authorJonathan Wakely <jwakely@redhat.com>
Tue, 25 Oct 2016 15:32:37 +0000 (16:32 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 25 Oct 2016 15:32:37 +0000 (16:32 +0100)
commitec04aad76d5a4ac4759a78a04cbd950f4a1e9517
treeed5e0dc857b8a43f528b75b3830ab61dd7929917
parent1cf1719bc07ade2e96d47c7bae00d1203c847ee0
Fix error handling in copy_file and equivalent

* src/filesystem/ops.cc (do_copy_file): Report an error if source or
destination is not a regular file (LWG 2712).
(equivalent): Fix error handling and result when only one file exists.
* testsuite/experimental/filesystem/operations/copy.cc: Remove files
created by tests. Test copying directories.
* testsuite/experimental/filesystem/operations/copy_file.cc: Remove
files created by tests.
* testsuite/experimental/filesystem/operations/equivalent.cc: New.
* testsuite/experimental/filesystem/operations/is_empty.cc: New.
* testsuite/experimental/filesystem/operations/read_symlink.cc: Remove
file created by test.
* testsuite/experimental/filesystem/operations/remove_all.cc: New.
* testsuite/util/testsuite_fs.h (~scoped_file): Only try to remove
file if path is non-empty, to support removal by other means.

From-SVN: r241521
libstdc++-v3/ChangeLog
libstdc++-v3/src/filesystem/ops.cc
libstdc++-v3/testsuite/experimental/filesystem/operations/copy.cc
libstdc++-v3/testsuite/experimental/filesystem/operations/copy_file.cc
libstdc++-v3/testsuite/experimental/filesystem/operations/equivalent.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/filesystem/operations/is_empty.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/filesystem/operations/read_symlink.cc
libstdc++-v3/testsuite/experimental/filesystem/operations/remove_all.cc [new file with mode: 0644]
libstdc++-v3/testsuite/util/testsuite_fs.h