diff options
| author | 2018-11-01 14:47:00 -0700 | |
|---|---|---|
| committer | 2018-11-01 16:34:43 -0700 | |
| commit | 1b8700f70e4cf520fcb76202d2a22bfb528c5560 (patch) | |
| tree | 8626920cc21f8504d472d63da660cb4f6ae0ca90 | |
| parent | 776e172712212a205e2f173d0962caf6e0cc6469 (diff) | |
Installd: Add selinux check
Add a check whether the device is enforcing selinux.
Bug: 118818285
Test: atest installd_dexopt_test
Change-Id: Icefbe04e45af8abad984ad6796f5c84c22f4c95e
| -rw-r--r-- | cmds/installd/tests/installd_dexopt_test.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cmds/installd/tests/installd_dexopt_test.cpp b/cmds/installd/tests/installd_dexopt_test.cpp index f216c53be4..eb69e780f3 100644 --- a/cmds/installd/tests/installd_dexopt_test.cpp +++ b/cmds/installd/tests/installd_dexopt_test.cpp @@ -143,6 +143,20 @@ static const char kDexFile[] = "AAAACADojmFLPcugSwoBAAAUAgAACwAYAAAAAAAAAAAAoIEAAAAAY2xhc3Nlcy5kZXhVVAUAA/Ns" "+ll1eAsAAQQj5QIABIgTAABQSwUGAAAAAAEAAQBRAAAATwEAAAAA"; +class DexoptTestEnvTest : public testing::Test { +}; + +TEST_F(DexoptTestEnvTest, CheckSelinux) { + ASSERT_EQ(1, is_selinux_enabled()); + + // Crude cutout for virtual devices. +#if !defined(__i386__) && !defined(__x86_64__) + constexpr bool kIsX86 = false; +#else + constexpr bool kIsX86 = true; +#endif + ASSERT_TRUE(1 == security_getenforce() || kIsX86); +} class DexoptTest : public testing::Test { protected: |