Move python sepolicy tests to embedded launcher
This is a necessary for enforcing these tests in CTS.
Bug: 37008075
Test: build
Change-Id: I36b4ce71c26a0ba01cd0289fe363f0a9f7db1214
(cherry picked from commit 8d614b3f8191ece8a8ce5002949a0fe54e009177)
diff --git a/tests/Android.bp b/tests/Android.bp
index 8fe89e5..8dc3330 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -19,6 +19,7 @@
name: "py2_only",
version: {
py2: {
+ embedded_launcher: true,
enabled: true,
},
py3: {
diff --git a/tests/policy.py b/tests/policy.py
index a0ddb90..4bc9c91 100644
--- a/tests/policy.py
+++ b/tests/policy.py
@@ -2,6 +2,7 @@
import re
import os
import sys
+import platform
###
# Check whether the regex will match a file path starting with the provided
@@ -252,12 +253,13 @@
# load ctypes-ified libsepol wrapper
def __InitLibsepolwrap(self, LibPath):
- if "linux" in sys.platform:
+ if "linux" in platform.system().lower():
lib = CDLL(LibPath + "/libsepolwrap.so")
- elif "darwin" in sys.platform:
+ elif "darwin" in platform.system().lower():
lib = CDLL(LibPath + "/libsepolwrap.dylib")
else:
- sys.exit("only Linux and Mac currrently supported")
+ sys.exit("policy.py: " + platform.system() + " not supported." +
+ " Only Linux and Darwin platforms are currently supported.")
# int get_allow_rule(char *out, size_t len, void *policydbp, void *avtab_iterp);
lib.get_allow_rule.restype = c_int