diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
commit | 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 (patch) | |
tree | a4f824bd33cb075dd5aa3eb5a0a94af221bbe83a /testing/raptor/test | |
parent | Adding debian version 124.0.1-1. (diff) | |
download | firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.tar.xz firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/raptor/test')
-rw-r--r-- | testing/raptor/test/test_cmdline.py | 86 | ||||
-rw-r--r-- | testing/raptor/test/test_raptor.py | 29 |
2 files changed, 106 insertions, 9 deletions
diff --git a/testing/raptor/test/test_cmdline.py b/testing/raptor/test/test_cmdline.py index 80ce6cf88a..de88e60c77 100644 --- a/testing/raptor/test/test_cmdline.py +++ b/testing/raptor/test/test_cmdline.py @@ -1,5 +1,6 @@ import os import sys +from unittest import mock import mozunit import pytest @@ -11,7 +12,7 @@ sys.path.insert(0, raptor_dir) from argparse import ArgumentParser, Namespace -from cmdline import verify_options +from cmdline import create_parser, verify_options def test_verify_options(filedir): @@ -33,6 +34,7 @@ def test_verify_options(filedir): benchmark_repository=None, benchmark_revision=None, benchmark_branch=None, + post_startup_delay=None, ) parser = ArgumentParser() @@ -61,6 +63,7 @@ def test_verify_options(filedir): benchmark_repository=None, benchmark_revision=None, benchmark_branch=None, + post_startup_delay=None, ) verify_options(parser, args) # assert no exception @@ -83,6 +86,7 @@ def test_verify_options(filedir): benchmark_repository=None, benchmark_revision=None, benchmark_branch=None, + post_startup_delay=None, ) verify_options(parser, args) # assert no exception @@ -105,6 +109,7 @@ def test_verify_options(filedir): benchmark_repository=None, benchmark_revision=None, benchmark_branch=None, + post_startup_delay=None, ) verify_options(parser, args) # assert no exception @@ -127,6 +132,7 @@ def test_verify_options(filedir): benchmark_repository=None, benchmark_revision=None, benchmark_branch=None, + post_startup_delay=None, ) verify_options(parser, args) # assert no exception @@ -149,11 +155,89 @@ def test_verify_options(filedir): benchmark_repository=None, benchmark_revision=None, benchmark_branch=None, + post_startup_delay=None, ) parser = ArgumentParser() verify_options(parser, args) # also will work as uses default activity +@mock.patch("perftest.Perftest.build_browser_profile", new=mock.MagicMock()) +@pytest.mark.parametrize( + "args,settings_to_check", + [ + # Test that post_startup_delay is 30s as expected + [ + [ + "--test", + "test-page-1", + "--binary", + "invalid/path", + # This gets set automatically from mach_commands, but is set + # to False by default in the Perftest class + "--run-local", + ], + [ + ("post_startup_delay", 30000), + ("run_local", True), + ("debug_mode", False), + ], + ], + # Test that run_local is false by default + [ + [ + "--test", + "test-page-1", + "--binary", + "invalid/path", + ], + [ + ("post_startup_delay", 30000), + ("run_local", False), + ("debug_mode", False), + ], + ], + # Test that debug mode gets set when running locally + [ + [ + "--test", + "test-page-1", + "--binary", + "invalid/path", + "--debug-mode", + "--run-local", + ], + [ + ("post_startup_delay", 3000), + ("run_local", True), + ("debug_mode", True), + ], + ], + # Test that debug mode doesn't get set when we're not running locally + [ + [ + "--test", + "test-page-1", + "--binary", + "invalid/path", + "--debug-mode", + ], + [ + ("post_startup_delay", 30000), + ("run_local", False), + ("debug_mode", False), + ], + ], + ], +) +def test_perftest_setup_with_args(ConcretePerftest, args, settings_to_check): + parser = create_parser() + args = parser.parse_args(args) + + perftest = ConcretePerftest(**vars(args)) + for setting, expected in settings_to_check: + assert getattr(perftest, setting) == expected + + if __name__ == "__main__": mozunit.main() diff --git a/testing/raptor/test/test_raptor.py b/testing/raptor/test/test_raptor.py index 9184fa5e18..3c90b611a5 100644 --- a/testing/raptor/test/test_raptor.py +++ b/testing/raptor/test/test_raptor.py @@ -127,38 +127,51 @@ def test_raptor_venv(ConcretePerftest, options): assert perftest.raptor_venv.endswith("raptor-venv") +@mock.patch("perftest.Perftest.build_browser_profile", new=mock.MagicMock()) @pytest.mark.parametrize( + "app," "run_local," "debug_mode," + "conditioned_profile," "post_startup_delay," "expected_post_startup_delay," "expected_debug_mode", [ - [True, True, 1234, 1234, True], - [True, True, 12345, 3000, True], - [False, False, 1234, 1234, False], - [False, False, 12345, 12345, False], - [True, False, 1234, 1234, False], - [True, False, 12345, 12345, False], - [False, True, 1234, 1234, False], - [False, True, 12345, 12345, False], + ["firefox", True, True, None, 1234, 1234, True], + ["firefox", True, True, None, None, 3000, True], + ["firefox", True, False, None, None, 30000, False], + ["firefox", True, False, "settled", None, 1000, False], + ["fenix", True, False, None, None, 20000, False], + ["fenix", True, False, "settled", None, 1000, False], + ["firefox", False, False, None, 1234, 1234, False], + ["firefox", False, False, None, 12345, 12345, False], + ["firefox", True, False, None, 1234, 1234, False], + ["firefox", True, False, None, 12345, 12345, False], + ["firefox", False, True, None, 1234, 1234, False], + ["firefox", False, True, None, 12345, 12345, False], ], ) def test_post_startup_delay( ConcretePerftest, options, + app, run_local, debug_mode, + conditioned_profile, post_startup_delay, expected_post_startup_delay, expected_debug_mode, ): + options["app"] = app + perftest = ConcretePerftest( run_local=run_local, debug_mode=debug_mode, post_startup_delay=post_startup_delay, + conditioned_profile=conditioned_profile, **options ) + assert perftest.post_startup_delay == expected_post_startup_delay assert perftest.debug_mode == expected_debug_mode |