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

Commit 7ba4b19f authored by Jack He's avatar Jack He
Browse files

Cert: Add directory structure to genrule

* The generated Python directory need to overlap with the GD source
  directries for them to run together in one ACTS test
* Since both generated library and source library has Python modules
  with the same name, such as "cert", they must not have duplicate
  files for them to be imported in the same interpreter

Bug: 150321998
Test: source cert/run
Change-Id: I2bd4e3e9c3a5ec8d51e0bbba7f8a8a767f9ce866
parent d3275232
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -459,14 +459,15 @@ genrule {
        "protoc-gen-grpc-python-plugin",
        "soong_zip",
    ],
    cmd: "$(location aprotoc) -Ipackages/modules/Bluetooth/system/gd -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-python-plugin) $(in) --grpc_out=$(genDir) --python_out=$(genDir); " +
        "touch $(genDir)/facade/__init__.py; " +
        "touch $(genDir)/hal/__init__.py; " +
        "touch $(genDir)/hci/__init__.py; " +
        "touch $(genDir)/hci/facade/__init__.py; " +
        "touch $(genDir)/l2cap/classic/__init__.py; " +
        "touch $(genDir)/neighbor/facade/__init__.py; " +
        "touch $(genDir)/security/__init__.py; " +
    cmd: "mkdir -p $(genDir)/packages/modules/Bluetooth/system/gd && " +
        "$(location aprotoc) -Ipackages/modules/Bluetooth/system/gd -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-python-plugin) $(in) --grpc_out=$(genDir)/packages/modules/Bluetooth/system/gd --python_out=$(genDir)/packages/modules/Bluetooth/system/gd && " +
        "touch $(genDir)/packages/modules/Bluetooth/system/gd/facade/__init__.py && " +
        "touch $(genDir)/packages/modules/Bluetooth/system/gd/hal/__init__.py && " +
        "touch $(genDir)/packages/modules/Bluetooth/system/gd/hci/__init__.py && " +
        "touch $(genDir)/packages/modules/Bluetooth/system/gd/hci/facade/__init__.py && " +
        "touch $(genDir)/packages/modules/Bluetooth/system/gd/l2cap/classic/__init__.py && " +
        "touch $(genDir)/packages/modules/Bluetooth/system/gd/neighbor/facade/__init__.py && " +
        "touch $(genDir)/packages/modules/Bluetooth/system/gd/security/__init__.py && " +
        "$(location soong_zip) -C $(genDir) -D $(genDir) -o $(out)",
    srcs: [
        ":BluetoothFacadeProto",
+1 −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 python3.8 "$@"
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 "$@"
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ 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 \
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 `which act.py`\
      -c $TEST_CONFIG \
      $TEST_FILTER \
+1 −1
Original line number Diff line number Diff line
@@ -3,4 +3,4 @@
unzip -u $ANDROID_BUILD_TOP/out/dist/bluetooth_cert_generated_py.zip -d $ANDROID_BUILD_TOP/out/dist/bluetooth_cert_generated_py

# For bluetooth_packets_python3
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 python3.8 `which act.py` -c $ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd/cert/pts.json -tf $ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd/cert/pts_l2cap_testcase -tp $ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd
python3.8-gd `which act.py` -c $ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd/cert/pts.json -tf $ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd/cert/pts_l2cap_testcase -tp $ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd
+7 −7
Original line number Diff line number Diff line
@@ -161,13 +161,13 @@ pushd .
cd $ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd/gd_cert_venv/lib/python3.8/site-packages
# Python generated code
ln -sfT $ANDROID_BUILD_TOP/tools/test/connectivity/acts/framework/acts acts
ln -sfT $ANDROID_BUILD_TOP/out/dist/bluetooth_cert_generated_py/cert cert
ln -sfT $ANDROID_BUILD_TOP/out/dist/bluetooth_cert_generated_py/facade facade
ln -sfT $ANDROID_BUILD_TOP/out/dist/bluetooth_cert_generated_py/hal hal
ln -sfT $ANDROID_BUILD_TOP/out/dist/bluetooth_cert_generated_py/hci hci
ln -sfT $ANDROID_BUILD_TOP/out/dist/bluetooth_cert_generated_py/l2cap l2cap
ln -sfT $ANDROID_BUILD_TOP/out/dist/bluetooth_cert_generated_py/neighbor neighbor
ln -sfT $ANDROID_BUILD_TOP/out/dist/bluetooth_cert_generated_py/security security
ln -sfT $ANDROID_BUILD_TOP/out/dist/bluetooth_cert_generated_py/packages/modules/Bluetooth/system/gd/cert cert
ln -sfT $ANDROID_BUILD_TOP/out/dist/bluetooth_cert_generated_py/packages/modules/Bluetooth/system/gd/facade facade
ln -sfT $ANDROID_BUILD_TOP/out/dist/bluetooth_cert_generated_py/packages/modules/Bluetooth/system/gd/hal hal
ln -sfT $ANDROID_BUILD_TOP/out/dist/bluetooth_cert_generated_py/packages/modules/Bluetooth/system/gd/hci hci
ln -sfT $ANDROID_BUILD_TOP/out/dist/bluetooth_cert_generated_py/packages/modules/Bluetooth/system/gd/l2cap l2cap
ln -sfT $ANDROID_BUILD_TOP/out/dist/bluetooth_cert_generated_py/packages/modules/Bluetooth/system/gd/neighbor neighbor
ln -sfT $ANDROID_BUILD_TOP/out/dist/bluetooth_cert_generated_py/packages/modules/Bluetooth/system/gd/security security
# Native libraries
ln -sfT $ANDROID_BUILD_TOP/out/dist/bluetooth_cert_test/out/host/linux-x86/lib64/bluetooth_packets_python3.so bluetooth_packets_python3.so
# Per systrace, Python only load from python3.8/lib64 directory for plugin imported native libraries