summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--system/blueberry/tests/gd/rust/topshim/facade/adapter_test.py21
-rw-r--r--system/blueberry/tests/gd/rust/topshim/facade/automation_helper.py (renamed from system/gd/rust/topshim/facade/automation_helper.py)0
-rw-r--r--system/blueberry/tests/gd/rust/topshim/facade/topshim_base_test.py (renamed from system/gd/rust/topshim/facade/topshim_base_test.py)17
-rw-r--r--system/blueberry/tests/gd/rust/topshim/facade/topshim_device.py (renamed from system/gd/rust/topshim/facade/topshim_device.py)9
-rw-r--r--system/gd/Android.bp8
-rwxr-xr-xsystem/gd/cert/run_topshim5
-rw-r--r--system/gd/rust/topshim/facade/adapter_test.py39
7 files changed, 36 insertions, 63 deletions
diff --git a/system/blueberry/tests/gd/rust/topshim/facade/adapter_test.py b/system/blueberry/tests/gd/rust/topshim/facade/adapter_test.py
index f47a0d74f8..1cb87ac5cf 100644
--- a/system/blueberry/tests/gd/rust/topshim/facade/adapter_test.py
+++ b/system/blueberry/tests/gd/rust/topshim/facade/adapter_test.py
@@ -14,13 +14,26 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from rust.topshim.facade import adapter_test
+import asyncio
from mobly import test_runner
+from blueberry.tests.gd.rust.topshim.facade import topshim_base_test
+from blueberry.tests.gd.rust.topshim.facade.automation_helper import AdapterAutomationHelper
-class AdapterTest(adapter_test.AdapterTest):
- pass
+class AdapterTest(topshim_base_test.TopshimBaseTest):
+ async def _test_verify_adapter_started(self):
+ self.dut_adapter = AdapterAutomationHelper(port=self.dut_port)
+ event_loop = asyncio.get_running_loop()
+ self.dut_adapter.fetch_events(event_loop)
+ self.dut_adapter.pending_future = event_loop.create_future()
+ await self.dut_adapter.toggle_stack()
+ await self.dut_adapter.verify_adapter_started()
+ self.dut_adapter.event_handler.cancel()
-if __name__ == '__main__':
+ def test_verify_adapter_started(self):
+ asyncio.run(self._test_verify_adapter_started())
+
+
+if __name__ == "__main__":
test_runner.main()
diff --git a/system/gd/rust/topshim/facade/automation_helper.py b/system/blueberry/tests/gd/rust/topshim/facade/automation_helper.py
index 8b0f73e02f..8b0f73e02f 100644
--- a/system/gd/rust/topshim/facade/automation_helper.py
+++ b/system/blueberry/tests/gd/rust/topshim/facade/automation_helper.py
diff --git a/system/gd/rust/topshim/facade/topshim_base_test.py b/system/blueberry/tests/gd/rust/topshim/facade/topshim_base_test.py
index 0fa9076c51..32922cb6fa 100644
--- a/system/gd/rust/topshim/facade/topshim_base_test.py
+++ b/system/blueberry/tests/gd/rust/topshim/facade/topshim_base_test.py
@@ -22,13 +22,13 @@ import subprocess
from blueberry.tests.gd.cert.context import get_current_context
from blueberry.tests.gd.cert.tracelogger import TraceLogger
-from cert.async_subprocess_logger import AsyncSubprocessLogger
-from cert.os_utils import get_gd_root
-from cert.os_utils import get_gd_root
-from cert.os_utils import read_crash_snippet_and_log_tail
-from cert.os_utils import is_subprocess_alive
-from cert.os_utils import make_ports_available
-from cert.os_utils import TerminalColor
+from blueberry.tests.gd.cert.async_subprocess_logger import AsyncSubprocessLogger
+from blueberry.tests.gd.cert.os_utils import get_gd_root
+from blueberry.tests.gd.cert.os_utils import get_gd_root
+from blueberry.tests.gd.cert.os_utils import read_crash_snippet_and_log_tail
+from blueberry.tests.gd.cert.os_utils import is_subprocess_alive
+from blueberry.tests.gd.cert.os_utils import make_ports_available
+from blueberry.tests.gd.cert.os_utils import TerminalColor
from mobly import asserts
from mobly import base_test
@@ -179,7 +179,8 @@ class TopshimBaseTest(base_test.BaseTestClass):
self.controller_configs = self.info['controller_configs']
- controllers = self.register_controller(importlib.import_module('rust.topshim.facade.topshim_device'))
+ controllers = self.register_controller(
+ importlib.import_module('blueberry.tests.gd.rust.topshim.facade.topshim_device'))
self.cert_port = controllers[0].grpc_port
self.dut_port = controllers[1].grpc_port
diff --git a/system/gd/rust/topshim/facade/topshim_device.py b/system/blueberry/tests/gd/rust/topshim/facade/topshim_device.py
index c0b0236903..850b6dad14 100644
--- a/system/gd/rust/topshim/facade/topshim_device.py
+++ b/system/blueberry/tests/gd/rust/topshim/facade/topshim_device.py
@@ -17,19 +17,16 @@
import logging
from blueberry.tests.gd.cert.gd_device import GdHostOnlyDevice
-from cert.gd_device_lib import create_core
-from cert.gd_device_lib import destroy_core
-from cert.gd_device_lib import MOBLY_CONTROLLER_CONFIG_NAME
-from cert.os_utils import get_gd_root
+from blueberry.tests.gd.cert.gd_device import MOBLY_CONTROLLER_CONFIG_NAME
+from blueberry.tests.gd.cert.os_utils import get_gd_root
def create(configs):
- create_core(configs)
return get_instances_with_configs(configs)
def destroy(devices):
- destroy_core(devices)
+ pass
def replace_vars_for_topshim(string, config):
diff --git a/system/gd/Android.bp b/system/gd/Android.bp
index 1dfdef93ea..3c2b9586a8 100644
--- a/system/gd/Android.bp
+++ b/system/gd/Android.bp
@@ -880,11 +880,11 @@ genrule {
"mkdir -p $(genDir)/files/blueberry/tests/gd/shim && " +
"touch $(genDir)/files/blueberry/tests/gd/shim/__init__.py && " +
// Bundle topshim proto here for now
- "mkdir -p $(genDir)/files/rust/topshim/facade && " +
+ "mkdir -p $(genDir)/files/blueberry/tests/gd/rust/topshim/facade && " +
"$(location aprotoc) -Ipackages/modules/Bluetooth/system/gd --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-python-plugin) packages/modules/Bluetooth/system/gd/rust/topshim/facade/facade.proto --grpc_out=$(genDir)/files --python_out=$(genDir)/files && " +
- "touch $(genDir)/files/rust/__init__.py && " +
- "touch $(genDir)/files/rust/topshim/__init__.py && " +
- "touch $(genDir)/files/rust/topshim/facade/__init__.py && " +
+ "touch $(genDir)/files/blueberry/tests/gd/rust/__init__.py && " +
+ "touch $(genDir)/files/blueberry/tests/gd/rust/topshim/__init__.py && " +
+ "touch $(genDir)/files/blueberry/tests/gd/rust/topshim/facade/__init__.py && " +
"$(location soong_zip) -C $(genDir)/files -D $(genDir)/files -o $(out)",
srcs: [
":BluetoothFacadeProto",
diff --git a/system/gd/cert/run_topshim b/system/gd/cert/run_topshim
index 5d65be3759..6ac78b23a3 100755
--- a/system/gd/cert/run_topshim
+++ b/system/gd/cert/run_topshim
@@ -99,7 +99,7 @@ def get_test_cmd_or_die(suite_name, config_path):
# path is relative to Android build top
def build_dist_target(target):
ANDROID_BUILD_TOP = get_android_root_or_die()
- build_cmd = [SOONG_UI_BASH, '--make-mode', target]
+ build_cmd = [SOONG_UI_BASH, '--make-mode', 'dist', target]
build_cmd.append(target)
p = subprocess.Popen(build_cmd, cwd=ANDROID_BUILD_TOP, env=os.environ.copy())
return_code = p.wait()
@@ -125,6 +125,7 @@ def main():
build_dist_target('bluetooth_stack_with_facade')
test_results = []
dist_path = os.path.join(get_android_root_or_die(), "out/dist")
+ subprocess.call(['unzip', '-o', 'bluetooth_cert_tests.zip'], cwd=dist_path)
for test in TEST_SUITES:
test_cmd = get_test_cmd_or_die(test, args.config_path)
if subprocess.call(test_cmd, cwd=dist_path) != 0:
@@ -139,4 +140,4 @@ def main():
print('TEST PASSED ' + str(len(test_results)) + ' tests were run')
if __name__ == '__main__':
- main() \ No newline at end of file
+ main()
diff --git a/system/gd/rust/topshim/facade/adapter_test.py b/system/gd/rust/topshim/facade/adapter_test.py
deleted file mode 100644
index b6b671770d..0000000000
--- a/system/gd/rust/topshim/facade/adapter_test.py
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env python3
-#
-# Copyright 2021 - 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.
-
-import asyncio
-from mobly import test_runner
-from rust.topshim.facade import topshim_base_test
-from rust.topshim.facade.automation_helper import AdapterAutomationHelper
-
-
-class AdapterTest(topshim_base_test.TopshimBaseTest):
-
- async def _test_verify_adapter_started(self):
- self.dut_adapter = AdapterAutomationHelper(port=self.dut_port)
- event_loop = asyncio.get_running_loop()
- self.dut_adapter.fetch_events(event_loop)
- self.dut_adapter.pending_future = event_loop.create_future()
- await self.dut_adapter.toggle_stack()
- await self.dut_adapter.verify_adapter_started()
- self.dut_adapter.event_handler.cancel()
-
- def test_verify_adapter_started(self):
- asyncio.run(self._test_verify_adapter_started())
-
-
-if __name__ == "__main__":
- test_runner.main()