Skip to content

Commit

Permalink
pw_transfer: Add transfer rate to integration test
Browse files Browse the repository at this point in the history
Change-Id: Id6e8e060d22cfa950ac41383af5e5af6e9c9d41d
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/91981
Reviewed-by: Ted Pudlik <tpudlik@google.com>
Commit-Queue: Erik Gilling <konkers@google.com>
  • Loading branch information
konkers authored and CQ Bot Account committed Apr 25, 2022
1 parent 7d420a1 commit 917daac
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import random
import sys
import tempfile
import time
from typing import List
import unittest

Expand Down Expand Up @@ -256,12 +257,18 @@ async def _perform_write(self, server_config: config_pb2.ServerConfig,
await self._server.wait_for_line(
"stderr", "Starting pw_rpc server on port", TIMEOUT)

start = time.monotonic()

await self._start_client(client_type, client_config)
# No timeout: the client will only exit once the transfer
# completes, and this can take a long time for large payloads.
await self._client.wait_for_termination(None)
self.assertEqual(self._client.returncode(), 0)

duration = time.monotonic() - start
rate = len(payload) / duration
print(f'Client transfer rate: {rate} B/s')

# Wait for the server to exit.
await self._server.wait_for_termination(TIMEOUT)
self.assertEqual(self._server.returncode(), 0)
Expand Down

0 comments on commit 917daac

Please sign in to comment.