Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion betocq/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def setup_class(self) -> None:
except (errors.Error, adb.Error, signals.ControllerError) as e:
setup_utils.report_error_on_setup_class(
self,
'Failed to get Android devices with error: %s,'
'Failed to get Android devices with error:'
f' {traceback.format_exception(e)}',
abort_all=not self.test_parameters.run_all_tests_in_suite,
error_class=constants.DeviceRegistrationError,
Expand Down
3 changes: 3 additions & 0 deletions betocq/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ class TestParameters:
wifi_chipset_model: str = ''
# check if the test is running in debug mode.
debug_mode: bool = False
# Ignore the indoor 5g test for china ap, as China AP has no 5g channel
# for Japan country code.
ignore_indoor_5g_test_for_china_ap: bool = False

@classmethod
def from_user_params(cls, user_params: dict[str, Any]) -> 'TestParameters':
Expand Down
9 changes: 8 additions & 1 deletion betocq/gms_auto_updates_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,14 @@ def _create_or_update_play_store_config(
except adb.AdbError as e:
self._device.log.warning('failed to pull %s: %s', device_path, e)

config_doc = ElementTree.parse(path) if os.path.isfile(path) else None
config_doc = None
if os.path.isfile(path):
try:
config_doc = ElementTree.parse(path)
except ElementTree.ParseError as e:
self._device.log.warning(
'failed to parse %s due to %s, assume it as blank config.', path, e
)

changing_element = None
root = (
Expand Down
7 changes: 4 additions & 3 deletions betocq/nearby_connection/betocq_aqt_test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@
from betocq.nearby_connection.directed_tests import xcc_hotspot_dfs_5g_sta_test
from betocq.nearby_connection.directed_tests import xcc_wfd_dbs_2g_sta_test
from betocq.nearby_connection.directed_tests import xcc_wfd_dfs_5g_sta_test
from betocq.nearby_connection.directed_tests import xcc_wfd_indoor_5g_sta_test
from betocq.nearby_connection.directed_tests import xcc_wfd_ww_5g_sta_test
from betocq.nearby_connection.function_tests import beto_cq_function_group_test


_SUITE_NAME = 'AQT'
# increment this version number when adding new tests or changing the config
# parameters of existing tests.
# LINT.IfChange(suite_version)
_SUITE_VERSION = '7'
_SUITE_VERSION = '8'
# LINT.ThenChange()


Expand Down Expand Up @@ -95,7 +96,7 @@ def setup_suite(self, config):
# 5G STA
self.add_test_class(scc_5g_wfd_sta_test.Scc5gWfdStaTest)
self.add_test_class(scc_5g_wlan_sta_test.Scc5gWifiLanStaTest)
self.add_test_class(xcc_wfd_indoor_5g_sta_test.XccWfdIndoor5gStaTest)
self.add_test_class(xcc_wfd_ww_5g_sta_test.XccWfdWw5gStaTest)
# 5G DFS STA
self.add_test_class(xcc_hotspot_dfs_5g_sta_test.XccHotspotDfs5gStaTest)
self.add_test_class(xcc_wfd_dfs_5g_sta_test.XccWfdDfs5gStaTest)
Expand Down
6 changes: 3 additions & 3 deletions betocq/nearby_connection/betocq_test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from betocq.nearby_connection.compound_tests import scc_5g_all_wifi_sta_test
from betocq.nearby_connection.directed_tests import ble_performance_test
from betocq.nearby_connection.directed_tests import bt_performance_test
from betocq.nearby_connection.directed_tests import mcc_2g_wfd_indoor_5g_sta_test
from betocq.nearby_connection.directed_tests import mcc_2g_wfd_ww_5g_sta_test
from betocq.nearby_connection.directed_tests import mcc_5g_hotspot_dfs_5g_sta_test
from betocq.nearby_connection.directed_tests import mcc_5g_wfd_dfs_5g_sta_test
from betocq.nearby_connection.directed_tests import mcc_5g_wfd_non_dbs_2g_sta_test
Expand All @@ -53,7 +53,7 @@
# increment this version number when adding new tests or changing the config
# parameters of existing tests.
# LINT.IfChange(suite_version)
_SUITE_VERSION = '1'
_SUITE_VERSION = '2'
# LINT.ThenChange()


Expand All @@ -75,13 +75,13 @@ def setup_suite(self, config):

# Directed test cases:
self.add_test_class(bt_performance_test.BtPerformanceTest)
self.add_test_class(mcc_2g_wfd_indoor_5g_sta_test.Mcc2gWfdIndoor5gStaTest)
self.add_test_class(mcc_5g_hotspot_dfs_5g_sta_test.Mcc5gHotspotDfs5gStaTest)
self.add_test_class(mcc_5g_wfd_dfs_5g_sta_test.Mcc5gWfdDfs5gStaTest)
self.add_test_class(mcc_5g_wfd_non_dbs_2g_sta_test.Mcc5gWfdNonDbs2gStaTest)
self.add_test_class(scc_2g_wfd_sta_test.Scc2gWfdStaTest)
self.add_test_class(scc_2g_wlan_sta_test.Scc2gWlanStaTest)
self.add_test_class(scc_5g_wfd_dbs_2g_sta_test.Scc5gWfdDbs2gStaTest)
self.add_test_class(mcc_2g_wfd_ww_5g_sta_test.Mcc2gWfdWw5gStaTest)
self.add_test_class(scc_5g_wfd_sta_test.Scc5gWfdStaTest)
self.add_test_class(scc_5g_wlan_sta_test.Scc5gWifiLanStaTest)
self.add_test_class(scc_dfs_5g_hotspot_sta_test.SccDfs5gHotspotStaTest)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""This test is to test the Wifi MCC with 2G WFD and indoor 5G STA.
"""This test is to test the Wifi MCC with 2G WFD and 5G STA.

This is about the feature - using indoor channels for WFD, for details, refer to
https://drive.google.com/file/d/1Aj77Euao8XkvE6uWF15WMK1XCwmYhdxW/view?resourcekey=0-a69XQup8McOcUnzYN9eh0Q
(confidential) and config_wifiEnableStaIndoorChannelForPeerNetwork -
https://cs.android.com/android/platform/superproject/main/+/main:packages/modules/Wifi/service/ServiceWifiResources/res/values/config.xml;l=1147
In this case, the feature is disabled for the device; The WFD will be started in
a 2G channel, but the STA is using the 5G channel.
This test case is to test the WFD performance when the STA is using the 5G
channel and the WFD is using the 2G channel, which is a scenario that may
occur in real-world usages.

Test requirements:
The device requirements:
support 5G band
support Wi-Fi Direct
(target device only) enable_sta_indoor_channel_for_peer_network=False in
config file
The AP requirements:
Wi-Fi channel: 36 (5180) or other 5G indoor channels in JP.
Wi-Fi channel: 36 (5180) or any other 5G channels.

Test preparations:
Set country code to JP on Android devices.
Set country code to '00' on Android devices.

Test steps:
1. Disconnect discoverer from the current connected Wi-Fi network.
Expand All @@ -45,8 +40,8 @@
Expected results:
1. The file transfer completes and throughput meets the target. The
target is calculated according to the device capabilities.
2. The Wi-Fi STA frequency is an indoor 5G frequency.
3. The Wi-Fi P2P frequency is different from the STA frequency.
2. The Wi-Fi STA frequency is a 5G frequency.
3. The Wi-Fi P2P frequency is a 2G frequency.
4. This test will be repeated for `TEST_ITERATION_NUM` times, requiring a
success rate of no less than `SUCCESS_RATE_TARGET`.
"""
Expand All @@ -73,12 +68,12 @@
_FILE_TRANSFER_SIZE_KB = constants.TRANSFER_FILE_SIZE_20MB
_FILE_TRANSFER_TIMEOUT = constants.WIFI_2G_20M_PAYLOAD_TRANSFER_TIMEOUT
_PAYLOAD_TYPE = constants.PayloadType.FILE
_COUNTRY_CODE = 'JP'
_COUNTRY_CODE = '00'


_THROUGHPUT_LOW_TIP = (
'This is a MCC test case where WFD uses a 2G channel and the STA uses a 5G'
' indoor channel. Check with the wifi chip vendor about the possible'
' channel. Check with the wifi chip vendor about the possible'
' firmware Tx/Rx issues in MCC mode.'
)

Expand All @@ -88,8 +83,8 @@
)


class Mcc2gWfdIndoor5gStaTest(performance_test_base.PerformanceTestBase):
"""Test class for wifi MCC with 2G WFD and indoor 5G STA."""
class Mcc2gWfdWw5gStaTest(performance_test_base.PerformanceTestBase):
"""Test class for wifi MCC with 2G WFD and 5G STA."""

test_runtime: constants.NcTestRuntime
wifi_info: constants.WifiInfo
Expand All @@ -98,14 +93,14 @@ def setup_class(self):
super().setup_class()

self.setup_wifi_env(
d2d_type=constants.WifiD2DType.MCC_2G_WFD_5G_INDOOR_STA,
d2d_type=constants.WifiD2DType.MCC_2G_WFD_5G_STA,
country_code=_COUNTRY_CODE,
)
nc_utils.check_wifi_ap_status_in_setup_class(
self, self.advertiser, self.test_parameters
)
self.wifi_info = constants.WifiInfo.from_test_parameters(
d2d_type=constants.WifiD2DType.MCC_2G_WFD_5G_INDOOR_STA,
d2d_type=constants.WifiD2DType.MCC_2G_WFD_5G_STA,
params=self.test_parameters,
)
self.test_runtime = constants.NcTestRuntime(
Expand Down Expand Up @@ -158,19 +153,13 @@ def _assert_test_conditions(self):
)
# Check WiFi AP.
setup_utils.abort_if_5g_ap_not_ready(self.test_parameters)
# Check device capabilities.
setup_utils.abort_if_device_cap_not_match(
[self.advertiser],
'enable_sta_indoor_channel_for_peer_network',
expected_value=False,
)

@base_test.repeat(
count=TEST_ITERATION_NUM,
max_consecutive_error=_MAX_CONSECUTIVE_ERROR,
)
def test_mcc_2g_wfd_indoor_5g_sta(self):
"""Test the performance for wifi MCC with 2G WFD and indoor 5G STA."""
def test_mcc_2g_ww_wfd_5g_sta(self):
"""Test the performance for wifi MCC with 2G WFD and 5G STA."""
# Test Step: Connect discoverer to wifi sta.
discoverer_sta_op = setup_utils.remove_current_connected_wifi_network(
self.discoverer
Expand Down Expand Up @@ -220,10 +209,8 @@ def test_mcc_2g_wfd_indoor_5g_sta(self):
self.test_runtime.is_dbs_mode,
sta_frequency=self.current_test_result.sta_frequency,
additional_error_message=(
'Check if enable_sta_indoor_channel_for_peer_network is really'
' false for the target device. If yes, the device violate the'
' regulation of Wi-Fi 5G indoor channel. You may work with your'
' chipset vendor.'
'You may work with your wifi chipset vendor, in the world wide'
' mode, WFD should use the 2G channel.'
),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,14 @@
Note that the country code is set to JP so that 5G is not available for
any D2D mediums.

Note: This test case is not related to the capability of
'enable_sta_indoor_channel_for_peer_network', which is only for 5G when the
device is connected to a sta 5G network.

Test requirements:
The device requirements
support Wi-Fi Direct
The AP requirements:
Wi-Fi channel: 6 (2437) or other 2G channels.

Test preparations:
Set country code to JP on Android devices.
Set country code to '00' on Android devices.

Test steps:
1. Disconnect discoverer from the current connected Wi-Fi network.
Expand Down Expand Up @@ -71,7 +67,7 @@
_FILE_TRANSFER_SIZE_KB = constants.TRANSFER_FILE_SIZE_20MB
_FILE_TRANSFER_TIMEOUT = constants.WIFI_2G_20M_PAYLOAD_TRANSFER_TIMEOUT
_PAYLOAD_TYPE = constants.PayloadType.FILE
_COUNTRY_CODE = 'JP'
_COUNTRY_CODE = '00'


_THROUGHPUT_LOW_TIP = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@

import time

from mobly import asserts
from mobly import base_test
from mobly import test_runner
from mobly import utils
Expand Down Expand Up @@ -99,6 +100,10 @@ class SccIndoor5gWfdStaTest(performance_test_base.PerformanceTestBase):

def setup_class(self):
super().setup_class()
asserts.skip_if(
self.test_parameters.ignore_indoor_5g_test_for_china_ap,
'Skip indoor 5g test for China AP',
)

self.setup_wifi_env(
d2d_type=constants.WifiD2DType.SCC_5G, country_code=_COUNTRY_CODE
Expand Down
25 changes: 12 additions & 13 deletions betocq/nearby_connection/directed_tests/xcc_2g_wfd_sta_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""This test is to test the WFD medium with 2G channel and Country code JP.
"""This test is to test the WFD medium with 2G channel and Country code 00.

In this case, the STA is using the 2G channel; and the WFD is expected to use
the 2G channel as well if the device cannot tell if they are indoor or not;
otherwise, the WFD may use 5G channel.

Note: This test case is not related to the capability of
'enable_sta_indoor_channel_for_peer_network', which is only for 5G when the
device is connected to a sta 5G network.
the 2G channel as well in the world wide country code '00'. but allow 5G channel
in case the device does not follow the world wide country code wifi channel.

Test requirements:
The device requirements
Expand All @@ -29,7 +25,7 @@
Wi-Fi channel: 6 (2437) or other 2G channels.

Test preparations:
Set country code to JP on Android devices.
Set country code to '00' on Android devices.

Test steps:
1. Disconnect discoverer from the current connected Wi-Fi network.
Expand Down Expand Up @@ -64,13 +60,14 @@


# use the SCC test count as most devices should be in SCC mode, except the
# device has indoor channel detection capability, which will be MCC mode.
# device does not follow the world wide country code wifi channel, which will be
# MCC mode.
TEST_ITERATION_NUM = constants.SCC_PERFORMANCE_TEST_COUNT
SUCCESS_RATE_TARGET = constants.SUCCESS_RATE_TARGET
_MAX_CONSECUTIVE_ERROR = constants.SCC_PERFORMANCE_TEST_MAX_CONSECUTIVE_ERROR
_FILE_TRANSFER_NUM = 1
_PAYLOAD_TYPE = constants.PayloadType.FILE
_COUNTRY_CODE = 'JP'
_COUNTRY_CODE = '00'


_THROUGHPUT_LOW_TIP = (
Expand Down Expand Up @@ -219,9 +216,11 @@ def test_xcc_2g_wfd_sta(self):
],
test_result=self.current_test_result,
additional_error_message=(
'If the device can detected as indoor, the concurrency mode should'
' be SCC_2G. If the device can not detect the indoor environment,'
' the concurrency mode will be MCC_5G_P2P_2G_STA.'
'In world wide country code, WFD should use the 2G channel, but the'
' device may use the 5G channel as well if the device does not'
' follow the world wide country code wifi channel. You may work'
' with your wifi chipset vendor to fix this frequency selection'
' issue.'
),
)
self.advertiser.log.info(
Expand Down
Loading