diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-02-28 21:17:30 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-02-28 21:17:30 +0000 |
commit | a662255a7b4e2a3a26eb4578e15eaa82e19be9dd (patch) | |
tree | fd324b272974653d094dc19edaf49c1ae31eb837 | |
parent | 3d5a8f6581b787483c59edfad1db78b93949fc2c (diff) | |
parent | 105c0930ef5c8c384511ef085bfd0b97e25c6cc1 (diff) | |
download | platform_testing-simpleperf-release.tar.gz |
Snap for 11510257 from 105c0930ef5c8c384511ef085bfd0b97e25c6cc1 to simpleperf-releasesimpleperf-release
Change-Id: Ib7fa35b25630b8f9775d01e542b291f9bdc921c3
9 files changed, 88 insertions, 41 deletions
diff --git a/libraries/collectors-helper/statsd/Android.bp b/libraries/collectors-helper/statsd/Android.bp index 148d85b36..bdd85fe2a 100644 --- a/libraries/collectors-helper/statsd/Android.bp +++ b/libraries/collectors-helper/statsd/Android.bp @@ -33,6 +33,4 @@ java_library { "platformprotosnano", "statsdprotonano", ], - - platform_apis: true, } diff --git a/libraries/collectors-helper/statsd/test/Android.bp b/libraries/collectors-helper/statsd/test/Android.bp index 6dcbdfa7a..04d465270 100644 --- a/libraries/collectors-helper/statsd/test/Android.bp +++ b/libraries/collectors-helper/statsd/test/Android.bp @@ -35,6 +35,4 @@ java_library { "mockito-target-minus-junit4", "launcher-aosp-tapl" ], - - platform_apis: true, } diff --git a/libraries/device-collectors/src/main/platform-collectors/Android.bp b/libraries/device-collectors/src/main/platform-collectors/Android.bp index 25e82bc16..76ec22c99 100644 --- a/libraries/device-collectors/src/main/platform-collectors/Android.bp +++ b/libraries/device-collectors/src/main/platform-collectors/Android.bp @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Genrule for handwritten statsd configs. package { default_applicable_licenses: ["Android-Apache-2.0"], } +// Genrule for handwritten statsd configs. java_genrule { name: "statsd-config-protos", host_supported: true, @@ -24,6 +24,7 @@ java_genrule { "res/statsd-configs/**/*.pb", ], out: ["statsd-config-protos.jar"], + tools: ["soong_zip"], /* * Loops over all subdirectories under res/statsd-configs/ and copy all *.pb configs within to * an assets/statsd-configs/ directory, which gets packed into a .jar file and ends up under the @@ -32,10 +33,9 @@ java_genrule { * * If a config fails to parse, an error is thrown and the build will fail. */ - cmd: "out_dir=$$(dirname $(out)) && assets_dir=\"assets/statsd-configs\" " + - "&& mkdir -p $$out_dir/$$assets_dir && protos=($(locations res/statsd-configs/**/*.pb)) " + - "&& for file in $${protos[@]} ; do cp $$file $$out_dir/$$assets_dir/ ; done " + - "&& jar cf $(out) -C $$(dirname $(out)) $$assets_dir" + cmd: "mkdir $(genDir)/pb && protos=($(locations res/statsd-configs/**/*.pb)) " + + "&& for file in $${protos[@]} ; do cp $$file $(genDir)/pb/ ; done " + + "&& $(location soong_zip) -jar -o $(out) -C $(genDir)/pb -P assets/statsd-configs -D $(genDir)/pb", } // This library enables additional listeners dependent on platform apis. @@ -53,5 +53,4 @@ java_library { "statsd-helper", "statsd-config-protos", ], - platform_apis: true, } diff --git a/tests/bettertogether/quickstart/performance_test/CHANGELOG.md b/tests/bettertogether/quickstart/performance_test/CHANGELOG.md new file mode 100644 index 000000000..1e51c2886 --- /dev/null +++ b/tests/bettertogether/quickstart/performance_test/CHANGELOG.md @@ -0,0 +1,18 @@ +# Quickstart performance test suite release history + +## 1.6 + +### New +* `nearby_share_stress_test.py` for testing Nearby Share using Wifi only. + +### Fixes +* Change discovery medium to BLE only. +* Increase 1G file transfer timeout to 400s. +* Disable GMS auto-updates for the duration of the test. + +## 1.5 + +### New +* `esim_transfer_stress_test.py` for testing eSIM transfer using Bluetooth only. +* `quick_start_stress_test.py` for testing the Quickstart flow using both + Bluetooth and Wifi.
\ No newline at end of file diff --git a/tests/bettertogether/quickstart/performance_test/esim_transfer_stress_test.py b/tests/bettertogether/quickstart/performance_test/esim_transfer_stress_test.py index 2125b45b0..1338dc7b9 100644 --- a/tests/bettertogether/quickstart/performance_test/esim_transfer_stress_test.py +++ b/tests/bettertogether/quickstart/performance_test/esim_transfer_stress_test.py @@ -41,7 +41,7 @@ from performance_test import nc_constants from performance_test import nearby_connection_wrapper from performance_test import setup_utils -_TEST_SCRIPT_VERSTION = '1.6' +_TEST_SCRIPT_VERSION = '1.6' _DELAY_BETWEEN_EACH_TEST_CYCLE = datetime.timedelta(seconds=5) _TRANSFER_FILE_SIZE_1MB = 1024 @@ -68,6 +68,7 @@ class EsimTransferStressTest(nc_base_test.NCBaseTestClass): super().__init__(configs) self._test_result = nc_constants.SingleTestResult() self._esim_transfer_test_metrics = self.EsimTransferTestMetrics() + self._test_script_version = _TEST_SCRIPT_VERSION # @typing.override def setup_class(self): @@ -165,7 +166,7 @@ class EsimTransferStressTest(nc_base_test.NCBaseTestClass): self.record_data({ 'Test Class': self.TAG, 'Test Name': self.current_test_info.name, - 'sponge_properties': test_report, + 'properties': test_report, }) def _collect_current_test_metrics(self): @@ -227,8 +228,8 @@ class EsimTransferStressTest(nc_base_test.NCBaseTestClass): self.record_data({ 'Test Class': self.TAG, - 'sponge_properties': { - 'test_script_verion': _TEST_SCRIPT_VERSTION, + 'properties': { + 'test_script_version': self._test_script_version, '00_test_report_alias_name': ( self.test_parameters.test_report_alias_name), '01_test_result': result_message, diff --git a/tests/bettertogether/quickstart/performance_test/nc_base_test.py b/tests/bettertogether/quickstart/performance_test/nc_base_test.py index 8467cfcf7..0d540413f 100644 --- a/tests/bettertogether/quickstart/performance_test/nc_base_test.py +++ b/tests/bettertogether/quickstart/performance_test/nc_base_test.py @@ -41,6 +41,7 @@ class NCBaseTestClass(base_test.BaseTestClass): self.advertiser: android_device.AndroidDevice = None self.discoverer: android_device.AndroidDevice = None self.test_parameters: nc_constants.TestParameters = None + self._test_script_version = None self._nearby_snippet_apk_path: str = None self.performance_test_iterations: int = 1 self.num_bug_reports: int = 0 @@ -51,6 +52,9 @@ class NCBaseTestClass(base_test.BaseTestClass): self._nearby_snippet_apk_path = self.user_params.get('files', {}).get( 'nearby_snippet', [''])[0] + # set run identifier property + self._set_run_identifier() + utils.concurrent_exec( self._setup_android_device, param_list=[[ad] for ad in self.ads], @@ -71,6 +75,22 @@ class NCBaseTestClass(base_test.BaseTestClass): ) self.advertiser, self.discoverer = self.ads + def _set_run_identifier(self) -> None: + """Set a run_identifier property describing the test run context.""" + run_identifier = {} + run_identifier['test_version'] = self._test_script_version + run_identifier['alias'] = self.test_parameters.test_report_alias_name + run_identifier['devices'] = [ + f'{ad.model}({ad.build_info["build_id"]})' for ad in self.ads + ] + run_identifier_str = ', '.join( + [f'{key}:{value}' for key, value in run_identifier.items()] + ) + run_identifier_str = f'{{{run_identifier_str}}}' + self.record_data( + {'properties': {'run_identifier': run_identifier_str}} + ) + def _disconnect_from_wifi(self, ad: android_device.AndroidDevice) -> None: if not ad.is_adb_root: ad.log.info("Can't clear wifi network in non-rooted device") @@ -117,7 +137,7 @@ class NCBaseTestClass(base_test.BaseTestClass): setup_utils.enable_wifi_aware(ad) if self.test_parameters.wifi_country_code: - setup_utils.set_wifi_country_code( + setup_utils.set_country_code( ad, self.test_parameters.wifi_country_code ) diff --git a/tests/bettertogether/quickstart/performance_test/nearby_share_stress_test.py b/tests/bettertogether/quickstart/performance_test/nearby_share_stress_test.py index f32d989e3..e33d18762 100644 --- a/tests/bettertogether/quickstart/performance_test/nearby_share_stress_test.py +++ b/tests/bettertogether/quickstart/performance_test/nearby_share_stress_test.py @@ -41,7 +41,7 @@ from performance_test import nc_constants from performance_test import nearby_connection_wrapper from performance_test import setup_utils -_TEST_SCRIPT_VERSTION = '1.6' +_TEST_SCRIPT_VERSION = '1.6' _DELAY_BETWEEN_EACH_TEST_CYCLE = datetime.timedelta(seconds=5) _TRANSFER_FILE_SIZE_1GB = 1024 * 1024 @@ -75,6 +75,7 @@ class NearbyShareStressTest(nc_base_test.NCBaseTestClass): super().__init__(configs) self._test_result = nc_constants.SingleTestResult() self._nearby_share_test_metrics = self.NearbyShareTestMetrics() + self._test_script_version = _TEST_SCRIPT_VERSION # @typing.override def setup_class(self): @@ -174,7 +175,7 @@ class NearbyShareStressTest(nc_base_test.NCBaseTestClass): self.record_data({ 'Test Class': self.TAG, 'Test Name': self.current_test_info.name, - 'sponge_properties': test_report, + 'properties': test_report, }) def _collect_current_test_metrics(self): @@ -198,7 +199,7 @@ class NearbyShareStressTest(nc_base_test.NCBaseTestClass): wifi_transfer_stats = self._stats_throughput_result( 'WiFi', self._nearby_share_test_metrics.wifi_transfer_throughputs_kbps, - nc_constants.BT_TRANSFER_SUCCESS_RATE_TARGET_PERCENTAGE, + nc_constants.WIFI_TRANSFER_SUCCESS_RATE_TARGET_PERCENTAGE, self.test_parameters.wifi_transfer_throughput_median_benchmark_kbps) discovery_stats = self._stats_latency_result( @@ -245,8 +246,8 @@ class NearbyShareStressTest(nc_base_test.NCBaseTestClass): self.record_data({ 'Test Class': self.TAG, - 'sponge_properties': { - 'test_script_verion': _TEST_SCRIPT_VERSTION, + 'properties': { + 'test_script_version': self._test_script_version, '00_test_report_alias_name': ( self.test_parameters.test_report_alias_name), '01_test_result': result_message, diff --git a/tests/bettertogether/quickstart/performance_test/quick_start_stress_test.py b/tests/bettertogether/quickstart/performance_test/quick_start_stress_test.py index 5cff00e3a..d3405fbe6 100644 --- a/tests/bettertogether/quickstart/performance_test/quick_start_stress_test.py +++ b/tests/bettertogether/quickstart/performance_test/quick_start_stress_test.py @@ -66,6 +66,7 @@ class QuickStartStressTest(nc_base_test.NCBaseTestClass): nc_constants.SingleTestResult()) self._quick_start_test_metrics: nc_constants.QuickStartTestMetrics = ( nc_constants.QuickStartTestMetrics()) + self._test_script_version = _TEST_SCRIPT_VERSION # @typing.override def setup_test(self): @@ -271,7 +272,7 @@ class QuickStartStressTest(nc_base_test.NCBaseTestClass): self.record_data({ 'Test Class': self.TAG, 'Test Name': self.current_test_info.name, - 'sponge_properties': test_report, + 'properties': test_report, }) def _collect_current_test_metrics(self) -> None: @@ -317,13 +318,13 @@ class QuickStartStressTest(nc_base_test.NCBaseTestClass): # @typing.override def _summary_test_results(self) -> None: """Summarizes test results of all iterations.""" - bt_transfer_stats = self._stats_throughput_result( + first_bt_transfer_stats = self._stats_throughput_result( 'BT', self._quick_start_test_metrics.bt_transfer_throughputs_kbps, nc_constants.BT_TRANSFER_SUCCESS_RATE_TARGET_PERCENTAGE, self.test_parameters.bt_transfer_throughput_median_benchmark_kbps) - wifi_transfer_stats = self._stats_throughput_result( + second_wifi_transfer_stats = self._stats_throughput_result( 'Wi-Fi', self._quick_start_test_metrics.wifi_transfer_throughputs_kbps, nc_constants.WIFI_TRANSFER_SUCCESS_RATE_TARGET_PERCENTAGE, @@ -343,12 +344,12 @@ class QuickStartStressTest(nc_base_test.NCBaseTestClass): passed = True result_message = 'Passed' fail_message = '' - if bt_transfer_stats.fail_targets: + if first_bt_transfer_stats.fail_targets: fail_message += self._generate_target_fail_message( - bt_transfer_stats.fail_targets) - if wifi_transfer_stats.fail_targets: + first_bt_transfer_stats.fail_targets) + if second_wifi_transfer_stats.fail_targets: fail_message += self._generate_target_fail_message( - wifi_transfer_stats.fail_targets) + second_wifi_transfer_stats.fail_targets) if fail_message: passed = False result_message = 'Test Failed due to:\n' + fail_message @@ -356,29 +357,29 @@ class QuickStartStressTest(nc_base_test.NCBaseTestClass): detailed_stats = { '0 test iterations': self.performance_test_iterations, '1 Completed BT/Wi-Fi transfer': ( - f'{bt_transfer_stats.success_count}' - f' / {wifi_transfer_stats.success_count}'), + f'{first_bt_transfer_stats.success_count}' + f' / {second_wifi_transfer_stats.success_count}'), '2 BT transfer failures': { '1 discovery': first_discovery_stats.failure_count, '2 connection': first_connection_stats.failure_count, '3 transfer': self.performance_test_iterations - ( - bt_transfer_stats.success_count), + first_bt_transfer_stats.success_count), }, '3 Wi-Fi transfer failures': { '1 discovery': second_discovery_stats.failure_count, '2 connection': second_connection_stats.failure_count, '3 upgrade': medium_upgrade_stats.failure_count, '4 transfer': self.performance_test_iterations - ( - wifi_transfer_stats.success_count), + second_wifi_transfer_stats.success_count), }, '4 Medium upgrade count': ( self._summary_upgraded_wifi_transfer_mediums()), '5 50% and 95% of BT transfer speed (KBps)': ( - f'{bt_transfer_stats.percentile_50_kbps}' - f' / {bt_transfer_stats.percentile_95_kbps}'), + f'{first_bt_transfer_stats.percentile_50_kbps}' + f' / {first_bt_transfer_stats.percentile_95_kbps}'), '6 50% and 95% of Wi-Fi transfer speed(KBps)': ( - f'{wifi_transfer_stats.percentile_50_kbps}' - f' / {wifi_transfer_stats.percentile_95_kbps}'), + f'{second_wifi_transfer_stats.percentile_50_kbps}' + f' / {second_wifi_transfer_stats.percentile_95_kbps}'), '7 50% and 95% of discovery latency(sec)': ( f'{first_discovery_stats.percentile_50}' f' / {first_discovery_stats.percentile_95} (1st), ' @@ -396,7 +397,7 @@ class QuickStartStressTest(nc_base_test.NCBaseTestClass): self.record_data({ 'Test Class': self.TAG, - 'sponge_properties': { + 'properties': { 'test_script_version': _TEST_SCRIPT_VERSION, '00_test_report_alias_name': ( self.test_parameters.test_report_alias_name), @@ -413,5 +414,6 @@ class QuickStartStressTest(nc_base_test.NCBaseTestClass): asserts.assert_true(passed, result_message) + if __name__ == '__main__': test_runner.main() diff --git a/tests/bettertogether/quickstart/performance_test/setup_utils.py b/tests/bettertogether/quickstart/performance_test/setup_utils.py index 9b8ac4b52..3e530f506 100644 --- a/tests/bettertogether/quickstart/performance_test/setup_utils.py +++ b/tests/bettertogether/quickstart/performance_test/setup_utils.py @@ -38,10 +38,10 @@ LOG_TAGS = [ ] -def set_wifi_country_code( +def set_country_code( ad: android_device.AndroidDevice, country_code: str ) -> None: - """Sets Wi-Fi country code to shrink Wi-Fi 5GHz available channels. + """Sets Wi-Fi and Telephony country code. When you set the phone to EU or JP, the available 5GHz channels shrinks. Some phones, like Pixel 2, can't use Wi-Fi Direct or Hotspot on 5GHz @@ -51,21 +51,31 @@ def set_wifi_country_code( Args: ad: AndroidDevice, Mobly Android Device. - country_code: WiFi Country Code. + country_code: WiFi and Telephony Country Code. """ if (not ad.is_adb_root): ad.log.info(f'Skipped setting wifi country code on device "{ad.serial}" ' - 'because we do not set wifi country code on unrooted phone.') + 'because we do not set country code on unrooted phone.') return - ad.log.info(f'Set Wi-Fi country code to {country_code}.') + ad.log.info(f'Set Wi-Fi and Telephony country code to {country_code}.') ad.adb.shell('cmd wifi set-wifi-enabled disabled') time.sleep(WIFI_COUNTRYCODE_CONFIG_TIME_SEC) + ad.adb.shell( + 'am broadcast -a com.android.internal.telephony.action.COUNTRY_OVERRIDE' + f' --es country {country_code}' + ) ad.adb.shell(f'cmd wifi force-country-code enabled {country_code}') enable_airplane_mode(ad) time.sleep(WIFI_COUNTRYCODE_CONFIG_TIME_SEC) disable_airplane_mode(ad) ad.adb.shell('cmd wifi set-wifi-enabled enabled') + telephony_country_code = ( + ad.adb.shell('dumpsys wifi | grep mTelephonyCountryCode') + .decode('utf-8') + .strip() + ) + ad.log.info(f'Telephony country code: {telephony_country_code}') def enable_logs(ad: android_device.AndroidDevice) -> None: |