From b33f117f1500e257d039d3f63753c3b30f7f4c57 Mon Sep 17 00:00:00 2001
From: Jeff Vander Stoep <jeffv@google.com>
Date: Mon, 25 Sep 2017 14:01:16 -0700
Subject: [PATCH] Revert "Move python sepolicy tests to embedded launcher"

This reverts commit 0b4edc4e3f69394d5039c4e0642311848172b3e1.

Bug: 66912095
Test: build
---
 Android.mk       | 4 ++--
 tests/Android.bp | 1 -
 tests/policy.py  | 8 +++-----
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/Android.mk b/Android.mk
index 4593876f5..196909737 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1186,7 +1186,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) $(HOST_OUT_EXECUTABLES)/sepolicy_tests -l $(HOST_OUT)/lib64 -f $(PRIVATE_PLAT_FC) -f $(PRIVATE_NONPLAT_FC) -p $(PRIVATE_SEPOLICY)
+	$(hide) python $(HOST_OUT_EXECUTABLES)/sepolicy_tests -l $(HOST_OUT)/lib64 -f $(PRIVATE_PLAT_FC) -f $(PRIVATE_NONPLAT_FC) -p $(PRIVATE_SEPOLICY)
 	$(hide) touch $@
 
 ##################################
@@ -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_26.0_plat_sepolicy) $(26.0_compat) $(26.0_mapping.combined.cil)
 	@mkdir -p $(dir $@)
-	$(hide) $(HOST_OUT_EXECUTABLES)/treble_sepolicy_tests -l \
+	$(hide) python $(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 8dc333045..8fe89e5fe 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -19,7 +19,6 @@ python_defaults {
     name: "py2_only",
     version: {
         py2: {
-            embedded_launcher: true,
             enabled: true,
         },
         py3: {
diff --git a/tests/policy.py b/tests/policy.py
index bfa0d8127..a0ddb9096 100644
--- a/tests/policy.py
+++ b/tests/policy.py
@@ -2,7 +2,6 @@ from ctypes import *
 import re
 import os
 import sys
-import platform
 
 ###
 # Check whether the regex will match a file path starting with the provided
@@ -253,13 +252,12 @@ class Policy:
 
     # load ctypes-ified libsepol wrapper
     def __InitLibsepolwrap(self, LibPath):
-        if "linux" in platform.system().lower():
+        if "linux" in sys.platform:
             lib = CDLL(LibPath + "/libsepolwrap.so")
-        elif "darwin" in platform.system.lower():
+        elif "darwin" in sys.platform:
             lib = CDLL(LibPath + "/libsepolwrap.dylib")
         else:
-            sys.exit("policy.py: " + platform.system() + " not supported." +
-                    " Only Linux and Darwin platforms are currently supported.")
+            sys.exit("only Linux and Mac currrently supported")
 
         # int get_allow_rule(char *out, size_t len, void *policydbp, void *avtab_iterp);
         lib.get_allow_rule.restype = c_int
-- 
GitLab