This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] [test] Fix fs.op.proximate for windows
ClosedPublic

Authored by mstorsjo on Mar 19 2021, 2:23 PM.

Details

Summary

Simmilar to many other similar path handling tests, convert the
test reference to preferred separators, and ifdef a few test references
that use network root names.

Additionally, generalize code for trimming off the root path for
generating relative_cwd, and for skipping the root name element
in count_path_elems.

Diff Detail

Event Timeline

mstorsjo requested review of this revision.Mar 19 2021, 2:23 PM
mstorsjo created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMar 19 2021, 2:23 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
curdeius accepted this revision as: curdeius.Mar 22 2021, 1:39 AM
curdeius added a subscriber: curdeius.

LGTM.

Quuxplusone accepted this revision.Mar 22 2021, 7:51 AM
Quuxplusone added a subscriber: Quuxplusone.

LGTM % comments.

libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp
88

There's no subtle difference between //base and //foo, right? I wish this test'd use //foo here.

Also, please add these tests, of which all but two I would say are "missing" right now on Windows. (On POSIX they should be basically duplicates of existing tests, but we might as well test the expected output on POSIX as well.)

{"//foo/a", "//bar", "//foo/a"}
{"//foo/a", "//bar/", "//foo/a"}
{"//foo/a", "b", "//foo/a"}  // already tested
{"//foo/a", "/b", "//foo/a"}
{"//foo/a", "//bar/b", "//foo/a"}  // already tested

And these Windows-only tests using drive letters, because this is the only way to get a path with a root-name but no root-path, right?

{"C:/a", "C:/b", "../a"}
{"C:/a", "C:b", "/a"} // ??? my best guess
{"C:/a", "D:/a", "C:/a"}
{"C:/a", "D:/b", "C:/a"}
{"C:/a", "D:b", "C:/a"}
{"C:a", "C:/b", "C:a"}
{"C:a", "C:b", "C:a"}
{"C:a", "D:/a", "C:a"}
{"C:a", "D:/b", "C:a"}
{"C:a", "D:b", "C:a"}
This revision is now accepted and ready to land.Mar 22 2021, 7:51 AM
This revision was automatically updated to reflect the committed changes.