-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #570 from google/gbg/bench-mobly-snippets
bench mobly snippets
- Loading branch information
Showing
30 changed files
with
1,163 additions
and
226 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from mobly import base_test | ||
from mobly import test_runner | ||
from mobly.controllers import android_device | ||
|
||
|
||
class OneDeviceBenchTest(base_test.BaseTestClass): | ||
|
||
def setup_class(self): | ||
self.ads = self.register_controller(android_device) | ||
self.dut = self.ads[0] | ||
self.dut.load_snippet("bench", "com.github.google.bumble.btbench") | ||
|
||
def test_rfcomm_client_ping(self): | ||
runner = self.dut.bench.runRfcommClient( | ||
"ping", "DC:E5:5B:E5:51:2C", 100, 970, 100 | ||
) | ||
print("### Initial status:", runner) | ||
final_status = self.dut.bench.waitForRunnerCompletion(runner["id"]) | ||
print("### Final status:", final_status) | ||
|
||
def test_rfcomm_client_send(self): | ||
runner = self.dut.bench.runRfcommClient( | ||
"send", "DC:E5:5B:E5:51:2C", 100, 970, 0 | ||
) | ||
print("### Initial status:", runner) | ||
final_status = self.dut.bench.waitForRunnerCompletion(runner["id"]) | ||
print("### Final status:", final_status) | ||
|
||
def test_l2cap_client_ping(self): | ||
runner = self.dut.bench.runL2capClient( | ||
"ping", "4B:2A:67:76:2B:E3", 128, True, 100, 970, 100 | ||
) | ||
print("### Initial status:", runner) | ||
final_status = self.dut.bench.waitForRunnerCompletion(runner["id"]) | ||
print("### Final status:", final_status) | ||
|
||
def test_l2cap_client_send(self): | ||
runner = self.dut.bench.runL2capClient( | ||
"send", "7E:90:D0:F2:7A:11", 131, True, 100, 970, 0 | ||
) | ||
print("### Initial status:", runner) | ||
final_status = self.dut.bench.waitForRunnerCompletion(runner["id"]) | ||
print("### Final status:", final_status) | ||
|
||
|
||
if __name__ == "__main__": | ||
test_runner.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
TestBeds: | ||
- Name: BenchTestBed | ||
Controllers: | ||
AndroidDevice: | ||
- serial: 37211FDJG000DJ | ||
local_bt_address: 94:45:60:5E:03:B0 | ||
|
||
- serial: 23071FDEE001F7 | ||
local_bt_address: DC:E5:5B:E5:51:2C |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import time | ||
|
||
from mobly import base_test | ||
from mobly import test_runner | ||
from mobly.controllers import android_device | ||
|
||
|
||
class TwoDevicesBenchTest(base_test.BaseTestClass): | ||
def setup_class(self): | ||
self.ads = self.register_controller(android_device) | ||
self.dut1 = self.ads[0] | ||
self.dut1.load_snippet("bench", "com.github.google.bumble.btbench") | ||
self.dut2 = self.ads[1] | ||
self.dut2.load_snippet("bench", "com.github.google.bumble.btbench") | ||
|
||
def test_rfcomm_client_send_receive(self): | ||
print("### Starting Receiver") | ||
receiver = self.dut2.bench.runRfcommServer("receive") | ||
receiver_id = receiver["id"] | ||
print("--- Receiver status:", receiver) | ||
while not receiver["model"]["running"]: | ||
print("--- Waiting for Receiver to be running...") | ||
time.sleep(1) | ||
receiver = self.dut2.bench.getRunner(receiver_id) | ||
|
||
print("### Starting Sender") | ||
sender = self.dut1.bench.runRfcommClient( | ||
"send", "DC:E5:5B:E5:51:2C", 100, 970, 100 | ||
) | ||
print("--- Sender status:", sender) | ||
|
||
print("--- Waiting for Sender to complete...") | ||
sender_result = self.dut1.bench.waitForRunnerCompletion(sender["id"]) | ||
print("--- Sender result:", sender_result) | ||
|
||
|
||
if __name__ == "__main__": | ||
test_runner.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.