Instead of storing static_test_env (with all the symlinks) in the repo, we create it on the fly to be cross-toolchain-friendly. The primary use case for this are Windows-hosted cross-toolchains. Windows doesn't really have a concept of symlinks. So, when the monorepo is cloned, those symlinks turn to ordinary text files. Previously, if we cross-compiled libc++ for some symlink-friendly system (e. g. Linux) and ran tests on the target system, some tests would fail. This patch makes them pass.
I'm not sure though about the need to create the RAII object in each test case that relies on static_test_env being present. Maybe a global would be better. Please let me know what you think.
Just to confirm, you add the guard here because we change the current directory, but the directory is then removed so the test would fail if we didn't go back to the previous cwd at the end?