Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
For mozilla-mobile#20017: use 'in' syntax for test name checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcomella authored and czlucius committed Aug 20, 2021
1 parent cf82d02 commit a835806
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tools/measure_start_up.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ def disable_startup_profiling():

def get_start_cmd(test_name, pkg_id):
args_prefix = get_activity_manager_args() + ['start-activity', '-W', '-n']
if test_name == TEST_COLD_MAIN_FF:
if test_name in [TEST_COLD_MAIN_FF]:
cmd = args_prefix + ['{}/.App'.format(pkg_id)]
elif test_name == TEST_COLD_VIEW_FF or test_name == TEST_COLD_VIEW_NAV_START:
elif test_name in [TEST_COLD_VIEW_FF, TEST_COLD_VIEW_NAV_START]:
pkg_activity = '{}/org.mozilla.fenix.IntentReceiverActivity'.format(pkg_id)
cmd = args_prefix + [
pkg_activity,
Expand Down Expand Up @@ -128,9 +128,9 @@ def measure(test_name, pkg_id, start_cmd_args, iter_count):


def get_measurement(test_name, pkg_id, stdout):
if test_name == TEST_COLD_MAIN_FF or test_name == TEST_COLD_VIEW_FF:
if test_name in [TEST_COLD_MAIN_FF, TEST_COLD_VIEW_FF]:
measurement = get_measurement_from_am_start_log(stdout)
elif test_name == TEST_COLD_VIEW_NAV_START:
elif test_name in [TEST_COLD_VIEW_NAV_START]:
time.sleep(3) # We must sleep until the navigation start event occurs.
proc = subprocess.run(['adb', 'logcat', '-d'], check=True, capture_output=True)
measurement = get_measurement_from_nav_start_logcat(pkg_id, proc.stdout)
Expand Down Expand Up @@ -205,9 +205,9 @@ def save_measurements(path, measurements):
def print_preface_text(test_name):
print("To analyze the results, use this script (we recommend using the median):" +
"\nhttps://github.com/mozilla-mobile/perf-tools/blob/master/analyze_durations.py")
if test_name == TEST_COLD_MAIN_FF:
if test_name in [TEST_COLD_MAIN_FF]:
print("\nWARNING: you may wish to clear the onboarding experience manually.")
elif test_name == TEST_COLD_VIEW_FF or test_name == TEST_COLD_VIEW_NAV_START:
elif test_name in [TEST_COLD_VIEW_FF, TEST_COLD_VIEW_NAV_START]:
print("\nWARNING: you may wish to reduce the number of open tabs when starting this test")
print("as this test may leave many additional tabs open which could impact the results.")

Expand Down

0 comments on commit a835806

Please sign in to comment.