diff --git a/betocq/constants.py b/betocq/constants.py index bf26e7a..ce33531 100644 --- a/betocq/constants.py +++ b/betocq/constants.py @@ -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 @classmethod def from_user_params(cls, user_params: dict[str, Any]) -> 'TestParameters': @@ -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) diff --git a/betocq/nearby_connection/betocq_aqt_test_suite.py b/betocq/nearby_connection/betocq_aqt_test_suite.py index c6c0b7f..5c6d9cc 100644 --- a/betocq/nearby_connection/betocq_aqt_test_suite.py +++ b/betocq/nearby_connection/betocq_aqt_test_suite.py @@ -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() @@ -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: diff --git a/betocq/nearby_connection/directed_tests/mcc_5g_hotspot_dfs_5g_sta_test.py b/betocq/nearby_connection/directed_tests/mcc_5g_hotspot_dfs_5g_sta_test.py index 0a8141e..2fb14c1 100644 --- a/betocq/nearby_connection/directed_tests/mcc_5g_hotspot_dfs_5g_sta_test.py +++ b/betocq/nearby_connection/directed_tests/mcc_5g_hotspot_dfs_5g_sta_test.py @@ -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. diff --git a/betocq/nearby_connection/directed_tests/mcc_5g_wfd_dfs_5g_sta_test.py b/betocq/nearby_connection/directed_tests/mcc_5g_wfd_dfs_5g_sta_test.py index 77de84d..f33adfd 100644 --- a/betocq/nearby_connection/directed_tests/mcc_5g_wfd_dfs_5g_sta_test.py +++ b/betocq/nearby_connection/directed_tests/mcc_5g_wfd_dfs_5g_sta_test.py @@ -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. diff --git a/betocq/nearby_connection/directed_tests/scc_2g_wfd_sta_test.py b/betocq/nearby_connection/directed_tests/scc_2g_wfd_sta_test.py index 8dd9522..687dbde 100644 --- a/betocq/nearby_connection/directed_tests/scc_2g_wfd_sta_test.py +++ b/betocq/nearby_connection/directed_tests/scc_2g_wfd_sta_test.py @@ -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: @@ -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.' ), ) diff --git a/betocq/nearby_connection/directed_tests/scc_dfs_5g_hotspot_sta_test.py b/betocq/nearby_connection/directed_tests/scc_dfs_5g_hotspot_sta_test.py index 79af8ee..1e58ddb 100644 --- a/betocq/nearby_connection/directed_tests/scc_dfs_5g_hotspot_sta_test.py +++ b/betocq/nearby_connection/directed_tests/scc_dfs_5g_hotspot_sta_test.py @@ -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. @@ -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 = ( diff --git a/betocq/nearby_connection/directed_tests/scc_dfs_5g_wfd_sta_test.py b/betocq/nearby_connection/directed_tests/scc_dfs_5g_wfd_sta_test.py index ca63259..c7e65bd 100644 --- a/betocq/nearby_connection/directed_tests/scc_dfs_5g_wfd_sta_test.py +++ b/betocq/nearby_connection/directed_tests/scc_dfs_5g_wfd_sta_test.py @@ -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. @@ -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 = ( diff --git a/betocq/nearby_connection/directed_tests/scc_indoor_5g_wfd_sta_test.py b/betocq/nearby_connection/directed_tests/scc_indoor_5g_wfd_sta_test.py index 5aa3b7b..c759130 100644 --- a/betocq/nearby_connection/directed_tests/scc_indoor_5g_wfd_sta_test.py +++ b/betocq/nearby_connection/directed_tests/scc_indoor_5g_wfd_sta_test.py @@ -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, + 'Skip indoor 5g test for China tri-band AP', ) self.setup_wifi_env( diff --git a/betocq/nearby_connection/directed_tests/xcc_hotspot_dfs_5g_sta_test.py b/betocq/nearby_connection/directed_tests/xcc_hotspot_dfs_5g_sta_test.py index ca2fa21..c85bee7 100644 --- a/betocq/nearby_connection/directed_tests/xcc_hotspot_dfs_5g_sta_test.py +++ b/betocq/nearby_connection/directed_tests/xcc_hotspot_dfs_5g_sta_test.py @@ -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. diff --git a/betocq/nearby_connection/directed_tests/xcc_wfd_dfs_5g_sta_test.py b/betocq/nearby_connection/directed_tests/xcc_wfd_dfs_5g_sta_test.py index ffd21a4..b3b6128 100644 --- a/betocq/nearby_connection/directed_tests/xcc_wfd_dfs_5g_sta_test.py +++ b/betocq/nearby_connection/directed_tests/xcc_wfd_dfs_5g_sta_test.py @@ -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. @@ -53,6 +53,7 @@ import time +from mobly import asserts from mobly import base_test from mobly import test_runner from mobly import utils @@ -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 ) @@ -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 diff --git a/betocq/performance_test_base.py b/betocq/performance_test_base.py index 62e5a00..85a28c4 100644 --- a/betocq/performance_test_base.py +++ b/betocq/performance_test_base.py @@ -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() diff --git a/betocq/test_result_utils.py b/betocq/test_result_utils.py index 8c429db..12c454c 100644 --- a/betocq/test_result_utils.py +++ b/betocq/test_result_utils.py @@ -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.' diff --git a/betocq/version.py b/betocq/version.py index 3daa9e6..3766db1 100644 --- a/betocq/version.py +++ b/betocq/version.py @@ -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.'