From afb221d01537bf640d8ba65fc0f3c04d89c510f3 Mon Sep 17 00:00:00 2001 From: Andrej Glavic Date: Fri, 9 May 2025 13:57:28 +0000 Subject: [PATCH] Bug 1960465 - Set HG_TO_GIT_MIGRATION_COMPLETE to True, and make sure all unit tests pass. r=perftest-reviewers,sparky Differential Revision: https://phabricator.services.mozilla.com/D248427 --- tools/tryselect/selectors/perf.py | 8 +-- tools/tryselect/test/test_perf.py | 86 ++++++++++++++----------------- 2 files changed, 43 insertions(+), 51 deletions(-) diff --git a/tools/tryselect/selectors/perf.py b/tools/tryselect/selectors/perf.py index 546eb9f369f5..faaf45084b4c 100644 --- a/tools/tryselect/selectors/perf.py +++ b/tools/tryselect/selectors/perf.py @@ -69,7 +69,7 @@ TREEHERDER_ALERT_TASKS_URL = ( ) # Our ./mach try perf changes should only take effect after we have migrated to github -HG_TO_GIT_MIGRATION_COMPLETE = False +HG_TO_GIT_MIGRATION_COMPLETE = True ON_GIT = get_repository_object(build.topsrcdir).name == "git" # Prevent users from running more than 300 tests at once. It's possible, but @@ -1324,7 +1324,7 @@ class PerfParser(CompareParser): dry_run=dry_run, closed_tree=False, allow_log_capture=True, - push_to_vcs=True, + push_to_vcs=not ON_GIT, ) PerfParser.push_info.base_revision = log_processor.revision @@ -1364,7 +1364,7 @@ class PerfParser(CompareParser): dry_run=dry_run, closed_tree=False, allow_log_capture=True, - push_to_vcs=True, + push_to_vcs=not ON_GIT, ) PerfParser.push_info.new_revision = log_processor.revision @@ -1655,7 +1655,7 @@ def run(**kwargs): PERFHERDER_BASE_URL % PerfParser.push_info.get_perfcompare_settings() ) compareview_url_print = f" The old comparison tool is still available at this URL:\n {compareview_url}\n" - if HG_TO_GIT_MIGRATION_COMPLETE: + if HG_TO_GIT_MIGRATION_COMPLETE and ON_GIT: perfcompare_url = ( PERFCOMPARE_BASE_URL_GIT % PerfParser.push_info.get_perfcompare_settings_git() diff --git a/tools/tryselect/test/test_perf.py b/tools/tryselect/test/test_perf.py index 7e4094fcd594..a2315852b3f5 100644 --- a/tools/tryselect/test/test_perf.py +++ b/tools/tryselect/test/test_perf.py @@ -929,11 +929,9 @@ def test_category_expansion_with_non_pgo_flag(category_options, call_counts): ( "\n!!!NOTE!!!\n You'll be able to find a performance comparison " "here once the tests are complete (ensure you select the right framework):\n" - " https://perf.compare/compare-results?" - "baseRev=revision&newRev=revision&baseRepo=try&newRepo=try&framework=13\n\n" - " The old comparison tool is still available at this URL:\n" - " https://treeherder.mozilla.org/perfherder/compare?originalProject=try&original" - "Revision=revision&newProject=try&newRevision=revision&framework=13\n" + " https://perf.compare/compare-hash-results?" + f"baseHash={hash('mockedmocked')}&newHash={hash('mocked100')}&baseHashDate=2025-01-01&newHashDate=2025-01-01" + f"&baseRepo=try&newRepo=try&framework=13\n\n" ), ), ( @@ -943,11 +941,9 @@ def test_category_expansion_with_non_pgo_flag(category_options, call_counts): ( "\n!!!NOTE!!!\n You'll be able to find a performance comparison " "here once the tests are complete (ensure you select the right framework):\n" - " https://perf.compare/compare-results?" - "baseRev=revision&newRev=revision&baseRepo=try&newRepo=try&framework=13\n\n" - " The old comparison tool is still available at this URL:\n" - " https://treeherder.mozilla.org/perfherder/compare?originalProject=try&original" - "Revision=revision&newProject=try&newRevision=revision&framework=13\n" + " https://perf.compare/compare-hash-results?" + f"baseHash={hash('mockedmocked')}&newHash={hash('mocked100')}&baseHashDate=2025-01-01&newHashDate=2025-01-01" + f"&baseRepo=try&newRepo=try&framework=13\n\n" ), ), ( @@ -957,12 +953,9 @@ def test_category_expansion_with_non_pgo_flag(category_options, call_counts): ( "\n!!!NOTE!!!\n You'll be able to find a performance comparison " "here once the tests are complete (ensure you select the right framework):\n" - " https://perf.compare/compare-results?" - "baseRev=cached_base_revision&newRev=revision&" - "baseRepo=try&newRepo=try&framework=13\n\n" - " The old comparison tool is still available at this URL:\n" - " https://treeherder.mozilla.org/perfherder/compare?originalProject=try&original" - "Revision=cached_base_revision&newProject=try&newRevision=revision&framework=13\n" + " https://perf.compare/compare-hash-results?" + f"baseHash=cached_base_revision&newHash={hash('mocked100')}&baseHashDate=2024-04-04&newHashDate=2025-01-01" + f"&baseRepo=try&newRepo=try&framework=13\n\n" ), ), ( @@ -981,11 +974,9 @@ def test_category_expansion_with_non_pgo_flag(category_options, call_counts): ( "\n!!!NOTE!!!\n You'll be able to find a performance comparison " "here once the tests are complete (ensure you select the right framework):\n" - " https://perf.compare/compare-results?" - "baseRev=revision&newRev=revision&baseRepo=try&newRepo=try&framework=1\n\n" - " The old comparison tool is still available at this URL:\n" - " https://treeherder.mozilla.org/perfherder/compare?originalProject=try&original" - "Revision=revision&newProject=try&newRevision=revision&framework=1\n" + " https://perf.compare/compare-hash-results?" + f"baseHash={hash('mockedmocked')}&newHash={hash('mocked100')}&baseHashDate=2025-01-01&newHashDate=2025-01-01" + f"&baseRepo=try&newRepo=try&framework=1\n\n" ), ), ( @@ -995,11 +986,9 @@ def test_category_expansion_with_non_pgo_flag(category_options, call_counts): ( "\n!!!NOTE!!!\n You'll be able to find a performance comparison " "here once the tests are complete (ensure you select the right framework):\n" - " https://perf.compare/compare-results?" - "baseRev=revision&newRev=revision&baseRepo=try&newRepo=try&framework=1\n\n" - " The old comparison tool is still available at this URL:\n" - " https://treeherder.mozilla.org/perfherder/compare?originalProject=try&original" - "Revision=revision&newProject=try&newRevision=revision&framework=1\n" + " https://perf.compare/compare-hash-results?" + f"baseHash={hash('mockedmocked')}&newHash={hash('mocked100')}&baseHashDate=2025-01-01&newHashDate=2025-01-01" + f"&baseRepo=try&newRepo=try&framework=1\n\n" ), ), ( @@ -1018,11 +1007,9 @@ def test_category_expansion_with_non_pgo_flag(category_options, call_counts): ( "\n!!!NOTE!!!\n You'll be able to find a performance comparison " "here once the tests are complete (ensure you select the right framework):\n" - " https://perf.compare/compare-results?" - "baseRev=revision&newRev=revision&baseRepo=try&newRepo=try&framework=13\n\n" - " The old comparison tool is still available at this URL:\n" - " https://treeherder.mozilla.org/perfherder/compare?originalProject=try&original" - "Revision=revision&newProject=try&newRevision=revision&framework=13\n" + " https://perf.compare/compare-hash-results?" + f"baseHash={hash('mockedmocked')}&newHash={hash('mocked100')}&baseHashDate=2025-01-01&newHashDate=2025-01-01" + f"&baseRepo=try&newRepo=try&framework=13\n\n" ), ), ( @@ -1032,11 +1019,9 @@ def test_category_expansion_with_non_pgo_flag(category_options, call_counts): ( "\n!!!NOTE!!!\n You'll be able to find a performance comparison " "here once the tests are complete (ensure you select the right framework):\n" - " https://perf.compare/compare-results?" - "baseRev=revision&newRev=revision&baseRepo=try&newRepo=try&framework=13\n\n" - " The old comparison tool is still available at this URL:\n" - " https://treeherder.mozilla.org/perfherder/compare?originalProject=try&original" - "Revision=revision&newProject=try&newRevision=revision&framework=13\n" + " https://perf.compare/compare-hash-results?" + f"baseHash={hash('mockedmocked')}&newHash={hash('mocked100')}&baseHashDate=2025-01-01&newHashDate=2025-01-01" + f"&baseRepo=try&newRepo=try&framework=13\n\n" ), ), ( @@ -1046,11 +1031,9 @@ def test_category_expansion_with_non_pgo_flag(category_options, call_counts): ( "\n!!!NOTE!!!\n You'll be able to find a performance comparison " "here once the tests are complete (ensure you select the right framework):\n" - " https://perf.compare/compare-results?" - "baseRev=revision&newRev=revision&baseRepo=try&newRepo=try&framework=1\n\n" - " The old comparison tool is still available at this URL:\n" - " https://treeherder.mozilla.org/perfherder/compare?originalProject=try&original" - "Revision=revision&newProject=try&newRevision=revision&framework=1\n" + " https://perf.compare/compare-hash-results?" + f"baseHash={hash('mockedmocked')}&newHash={hash('mocked100')}&baseHashDate=2025-01-01&newHashDate=2025-01-01" + f"&baseRepo=try&newRepo=try&framework=1\n\n" ), ), ( @@ -1060,11 +1043,9 @@ def test_category_expansion_with_non_pgo_flag(category_options, call_counts): ( "\n!!!NOTE!!!\n You'll be able to find a performance comparison " "here once the tests are complete (ensure you select the right framework):\n" - " https://perf.compare/compare-results?" - "baseRev=revision&newRev=revision&baseRepo=try&newRepo=try&framework=1\n\n" - " The old comparison tool is still available at this URL:\n" - " https://treeherder.mozilla.org/perfherder/compare?originalProject=try&original" - "Revision=revision&newProject=try&newRevision=revision&framework=1\n" + " https://perf.compare/compare-hash-results?" + f"baseHash={hash('mockedmocked')}&newHash={hash('mocked100')}&baseHashDate=2025-01-01&newHashDate=2025-01-01" + f"&baseRepo=try&newRepo=try&framework=1\n\n" ), ), ], @@ -1089,7 +1070,17 @@ def test_full_run(options, call_counts, log_ind, expected_log_message): "tryselect.selectors.perf.PerfParser.set_categories_for_test" ) as tests_mock, mock.patch( "tryselect.selectors.perf.requests" - ) as requests_mock: + ) as requests_mock, mock.patch( + "tryselect.selectors.perf.datetime" + ) as mock_datetime, mock.patch( + "tryselect.selectors.perf.HG_TO_GIT_MIGRATION_COMPLETE", return_value=True + ), mock.patch( + "tryselect.selectors.perf.ON_GIT", return_value=True + ), mock.patch( + "tryselect.selectors.perf.time.time", return_value=100 + ), mock.patch( + "tryselect.selectors.perf.subprocess.getoutput", return_value="mocked" + ): def test_mock_func(*args, **kwargs): """Used for testing any --test functionality.""" @@ -1155,6 +1146,7 @@ def test_full_run(options, call_counts, log_ind, expected_log_message): fzf.side_effect = fzf_side_effects ccr.return_value = options.get("cached_revision", (None, None)) + mock_datetime.today.return_value = datetime(2025, 1, 1) with category_reset(): run(**options)