diff --git a/Android.mk b/Android.mk index cb67f72f822be97a1c6ac49040daae321aac2cec..4ae0dab48f6beb54c963c51a532f0a11a5105b93 100644 --- a/Android.mk +++ b/Android.mk @@ -1188,7 +1188,7 @@ $(sepolicy_tests): PRIVATE_SEPOLICY := $(built_sepolicy) $(sepolicy_tests): $(HOST_OUT_EXECUTABLES)/sepolicy_tests \ $(built_plat_fc) $(built_nonplat_fc) $(built_sepolicy) @mkdir -p $(dir $@) - $(hide) python $(HOST_OUT_EXECUTABLES)/sepolicy_tests -l $(HOST_OUT)/lib64 -f $(PRIVATE_PLAT_FC) -f $(PRIVATE_NONPLAT_FC) -p $(PRIVATE_SEPOLICY) + $(hide) $(HOST_OUT_EXECUTABLES)/sepolicy_tests -l $(HOST_OUT)/lib64 -f $(PRIVATE_PLAT_FC) -f $(PRIVATE_NONPLAT_FC) -p $(PRIVATE_SEPOLICY) $(hide) touch $@ ################################## @@ -1304,7 +1304,7 @@ $(treble_sepolicy_tests): $(HOST_OUT_EXECUTABLES)/treble_sepolicy_tests \ $(built_plat_fc) $(built_nonplat_fc) $(built_sepolicy) $(built_plat_sepolicy) \ $(built_26.0_plat_sepolicy) $(26.0_compat) $(26.0_mapping.combined.cil) @mkdir -p $(dir $@) - $(hide) python $(HOST_OUT_EXECUTABLES)/treble_sepolicy_tests -l \ + $(hide) $(HOST_OUT_EXECUTABLES)/treble_sepolicy_tests -l \ $(HOST_OUT)/lib64 -f $(PRIVATE_PLAT_FC) -f $(PRIVATE_NONPLAT_FC) \ -b $(PRIVATE_PLAT_SEPOLICY) -m $(PRIVATE_COMBINED_MAPPING) \ -o $(PRIVATE_SEPOLICY_OLD) -p $(PRIVATE_SEPOLICY) \ diff --git a/tests/Android.bp b/tests/Android.bp index 8fe89e5feaf86aebe2aef8daffcd2f466b66b281..8dc333045a0a380151092cee1d679d3c18f99faf 100644 --- a/tests/Android.bp +++ b/tests/Android.bp @@ -19,6 +19,7 @@ python_defaults { name: "py2_only", version: { py2: { + embedded_launcher: true, enabled: true, }, py3: { diff --git a/tests/policy.py b/tests/policy.py index a0ddb909614102273509e2d63b2199165842a5e8..4bc9c9118cdb352b8347ef99972dfa54ad6166c4 100644 --- a/tests/policy.py +++ b/tests/policy.py @@ -2,6 +2,7 @@ from ctypes import * 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 @@ class Policy: # 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