This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] [test] Fix windows errors in fs.op.rename
ClosedPublic

Authored by mstorsjo on Mar 15 2021, 10:47 AM.

Details

Diff Detail

Event Timeline

mstorsjo requested review of this revision.Mar 15 2021, 10:47 AM
mstorsjo created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2021, 10:47 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Quuxplusone added inline comments.
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.rename/rename.pass.cpp
66

(1) Please add a trailing comma on line 67.
(2) I'd feel better if the comment were phrased in terms of the standard-specified behavior: is libc++'s current Win32 behavior conforming, or does libc++ actually need to go put a check inside std::filesystem::rename to deal with the moving-a-directory-onto-a-file situation because Win32 doesn't appropriately reject it? Can you find the chapter and verse that describes this behavior in the standard?

mstorsjo updated this revision to Diff 330936.Mar 16 2021, 4:31 AM

Expanded the comment with spec references, added a requested trailing comma.

mstorsjo added inline comments.Mar 16 2021, 4:32 AM
libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.rename/rename.pass.cpp
66
  1. Done
  1. Expanded the comment. As far as I can see from http://eel.is/c++draft/fs.op.rename, exactly which cases are treated as errors is left to be implementation/platform dependent, and the note explicitly calls out that renaming (an unspecified type of path object) over a non-directory is allowed to succeed and remove the non-directory (i.e. regular file).

LGTM! Although, if you wanted to scope-creep it, it might be nice to add a positive test for Windows' actual behavior. Right now IIUC you're making Windows lose all test coverage for this (interesting) case.

LGTM! Although, if you wanted to scope-creep it, it might be nice to add a positive test for Windows' actual behavior. Right now IIUC you're making Windows lose all test coverage for this (interesting) case.

I can look into doing that later as follow-up. I see that the test otherwise also is lacking positive tests for renaming directories, and negative tests for dir->dir renames.

Ping for a second approval

curdeius accepted this revision.Mar 19 2021, 6:44 AM
curdeius added a subscriber: curdeius.

LGTM.

This revision is now accepted and ready to land.Mar 19 2021, 6:44 AM
This revision was automatically updated to reflect the committed changes.