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
7 changes: 4 additions & 3 deletions betocq/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +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
# Ignore the indoor 5g test for China tri-band AP, as China tri-band AP only
# can use UNII-3 band for 5G wifi, which is not supported by Japan devices.
ignore_indoor_5g_test_for_china_triband_ap: bool = False

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Renaming ignore_indoor_5g_test_for_china_ap to ignore_indoor_5g_test_for_china_triband_ap is a breaking change for existing test configurations. Since from_user_params dynamically maps user parameters to dataclass fields, any configuration using the old name will now be ignored, and the test will default to False (not ignored). Consider maintaining backward compatibility by keeping the old field as a deprecated alias.

Suggested change
ignore_indoor_5g_test_for_china_triband_ap: bool = False
ignore_indoor_5g_test_for_china_triband_ap: bool = False
# Deprecated: use ignore_indoor_5g_test_for_china_triband_ap instead.
ignore_indoor_5g_test_for_china_ap: bool = False


@classmethod
def from_user_params(cls, user_params: dict[str, Any]) -> 'TestParameters':
Expand Down Expand Up @@ -863,6 +863,7 @@ class NcTestRuntime:
iperf_to_d2d_throughput_ratio: float = IPERF_TO_D2D_THROUGHPUT_RATIO_DEF
is_discoverer_network_owner: bool = False
wlan_throughput_cap_mbps: float = WLAN_MEDIUM_THROUGHPUT_CAP_MBPS
all_tests_should_be_skipped: bool = False


@dataclasses.dataclass(frozen=True)
Expand Down
5 changes: 1 addition & 4 deletions betocq/nearby_connection/betocq_aqt_test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# increment this version number when adding new tests or changing the config
# parameters of existing tests.
# LINT.IfChange(suite_version)
_SUITE_VERSION = '8'
_SUITE_VERSION = '9'
# LINT.ThenChange()


Expand Down Expand Up @@ -96,12 +96,9 @@ 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_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)
# 2G STA
self.add_test_class(xcc_2g_wfd_sta_test.Xcc2gWfdStaTest)
self.add_test_class(scc_2g_wlan_sta_test.Scc2gWlanStaTest)
self.add_test_class(xcc_wfd_dbs_2g_sta_test.XccWfdDbs2gStaTest)
# Compound test cases:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
wifi channel: 52 (5260) or 112 (5560) or other DFS channels.

Test preparations:
Set country code to GB on Android devices.
Set country code to US on Android devices.

Test steps:
1. Disconnect discoverer from the current connected Wi-Fi network.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
wifi channel: 52 (5260) or 112 (5560) or other DFS channels.

Test preparations:
Set country code to GB on Android devices.
Set country code to US on Android devices.

Test steps:
1. Disconnect discoverer from the current connected Wi-Fi network.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""This test is to test the Wifi SCC in a general case.

In this case, both the WFD and STA are using the same 2G channel.
Note that the country code is set to JP so that 5G is not available for
Note that the country code is set to '00' so that 5G is not available for
any D2D mediums.

Test requirements:
Expand Down Expand Up @@ -202,8 +202,11 @@ def test_scc_2g_wfd_sta(self):
self.test_runtime.is_dbs_mode,
sta_frequency=self.current_test_result.sta_frequency,
additional_error_message=(
'The device violates the regulation of Wi-Fi 5G indoor channel.'
'You may work with the chipset vendor.'
'In world wide country code, WFD should use the 2G channel, but'
' the device is using the 5G channel. 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.'
),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
wifi channel: 52 (5260) or 112 (5560) or other DFS channels.

Test preparations:
Set country code to GB on Android devices.
Set country code to US on Android devices.

Test steps:
1. Disconnect discoverer from the current connected Wi-Fi network.
Expand Down Expand Up @@ -77,7 +77,7 @@
_FILE_TRANSFER_SIZE_KB = constants.TRANSFER_FILE_SIZE_500MB
_FILE_TRANSFER_TIMEOUT = constants.WIFI_500M_PAYLOAD_TRANSFER_TIMEOUT
_PAYLOAD_TYPE = constants.PayloadType.FILE
_COUNTRY_CODE = 'GB'
_COUNTRY_CODE = 'US'


_THROUGHPUT_LOW_TIP = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
wifi channel: 52 (5260) or 112 (5560) or any other DFS channels.

Test preparations:
Set country code to GB on Android devices.
Set country code to US on Android devices.

Test steps:
1. Disconnect discoverer from the current connected Wi-Fi network.
Expand Down Expand Up @@ -72,7 +72,7 @@
_FILE_TRANSFER_SIZE_KB = constants.TRANSFER_FILE_SIZE_500MB
_FILE_TRANSFER_TIMEOUT = constants.WIFI_500M_PAYLOAD_TRANSFER_TIMEOUT
_PAYLOAD_TYPE = constants.PayloadType.FILE
_COUNTRY_CODE = 'GB'
_COUNTRY_CODE = 'US'


_THROUGHPUT_LOW_TIP = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ 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.test_parameters.ignore_indoor_5g_test_for_china_triband_ap,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To support backward compatibility with existing configurations that still use the old parameter name, consider checking both the new and the deprecated flags.

Suggested change
self.test_parameters.ignore_indoor_5g_test_for_china_triband_ap,
self.test_parameters.ignore_indoor_5g_test_for_china_triband_ap or self.test_parameters.ignore_indoor_5g_test_for_china_ap,

'Skip indoor 5g test for China tri-band AP',
)

self.setup_wifi_env(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
wifi channel: 52 (5260) or 112 (5560) or other DFS channels.

Test preparations:
Set country code to GB on Android devices.
Set country code to US on Android devices.

Test steps:
1. Disconnect discoverer from the current connected Wi-Fi network.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
wifi channel: 52 (5260) or 112 (5560) or other DFS channels.

Test preparations:
Set country code to GB on Android devices.
Set country code to US on Android devices.

Test steps:
1. Disconnect discoverer from the current connected Wi-Fi network.
Expand All @@ -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 @@ -166,6 +167,11 @@ def test_xcc_wfd_dfs_5g_sta(self) -> None:
supported) and MCC (otherwise) scenarios.
"""
# Test Step: Disconnect discoverer from the current connected wifi sta.
if getattr(self.test_runtime, 'all_tests_should_be_skipped', False):
asserts.skip(
'medium_frequency is equal to sta_frequency, skipping all following'
' iterations. duplicate test case with SCC_5G_WFD_STA_TEST.'
)
discoverer_sta_op = setup_utils.remove_current_connected_wifi_network(
self.discoverer
)
Expand Down Expand Up @@ -236,6 +242,19 @@ def test_xcc_wfd_dfs_5g_sta(self) -> None:
self.current_test_result.sta_frequency,
wifi_concurrency_mode.name,
)
if (
self.current_test_result.quality_info.medium_frequency
== self.current_test_result.sta_frequency
and self.current_test_result.sta_frequency is not constants.INVALID_INT
):
self.test_runtime.all_tests_should_be_skipped = True
prior_bt_snippet.disconnect_endpoint()
active_snippet.disconnect_endpoint()

asserts.skip(
'medium_frequency is equal to sta_frequency, skipping all following'
' iterations. duplicate test case with SCC_5G_WFD_STA_TEST.'
)

file_transfer_size_kb = (
nc_constants.NC_MCC_5G_D2D_5G_STA_TRANSFER_FILE_SIZE_KB
Expand Down
13 changes: 11 additions & 2 deletions betocq/performance_test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,16 @@ def teardown_class(self):
self.TAG: final_result_message,
},
})
test_runtime = getattr(
self, 'test_runtime', getattr(self, 'test_runtime', None)
)
if getattr(test_runtime, 'all_tests_should_be_skipped', False):
logging.info(
'Skipping result assertion in teardown class because all test'
' iterations are skipped.'
)
else:
passed = self.test_results.is_test_class_passed()
asserts.assert_true(passed, final_result_message)

passed = self.test_results.is_test_class_passed()
asserts.assert_true(passed, final_result_message)
super().teardown_class()
4 changes: 4 additions & 0 deletions betocq/test_result_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,10 @@ def get_wifi_concurrency_mode(self) -> constants.WifiConcurrencyMode:

def get_test_class_result_message(self) -> str:
"""Gets the test result message for the test class based on result enum."""
if self.nc_test_runtime and getattr(
self.nc_test_runtime, 'all_tests_should_be_skipped', False
):
return 'SKIP'
finished_iteration_count = len(self._results)
if finished_iteration_count == 0:
return 'FAIL: Test did not execute any iterations. Zero finished tests.'
Expand Down
2 changes: 1 addition & 1 deletion betocq/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
# '2.6.2': ('Optimize tests for AQT and fix some bugs.')
# '2.6.3': ('Fix some bugs.')
# '2.6.4': 'Replace the SCC 2G WFD STA test with XCC 2G WFD STA test.'
# '2.6.5': ('Making the test compatible with the China version of the AP.')
# '2.6.5': 'Reduce the test cases for AQT and fix some bugs.'