tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

linux_unittest.py (10164B)


      1 # This Source Code Form is subject to the terms of the Mozilla Public
      2 # License, v. 2.0. If a copy of the MPL was not distributed with this
      3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
      4 
      5 import os
      6 import platform
      7 
      8 # OS Specifics
      9 ABS_WORK_DIR = os.path.join(os.getcwd(), "build")
     10 BINARY_PATH = os.path.join(ABS_WORK_DIR, "application", "firefox", "firefox-bin")
     11 INSTALLER_PATH = os.path.join(ABS_WORK_DIR, "installer.tar.xz")
     12 XPCSHELL_NAME = "xpcshell"
     13 PLUGIN_CONTAINER_NAME = "plugin-container"
     14 HTTP3SERVER_NAME = "http3server"
     15 EXE_SUFFIX = ""
     16 DISABLE_SCREEN_SAVER = True
     17 ADJUST_MOUSE_AND_SCREEN = False
     18 
     19 # Note: keep these Valgrind .sup file names consistent with those
     20 # in testing/mochitest/mochitest_options.py.
     21 VALGRIND_SUPP_DIR = os.path.join(os.getcwd(), "build/tests/mochitest")
     22 NODEJS_PATH = None
     23 if "MOZ_FETCHES_DIR" in os.environ:
     24    NODEJS_PATH = os.path.join(os.environ["MOZ_FETCHES_DIR"], "node/bin/node")
     25 
     26 VALGRIND_SUPP_CROSS_ARCH = os.path.join(VALGRIND_SUPP_DIR, "cross-architecture.sup")
     27 VALGRIND_SUPP_ARCH = None
     28 
     29 if platform.architecture()[0] == "64bit":
     30    VALGRIND_SUPP_ARCH = os.path.join(VALGRIND_SUPP_DIR, "x86_64-pc-linux-gnu.sup")
     31 else:
     32    VALGRIND_SUPP_ARCH = os.path.join(VALGRIND_SUPP_DIR, "i386-pc-linux-gnu.sup")
     33 
     34 #####
     35 config = {
     36    ###
     37    "virtualenv_modules": ["six==1.16.0", "vcversioner==2.16.0.0"],
     38    "installer_path": INSTALLER_PATH,
     39    "binary_path": BINARY_PATH,
     40    "xpcshell_name": XPCSHELL_NAME,
     41    "plugin_container_name": PLUGIN_CONTAINER_NAME,
     42    "http3server_name": HTTP3SERVER_NAME,
     43    "exe_suffix": EXE_SUFFIX,
     44    "run_file_names": {
     45        "mochitest": "runtests.py",
     46        "reftest": "runreftest.py",
     47        "xpcshell": "runxpcshelltests.py",
     48        "cppunittest": "runcppunittests.py",
     49        "gtest": "rungtests.py",
     50        "jittest": "jit_test.py",
     51    },
     52    "minimum_tests_zip_dirs": [
     53        "bin/*",
     54        "certs/*",
     55        "config/*",
     56        "mach",
     57        "marionette/*",
     58        "modules/*",
     59        "mozbase/*",
     60        "tools/*",
     61        "mozpack/*",
     62        "mozbuild/*",
     63    ],
     64    "suite_definitions": {
     65        "cppunittest": {
     66            "options": [
     67                "--symbols-path=%(symbols_path)s",
     68                "--utility-path=tests/bin",
     69                "--xre-path=%(abs_app_dir)s",
     70            ],
     71            "run_filename": "runcppunittests.py",
     72            "testsdir": "cppunittest",
     73        },
     74        "jittest": {
     75            "options": [
     76                "tests/bin/js",
     77                "--no-slow",
     78                "--no-progress",
     79                "--format=automation",
     80                "--jitflags=all",
     81                "--timeout=970",  # Keep in sync with run_timeout below.
     82            ],
     83            "run_filename": "jit_test.py",
     84            "testsdir": "jit-test/jit-test",
     85            "run_timeout": 1000,  # Keep in sync with --timeout above.
     86        },
     87        "mochitest": {
     88            "options": [
     89                "--appname=%(binary_path)s",
     90                "--utility-path=tests/bin",
     91                "--extra-profile-file=tests/bin/plugins",
     92                "--symbols-path=%(symbols_path)s",
     93                "--certificate-path=tests/certs",
     94                "--setpref=webgl.force-enabled=true",
     95                "--quiet",
     96                "--log-errorsummary=%(error_summary_file)s",
     97                "--use-test-media-devices",
     98                "--screenshot-on-fail",
     99                "--cleanup-crashes",
    100                "--marionette-startup-timeout=180",
    101                "--sandbox-read-whitelist=%(abs_work_dir)s",
    102            ],
    103            "run_filename": "runtests.py",
    104            "testsdir": "mochitest",
    105        },
    106        "reftest": {
    107            "options": [
    108                "--appname=%(binary_path)s",
    109                "--utility-path=tests/bin",
    110                "--extra-profile-file=tests/bin/plugins",
    111                "--symbols-path=%(symbols_path)s",
    112                "--log-errorsummary=%(error_summary_file)s",
    113                "--cleanup-crashes",
    114                "--marionette-startup-timeout=180",
    115                "--sandbox-read-whitelist=%(abs_work_dir)s",
    116            ],
    117            "run_filename": "runreftest.py",
    118            "testsdir": "reftest",
    119        },
    120        "xpcshell": {
    121            "options": [
    122                "--self-test",
    123                "--symbols-path=%(symbols_path)s",
    124                "--log-errorsummary=%(error_summary_file)s",
    125                "--utility-path=tests/bin",
    126            ],
    127            "run_filename": "runxpcshelltests.py",
    128            "testsdir": "xpcshell",
    129        },
    130        "gtest": {
    131            "options": [
    132                "--xre-path=%(abs_res_dir)s",
    133                "--cwd=%(gtest_dir)s",
    134                "--symbols-path=%(symbols_path)s",
    135                "--utility-path=tests/bin",
    136                "%(binary_path)s",
    137            ],
    138            "run_filename": "rungtests.py",
    139        },
    140    },
    141    # local mochi suites
    142    "all_mochitest_suites": {
    143        "mochitest-valgrind-plain": [
    144            "--valgrind=/usr/bin/valgrind",
    145            "--valgrind-supp-files="
    146            + VALGRIND_SUPP_ARCH
    147            + ","
    148            + VALGRIND_SUPP_CROSS_ARCH,
    149            "--timeout=900",
    150            "--max-timeouts=50",
    151        ],
    152        "mochitest-plain": ["--chunk-by-dir=4"],
    153        "mochitest-plain-gpu": ["--subsuite=gpu"],
    154        "mochitest-plain-coverage": ["--chunk-by-dir=4", "--timeout=1200"],
    155        "mochitest-media": ["--subsuite=media"],
    156        "mochitest-chrome": ["--flavor=chrome", "--chunk-by-dir=4", "--disable-e10s"],
    157        "mochitest-chrome-gpu": ["--flavor=chrome", "--subsuite=gpu", "--disable-e10s"],
    158        "mochitest-browser-chrome": ["--flavor=browser", "--chunk-by-runtime"],
    159        "mochitest-browser-chrome-coverage": [
    160            "--flavor=browser",
    161            "--chunk-by-runtime",
    162            "--timeout=1200",
    163        ],
    164        "mochitest-browser-screenshots": [
    165            "--flavor=browser",
    166            "--subsuite=screenshots",
    167        ],
    168        "mochitest-webgl1-core": ["--subsuite=webgl1-core"],
    169        "mochitest-webgl1-ext": ["--subsuite=webgl1-ext"],
    170        "mochitest-webgl2-core": ["--subsuite=webgl2-core"],
    171        "mochitest-webgl2-ext": ["--subsuite=webgl2-ext"],
    172        "mochitest-webgl2-deqp": ["--subsuite=webgl2-deqp"],
    173        "mochitest-webgpu": ["--subsuite=webgpu"],
    174        "mochitest-devtools-chrome": [
    175            "--flavor=browser",
    176            "--subsuite=devtools",
    177            "--chunk-by-runtime",
    178        ],
    179        "mochitest-devtools-chrome-coverage": [
    180            "--flavor=browser",
    181            "--subsuite=devtools",
    182            "--chunk-by-runtime",
    183            "--timeout=1200",
    184        ],
    185        "mochitest-browser-a11y": ["--flavor=browser", "--subsuite=a11y"],
    186        "mochitest-browser-media": ["--flavor=browser", "--subsuite=media-bc"],
    187        "mochitest-browser-translations": [
    188            "--flavor=browser",
    189            "--subsuite=translations",
    190        ],
    191        "mochitest-a11y": ["--flavor=a11y", "--disable-e10s"],
    192        "mochitest-remote": ["--flavor=browser", "--subsuite=remote"],
    193    },
    194    # local reftest suites
    195    "all_reftest_suites": {
    196        "crashtest": {
    197            "options": ["--suite=crashtest", "--topsrcdir=tests/reftest/tests"],
    198            "tests": ["tests/reftest/tests/testing/crashtest/crashtests.list"],
    199        },
    200        "jsreftest": {
    201            "options": [
    202                "--extra-profile-file=tests/jsreftest/tests/js/src/tests/user.js",
    203                "--suite=jstestbrowser",
    204                "--topsrcdir=tests/jsreftest/tests",
    205            ],
    206            "tests": ["tests/jsreftest/tests/js/src/tests/jstests.list"],
    207        },
    208        "reftest": {
    209            "options": ["--suite=reftest", "--topsrcdir=tests/reftest/tests"],
    210            "tests": ["tests/reftest/tests/layout/reftests/reftest.list"],
    211        },
    212    },
    213    "all_xpcshell_suites": {
    214        "xpcshell": {
    215            "options": [
    216                "--xpcshell=%(abs_app_dir)s/" + XPCSHELL_NAME,
    217                "--http3server=%(abs_app_dir)s/" + HTTP3SERVER_NAME,
    218                "--manifest=tests/xpcshell/tests/xpcshell.toml",
    219            ],
    220            "tests": [],
    221        },
    222        "xpcshell-coverage": {
    223            "options": [
    224                "--xpcshell=%(abs_app_dir)s/" + XPCSHELL_NAME,
    225                "--http3server=%(abs_app_dir)s/" + HTTP3SERVER_NAME,
    226                "--manifest=tests/xpcshell/tests/xpcshell.toml",
    227                "--sequential",
    228            ],
    229            "tests": [],
    230        },
    231    },
    232    "all_cppunittest_suites": {"cppunittest": {"tests": ["tests/cppunittest"]}},
    233    "all_gtest_suites": {"gtest": []},
    234    "all_jittest_suites": {
    235        "jittest": [],
    236        "jittest1": ["--total-chunks=2", "--this-chunk=1"],
    237        "jittest2": ["--total-chunks=2", "--this-chunk=2"],
    238    },
    239    "run_cmd_checks_enabled": True,
    240    "preflight_run_cmd_suites": [
    241        # NOTE 'enabled' is only here while we have unconsolidated configs
    242        {
    243            "name": "disable_screen_saver",
    244            "cmd": ["xset", "s", "off", "s", "reset"],
    245            "halt_on_failure": False,
    246            "architectures": ["32bit", "64bit"],
    247            "enabled": DISABLE_SCREEN_SAVER,
    248        },
    249        {
    250            "name": "run mouse & screen adjustment script",
    251            "cmd": [
    252                # when configs are consolidated this python path will only show
    253                # for windows.
    254                "python",
    255                "../scripts/external_tools/mouse_and_screen_resolution.py",
    256                "--configuration-file",
    257                "../scripts/external_tools/machine-configuration.json",
    258            ],
    259            "architectures": ["32bit"],
    260            "halt_on_failure": True,
    261            "enabled": ADJUST_MOUSE_AND_SCREEN,
    262        },
    263    ],
    264    "vcs_output_timeout": 1000,
    265    "minidump_save_path": "%(abs_work_dir)s/../minidumps",
    266    "unstructured_flavors": {
    267        "gtest": [],
    268        "cppunittest": [],
    269        "jittest": [],
    270    },
    271    "tooltool_cache": "/builds/worker/tooltool-cache",
    272    "nodejs_path": NODEJS_PATH,
    273    # "log_format": "%(levelname)8s - %(message)s",
    274 }