Previously, filesystem tests would require LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT
to be present in the environment and to match the value provided when
compiling, as a macro. This has the problem that it only allows for the
filesystem tests to be run on the same machine they are created.
Instead, we create a temporary directory for each test. Technically,
this is tricky to do because we're relying on some of the code that
we're testing to do this. However, there's no other portable way of
creating temporary direcories in C++, so this is difficult to avoid.
clang-format: please reformat the code
- scoped_test_env() : test_root(random_path()) - { - fs_helper_run(fs_make_cmd("init_test_directory", test_root)); - - // Ensure that the root_path is fully resolved, i.e. it contains no - // symlinks. The filesystem tests depend on that. We do this after - // creating the root_path, because `fs::canonical` requires the - // path to exist. - test_root = fs::canonical(test_root); - }9 diff lines are omitted. See full diff.