Added better filesystem layout testing harness #15874
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR try to resolve?
The goal is to make filesystem layout tests easier to understand and review.
The
build-dir
test's have a helper fns that have imperative checks. While this works, its not easy to see what its validating at a glance.My thought is to reuse the snapbox infrastructure we already have for the cargo ui tests.
The prototype in this PR generates a file tree (like the unix tree command) and uses snapbox to compare against a snapshot. This makes the layout tests much easier to read and failures are much more obvious what what went wrong.
However there are some problems with the current implementation that limit the usefulness of it.
dSYM
on macos└── foo-[HASH].dSYM [cfg(target_os = "macos")]
└
,├
,│
) to handle optional files.target/<profile>/build/pkg-[HASH]
directories. The hash changes the order of the directories when generating the tree making snapshots inconsistent.[HASH]
, but this does not help with the order.