This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] [test] Ifdef out uses of create_fifo on windows
ClosedPublic

Authored by mstorsjo on Oct 22 2020, 3:53 AM.

Details

Summary

Restructure code in directory_entry.obs/file_type_obs.pass.cpp and directory_entry.obs/hard_link_count.pass.cpp to reduce the amount of ifdeffery needed.

In file_type_obs.pass.cpp, we can't inline the calls to env.create_* into the lambda calls (e.g. "test_path(env.create_*())"), because the lambda removes the referenced file, and the hardlink must be created while the earlier test file exists.

In hard_link_count.pass.cpp, move restoration of the original directory permissions to the end of the lambda, so that new directory entries can be created after the lambda has run once.

Diff Detail

Event Timeline

mstorsjo created this revision.Oct 22 2020, 3:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 22 2020, 3:53 AM
Herald added 1 blocking reviewer(s): Restricted Project. · View Herald Transcript
mstorsjo requested review of this revision.Oct 22 2020, 3:53 AM
mstorsjo updated this revision to Diff 325078.Feb 19 2021, 1:22 PM
mstorsjo edited the summary of this revision. (Show Details)
mstorsjo added reviewers: ldionne, curdeius.

Updated/rebased.

This is probably not ready to go as-is, but serves to point out the cases that need to be disabled in one way or another.

Some of the lists, that currently are in the form {a, b, c, d} might be easier to make conditional if split up over multiple lines with one line per entry.

ldionne requested changes to this revision.Feb 19 2021, 1:25 PM
ldionne added inline comments.
libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/hard_link_count.pass.cpp
89–90

As a general pattern, could we instead refactor the body of the loop (which contains the actual tests) into a lambda, and then call it with the appropriate inputs? I think that might make the #ifdefs less awkward. WDYT?

I don't think it makes sense to do that everywhere, but I think it might here.

This revision now requires changes to proceed.Feb 19 2021, 1:25 PM
mstorsjo added inline comments.Feb 19 2021, 1:46 PM
libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/hard_link_count.pass.cpp
89–90

Sounds good, I'll give that a try later and come back to this patch.

mstorsjo updated this revision to Diff 326344.Feb 25 2021, 3:41 AM
mstorsjo edited the summary of this revision. (Show Details)
mstorsjo set the repository for this revision to rG LLVM Github Monorepo.

Reworked some ugly cases to use a lambda, as suggested by @ldionne.

ldionne accepted this revision.Feb 25 2021, 11:19 AM

I think this is a net improvement. Thanks!

This revision is now accepted and ready to land.Feb 25 2021, 11:19 AM
This revision was automatically updated to reflect the committed changes.