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

Commit 7b09be8c authored by Zach Johnson's avatar Zach Johnson Committed by Gerrit Code Review
Browse files

Merge "make incremental blueberry testing faster"

parents 501001d0 e8052015
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
LOCAL_PATH := $(call my-dir)
LOCAL_PATH := $(call my-dir)


#LINT.IfChange
LOCAL_cert_test_sources := \
LOCAL_cert_test_sources := \
	$(call all-named-files-under,*.py,.) \
	$(call all-named-files-under,*.py,.) \
	cert/all_cert_testcases
	cert/all_cert_testcases
@@ -42,6 +43,7 @@ LOCAL_target_libraries := \
	$(TARGET_OUT_SHARED_LIBRARIES)/libcrypto.so \
	$(TARGET_OUT_SHARED_LIBRARIES)/libcrypto.so \
	$(TARGET_OUT_SHARED_LIBRARIES)/libbluetooth_gd.so \
	$(TARGET_OUT_SHARED_LIBRARIES)/libbluetooth_gd.so \
	$(TARGET_OUT_SHARED_LIBRARIES)/libgrpc++_unsecure.so
	$(TARGET_OUT_SHARED_LIBRARIES)/libgrpc++_unsecure.so
#LINT.ThenChange(cert/run)


bluetooth_cert_src_and_bin_zip := \
bluetooth_cert_src_and_bin_zip := \
	$(call intermediates-dir-for,PACKAGING,bluetooth_cert_src_and_bin,HOST)/bluetooth_cert_src_and_bin.zip
	$(call intermediates-dir-for,PACKAGING,bluetooth_cert_src_and_bin,HOST)/bluetooth_cert_src_and_bin.zip
+66 −9
Original line number Original line Diff line number Diff line
@@ -79,7 +79,9 @@ CERT_TEST_VENV=${ANDROID_BUILD_TOP}/out/dist/bluetooth_venv
OUT_TARGET="${ANDROID_BUILD_TOP}/out/target"
OUT_TARGET="${ANDROID_BUILD_TOP}/out/target"
TEST_CONFIG="${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system/gd/cert/host_config.json"
TEST_CONFIG="${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system/gd/cert/host_config.json"
TEST_FILTER="-tf ${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system/gd/cert/all_cert_testcases"
TEST_FILTER="-tf ${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system/gd/cert/all_cert_testcases"
BUILD_TARGET="bluetooth_stack_with_facade"
CPP_BUILD_TARGET="bluetooth_stack_with_facade root-canal bluetooth_packets_python3"
RUST_BUILD_TARGET="bluetooth_with_facades root-canal bluetooth_packets_python3"
BUILD_TARGET=$CPP_BUILD_TARGET


CLEAN_VENV=false
CLEAN_VENV=false
GOTTA_GO_FAST=false
GOTTA_GO_FAST=false
@@ -193,12 +195,14 @@ function parse_options {
        shift # past argument
        shift # past argument
        ;;
        ;;
        --rust)
        --rust)
        BUILD_TARGET="bluetooth_with_facades"
        BUILD_TARGET=$RUST_BUILD_TARGET
        export RUST_BACKTRACE=1
        TEST_CONFIG=$ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd/cert/rust_android_devices_config.json
        TEST_CONFIG=$ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd/cert/rust_android_devices_config.json
        shift # past argument
        shift # past argument
        ;;
        ;;
        --rhost)
        --rhost)
        BUILD_TARGET="bluetooth_with_facades"
        export RUST_BACKTRACE=1
        BUILD_TARGET=$RUST_BUILD_TARGET
        TEST_CONFIG=$ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd/cert/rust_host_config.json
        TEST_CONFIG=$ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd/cert/rust_host_config.json
        shift # past argument
        shift # past argument
        ;;
        ;;
@@ -234,11 +238,19 @@ function parse_options {
}
}


function soong_build {
function soong_build {
    $ANDROID_BUILD_TOP/build/soong/soong_ui.bash --build-mode --"modules-in-a-dir" --dir="${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system/gd" dist $BUILD_TARGET
    if [ "$CLEAN_VENV" == true ] ; then
        $ANDROID_BUILD_TOP/build/soong/soong_ui.bash --build-mode --"modules-in-a-dir" --dir="${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system/gd" dist $BUILD_TARGET -j20
        if [[ $? -ne 0 ]] ; then
        if [[ $? -ne 0 ]] ; then
            echo "Failed to build ${BUILD_TARGET}"
            echo "Failed to build ${BUILD_TARGET}"
            exit 1
            exit 1
        fi
        fi
    else
        $ANDROID_BUILD_TOP/build/soong/soong_ui.bash --build-mode --"all-modules" --dir="${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system/gd" $BUILD_TARGET -j20
        if [[ $? -ne 0 ]] ; then
            echo "Failed to build ${BUILD_TARGET}"
            exit 1
        fi
    fi
}
}


function setup_venv {
function setup_venv {
@@ -283,6 +295,48 @@ function setup_venv {
        exit 1
        exit 1
    fi
    fi


    venv_common
}

function incremental_venv {
#LINT.IfChange
    HOST_BIN="${ANDROID_BUILD_TOP}/out/host/linux-x86/bin"
    HOST_LIB="${ANDROID_BUILD_TOP}/out/host/linux-x86/lib64"
    DEST_DIR="${ANDROID_BUILD_TOP}/out/dist/bluetooth_venv/acts"
    DEST_LIB_DIR="${DEST_DIR}/lib64"
    cp {$HOST_BIN,$DEST_DIR}/bluetooth_stack_with_facade
    cp {$HOST_BIN,$DEST_DIR}/bluetooth_with_facades
    cp {$HOST_BIN,$DEST_DIR}/root-canal

    cp {$HOST_LIB,$DEST_DIR}/bluetooth_packets_python3.so

    cp {$HOST_LIB,$DEST_LIB_DIR}/libbase.so
    cp {$HOST_LIB,$DEST_LIB_DIR}/libbluetooth_gd.so
    cp {$HOST_LIB,$DEST_LIB_DIR}/libc++.so
    cp {$HOST_LIB,$DEST_LIB_DIR}/libchrome.so
    cp {$HOST_LIB,$DEST_LIB_DIR}/libcrypto-host.so
    cp {$HOST_LIB,$DEST_LIB_DIR}/libevent-host.so
    cp {$HOST_LIB,$DEST_LIB_DIR}/libgrpc++_unsecure.so
    cp {$HOST_LIB,$DEST_LIB_DIR}/libgrpc++.so
    cp {$HOST_LIB,$DEST_LIB_DIR}/libgrpc_wrap.so
    cp {$HOST_LIB,$DEST_LIB_DIR}/liblog.so
    cp {$HOST_LIB,$DEST_LIB_DIR}/libssl-host.so
    cp {$HOST_LIB,$DEST_LIB_DIR}/libz-host.so
    cp {$HOST_LIB,$DEST_LIB_DIR}/libprotobuf-cpp-full.so
    cp {$HOST_LIB,$DEST_LIB_DIR}/libunwindstack.so
    cp {$HOST_LIB,$DEST_LIB_DIR}/libdexfile_support.so
    cp {$HOST_LIB,$DEST_LIB_DIR}/liblzma.so
    cp {$HOST_LIB,$DEST_LIB_DIR}/libbacktrace.so

    for i in `find ${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system/gd -name "*.py" -type f`; do
        cp {${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system/gd,$DEST_DIR}${i#${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system/gd}
    done
#LINT.ThenChange(../Android.mk)

    venv_common
}

function venv_common {
    $(echo "${CERT_TEST_VENV}/bin/python" "${CERT_TEST_VENV}/acts/setup.py" --quiet build --force)
    $(echo "${CERT_TEST_VENV}/bin/python" "${CERT_TEST_VENV}/acts/setup.py" --quiet build --force)
    if [[ $? -ne 0 ]] ; then
    if [[ $? -ne 0 ]] ; then
        echo "Error building GD Python libraries"
        echo "Error building GD Python libraries"
@@ -320,7 +374,6 @@ print(json.dumps(config))
    exit 1
    exit 1
  fi
  fi
fi
fi

}
}


function gotta_go_fast {
function gotta_go_fast {
@@ -425,7 +478,11 @@ function main {
    if [[ "${SKIP_SOONG_BUILD}" != true ]] ; then
    if [[ "${SKIP_SOONG_BUILD}" != true ]] ; then
        soong_build
        soong_build
    fi
    fi
    if [ "$CLEAN_VENV" == true ] ; then
        setup_venv
        setup_venv
    else
        incremental_venv
    fi
    gotta_go_fast
    gotta_go_fast
    run_tests
    run_tests
}
}