[System] Implement a helper function to create unique temporary directories and use it in tests. (#11831)
While working on PR #11829 I stress-tested the tests by running multiple test
runs in parallel, and it turned out that many tests were not parallel-safe,
because they used the same temporary file names and ended up stomping on
eachother.
So I implemented a helper method that creates a guaranteed unique temporary
directory, and I've changed all tests to use this new helper method.
15 files changed: