[clang][ssaf] Skip permission-based tests when permissions are not enforced (#183128)
`JSONFormatTest/NoReadPermission` and
`JSONFormatTest/WriteStreamOpenFailure` are negative tests that expect
file operations to fail when Unix permissions are revoked. These tests
unexpectedly succeed instead of failing if they are run as root, or
executed in environments with non-standard filesystem semantics that do
not enforce permission checks.
This change adds a `permissionsAreEnforced()` helper to the
`JSONFormatTest` fixture that detects if:
- The process is running as root `(getuid() == 0)`
- A probe file with read permission removed can still be opened,
indicating that file permission has no effect in the current
environment. The probe file's permissions are restored before returning
so `TearDown` can clean up the temp directory unconditionally.
This method is used to skip the two negative tests rather than failing
with a spurious assertion error.
rdar://170917013
rdar://170916929