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

Commit 2b18f207 authored by Jack He's avatar Jack He
Browse files

Cert: Use Python3.8 and bluetooth_packets_python3

* bluetooth_packets_python3 is compiled against Python3.8
  sources in Android tree. Thus cert tests have to use
  Python3.8 if it wants to use compiled bluetooth_packets_python3.so
  from Soong

Bug: 143374372
Test: make and run cert/setup_up_acts.sh and cert/run_cert.sh
Change-Id: I7eabc51999b90229a2f60b62bef5261e6bfe01d9
parent 9dfbff12
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
#! /bin/bash

act.py -c $ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd/cert/host_only_config.json -tf $ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd/cert/cert_testcases -tp $ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd
# For bluetooth_packets_python3
export PYTHONPATH=$PYTHONPATH:$ANDROID_BUILD_TOP/out/host/linux-x86/lib64
python3.8 `which act.py` -c $ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd/cert/host_only_config.json -tf $ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd/cert/cert_testcases -tp $ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd
+3 −1
Original line number Diff line number Diff line
#! /bin/bash

act.py -c $ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd/cert/android_devices_config.json -tf $ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd/cert/cert_testcases -tp $ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd
# For bluetooth_packets_python3
export PYTHONPATH=$PYTHONPATH:$ANDROID_BUILD_TOP/out/host/linux-x86/lib64
python3.8 `which act.py` -c $ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd/cert/android_devices_config.json -tf $ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd/cert/cert_testcases -tp $ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd
+38 −7
Original line number Diff line number Diff line
@@ -46,9 +46,15 @@ function SetUpAndroidBuild {
    popd
}

function SetupPython3 {
    echo "Setting up python3"
    sudo apt-get install python3-dev
function SetupPython38 {
    echo "Setting up python3.8"
    sudo apt-get install python3.8-dev
}

function CompileBluetoothPacketsPython3 {
    echo "bluetooth_packets_python3 is not found, compiling"
    croot
    make -j bluetooth_packets_python3
}

if [[ "${BASH_SOURCE[0]}" == "${0}" ]] ; then
@@ -60,16 +66,41 @@ if [[ -z "$ANDROID_BUILD_TOP" ]] ; then
    SetUpAndroidBuild
fi

## Check python3 is installed properly
dpkg -l python3-dev > /dev/null 2>&1
## Check python3.8 is installed properly
## Need Python 3.8 because bluetooth_packets_python3 is compiled against
## Python 3.8 headers
dpkg -l python3.8-dev > /dev/null 2>&1
if [[ $? -ne 0 ]] ; then
    SetupPython38
fi

## Check bluetooth_packets_python3 is compiled succssfully
export PYTHONPATH=$PYTHONPATH:$ANDROID_BUILD_TOP/out/host/linux-x86/lib64
python3.8 -c "
import bluetooth_packets_python3 as bp3
bp3.BaseStruct
"
if [[ $? -ne 0 ]] ; then
    SetupPython3
  pushd .
  CompileBluetoothPacketsPython3
  popd
  python3.8 -c "
import bluetooth_packets_python3 as bp3
bp3.BaseStruct
"
  if [[ $? -ne 0 ]] ; then
    echo "Setup failed as bluetooth_packets_python3 cannot be found"
  else
    echo "Found bluetooth_packets_python3 after compilation"
  fi
else
  echo "Found bluetooth_packets_python3"
fi

## All is good now so go ahead with the acts setup
pushd .
cd $ANDROID_BUILD_TOP/tools/test/connectivity/acts/framework/
sudo python3 setup.py develop
sudo python3.8 setup.py develop
if [[ $? -eq 0 ]] ; then
    echo "cert setup complete"
else