p2p: allow to skip reading factory mac address
Reading factory mac address needs rebooting or toggle off/on airplane mode which is
a time-consuming job. Most of p2p tests do not need to know factory mac
address, as a result, add a parameter to skip this job.
Bug: 159779893
Test: act.py -c ./tools/test/connectivity/acts/tests/google/wifi/p2p/config/wifi_p2p.json
-tb WifiP2pAllAttached -tc WifiP2pLocalServiceTest WifiP2pManagerTest
Change-Id: Ib8a313616798c98f1eafbd5ce3f352ccc21424ff
diff --git a/acts/framework/acts/test_utils/wifi/p2p/WifiP2pBaseTest.py b/acts/framework/acts/test_utils/wifi/p2p/WifiP2pBaseTest.py
index 448647e..6644296 100644
--- a/acts/framework/acts/test_utils/wifi/p2p/WifiP2pBaseTest.py
+++ b/acts/framework/acts/test_utils/wifi/p2p/WifiP2pBaseTest.py
@@ -32,10 +32,21 @@
super(WifiP2pBaseTest, self).__init__(controllers)
def setup_class(self):
+ required_params = ()
+ optional_params = ("skip_read_factory_mac",)
+ self.unpack_userparams(
+ required_params,
+ optional_params,
+ skip_read_factory_mac=0)
+
self.dut1 = self.android_devices[0]
self.dut2 = self.android_devices[1]
- self.dut1_mac = self.get_p2p_mac_address(self.dut1)
- self.dut2_mac = self.get_p2p_mac_address(self.dut2)
+ if self.skip_read_factory_mac:
+ self.dut1_mac = None
+ self.dut2_mac = None
+ else:
+ self.dut1_mac = self.get_p2p_mac_address(self.dut1)
+ self.dut2_mac = self.get_p2p_mac_address(self.dut2)
#init location before init p2p
acts.utils.set_location_service(self.dut1, True)
diff --git a/acts/tests/google/wifi/p2p/config/wifi_p2p.json b/acts/tests/google/wifi/p2p/config/wifi_p2p.json
index fb4697d..31af531 100644
--- a/acts/tests/google/wifi/p2p/config/wifi_p2p.json
+++ b/acts/tests/google/wifi/p2p/config/wifi_p2p.json
@@ -8,6 +8,7 @@
"AndroidDevice": "*"
}
],
+ "skip_read_factory_mac": 1,
"logpath": "~/logs",
"testpaths": ["./tools/test/connectivity/acts/tests/google/wifi/p2p"],
"adb_logcat_param": "-b all"
diff --git a/acts/tests/google/wifi/p2p/config/wifi_p2p_group.json b/acts/tests/google/wifi/p2p/config/wifi_p2p_group.json
index 443932b..5ca412d 100644
--- a/acts/tests/google/wifi/p2p/config/wifi_p2p_group.json
+++ b/acts/tests/google/wifi/p2p/config/wifi_p2p_group.json
@@ -8,6 +8,7 @@
"AndroidDevice": "*"
}
],
+ "skip_read_factory_mac": 1,
"network_name": "DIRECT-xy-Hello",
"passphrase": "P2pWorld1234",
"group_band": "2",