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

Commit 2af07290 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Add python version check in gd/cert/run

Without this check, one is left with unmeaningful errors when attempting
to run cert tests.
Also use exit - return is just for functions.

Test: run gd/cert/run --host on machine without python3.8
Change-Id: I3cbe8ba5209fda2680a82fa117c5dcdedd1b8fde
parent 0afd3e7a
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -8,6 +8,11 @@ if [[ -z "${ANDROID_HOST_OUT}" ]]; then
  echo "ANDROID_HOST_OUT is not set for host run"
fi

if ! [ -x "$(command -v python3.8)" ] ; then
    echo "You must have python 3.8 installed"
    exit 1
fi

$ANDROID_BUILD_TOP/build/soong/soong_ui.bash --build-mode --"all-modules" --dir="$(pwd)" dist bluetooth_stack_with_facade

TEST_CONFIG="$ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd/cert/android_devices_config.json"
@@ -57,19 +62,19 @@ fi
python3.8 -m virtualenv --python `which python3.8` $CERT_TEST_VENV
if [[ $? -ne 0 ]] ; then
    echo "Error setting up virtualenv"
    return 1
    exit 1
fi

unzip -o -q $ANDROID_BUILD_TOP/out/dist/bluetooth_cert_tests.zip -d $CERT_TEST_VENV/acts
if [[ $? -ne 0 ]] ; then
    echo "Error unzipping bluetooth_cert_tests.zip"
    return 1
    exit 1
fi

$CERT_TEST_VENV/bin/python $CERT_TEST_VENV/acts/setup.py install
if [[ $? -ne 0 ]] ; then
    echo "Error installing GD libraries"
    return 1
    exit 1
fi

$CERT_TEST_VENV/bin/python -c "
@@ -78,7 +83,7 @@ bp3.BaseStruct
"
if [[ $? -ne 0 ]] ; then
  echo "Setup failed as bluetooth_packets_python3 cannot be imported"
  return 1
  exit 1
fi

$CERT_TEST_VENV/bin/python $CERT_TEST_VENV/bin/act.py \