about summary refs log tree commit diff
path: root/library/std/src/fs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-07-26 07:57:32 +0000
committerbors <bors@rust-lang.org>2023-07-26 07:57:32 +0000
commita6236fa460811bbd4a08a94db249c344fa9f2220 (patch)
tree48eabc5524cc696dc66b4c59346bf763f4814a21 /library/std/src/fs
parentcf34adb0dd408d7b2f27a64484df63c36c1cc514 (diff)
parentfed6fceb6f7f73e6870e84a2a3389cb71108f197 (diff)
Auto merge of #102757 - pcc:android-std-tests, r=workingjubilee
Make std tests pass on newer Android

Newer versions of Android forbid the creation of hardlinks as well as Unix domain sockets in the /data filesystem via SELinux rules, which causes several tests depending on this behavior to fail. So let's skip these tests on Android if we see an EACCES from one of these syscalls. To achieve this, introduce a macro with the horrible name of or_panic_or_skip_on_android_eacces (better suggestions welcome) which skips (returns from) the test if an EACCES return value is seen on Android.
Diffstat (limited to 'library/std/src/fs')
-rw-r--r--library/std/src/fs/tests.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/library/std/src/fs/tests.rs b/library/std/src/fs/tests.rs
index 9ff01b9c35d..d74f0f00e46 100644
--- a/library/std/src/fs/tests.rs
+++ b/library/std/src/fs/tests.rs
@@ -957,6 +957,7 @@ fn readlink_not_symlink() {
 }
 
 #[test]
+#[cfg_attr(target_os = "android", ignore)] // Android SELinux rules prevent creating hardlinks
 fn links_work() {
     let tmpdir = tmpdir();
     let input = tmpdir.join("in.txt");
@@ -1453,6 +1454,7 @@ fn metadata_access_times() {
 
 /// Test creating hard links to symlinks.
 #[test]
+#[cfg_attr(target_os = "android", ignore)] // Android SELinux rules prevent creating hardlinks
 fn symlink_hard_link() {
     let tmpdir = tmpdir();
     if !got_symlink_permission(&tmpdir) {