Commit ce7fa79b authored by brizental's avatar brizental
Browse files

Bug 40107: Execute xpcshell tests on CI

parent d7f73057
Loading
Loading
Loading
Loading
+2 −0
Changes for .gitlab-ci.yml: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ spec:
    - local: '.gitlab/_inputs.yml'
---
stages:
  - test-xpcshell
  - test-marionette

default:
@@ -31,4 +32,5 @@ include:
      windows_x86_64_installer_url: $[[ inputs.windows_x86_64_installer_url ]]
      windows_x86_64_artifacts_url: $[[ inputs.windows_x86_64_artifacts_url ]]
      windows_x86_64_sha256sums_url: $[[ inputs.windows_x86_64_sha256sums_url ]]
  - local: '.gitlab/test_xpcshell.yml'
  - local: '.gitlab/test_marionette.yml'
+14 −0
Changes for .gitlab/_base.yml: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ variables:
  TAG: "$[[ inputs.tag ]]"

.common:
  allow_failure: true
  before_script:
    - python3 .gitlab/scripts/before_script.py

@@ -16,6 +17,10 @@ variables:
.debian-x86_64:
  extends: .common

  before_script:
    - Xvfb :99 -screen 0 1280x1024x24 >/dev/null 2>&1 &
    - python3 .gitlab/scripts/before_script.py

  tags:
    - debian-trixie-x86_64

@@ -25,9 +30,11 @@ variables:
    - when: never

  variables:
    DISPLAY: ":99"
    MOZ_FETCHES_DIR: "/home/gitlab-runner/fetches"
    MINIDUMP_STACKWALK_URL: "https://github.com/rust-minidump/rust-minidump/releases/download/v0.26.1/minidump-stackwalk-x86_64-unknown-linux-gnu.tar.xz"
    MINIDUMP_STACKWALK_SHA256: "f789997f086dab6e46c46ab4560fc28676124613770ddac3b89a6e2e0e4963d8"
    NODEJS_PATH: "/home/gitlab-runner/.nvm/versions/node/v22.16.0/bin/node"
    INSTALLER_URL: "$[[ inputs.debian_x86_64_installer_url ]]"
    ARTIFACTS_URL: "$[[ inputs.debian_x86_64_artifacts_url ]]"
    SHA256SUMS_URL: "$[[ inputs.debian_x86_64_sha256sums_url ]]"
@@ -35,6 +42,11 @@ variables:
.macos-x86_64:
  extends: .common

  # Overwrite just so we can change $PATH
  before_script:
    - export PATH="/usr/local/bin:$PATH"
    - python3 .gitlab/scripts/before_script.py

  tags:
    - macos-sonoma-x86_64

@@ -47,6 +59,7 @@ variables:
    MOZ_FETCHES_DIR: "/Users/gitlab-runner/fetches"
    MINIDUMP_STACKWALK_URL: "https://github.com/rust-minidump/rust-minidump/releases/download/v0.26.1/minidump-stackwalk-x86_64-apple-darwin.tar.xz"
    MINIDUMP_STACKWALK_SHA256: "7a3e274a09bc35ccc35e9d3dcd60e738ab14e54ea3306be94a4a8dedaf7a468d"
    NODEJS_PATH: "/Users/gitlab-runner/.nvm/versions/node/v22.16.0/bin/node"
    INSTALLER_URL: "$[[ inputs.macos_x86_64_installer_url ]]"
    ARTIFACTS_URL: "$[[ inputs.macos_x86_64_artifacts_url ]]"
    SHA256SUMS_URL: "$[[ inputs.macos_x86_64_sha256sums_url ]]"
@@ -66,6 +79,7 @@ variables:
    MOZ_FETCHES_DIR: 'C:\windoes\fetches'
    MINIDUMP_STACKWALK_URL: 'https://github.com/rust-minidump/rust-minidump/releases/download/v0.26.1/minidump-stackwalk-x86_64-pc-windows-msvc.zip'
    MINIDUMP_STACKWALK_SHA256: "dc6da411047ef15b784bffe0f9bf7ecb9221186c4c8fd655e3d8a3fbba0a9c61"
    NODEJS_PATH: 'C:\Program Files\nodejs\node.exe'
    INSTALLER_URL: "$[[ inputs.windows_x86_64_installer_url ]]"
    ARTIFACTS_URL: "$[[ inputs.windows_x86_64_artifacts_url ]]"
    SHA256SUMS_URL: "$[[ inputs.windows_x86_64_sha256sums_url ]]"
+26 −3
Changes for .gitlab/scripts/before_script.py: 26 added lines, 3 removed lines.
Original line number Diff line number Diff line
import hashlib
import os
import platform
import shutil
import subprocess
import time
@@ -32,12 +33,17 @@ def download_file(url: str, dest: Path, sha256: str = "") -> None:


def extract_tar(tar_path: Path, dest_dir: Path) -> None:
    subprocess.run(
    result = subprocess.run(
        # --strip-components=1: all the archives we fetch have contents nested inside a
        # top-level directory rather than at the root, so we strip it on extraction.
        ["tar", "-xf", str(tar_path), "-C", str(dest_dir), "--strip-components=1"],
        check=True,
        #
        # NOTE: The `v` flag is _required_ for tar to work on MacOS ¯\_(ツ)_/¯
        ["tar", f"-x{'v' if platform.system() == 'Darwin' else ''}f", str(tar_path), "-C", str(dest_dir), "--strip-components=1"],
        stderr=subprocess.PIPE,
        text=True,
    )
    if result.returncode != 0:
        raise RuntimeError(f"tar failed (exit {result.returncode}):\n{result.stderr}")


def check_sha256sums_url(sha256sums_url: str) -> None:
@@ -159,6 +165,22 @@ def setup_android_sdk(moz_fetches_dir: str) -> None:
    print(f"Moved AVD -> {android_device_dir / 'avd'}")



def download_hostutils(moz_fetches_dir: str) -> None:
    # Stable mirror of  https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/gecko.cache.level-3.toolchains.v3.linux64-hostutils.latest/artifacts/public%2Fbuild%2Fhostutils.tar.zst
    HOSTUTILS_URL = "https://build-sources.tbb.torproject.org/hostutils.tar.zst"
    HOSTUTILS_SHA256 = (
        "90ff9390181d7dc015c882f11e11800ef03be39f003c29b22bda01ad21c04a9e"
    )

    hostutils_dir = Path(moz_fetches_dir) / "hostutils"
    hostutils_dir.mkdir(parents=True, exist_ok=True)

    tar_zst_path = Path("hostutils.tar.zst")
    download_file(HOSTUTILS_URL, tar_zst_path, HOSTUTILS_SHA256)
    extract_tar(tar_zst_path, hostutils_dir)


def before_script(
    mozharness_url: str,
    minidump_stackwalk_url: str,
@@ -175,6 +197,7 @@ def before_script(

    if setup_android:
        setup_android_sdk(moz_fetches_dir)
        download_hostutils(moz_fetches_dir)


if __name__ == "__main__":
+50 −0
Changes for .gitlab/test_xpcshell.yml: 50 added lines, 0 removed lines.
Original line number Diff line number Diff line
debian-x86_64_xpcshell:
  extends: .debian-x86_64
  stage: test-xpcshell
  script:
    - >
      python3 "$(pwd)/mozharness/scripts/desktop_unittest.py"
      --config-file "$(pwd)/mozharness/configs/unittests/linux_unittest.py"
      --xpcshell-suite xpcshell
      --installer-url "$INSTALLER_URL"
      --test-packages-url "$ARTIFACTS_URL/target.test_packages.json"
      --tag "$TAG"

macos-x86_64_xpcshell:
  extends: .macos-x86_64
  stage: test-xpcshell
  script:
    - >
      python3 "$(pwd)/mozharness/scripts/desktop_unittest.py"
      --config-file "$(pwd)/mozharness/configs/unittests/mac_unittest.py"
      --xpcshell-suite xpcshell
      --installer-url "$INSTALLER_URL"
      --test-packages-url "$ARTIFACTS_URL/target.test_packages.json"
      --tag "$TAG"

windows-x86_64_xpcshell:
  extends: .windows-x86_64
  stage: test-xpcshell
  script:
    - >
      python3 "$(pwd)/mozharness/scripts/desktop_unittest.py"
      --config-file "$(pwd)/mozharness/configs/unittests/win_unittest.py"
      --xpcshell-suite xpcshell
      --installer-url "$INSTALLER_URL"
      --test-packages-url "$ARTIFACTS_URL/target.test_packages.json"
      --pip-index
      --tag "$TAG"

android-x86_64_xpcshell:
  extends: .android-x86_64
  stage: test-xpcshell
  script:
    - >
      python3 "$(pwd)/mozharness/scripts/android_emulator_unittest.py"
      --config-file "$(pwd)/mozharness/configs/android/android_common.py"
      --config-file "$(pwd)/mozharness/configs/android/android14-x86_64.py"
      --test-suite=xpcshell
      --installer-url "$ARTIFACTS_URL/test_runner.apk"
      --test-packages-url "$ARTIFACTS_URL/target.test_packages.json"
      --package-name "$PACKAGE_NAME"
      --tag "$TAG"