diff options
author | 2024-12-17 11:39:05 -0800 | |
---|---|---|
committer | 2024-12-17 17:14:01 -0800 | |
commit | 7f6912c03f22191ddfe2cd58e0cb014e5377e34f (patch) | |
tree | a4bd82f7a9d2e397e6d8c95743276df3c3b4c936 | |
parent | 66e0e71beca0ee76b48859c275efc4dfbc479db7 (diff) |
gd/cert: Remove the build rule for bluetooth_cert_tests.zip
Bug: 384782957
Test: TreeHugger
Flag: EXEMPT, build change
Change-Id: I51a0348910a63b0c98740d9a1163f0bf91c8b698
-rw-r--r-- | system/Android.bp | 183 | ||||
-rw-r--r-- | system/gd/cert/change_waiter.py | 18 | ||||
-rwxr-xr-x | system/gd/cert/gen_html_coverage.sh | 10 | ||||
-rwxr-xr-x | system/gd/cert/irun | 10 | ||||
-rwxr-xr-x | system/gd/cert/run | 495 | ||||
-rwxr-xr-x | system/gd/cert/set_up_and_run_device_cert.sh | 158 | ||||
-rw-r--r-- | system/setup.py | 101 |
7 files changed, 0 insertions, 975 deletions
diff --git a/system/Android.bp b/system/Android.bp index b79fa12489..0002fbdaff 100644 --- a/system/Android.bp +++ b/system/Android.bp @@ -119,24 +119,6 @@ genrule { ], } -genrule { - name: "BlueberryFacadeAndCertGeneratedStub_py", - tools: [ - "aprotoc", - "protoc-gen-grpc-python-plugin", - "soong_zip", - ], - cmd: "mkdir -p $(genDir)/files && " + - "$(location aprotoc) -Ipackages/modules/Bluetooth/system -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-python-plugin) $(locations :BlueberryFacadeProto) --grpc_out=$(genDir)/files --python_out=$(genDir)/files && " + - "for dir in `find $(genDir)/files -type d`; do touch $$dir/__init__.py; done &&" + - "$(location soong_zip) -C $(genDir)/files -D $(genDir)/files -o $(out)", - srcs: [ - ":BlueberryFacadeProto", - ":libprotobuf-internal-protos", - ], - out: ["blueberry_facade_generated_py.zip"], -} - rust_protobuf { name: "libbt_topshim_facade_protobuf", crate_name: "bt_topshim_facade_protobuf", @@ -160,168 +142,3 @@ cc_library_headers { ], min_sdk_version: "30", } - -genrule { - name: "bluetooth_cert_test_sources-zip", - tools: [ - "soong_zip", - ], - srcs: [ - "blueberry/**/*.py", - "blueberry/**/*.yaml", - "setup.py", - ], - out: ["bluetooth_cert_test_sources.zip"], - cmd: "echo $(in) > $(genDir)/file_list.txt && " + - "$(location soong_zip) -C packages/modules/Bluetooth/system -l $(genDir)/file_list.txt -o $(out)", -} - -genrule { - name: "gd_hci_packets_python3_gen-zip", - tools: [ - "soong_zip", - ], - srcs: [ - ":gd_hci_packets_python3_gen", - ], - out: ["gd_hci_packets_python3_gen.zip"], - cmd: "echo $(in) > $(genDir)/file_list.txt && " + - "$(location soong_zip) -j -l $(genDir)/file_list.txt -o $(out)", -} - -genrule { - name: "gd_smp_packets_python3_gen-zip", - tools: [ - "soong_zip", - ], - srcs: [ - ":gd_smp_packets_python3_gen", - ], - out: ["gd_smp_packets_python3_gen.zip"], - cmd: "echo $(in) > $(genDir)/file_list.txt && " + - "$(location soong_zip) -j -l $(genDir)/file_list.txt -o $(out)", -} - -cc_genrule { - name: "bluetooth_cert_test_host_deps-zip", - host_supported: true, - device_supported: false, - compile_multilib: "first", - tools: [ - "bluetooth_stack_with_facade", - "bt_topshim_facade", - "root-canal", - "soong_zip", - ], - srcs: [ - ":libbase", - ":libbinder", - ":libbinder_ndk", - ":libbluetooth", - ":libbluetooth_gd", - ":libc++", - ":libchrome", - ":libcrypto", - ":libcutils", - ":libevent", - ":libflatbuffers-cpp", - ":libgrpc++", - ":libgrpc_wrap", - ":liblog", - ":liblzma", - ":libprotobuf-cpp-full", - ":libssl", - ":libunwindstack", - ":libutils", - ":libz", - ":server_configurable_flags", - ], - out: ["bluetooth_cert_test_host_deps.zip"], - cmd: "echo $(in) > $(genDir)/file_list.txt && " + - "$(location soong_zip) -j -f $(location bluetooth_stack_with_facade) -f $(location bt_topshim_facade) -f $(location root-canal) -P lib64 -l $(genDir)/file_list.txt -o $(out)", -} - -cc_genrule { - name: "bluetooth_cert_test_target_deps-zip", - compile_multilib: "first", - tools: [ - "soong_zip", - ], - srcs: [ - // executables - ":bluetooth_stack_with_facade", - // libs - ":android.hardware.bluetooth@1.0", - ":android.hardware.bluetooth@1.1", - ":libandroid_runtime_lazy", - ":libbase", - ":libbinder", - ":libbinder_ndk", - ":libc++", - ":libcrypto", - ":libcutils", - ":libgrpc++", - ":libgrpc_wrap", - ":libhidlbase", - ":liblog", - ":liblzma", - ":libprotobuf-cpp-full", - ":libssl", - ":libunwindstack", - ":libutils", - ":libz", - ":server_configurable_flags", - ], - out: ["bluetooth_cert_test_target_deps.zip"], - cmd: "echo $(in) > $(genDir)/file_list.txt && " + - "$(location soong_zip) -j -P target -l $(genDir)/file_list.txt -o $(out)", -} - -genrule { - name: "llvm-tools-zip", - tools: [ - "soong_zip", - ], - srcs: [ - ":llvm-tools", - ], - out: ["llvm-tools.zip"], - cmd: "mkdir -p $(genDir)/llvm_binutils/bin && mkdir -p $(genDir)/llvm_binutils/lib/x86_64-unknown-linux-gnu && " + - "cp prebuilts/clang/host/linux-x86/*/bin/llvm-cov $(genDir)/llvm_binutils/bin && " + - "cp prebuilts/clang/host/linux-x86/*/bin/llvm-profdata $(genDir)/llvm_binutils/bin && " + - "cp prebuilts/clang/host/linux-x86/*/bin/llvm-symbolizer $(genDir)/llvm_binutils/bin && " + - "cp prebuilts/clang/host/linux-x86/*/lib/x86_64-unknown-linux-gnu/libc++.so $(genDir)/llvm_binutils/lib/x86_64-unknown-linux-gnu && " + - "$(location soong_zip) -C $(genDir) -D $(genDir)/llvm_binutils -o $(out)", -} - -cc_genrule { - name: "bluetooth_cert_tests.zip", - host_supported: true, - device_supported: false, - compile_multilib: "first", - tools: [ - "merge_zips", - "soong_zip", - ], - srcs: [ - ":BlueberryFacadeAndCertGeneratedStub_py", - ":bluetooth_cert_test_host_deps-zip", - ":bluetooth_cert_test_sources-zip", - ":gd_hci_packets_python3_gen-zip", - ":gd_smp_packets_python3_gen-zip", - ":llvm-tools-zip", - ], - device_first_srcs: [ - ":bluetooth_cert_test_target_deps-zip", - ], - out: ["bluetooth_cert_tests.zip"], - cmd: "$(location merge_zips) $(genDir)/temp.zip $(in) && " + - "unzip -q -d $(genDir)/files $(genDir)/temp.zip && " + - "for d in $$(find $(genDir)/files/blueberry -type d -name '*'); do touch -a $$d/__init__.py; done && " + - "$(location soong_zip) -C $(genDir)/files -D $(genDir)/files -o $(out)", - dist: { - targets: [ - "bluetooth_stack_with_facade", - ], - }, -} diff --git a/system/gd/cert/change_waiter.py b/system/gd/cert/change_waiter.py deleted file mode 100644 index 30a72f9671..0000000000 --- a/system/gd/cert/change_waiter.py +++ /dev/null @@ -1,18 +0,0 @@ -import pyinotify -import sys - -wm = pyinotify.WatchManager() -mask = pyinotify.IN_DELETE | pyinotify.IN_CREATE | pyinotify.IN_MODIFY - - -class EventHandler(pyinotify.ProcessEvent): - - def process_default(self, event): - quit() - - -handler = EventHandler() -notifier = pyinotify.Notifier(wm, handler) -wdd = wm.add_watch(sys.argv[1], mask, rec=True) - -notifier.loop() diff --git a/system/gd/cert/gen_html_coverage.sh b/system/gd/cert/gen_html_coverage.sh deleted file mode 100755 index bfb1edb3bf..0000000000 --- a/system/gd/cert/gen_html_coverage.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -pushd $ANDROID_BUILD_TOP - -llvm-cov show --format=html --summary-only --show-line-counts-or-regions --show-instantiation-summary --instr-profile=/tmp/logs/HostOnlyCert/latest/GdDevice_dut_backing_process_coverage.profdata --output-dir=/tmp/logs/HostOnlyCert/latest/GdDevice_dut_backing_process_coverage/ out/dist/bluetooth_venv/lib/python3.8/site-packages/bluetooth_stack_with_facade - -popd - -echo "point your browser to file:///tmp/logs/HostOnlyCert/latest/GdDevice_dut_backing_process_coverage/index.html" - diff --git a/system/gd/cert/irun b/system/gd/cert/irun deleted file mode 100755 index 062f07f6cf..0000000000 --- a/system/gd/cert/irun +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/bash -# interactive version of run - -trap "exit;" SIGINT SIGTERM - -while true -do - ${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system/gd/cert/run "$@" - python3 ${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system/gd/cert/change_waiter.py ${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system -done diff --git a/system/gd/cert/run b/system/gd/cert/run deleted file mode 100755 index 94708ff69c..0000000000 --- a/system/gd/cert/run +++ /dev/null @@ -1,495 +0,0 @@ -#! /bin/bash - -YELLOW="\033[1;33m" -NOCOLOR="\033[0m" -BLUE="\033[1;34m" -RED="\033[1;91m" - -function happy_hedgehog { - echo -e "\t${BLUE}" - echo -e "\t ___------__" - echo -e "\t |\__-- /\ _-" - echo -e "\t |/_ __ -" - echo -e "\t // \ / \ /__" - echo -e "\t | 0 | 0 |__ --_ Gotta go fast!" - echo -e "\t \\____-- __ \ ___-" - echo -e "\t ( @ __/ / /_" - echo -e "\t -_____--- --_" - echo -e "\t // \ \\ ___-" - echo -e "\t //|\__/ \\ \\" - echo -e "\t \_-\_____/ \-\\" - echo -e "\t // \\--\|" - echo -e "\t ${RED}____${BLUE}// ||${RED}_" - echo -e "\t${RED} /_____\ /___\\" - echo -e "${NOCOLOR}" -} - -function sad_hedgehog { - echo -e "\t${BLUE}" - echo -e "\t ___------__" - echo -e "\t |\__-- /\ _-" - echo -e "\t |/_ __ -" - echo -e "\t // \ / \ /__" - echo -e "\t | 0 | 0 |__ --_ Gotta go sllloowwww!" - echo -e "\t \\____-- __ \ ___-" - echo -e "\t ( @ __ / /_" - echo -e "\t -_____--- --_" - echo -e "\t // \ \\ ___-" - echo -e "\t //|\__/ \\ \\" - echo -e "\t \_-\_____/ \-\\" - echo -e "\t // \\--\|" - echo -e "\t ${RED} ____${BLUE}// ||${RED}_" - echo -e "\t${RED} /_____\ /___\\" - echo -e "{$NOCOLOR}" -} - -PYTHON_BIN="python3.11" - -function check_environment { - if [[ -z "${ANDROID_BUILD_TOP}" ]] || [[ -z "${ANDROID_HOST_OUT}" ]] ; then - echo -e "${RED}ANDROID_BUILD_TOP${NOCOLOR} or ${RED}ANDROID_HOST_OUT${NOCOLOR} is not set for host run" - echo -e "Navigate to android root and run:" - echo -e "${YELLOW}" - echo -e ". build/envsetup.sh" - echo -e "lunch <fish>" - echo -e "${NOCOLOR}" - echo - exit 1 - fi - if ! [ -x "$(command -v ${PYTHON_BIN})" ] ; then - echo -e "${RED}You must have ${PYTHON_BIN} installed${NOCOLOR}" - exit 1 - fi - ${PYTHON_BIN} -m venv -h > /dev/null - if [[ $? -ne 0 ]] ; then - echo -e "${RED}venv not available for ${PYTHON_BIN}${NOCOLOR}" - exit 1 - fi -} - -ASHMEM_OUT="/dev/shm/out" -ASHMEM_DIST="${ASHMEM_OUT}/dist" -ASHMEM_VENV="${ASHMEM_DIST}/bluetooth_venv" -ASHMEM_GOTTA_GO_FAST="/dev/shm/gottagofast" -ASHMEM_HOST_LOGS="${ASHMEM_GOTTA_GO_FAST}/logs" -ASHMEM_OUT_TARGET="${ASHMEM_GOTTA_GO_FAST}/target" -ASHMEM_SOONG="${ASHMEM_GOTTA_GO_FAST}/out/soong" -CERT_HOST_LOGS="/tmp/logs/HostOnlyCert" -CERT_DEVICE_LOGS="TODO: Add this" -CERT_TEST_VENV=${ANDROID_BUILD_TOP}/out/dist/bluetooth_venv -OUT_TARGET="${ANDROID_BUILD_TOP}/out/target" -TEST_CONFIG="${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system/blueberry/tests/gd/host_config.yaml" -TEST_FILTER="--presubmit" -TEST_RUNNER="blueberry/tests/gd/gd_test_runner.py" -CPP_BUILD_TARGET="bluetooth_stack_with_facade root-canal gd_hci_packets_python3_gen gd_smp_packets_python3_gen" -RUST_BUILD_TARGET="bluetooth_with_facades root-canal bt_topshim_facade gd_hci_packets_python3_gen gd_smp_packets_python3_gen" -BUILD_TARGET=$CPP_BUILD_TARGET - -CLEAN_VENV=false -GOTTA_GO_FAST=false -NUM_REPETITIONS="1" -SKIP_SOONG_BUILD=false -USE_ASHMEM_VENV=true -VERBOSE_MODE=false -DEVICE_TEST=false - -## Verify devices connected and valid -DUT_SERIAL="DUT Not Set" -DUT_ADB="DUT Not Set" -DUT_NAME="DUT Not Set" - -# Used for position arguments needed for later -POSITIONAL=() -function parse_options { - while [[ $# -gt 0 ]] - do - key="$1" - case $key in - # This will delete the existing venv before running the test - # If you updated external libraries such as ACTS, you need to add this flag - --clean) - CLEAN_VENV=true - shift # past argument - ;; - --help) - echo - echo -e "${YELLOW}Help menu${NOCOLOR}" - echo -e "===================================" - echo -e "${BLUE} --clean${NOCOLOR}" - echo -e " Clean the virtul environment; use if ACTS has been updated." - echo -e "${BLUE} --disable-ashmem-venv${NOCOLOR}" - echo -e " Places the virtual environment on disk rather than in ashmem which is default." - echo -e "${BLUE} --gotta-go-fast${NOCOLOR}" - echo -e " Makes use of ashmem as best as possible for targeted speed increases." - echo -e "${BLUE} --device${NOCOLOR}" - echo -e " Run the test on the 2 real devices." - echo -e "${BLUE} --topshim${NOCOLOR}" - echo -e " Run Topshim combination tests using the default topshim config." - echo -e "${BLUE} --rust${NOCOLOR}" - echo -e " Run the test using the rust implementation on the 2 real devices." - echo -e "${BLUE} --rhost${NOCOLOR}" - echo -e " Run the test using the rust implementation on the host." - echo -e "${BLUE} --repeat=<N>${NOCOLOR}" - echo -e " Repeat the test sequence N (int) number of times." - echo -e "${BLUE} --skip-soong-build${NOCOLOR}" - echo -e " Skips building soong targets. Use when you are just modifying simple python files." - echo -e "${BLUE} --test_config=<configfile>${NOCOLOR}" - echo -e " Override default test configuration." - echo -e "${BLUE} --verbose${NOCOLOR}" - echo -e " Displays device logs and test logs to output." - echo - echo -e "Usage: $0 [--clean|--repeat=<N>|--test_config=<config>] [TestGroupName[.IndividualTestName]]" - echo -e " ${YELLOW}e.g." - echo -e " $0 --clean SecurityTest" - echo -e " $0 --verbose SecurityTest:test_dut_initiated_display_only_display_only ${NOCOLOR}" - echo - shift - exit 0 - ;; - # This will cause the bluetooth_venv to NOT be created in ashmem - # Using ashmem increases --clean build times by 40% (~21 seconds on my machine) - --disable-ashmem-venv) - USE_ASHMEM_VENV=false - shift # past argument - ;; - --gotta-go-fast) - GOTTA_GO_FAST=true - shift # past argument - ;; - --device) - DEVICE_TEST=true - TEST_CONFIG="${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system/blueberry/tests/gd/devices_config.yaml" - shift # past argument - ;; - # Repeat running the specified test cases by N times in one single setup - --repeat=*) - NUM_REPETITIONS="${key#*=}" - shift # past argument - ;; - --skip-soong-build) - SKIP_SOONG_BUILD=true - shift - ;; - --test_config=*) - TEST_CONFIG="${key#*=}" - shift # past argument - ;; - --rust) - BUILD_TARGET=$RUST_BUILD_TARGET - export RUST_BACKTRACE=1 - TEST_CONFIG="${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system/blueberry/tests/gd/rust_devices_config.yaml" - DEVICE_TEST=true - shift # past argument - ;; - --rhost) - export RUST_BACKTRACE=1 - BUILD_TARGET=$RUST_BUILD_TARGET - TEST_CONFIG="${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system/blueberry/tests/gd/rust_host_config.yaml" - shift # past argument - ;; - --topshim) - TEST_CONFIG="${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system/blueberry/tests/topshim/topshim_host_config.yaml" - TEST_RUNNER="blueberry/tests/topshim/topshim_test_runner.py" - shift - ;; - # This will log everything to both log file and stdout - --verbose) - VERBOSE_MODE=true - shift # past argument - ;; - --*) # unknown argument - echo "$0: unrecognized argument '$1'" - echo "Try '$0 --help' for more information" - exit 1 - shift - ;; - *) # unknown option - POSITIONAL+=("$1") # save it in an array for later - shift # past argument - ;; - esac - done - set -- "${POSITIONAL[@]}" # restore positional parameters - - # Set the test filter - if [[ -n "$1" ]] ; then - TEST_FILTER="--tests $1" - fi - - INSTALL_ARGS="--reuse-libraries" - if [ "$CLEAN_VENV" == true ] ; then - echo -e "${YELLOW}Cleaning up existing virtualenv${NOCOLOR}" - rm -rf $CERT_TEST_VENV/* - rm -rf $CERT_TEST_VENV - mkdir -p ${CERT_TEST_VENV} - INSTALL_ARGS="" - else - echo -e "${YELLOW}Try to reuse existing virtualenv at ${CERT_TEST_VENV}${NOCOLOR}" - fi - -} - -function select_devices { - if [ "$DEVICE_TEST" == true ] ; then - RR="$(cat ${TEST_CONFIG}|grep \'CERT\\\|DUT\')" - if [ "$RR" != "" ]; then - DUT_SERIAL="$(menu-adb DUT)" - DUT_ADB="adb -s ${DUT_SERIAL}" - DUT_NAME="$(adb devices -l | grep -v "List of device" | grep ${DUT_SERIAL} | awk '{ print $6 }' | cut -d ':' -f 2)" - CERT_SERIAL="$(menu-adb CERT)" - CERT_ADB="adb -s ${CERT_SERIAL}" - CERT_NAME="$(adb devices -l | grep -v "List of device" | grep ${CERT_SERIAL} | awk '{ print $6 }' | cut -d ':' -f 2)" - - if [ "${CERT_SERIAL}" == "${DUT_SERIAL}" ]; then - echo - echo -e "${RED}ERROR: CERT and DUT cannot be the same device, or you only have one device connected!${NOCOLOR}" - echo - exit 1 - fi - - ## Set android devices in config - sed -i "s/'DUT'/'${DUT_SERIAL}'/g" ${TEST_CONFIG} - sed -i "s/'CERT'/'${CERT_SERIAL}'/g" ${TEST_CONFIG} - fi - fi -} - -function soong_build { - 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" dist $BUILD_TARGET -j $(nproc) - if [[ $? -ne 0 ]] ; then - echo -e "${RED}Failed to build ${BUILD_TARGET}${NOCOLOR}" - exit 1 - fi - else - $ANDROID_BUILD_TOP/build/soong/soong_ui.bash --build-mode --"all-modules" --dir="${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system" dist $BUILD_TARGET -j $(nproc) - if [[ $? -ne 0 ]] ; then - echo -e "${RED}Failed to build ${BUILD_TARGET}${NOCOLOR}" - exit 1 - fi - fi -} - -function setup_venv { - # Make venv in memory, decreases --clean build times by 40% - # Caveat is you lose the venv if the computer reboots - if [ "${USE_ASHMEM_VENV}" == true ] ; then - echo -e "${BLUE}Using ashmem virtual environment.${NOCOLOR}" - if [[ ! -L ${CERT_TEST_VENV} ]] ; then - echo -e "${BLUE}" - echo -ne "Creating ashmem dist folder..." - mkdir -p "${ASHMEM_VENV}" - # Ensure the directory doesn't exist - rm -rf "${CERT_TEST_VENV}" - echo -e "Done" - echo -ne "Sym linking ${ASHMEM_VENV} to ${CERT_TEST_VENV}..." - ln -s "${ASHMEM_VENV}" "${CERT_TEST_VENV}" - echo -e "Done" - echo -e "${NOCOLOR}" - fi - else - echo -e "${RED}Not using ashmem virtual environment.${NOCOLOR}" - if [[ -L ${CERT_TEST_VENV} ]] ; then - echo -e "${RED}" - echo -en "Removing sym link from ${ASHMEM_VENV} to ${CERT_TEST_VENV}..." - rm -rf ""${ASHMEM_VENV} "${CERT_TEST_VENV}" - echo -e "Done" - echo -en "Cleaning up memory..." - rm -rf "${ASHMEM_VENV}" - echo -e "Done" - echo -e "${NOCOLOR}" - fi - fi - ${PYTHON_BIN} -m venv --clear "${CERT_TEST_VENV}" - if [[ $? -ne 0 ]] ; then - echo -e "${RED}Error setting up virtualenv${NOCOLOR}" - exit 1 - fi - - unzip -o -q "${ANDROID_BUILD_TOP}/out/dist/bluetooth_cert_tests.zip" -d "${CERT_TEST_VENV}/sources" - if [[ $? -ne 0 ]] ; then - echo -e "${RED}Error unzipping bluetooth_cert_tests.zip${NOCOLOR}" - exit 1 - 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/sources" - 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}/bt_topshim_facade - cp {$HOST_BIN,$DEST_DIR}/root-canal - - 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++.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}/liblzma.so - - i="${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system/setup.py" - cp {${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system,$DEST_DIR}${i#${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system} - for i in `find ${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system/blueberry -name "*.py" -type f`; do - cp {${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system,$DEST_DIR}${i#${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system} - done -#LINT.ThenChange(../../Android.mk) - - venv_common -} - -function venv_common { - $(echo "${CERT_TEST_VENV}/bin/python" "${CERT_TEST_VENV}/sources/setup.py" --quiet build --force "${INSTALL_ARGS}") - if [[ $? -ne 0 ]] ; then - echo -e "${RED}Error building GD Python libraries${NOCOLOR}" - echo -e "${YELLOW}NOTE:${NOCOLOR} To build external libraries the first time, please add --clean option." - exit 1 - fi - - $(echo "${CERT_TEST_VENV}/bin/python" "${CERT_TEST_VENV}/sources/setup.py" --quiet install --skip-build --force "${INSTALL_ARGS}") - if [[ $? -ne 0 ]] ; then - echo -e "${RED}Error installing GD Python libraries${NOCOLOR}" - exit 1 - fi - -if [ "${VERBOSE_MODE}" == true ] ; then - TEMP_CONFIG=/tmp/temp_mobly_config.yaml - cat "${TEST_CONFIG}" | "${CERT_TEST_VENV}/bin/python" -c " -import sys -import yaml -config = yaml.load(sys.stdin) -config['verbose_mode'] = True -print(yaml.dump(config)) - " > "${TEMP_CONFIG}" - TEST_CONFIG="${TEMP_CONFIG}" - if [[ $? -ne 0 ]] ; then - echo -e "${RED}Setup failed as verbose mode is chosen but cannot be enabled${NOCOLOR}" - exit 1 - fi -fi -} - -function gotta_go_fast { - if [ "${GOTTA_GO_FAST}" == true ] ; then - # Call here to explicitly note the flag is in use - happy_hedgehog - if [[ ! -L "${CERT_HOST_LOGS}" ]] ; then - rm -rf "${CERT_HOST_LOGS}" - mkdir -p "${ASHMEM_HOST_LOGS}" - ln -s "${ASHMEM_HOST_LOGS}" "${CERT_HOST_LOGS}" - fi - - if [[ ! -L "${OUT_TARGET}" ]] ; then - rm -rf "${OUT_TARGET}" - mkdir -p "${ASHMEM_OUT_TARGET}" - ln -s "${ASHMEM_OUT_TARGET}" "${OUT_TARGET}" - fi - else - if [[ -L "${CERT_HOST_LOGS}" ]] ; then - # Call here so we don't spam anyone not using the flag - sad_hedgehog - rm -rf "${CERT_HOST_LOGS}" - rm -rf "${ASHMEM_HOST_LOGS}" - fi - - if [[ -L "${OUT_TARGET}" ]] ; then - rm -rf "${OUT_TARGET}" - rm -rf "${ASHMEM_OUT_TARGET}" - fi - fi -} - -function run_tests { - for n in $(seq "${NUM_REPETITIONS}"); do - $(echo "${CERT_TEST_VENV}/bin/python" "${CERT_TEST_VENV}/sources/${TEST_RUNNER}" \ - "-c ${TEST_CONFIG}" "${TEST_FILTER}") - done - - if [ "${CLEAN_VENV}" != true ] ; then - echo -e "${YELLOW}NOTE:${NOCOLOR} Completed tests using existing external libraries in virtualenv." - echo -e "${YELLOW}NOTE:${NOCOLOR} To update external libraries, please add --clean option." - fi -} - -function menu-adb() { - TMP=$(adb devices -l | grep -v "List of device" | awk '{ print $1 }') - # TODO(optedoblivion): If the device doesn't have a name (offline), it misnames them - NTMP=$(adb devices -l | grep -v "List of device" | awk '{ print $6 }' | cut -d ':' -f 2) - SERIALS=($TMP) - DEVICES=($NTMP) - LEN=${#SERIALS[@]} - result=0 - if [ $LEN -lt 1 ]; then - echo -e "${YELLOW}No devices connected!${NOCOLOR}" - return 1 - fi - - if [ "$LEN" == "" ]; then - LEN=0 - fi - - answer=0 - - DEVICE_NAME="$1 device" - - if [ $LEN -gt 1 ]; then - echo "+-------------------------------------------------+" 1>&2 - echo "| Choose a ${DEVICE_NAME}: " 1>&2 - echo "+-------------------------------------------------+" 1>&2 - echo "| |" 1>&2 - let fixed_len=$LEN-1 - for i in `seq 0 $fixed_len`; - do - serial=${SERIALS[i]} - device=${DEVICES[i]} - echo "| $i) $serial $device" 1>&2 - ## TODO[MSB]: Find character count, fill with space and ending box wall - done - echo "| |" 1>&2 - echo "+-------------------------------------------------+" 1>&2 - echo 1>&2 - echo -n "Index number: " 1>&2 - read answer - fi - - if [ $answer -ge $LEN ]; then - echo - echo "Please choose a correct index!" 1>&2 - echo - return 1 - fi - - SERIAL=${SERIALS[$answer]} - echo $SERIAL -} - -function main { - check_environment - parse_options $@ - select_devices - if [[ "${SKIP_SOONG_BUILD}" != true ]] ; then - soong_build - fi - if [ "$CLEAN_VENV" == true ] ; then - setup_venv - else - incremental_venv - fi - gotta_go_fast - run_tests -} - -main $@ diff --git a/system/gd/cert/set_up_and_run_device_cert.sh b/system/gd/cert/set_up_and_run_device_cert.sh deleted file mode 100755 index 60e9ce00c5..0000000000 --- a/system/gd/cert/set_up_and_run_device_cert.sh +++ /dev/null @@ -1,158 +0,0 @@ -#!/bin/bash - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - -function menu-adb() { - TMP=$(adb devices -l | grep -v "List of device" | awk '{ print $1 }') - # TODO(optedoblivion): If the device doesn't have a name (offline), it misnames them - NTMP=$(adb devices -l | grep -v "List of device" | awk '{ print $6 }' | cut -d ':' -f 2) - SERIALS=($TMP) - DEVICES=($NTMP) - LEN=${#SERIALS[@]} - result=0 - if [ $LEN -lt 1 ]; then - echo "No devices connected!" - return 1 - fi - - if [ "$LEN" == "" ]; then - LEN=0 - fi - - answer=0 - - DEVICE_NAME="$1 device" - - if [ $LEN -gt 1 ]; then - echo "+-------------------------------------------------+" 1>&2 - echo "| Choose a ${DEVICE_NAME}: " 1>&2 - echo "+-------------------------------------------------+" 1>&2 - echo "| |" 1>&2 - let fixed_len=$LEN-1 - for i in `seq 0 $fixed_len`; - do - serial=${SERIALS[i]} - device=${DEVICES[i]} - echo "| $i) $serial $device" 1>&2 - ## TODO[MSB]: Find character count, fill with space and ending box wall - done - echo "| |" 1>&2 - echo "+-------------------------------------------------+" 1>&2 - echo 1>&2 - echo -n "Index number: " 1>&2 - read answer - fi - - if [ $answer -ge $LEN ]; then - echo - echo "Please choose a correct index!" 1>&2 - echo - return 1 - fi - - SERIAL=${SERIALS[$answer]} - echo $SERIAL -} - -function UpFind { - while [[ $PWD != / ]] ; do - rc=$(find "$PWD" -maxdepth 1 "$@") - if [ -n "$rc" ]; then - echo $(dirname "$rc") - return - fi - cd .. - done -} - - -function get-android-root() { - android_root=$(UpFind -name dalvik -type d) - if [[ -z $android_root ]] ; then - echo - echo "Needs to be ran in the android tree" - echo - return 1 - fi - echo "${android_root}" -} - -function banner() { - echo - echo "GD On Device Cert Test" - echo -} - -## Main -banner - -DRY_RUN="" -DO_BUILD=0 -echo "$@" -if [ $# -gt 0 ]; then - for var in "$@" - do - if [ "$var" == "-h" ]; then - echo - echo "Usage: $0 [-h|-d]" - echo - echo "Available Options:" - echo "==================" - echo " -h | Help(this) Menu" - echo " -d | Dry run; just prints commands" - echo - return 0 - elif [ "$var" == "-d" ]; then - DRY_RUN="echo" - elif [ "$var" == "-b" ]; then - DO_BUILD=1 - fi - done -fi - -## Verify devices connected and sane -DUT_SERIAL="$(menu-adb DUT)" -DUT_ADB="adb -s ${DUT_SERIAL}" -DUT_NAME="$(adb devices -l | grep -v "List of device" | grep ${DUT_SERIAL} | awk '{ print $6 }' | cut -d ':' -f 2)" - -CERT_SERIAL="$(menu-adb CERT)" -CERT_ADB="adb -s ${CERT_SERIAL}" -CERT_NAME="$(adb devices -l | grep -v "List of device" | grep ${CERT_SERIAL} | awk '{ print $6 }' | cut -d ':' -f 2)" - -if [ "${CERT_SERIAL}" == "${DUT_SERIAL}" ]; then - echo - echo "ERROR: CERT and DUT cannot be the same device, or you only have one device connected!" - echo - return 1 -fi - -## Start builds -if [ $DO_BUILD == 1 ]; then - $DRY_RUN cd $(get-android-root) - $DRY_RUN . build/envsetup.sh - #DUT - $DRY_RUN lunch $DUT_NAME - $DRY_RUN cd $(get-android-root)/packages/modules/Bluetooth/system/gd - $DRY_RUN mma -j `cat /proc/cpuinfo | grep core | wc -l` - $DRY_RUN cd $(get-android-root) - # CERT - $DRY_RUN lunch $CERT_NAME - $DRY_RUN cd $(get-android-root)/packages/modules/Bluetooth/system/gd - $DRY_RUN mma -j `cat /proc/cpuinfo | grep core | wc -l` - $DRY_RUN cd $(get-android-root) -fi - -## Set android devices in config -pushd . -cd "${DIR}" -# Reset in case user chooses different item in menu -git checkout devices_config.json -popd -$DRY_RUN sed -i "s/\"DUT\"/\"${DUT_SERIAL}\"/g" ${DIR}/devices_config.json -$DRY_RUN sed -i "s/\"CERT\"/\"${CERT_SERIAL}\"/g" ${DIR}/devices_config.json - -## ACTS -#$DRY_RUN source $(get-android-root)/packages/modules/Bluetooth/system/gd/cert/set_up_acts.sh - -## Start test -$DRY_RUN $(get-android-root)/packages/modules/Bluetooth/system/gd/cert/run --device diff --git a/system/setup.py b/system/setup.py deleted file mode 100644 index b593205e6e..0000000000 --- a/system/setup.py +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright 2020 - The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from distutils import log -import os -from setuptools import find_packages -from setuptools import setup -from setuptools.command.install import install -import stat -import subprocess -import sys - -reuse_libraries = False -force_install = False - -install_requires = [ - 'grpcio', - 'psutil', - 'protobuf>=3.14.0, <4.0', - 'mobly', -] - -host_executables = [ - 'root-canal', - 'bluetooth_stack_with_facade', # c++ - 'bluetooth_with_facades', # rust - 'bt_topshim_facade', # topshim -] - - -def set_permissions_for_host_executables(outputs): - for file in outputs: - if os.path.basename(file) in host_executables: - current_mode = os.stat(file).st_mode - new_mode = current_mode | stat.S_IEXEC - os.chmod(file, new_mode) - log.log(log.INFO, "Changed file mode of %s from %s to %s" % (file, oct(current_mode), oct(new_mode))) - - -class InstallLocalPackagesForInstallation(install): - - def run(self): - global reuse_libraries, force_install - install_args = [sys.executable, '-m', 'pip', 'install'] - subprocess.check_call(install_args + ['--upgrade', 'pip']) - - for package in install_requires: - self.announce('Installing %s...' % package, log.INFO) - cmd = install_args + ['-v', '--no-cache-dir', package] - if force_install and not reuse_libraries: - cmd.append("--force-reinstall") - subprocess.check_call(cmd) - self.announce('Dependencies installed.') - - install.run(self) - set_permissions_for_host_executables(self.get_outputs()) - - -def main(): - global reuse_libraries, force_install - if sys.argv[-1] == "--reuse-libraries": - reuse_libraries = True - sys.argv = sys.argv[:-1] - if "--force" in sys.argv: - force_install = True - # Relative path from calling directory to this file - our_dir = os.path.dirname(__file__) - # Must cd into this dir for package resolution to work - # This won't affect the calling shell - os.chdir(our_dir) - setup( - name='bluetooth_cert_tests', - version='1.0', - author='Android Open Source Project', - license='Apache2.0', - description="""Bluetooth Cert Tests Package""", - packages=[''] + find_packages(exclude=['llvm_binutils', 'llvm_binutils.*']), - install_requires=install_requires, - package_data={ - '': host_executables + ['*.so', 'lib64/*.so', 'target/*', 'llvm_binutils/bin/*', 'llvm_binutils/lib64/*'], - }, - cmdclass={ - 'install': InstallLocalPackagesForInstallation, - }) - - -if __name__ == '__main__': - main() |