Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd258950 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Cert: Do not use ANDROID_ build environment variables in test" am:...

Merge "Cert: Do not use ANDROID_ build environment variables in test" am: 09815cac am: 259e5ca4 am: 9253bc97 am: 701ce18f

Change-Id: I9d6c38321cc8300a24e2c3bcaed2210b163778f2
parents d8b4e171 701ce18f
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ bluetooth_cert_test_file_list := \
    security/cert/simple_security_test.py \
    shim/cert/stack_test.py


bluetooth_cert_test_file_list := $(addprefix $(LOCAL_PATH)/,$(bluetooth_cert_test_file_list))

bluetooth_cert_test_file_list += \
@@ -36,12 +35,22 @@ bluetooth_cert_test_file_list += \
    $(TARGET_OUT_SHARED_LIBRARIES)/libgrpc++_unsecure.so \
    $(HOST_OUT_NATIVE_TESTS)/root-canal/root-canal

bluetooth_cert_env_provider_path := \
    $(call intermediates-dir-for,PACKAGING,bluetooth_cert_test_package,HOST)/packages/modules/Bluetooth/system/gd/cert/environment_provider.py

$(bluetooth_cert_env_provider_path):
	@mkdir -p $(dir $@)
	$(hide) echo "PRODUCT_DEVICE = \"$(PRODUCT_DEVICE)\"" > $@

bluetooth_cert_zip_path := \
    $(call intermediates-dir-for,PACKAGING,bluetooth_cert_test_package,HOST)/bluetooth_cert_test.zip

$(bluetooth_cert_zip_path): PRIVATE_BLUETOOTH_CERT_TEST_FILE_LIST := $(bluetooth_cert_test_file_list)

$(bluetooth_cert_zip_path) : $(SOONG_ZIP) $(bluetooth_cert_test_file_list)
	$(hide) $(SOONG_ZIP) -d -o $@ $(addprefix -f ,$(PRIVATE_BLUETOOTH_CERT_TEST_FILE_LIST))
$(bluetooth_cert_zip_path): PRIVATE_BLUETOOTH_CERT_ENV_PROVIDER_PATH := $(bluetooth_cert_env_provider_path)

$(bluetooth_cert_zip_path) : $(SOONG_ZIP) $(bluetooth_cert_env_provider_path) $(bluetooth_cert_test_file_list)
	$(hide) $(SOONG_ZIP) -d -o $@ $(addprefix -f ,$(PRIVATE_BLUETOOTH_CERT_TEST_FILE_LIST)) \
		-C $(call intermediates-dir-for,PACKAGING,bluetooth_cert_test_package,HOST) -f $(PRIVATE_BLUETOOTH_CERT_ENV_PROVIDER_PATH)

$(call dist-for-goals,bluetooth_stack_with_facade,$(bluetooth_cert_zip_path):bluetooth_cert_test.zip)
+4 −5
Original line number Diff line number Diff line
@@ -23,8 +23,6 @@ import os
import signal
import subprocess

ANDROID_BUILD_TOP = os.environ.get('ANDROID_BUILD_TOP')


class GdFacadeOnlyBaseTestClass(BaseTestClass):

@@ -42,8 +40,9 @@ class GdFacadeOnlyBaseTestClass(BaseTestClass):
            self.rootcanal_logs = open(rootcanal_logpath, 'w')
            rootcanal_config = self.controller_configs['rootcanal']
            rootcanal_hci_port = str(rootcanal_config.get("hci_port", "6402"))
            android_host_out = os.environ.get('ANDROID_HOST_OUT')
            rootcanal = android_host_out + "/nativetest64/root-canal/root-canal"
            rootcanal = os.path.join(
                os.getcwd(),
                "out/host/linux-x86/nativetest64/root-canal/root-canal")
            self.rootcanal_process = subprocess.Popen(
                [
                    rootcanal,
@@ -51,7 +50,7 @@ class GdFacadeOnlyBaseTestClass(BaseTestClass):
                    rootcanal_hci_port,
                    str(rootcanal_config.get("link_layer_port", "6403"))
                ],
                cwd=ANDROID_BUILD_TOP,
                cwd=os.getcwd(),
                env=os.environ.copy(),
                stdout=self.rootcanal_logs,
                stderr=self.rootcanal_logs)
+9 −5
Original line number Diff line number Diff line
@@ -28,9 +28,12 @@ from acts.controllers.adb import AdbProxy

import grpc

ANDROID_BUILD_TOP = os.environ.get('ANDROID_BUILD_TOP')
ANDROID_HOST_OUT = os.environ.get('ANDROID_HOST_OUT')
ANDROID_PRODUCT_OUT = os.environ.get('ANDROID_PRODUCT_OUT')
from cert.environment_provider import PRODUCT_DEVICE

ANDROID_PRODUCT_OUT = os.path.join(
    os.getcwd(), "out/dist/bluetooth_cert_test/out/target/product",
    PRODUCT_DEVICE)

WAIT_CHANNEL_READY_TIMEOUT = 10


@@ -43,7 +46,8 @@ def replace_vars(string, config):
        rootcanal_port = ""
    if serial_number == "DUT" or serial_number == "CERT":
        raise Exception("Did you forget to configure the serial number?")
    return string.replace("$ANDROID_HOST_OUT", ANDROID_HOST_OUT) \
    android_host_out = os.path.join(os.getcwd(), "out/host/linux-x86")
    return string.replace("$ANDROID_HOST_OUT", android_host_out) \
                 .replace("$(grpc_port)", config.get("grpc_port")) \
                 .replace("$(grpc_root_server_port)", config.get("grpc_root_server_port")) \
                 .replace("$(rootcanal_port)", rootcanal_port) \
@@ -103,7 +107,7 @@ class GdDeviceBase:

        self.backing_process = subprocess.Popen(
            cmd,
            cwd=ANDROID_BUILD_TOP,
            cwd=os.getcwd(),
            env=os.environ.copy(),
            stdout=self.backing_process_logs,
            stderr=self.backing_process_logs)
+3 −1
Original line number Diff line number Diff line
#! /bin/bash
PYTHONPATH=$PYTHONPATH:$ANDROID_BUILD_TOP/out/host/linux-x86/lib64:$ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd:$ANDROID_BUILD_TOP/out/dist/bluetooth_cert_generated_py/packages/modules/Bluetooth/system/gd python3.8 "$@"
PYTHONPATH=$ANDROID_BUILD_TOP/out/host/linux-x86/lib64:$ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd:$ANDROID_BUILD_TOP/out/dist/bluetooth_cert_test/packages/modules/Bluetooth/system/gd:$ANDROID_BUILD_TOP/out/dist/bluetooth_cert_generated_py/packages/modules/Bluetooth/system/gd:$PYTHONPATH \
PATH=$ANDROID_HOST_OUT/nativetest64/root-canal:$ANDROID_HOST_OUT/nativetest64/bin:$PATH \
 python3.8 "$@"
+8 −1
Original line number Diff line number Diff line
@@ -37,8 +37,15 @@ set -- "${POSITIONAL[@]}" # restore positional parameters
unzip -o -q $ANDROID_BUILD_TOP/out/dist/bluetooth_cert_generated_py.zip \
   -d $ANDROID_BUILD_TOP/out/dist/bluetooth_cert_generated_py

PYTHONPATH=$PYTHONPATH:$ANDROID_BUILD_TOP/out/host/linux-x86/lib64:$ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd:$ANDROID_BUILD_TOP/out/dist/bluetooth_cert_generated_py/packages/modules/Bluetooth/system/gd \
unzip -o -q $ANDROID_BUILD_TOP/out/dist/bluetooth_cert_test.zip \
   -d $ANDROID_BUILD_TOP/out/dist/bluetooth_cert_test

pushd .
cd $ANDROID_BUILD_TOP
PYTHONPATH=$ANDROID_BUILD_TOP/out/host/linux-x86/lib64:$ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd:$ANDROID_BUILD_TOP/out/dist/bluetooth_cert_test/packages/modules/Bluetooth/system/gd:$ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd:$ANDROID_BUILD_TOP/out/dist/bluetooth_cert_generated_py/packages/modules/Bluetooth/system/gd:$PYTHONPATH \
PATH=$ANDROID_BUILD_TOP/out/dist/bluetooth_cert_test/out/host/linux-x86/nativetest64/root-canal:$ANDROID_BUILD_TOP/out/dist/bluetooth_cert_test/out/host/linux-x86/bin:$PATH \
    python3.8 `which act.py`\
      -c $TEST_CONFIG \
      $TEST_FILTER \
      -tp $ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd
popd
 No newline at end of file
Loading