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

Commit df4c3166 authored by Charlie Boutier's avatar Charlie Boutier
Browse files

BumbleBluetoothTets: local setup configuration

Tested on the Pandora lab

Test: atest BumbleBluetoothTests
Bug: 313698463
Bug: 344083291
Change-Id: I225d995b696a3faead44083b7b61abcbf4c4177e
parent 365a0ed8
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -69,6 +69,31 @@ java_test_host {
    ],
}

// Runs the Bumble Bluetooth tests on a USB Bluetooth dongle.
java_test_host {
    name: "BumbleBluetoothTestsPhy",

    test_config: "AndroidPhyTest.xml",

    libs: [
        "tradefed",
    ],

    data: [
        ":BumbleBluetoothTestsApp",
        "bumble_config.json",
    ],
    data_native_bins: [
        "bumble_pandora_server",
    ],

    required: ["bumble_pandora_server"],

    test_suites: [
        "general-tests",
    ],
}

python_binary_host {
    name: "bumble_pandora_server",
    main: "src/bumble_server.py",
+61 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
  <configuration description="Bumble bluetooth tests.">
    <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer">
        <option name="force-root" value="true"/>
    </target_preparer>

    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
        <option name="cleanup-apks" value="true" />
        <option name="test-file-name" value="BumbleBluetoothTestsApp.apk" />
        <option name="install-arg" value="-g" />
    </target_preparer>

    <target_preparer class="com.android.tradefed.targetprep.PythonVirtualenvPreparer">
        <option name="dep-module" value="grpcio==1.51.1" />
        <option name="dep-module" value="cryptography==35" />
        <option name="dep-module" value="libusb1>=2.0.1" />
        <option name="dep-module" value="libusb-package==1.0.26.1" />
        <option name="dep-module" value="pyusb>=1.2" />
    </target_preparer>

    <target_preparer class="com.android.tradefed.targetprep.RunHostCommandTargetPreparer">
      <option name="python-virtualenv" value="true"/>

      <option name="host-setup-command" value="adb -s $SERIAL reverse tcp:7999 tcp:7999" />
      <option name="host-background-command"
        value="$EXTRA_FILE(host_testcases)/BumbleBluetoothTests/bumble_pandora_server --transport pyusb:8087:0036 --config $EXTRA_FILE(host_testcases)/BumbleBluetoothTests/bumble_config.json"/>
      <option name="host-teardown-command" value="adb -s $SERIAL reverse --remove tcp:7999" />
    </target_preparer>

    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
        <option name="throw-if-cmd-fail" value="true" />
        <option name="run-command" value="setprop persist.bluetooth.btsnooplogmode full" />
        <option name="run-command" value="device_config set_sync_disabled_for_tests persistent" />
        <option name="run-command" value="setprop log.tag.bluetooth VERBOSE" />
        <option name="run-command" value="settings put global ble_scan_always_enabled 0" />
        <option name="run-command" value="cmd bluetooth_manager disable" />
        <option name="run-command" value="cmd bluetooth_manager wait-for-state:STATE_OFF" />
        <option name="run-command" value="cmd bluetooth_manager enable" />
        <option name="run-command" value="cmd bluetooth_manager wait-for-state:STATE_ON" />
    </target_preparer>

    <option name="test-tag" value="BumbleBluetoothTests" />
    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
        <option name="package" value="android.bluetooth" />
    </test>

    <!-- Only run if the Bluetooth Mainline module is installed. -->
    <object type="module_controller"
            class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
        <option name="mainline-module-package-name" value="com.android.btservices" />
        <option name="mainline-module-package-name" value="com.google.android.btservices" />
    </object>

    <!-- Collect Bluetooth snoop logs for each test run -->
    <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector">
        <option name="directory-keys" value="/data/misc/bluetooth/logs" />
        <option name="collect-on-run-ended-only" value="false" />
        <option name="clean-up" value="false" />
    </metrics_collector>
</configuration>