[SystemZ][z/OS] Fix handling of dirs with filesystem tests
authorMuiez Ahmed <muiez@ibm.com>
Mon, 13 Dec 2021 16:00:56 +0000 (11:00 -0500)
committerMuiez Ahmed <muiez@ibm.com>
Mon, 13 Dec 2021 16:02:23 +0000 (11:02 -0500)
commitb8c12af9dd761c5118b70b1e2952e6c1a63628a8
treed1279111d12fa385172f5bf144102b88c4e6f205
parent9c1fd1b533120b204d7a4b285a7967c29f949de9
[SystemZ][z/OS] Fix handling of dirs with filesystem tests

The aim of this patch is to fix the post processing that is happening on the temporary test directories upon scope exit. In particular, ~scoped_test_env aims to chmod and remove the temporary directories; however,

bad symlinks are followed and we get "No such file or directory". FIX: use find as alternative to chmod and avoid -follow option.
Attempting to remove read-only files on z/OS prompts a message asking for confirmation. FIX: use the -f option to delete read-only files immediately without asking for confirmation.
Some libcxx tests such as libcxx/test/std/input.output/filesystems/cl ass.directory_entry/directory_entry.cons/path.pass.cpp set the dir permissions to none. In turn, recursively doing chmod (-R) does not set the file permissions needed to be able to remove the dir on z/OS only. FIX: use find as alternative to chmod -R, which does not run into this issue on z/OS.

Differential Revision: https://reviews.llvm.org/D108326
libcxx/test/support/filesystem_test_helper.h