Skip to content
Snippets Groups Projects
Commit 8d614b3f authored by Jeff Vander Stoep's avatar Jeff Vander Stoep
Browse files

Move python sepolicy tests to embedded launcher

This is a necessary for enforcing these tests in CTS.

Bug: 37008075
Test: build
Change-Id: I36b4ce71c26a0ba01cd0289fe363f0a9f7db1214
parent b33f117f
No related branches found
No related tags found
No related merge requests found
...@@ -1186,7 +1186,7 @@ $(sepolicy_tests): PRIVATE_SEPOLICY := $(built_sepolicy) ...@@ -1186,7 +1186,7 @@ $(sepolicy_tests): PRIVATE_SEPOLICY := $(built_sepolicy)
$(sepolicy_tests): $(HOST_OUT_EXECUTABLES)/sepolicy_tests \ $(sepolicy_tests): $(HOST_OUT_EXECUTABLES)/sepolicy_tests \
$(built_plat_fc) $(built_nonplat_fc) $(built_sepolicy) $(built_plat_fc) $(built_nonplat_fc) $(built_sepolicy)
@mkdir -p $(dir $@) @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 $@ $(hide) touch $@
################################## ##################################
...@@ -1302,7 +1302,7 @@ $(treble_sepolicy_tests): $(HOST_OUT_EXECUTABLES)/treble_sepolicy_tests \ ...@@ -1302,7 +1302,7 @@ $(treble_sepolicy_tests): $(HOST_OUT_EXECUTABLES)/treble_sepolicy_tests \
$(built_plat_fc) $(built_nonplat_fc) $(built_sepolicy) $(built_plat_sepolicy) \ $(built_plat_fc) $(built_nonplat_fc) $(built_sepolicy) $(built_plat_sepolicy) \
$(built_26.0_plat_sepolicy) $(26.0_compat) $(26.0_mapping.combined.cil) $(built_26.0_plat_sepolicy) $(26.0_compat) $(26.0_mapping.combined.cil)
@mkdir -p $(dir $@) @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) \ $(HOST_OUT)/lib64 -f $(PRIVATE_PLAT_FC) -f $(PRIVATE_NONPLAT_FC) \
-b $(PRIVATE_PLAT_SEPOLICY) -m $(PRIVATE_COMBINED_MAPPING) \ -b $(PRIVATE_PLAT_SEPOLICY) -m $(PRIVATE_COMBINED_MAPPING) \
-o $(PRIVATE_SEPOLICY_OLD) -p $(PRIVATE_SEPOLICY) \ -o $(PRIVATE_SEPOLICY_OLD) -p $(PRIVATE_SEPOLICY) \
......
...@@ -19,6 +19,7 @@ python_defaults { ...@@ -19,6 +19,7 @@ python_defaults {
name: "py2_only", name: "py2_only",
version: { version: {
py2: { py2: {
embedded_launcher: true,
enabled: true, enabled: true,
}, },
py3: { py3: {
......
...@@ -2,6 +2,7 @@ from ctypes import * ...@@ -2,6 +2,7 @@ from ctypes import *
import re import re
import os import os
import sys import sys
import platform
### ###
# Check whether the regex will match a file path starting with the provided # Check whether the regex will match a file path starting with the provided
...@@ -252,12 +253,13 @@ class Policy: ...@@ -252,12 +253,13 @@ class Policy:
# load ctypes-ified libsepol wrapper # load ctypes-ified libsepol wrapper
def __InitLibsepolwrap(self, LibPath): def __InitLibsepolwrap(self, LibPath):
if "linux" in sys.platform: if "linux" in platform.system().lower():
lib = CDLL(LibPath + "/libsepolwrap.so") lib = CDLL(LibPath + "/libsepolwrap.so")
elif "darwin" in sys.platform: elif "darwin" in platform.system().lower():
lib = CDLL(LibPath + "/libsepolwrap.dylib") lib = CDLL(LibPath + "/libsepolwrap.dylib")
else: 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); # int get_allow_rule(char *out, size_t len, void *policydbp, void *avtab_iterp);
lib.get_allow_rule.restype = c_int lib.get_allow_rule.restype = c_int
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment