Make cache partition optional in selinux test
/cache is no longer required. If it exists, enforce that it has the
cache_file label, else skip the test.
Change-Id: Ic098b0066311feae5b85e818828ea7467b85ffff
Fixes: 30445063
diff --git a/tests/tests/security/src/android/security/cts/SELinuxTest.java b/tests/tests/security/src/android/security/cts/SELinuxTest.java
index 24ad020..1733aa5 100644
--- a/tests/tests/security/src/android/security/cts/SELinuxTest.java
+++ b/tests/tests/security/src/android/security/cts/SELinuxTest.java
@@ -69,8 +69,11 @@
assertEquals(getFileContext("/data"), "u:object_r:system_data_file:s0");
assertEquals(getFileContext("/data/app"), "u:object_r:apk_data_file:s0");
assertEquals(getFileContext("/data/local/tmp"), "u:object_r:shell_data_file:s0");
- assertEquals(getFileContext("/cache"), "u:object_r:cache_file:s0");
assertEquals(getFileContext("/sys"), "u:object_r:sysfs:s0");
+ File dir = new File("/cache");
+ if (dir.exists()) {
+ assertEquals(getFileContext("/cache"), "u:object_r:cache_file:s0");
+ }
}
private static final native String getFileContext(String path);