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

Commit 7796be10 authored by Zach Johnson's avatar Zach Johnson
Browse files

Start integration with gd rust & cert tests

two additional flags for gd/cert/run

--rust (rust on device)
--rhost (rust on host)

Bug: 171749953
Tag: #gd-refactor
Test: gd/cert/run --host
Change-Id: I11cbffdeca27cdfee12afbf2c8c0a5afa8ba2f17
parent 9f0cc00c
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ LOCAL_cert_test_sources := \

LOCAL_host_executables := \
	$(HOST_OUT_EXECUTABLES)/bluetooth_stack_with_facade \
	$(HOST_OUT_EXECUTABLES)/bluetooth_with_facades \
	$(HOST_OUT_EXECUTABLES)/root-canal

LOCAL_host_python_extension_libraries := \
@@ -23,7 +24,10 @@ LOCAL_host_libraries := \
	$(HOST_OUT_SHARED_LIBRARIES)/libcrypto-host.so \
	$(HOST_OUT_SHARED_LIBRARIES)/libevent-host.so \
	$(HOST_OUT_SHARED_LIBRARIES)/libgrpc++_unsecure.so \
	$(HOST_OUT_SHARED_LIBRARIES)/libgrpc++.so \
	$(HOST_OUT_SHARED_LIBRARIES)/libgrpc_wrap.so \
	$(HOST_OUT_SHARED_LIBRARIES)/liblog.so \
	$(HOST_OUT_SHARED_LIBRARIES)/libssl-host.so \
	$(HOST_OUT_SHARED_LIBRARIES)/libz-host.so \
	$(HOST_OUT_SHARED_LIBRARIES)/libprotobuf-cpp-full.so \
	$(HOST_OUT_SHARED_LIBRARIES)/libunwindstack.so \
+14 −3
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ 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/gd/cert/android_devices_config.json"
TEST_FILTER="-tf ${ANDROID_BUILD_TOP}/packages/modules/Bluetooth/system/gd/cert/all_cert_testcases"
BUILD_TARGET="bluetooth_stack_with_facade"

CLEAN_VENV=false
GOTTA_GO_FAST=false
@@ -150,6 +151,16 @@ function parse_options {
        TEST_CONFIG="${key#*=}"
        shift # past argument
        ;;
        --rust)
        BUILD_TARGET="bluetooth_with_facades"
        TEST_CONFIG=$ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd/cert/rust_android_devices_config.json
        shift # past argument
        ;;
        --rhost)
        BUILD_TARGET="bluetooth_with_facades"
        TEST_CONFIG=$ANDROID_BUILD_TOP/packages/modules/Bluetooth/system/gd/cert/rust_host_config.json
        shift # past argument
        ;;
        # This will log everything to both log file and stdout
        --verbose)
        VERBOSE_MODE=true
@@ -182,9 +193,9 @@ function parse_options {
}

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 bluetooth_stack_with_facade
    $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 [[ $? -ne 0 ]] ; then
        echo "Failed to build bluetooth_stack_with_facade"
        echo "Failed to build ${BUILD_TARGET}"
        exit 1
    fi
}
+55 −0
Original line number Diff line number Diff line
{   "_description": "Bluetooth cert testing",
    "testbed":
    [
        {
            "_description": "Two Android devices cert testbed",
            "name": "AndroidDeviceCert",
            "GdDevice":
            [
                {
                    "grpc_port": "8898",
                    "grpc_root_server_port": "8896",
                    "signal_port": "8894",
                    "label": "cert",
                    "serial_number": "CERT",
                    "name": "Cert Device",
                    "cmd":
                    [
                        "adb",
                        "-s",
                        "$(serial_number)",
                        "shell",
                        "/system/bin/bluetooth_with_facadas",
                        "--grpc-port=$(grpc_port)",
                        "--root-server-port=$(grpc_root_server_port)",
                        "--btsnoop=/data/misc/bluetooth/logs/btsnoop_hci.log",
                        "--btconfig=/data/misc/bluedroid/bt_config.conf",
                        "--signal-port=$(signal_port)"
                    ]
                },
                {
                    "grpc_port": "8899",
                    "grpc_root_server_port": "8897",
                    "signal_port": "8895",
                    "label": "dut",
                    "serial_number": "DUT",
                    "name": "DUT Device",
                    "cmd":
                    [
                        "adb",
                        "-s",
                        "$(serial_number)",
                        "shell",
                        "/system/bin/bluetooth_with_facades",
                        "--grpc-port=$(grpc_port)",
                        "--root-server-port=$(grpc_root_server_port)",
                        "--btsnoop=/data/misc/bluetooth/logs/btsnoop_hci.log",
                        "--btconfig=/data/misc/bluedroid/bt_config.conf",
                        "--signal-port=$(signal_port)"
                    ]
                }
            ]
        }
    ],
    "logpath": "/tmp/logs"
}
+50 −0
Original line number Diff line number Diff line

{   "_description": "Bluetooth cert testing",
    "testbed":
    [
        {
            "_description": "Host only cert testbed",
            "name": "HostOnlyCert",
            "rootcanal":
            {
                "test_port": "6401",
                "hci_port": "6402",
                "link_layer_port": "6403"
            },
            "GdDevice":
            [
                {
                    "grpc_port": "8998",
                    "grpc_root_server_port": "8996",
                    "signal_port": "8994",
                    "label": "cert",
                    "name": "Cert Device",
                    "cmd":
                    [
                        "$GD_ROOT/bluetooth_with_facades",
                        "--grpc-port=$(grpc_port)",
                        "--root-server-port=$(grpc_root_server_port)",
                        "--rootcanal-port=$(rootcanal_port)",
                        "--signal-port=$(signal_port)"
                    ]
                },
                {
                    "grpc_port": "8999",
                    "grpc_root_server_port": "8997",
                    "signal_port": "8995",
                    "label": "dut",
                    "name": "DUT Device",
                    "cmd":
                    [
                        "$GD_ROOT/bluetooth_with_facades",
                        "--grpc-port=$(grpc_port)",
                        "--root-server-port=$(grpc_root_server_port)",
                        "--rootcanal-port=$(rootcanal_port)",
                        "--signal-port=$(signal_port)"
                    ]
                }
            ]
        }
    ],
    "logpath": "/tmp/logs"
}
+16 −0
Original line number Diff line number Diff line
@@ -52,6 +52,21 @@ async fn async_main(rt: Arc<Runtime>, mut sigint: mpsc::UnboundedReceiver<()>) {
                .default_value("8895")
                .takes_value(true),
        )
        .arg(
            Arg::with_name("rootcanal-port")
                .long("rootcanal-port")
                .takes_value(true),
        )
        .arg(
            Arg::with_name("btsnoop")
                .long("btsnoop")
                .takes_value(true),
        )
        .arg(
            Arg::with_name("btconfig")
                .long("btconfig")
                .takes_value(true),
        )
        .get_matches();

    let root_server_port = value_t!(matches, "root-server-port", u16).unwrap();
@@ -69,6 +84,7 @@ async fn async_main(rt: Arc<Runtime>, mut sigint: mpsc::UnboundedReceiver<()>) {
        .bind("0.0.0.0", root_server_port)
        .build()
        .unwrap();
    server.start();

    indicate_started(signal_port).await;
    sigint.next().await;
Loading