summaryrefslogtreecommitdiffstats
path: root/testing/raptor/test/test_cmdline.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/raptor/test/test_cmdline.py
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/raptor/test/test_cmdline.py')
-rw-r--r--testing/raptor/test/test_cmdline.py177
1 files changed, 177 insertions, 0 deletions
diff --git a/testing/raptor/test/test_cmdline.py b/testing/raptor/test/test_cmdline.py
new file mode 100644
index 0000000000..8da43db727
--- /dev/null
+++ b/testing/raptor/test/test_cmdline.py
@@ -0,0 +1,177 @@
+import os
+import sys
+
+import mozunit
+import pytest
+
+# need this so the raptor unit tests can find raptor/raptor classes
+here = os.path.abspath(os.path.dirname(__file__))
+raptor_dir = os.path.join(os.path.dirname(here), "raptor")
+sys.path.insert(0, raptor_dir)
+
+from argparse import ArgumentParser, Namespace
+
+from cmdline import verify_options
+
+
+def test_verify_options(filedir):
+ args = Namespace(
+ app="firefox",
+ binary="invalid/path",
+ gecko_profile="False",
+ page_cycles=1,
+ page_timeout=60000,
+ debug="True",
+ power_test=False,
+ cpu_test=False,
+ memory_test=False,
+ chimera=False,
+ browsertime_video=False,
+ browsertime_visualmetrics=False,
+ fission=True,
+ fission_mobile=False,
+ test_bytecode_cache=False,
+ webext=False,
+ extra_prefs=[],
+ benchmark_repository=None,
+ benchmark_revision=None,
+ benchmark_branch=None,
+ )
+ parser = ArgumentParser()
+
+ with pytest.raises(SystemExit):
+ verify_options(parser, args)
+
+ args.binary = os.path.join(filedir, "fake_binary.exe")
+ verify_options(parser, args) # assert no exception
+
+ args = Namespace(
+ app="geckoview",
+ binary="org.mozilla.geckoview_example",
+ activity="org.mozilla.geckoview_example.GeckoViewActivity",
+ intent="android.intent.action.MAIN",
+ gecko_profile="False",
+ is_release_build=False,
+ host="sophie",
+ power_test=False,
+ cpu_test=False,
+ memory_test=False,
+ chimera=False,
+ browsertime_video=False,
+ browsertime_visualmetrics=False,
+ fission=True,
+ fission_mobile=False,
+ test_bytecode_cache=False,
+ webext=False,
+ extra_prefs=[],
+ benchmark_repository=None,
+ benchmark_revision=None,
+ benchmark_branch=None,
+ )
+ verify_options(parser, args) # assert no exception
+
+ args = Namespace(
+ app="refbrow",
+ binary="org.mozilla.reference.browser",
+ activity="org.mozilla.reference.browser.BrowserTestActivity",
+ intent="android.intent.action.MAIN",
+ gecko_profile="False",
+ is_release_build=False,
+ host="sophie",
+ power_test=False,
+ cpu_test=False,
+ memory_test=False,
+ chimera=False,
+ browsertime_video=False,
+ browsertime_visualmetrics=False,
+ fission=True,
+ fission_mobile=False,
+ test_bytecode_cache=False,
+ webext=False,
+ extra_prefs=[],
+ benchmark_repository=None,
+ benchmark_revision=None,
+ benchmark_branch=None,
+ )
+ verify_options(parser, args) # assert no exception
+
+ args = Namespace(
+ app="fenix",
+ binary="org.mozilla.fenix.browser",
+ activity="org.mozilla.fenix.browser.BrowserPerformanceTestActivity",
+ intent="android.intent.action.VIEW",
+ gecko_profile="False",
+ is_release_build=False,
+ host="sophie",
+ power_test=False,
+ cpu_test=False,
+ memory_test=False,
+ chimera=False,
+ browsertime_video=False,
+ browsertime_visualmetrics=False,
+ fission=True,
+ fission_mobile=False,
+ test_bytecode_cache=False,
+ webext=False,
+ extra_prefs=[],
+ benchmark_repository=None,
+ benchmark_revision=None,
+ benchmark_branch=None,
+ )
+ verify_options(parser, args) # assert no exception
+
+ args = Namespace(
+ app="geckoview",
+ binary="org.mozilla.geckoview_example",
+ activity="org.mozilla.geckoview_example.GeckoViewActivity",
+ intent="android.intent.action.MAIN",
+ gecko_profile="False",
+ is_release_build=False,
+ host="sophie",
+ power_test=False,
+ cpu_test=True,
+ memory_test=False,
+ chimera=False,
+ browsertime_video=False,
+ browsertime_visualmetrics=False,
+ fission=True,
+ fission_mobile=False,
+ test_bytecode_cache=False,
+ webext=False,
+ extra_prefs=[],
+ benchmark_repository=None,
+ benchmark_revision=None,
+ benchmark_branch=None,
+ )
+ verify_options(parser, args) # assert no exception
+
+ args = Namespace(
+ app="refbrow",
+ binary="org.mozilla.reference.browser",
+ activity=None,
+ intent="android.intent.action.MAIN",
+ gecko_profile="False",
+ is_release_build=False,
+ host="sophie",
+ power_test=False,
+ cpu_test=False,
+ memory_test=False,
+ chimera=False,
+ browsertime_video=False,
+ browsertime_visualmetrics=False,
+ fission=True,
+ fission_mobile=False,
+ test_bytecode_cache=False,
+ webext=False,
+ extra_prefs=[],
+ benchmark_repository=None,
+ benchmark_revision=None,
+ benchmark_branch=None,
+ )
+ parser = ArgumentParser()
+
+ verify_options(parser, args) # also will work as uses default activity
+
+
+if __name__ == "__main__":
+ mozunit.main()