This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] [test] Avoid littering the temp dir with empty directories
AbandonedPublic

Authored by mstorsjo on Mar 16 2021, 6:07 AM.

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

When the filesystem tests want to create a directory, a temporary
path is created as <temp>/<cwd filename>/static_env.0. The directory
is created, and when done, this particular directory is removed.
However, the directory <temp>/<cwd filename> is left around, empty.

(When running tests locally, the <cwd filename> bit is derived from
the individual test, like "copy_symlink.pass.cpp.dir". When doing
remote testing, the cwd name is a unique temporary name like
"libcxx.pZVQdKeSEN".)

Instead name these temporary directories as
<temp>/<cwd filename>-static_env.0. That way, when they are removed,
no extra intermediate directory is left behind.

Prior to e0d01294bc124211a8ffb55e69162eb34a242680, the temporary
directories were created in only one level, leaving no empty
directories behind.

Diff Detail

Event Timeline

mstorsjo requested review of this revision.Mar 16 2021, 6:07 AM
mstorsjo created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMar 16 2021, 6:07 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript

I think you should roll this into D98703 because it obviously is dependent with that one, and they're both pretty small and solve similar problems.

mstorsjo abandoned this revision.Mar 17 2021, 1:15 AM

Merging this with D98703.