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

Commit da961579 authored by Chienyuan's avatar Chienyuan Committed by Chienyuan Huang
Browse files

GD:Wait channel ready after stop/start server

When running multiple tests, the second test will always fail due to
client send rpc request before channel ready. Add wait_channel_ready
function to GdDeviceBase and use it to check channel ready when each
testcase start.

Bug: 136577370
Test: run run_cert.sh
Change-Id: I210dcd69d6e40a315710ba2b8e9e8819e462b42b
parent c67d23f4
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import grpc

ANDROID_BUILD_TOP = os.environ.get('ANDROID_BUILD_TOP')
ANDROID_HOST_OUT = os.environ.get('ANDROID_HOST_OUT')
_WAIT_CHANNEL_READY_TIMEOUT = 10

def replace_vars(string, config):
    return string.replace("$ANDROID_HOST_OUT", ANDROID_HOST_OUT) \
@@ -86,6 +87,14 @@ class GdDeviceBase:
                          backing_process_return_code)
            return False

    def wait_channel_ready(self):
        future = grpc.channel_ready_future(self.grpc_channel)
        try:
          future.result(timeout=_WAIT_CHANNEL_READY_TIMEOUT)
        except grpc.FutureTimeoutError:
          logging.error("wait channel ready timeout")



class GdDeviceBaseLoggerAdapter(logging.LoggerAdapter):
    def process(self, msg, kwargs):
+3 −0
Original line number Diff line number Diff line
@@ -46,6 +46,9 @@ class SimpleHalTest(GdBaseTestClass):
            )
        )

        self.device_under_test.wait_channel_ready()
        self.cert_device.wait_channel_ready()

        self.device_under_test.hal.SendHciResetCommand(empty_pb2.Empty())
        self.cert_device.hal.SendHciResetCommand(empty_pb2.Empty())