Skip to content

WIP: modify tc files, add python script to run tests independent of os #648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
040d54b
modify tc files, add python script to run tests independent of os
ben-c-at-moz Jul 7, 2025
9cf590b
run with ci flag
ben-c-at-moz Jul 7, 2025
c44db05
run with ci flag
ben-c-at-moz Jul 7, 2025
0d3ef61
add windows to tc
ben-c-at-moz Jul 7, 2025
a66a945
add windows to tc
ben-c-at-moz Jul 7, 2025
1cdac6a
try different worker
ben-c-at-moz Jul 8, 2025
1f353ea
get correct trust prov for win
ben-c-at-moz Jul 9, 2025
59723ec
use moz-1 b- pools for win
ben-c-at-moz Jul 9, 2025
0971723
use moz-1 b- pools for win
ben-c-at-moz Jul 9, 2025
90b33f3
use moz-1 b- pools for win
ben-c-at-moz Jul 9, 2025
5c78388
use moz-1 b- pools for win
ben-c-at-moz Jul 9, 2025
b7127a0
use moz-1 b- pools for win
ben-c-at-moz Jul 9, 2025
c97fbe3
use moz-1 b- pools for win
ben-c-at-moz Jul 9, 2025
3b07ab6
use moz-1 b- pools for win
ben-c-at-moz Jul 9, 2025
900c7b6
use moz-1 b- pools for win
ben-c-at-moz Jul 9, 2025
d3d1c43
use moz-1 b- pools for win
ben-c-at-moz Jul 10, 2025
76d14d3
use moz-1 b- pools for win
ben-c-at-moz Jul 10, 2025
7f72663
use moz-1 b- pools for win
ben-c-at-moz Jul 10, 2025
317db28
use moz-1 b- pools for win
ben-c-at-moz Jul 10, 2025
d98c440
use moz-1 b- pools for win
ben-c-at-moz Jul 10, 2025
a3b24f2
use moz-1 b- pools for win
ben-c-at-moz Jul 10, 2025
84dfefe
use moz-1 b- pools for win
ben-c-at-moz Jul 10, 2025
5bc4682
use moz-1 b- pools for win
ben-c-at-moz Jul 14, 2025
a3f0cfa
use moz-1 b- pools for win
ben-c-at-moz Jul 14, 2025
4460dca
use moz-1 b- pools for win
ben-c-at-moz Jul 14, 2025
cae16b3
use moz-1 b- pools for win
ben-c-at-moz Jul 14, 2025
efd43a8
use moz-1 b- pools for win
ben-c-at-moz Jul 14, 2025
dcfce6b
use moz-1 b- pools for win
ben-c-at-moz Jul 14, 2025
ac91ba5
list installed modules
ben-c-at-moz Jul 17, 2025
cd8fbd5
list installed modules
ben-c-at-moz Jul 17, 2025
0c936ed
fix pipenv issue
ben-c-at-moz Jul 17, 2025
b52d919
fix pipenv issue
ben-c-at-moz Jul 17, 2025
c3e02d6
fix pipenv issue
ben-c-at-moz Jul 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ google-auth = "2.32.0"
psutil = "<6.1"
pytest-json-report = "==1.5.0"
beautifulsoup4 = "4.12.3"
mozinstall = "*"

[dev-packages]
werkzeug = "==3.0.3"
Expand Down
11 changes: 10 additions & 1 deletion l10n_CM/run_l10n.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@
valid_flags = {"--run-headless", "-n", "--reruns", "--fx-executable", "--ci"}
flag_with_parameter = {"-n", "--reruns"}
valid_region = {"US", "CA", "DE", "FR"}
valid_sites = {"demo", "amazon", "walmart", "mediamarkt", "lowes", "etsy", "calvinklein", "bestbuy"}
valid_sites = {
"demo",
"amazon",
"walmart",
"mediamarkt",
"lowes",
"etsy",
"calvinklein",
"bestbuy",
}
live_sites = []

LOCALHOST = "127.0.0.1"
Expand Down
85 changes: 85 additions & 0 deletions run_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import argparse
import os
import platform
import sys
from pathlib import Path
from subprocess import check_output

import mozinstall
import pytest
import requests

LINUX_FX_EXEC = "./firefox/firefox"
WIN_FX_EXEC = "C:\\Program Files\\Custom Firefox\\firefox.exe"
MAC_FX_EXEC = ""


def get_fx_exec():
fx_exec = LINUX_FX_EXEC
if platform.system().lower().startswith("win"):
fx_exec = WIN_FX_EXEC
elif platform.system().lower().startswith("darwin"):
fx_exec = MAC_FX_EXEC
return fx_exec


def install():
command = ["pipenv", "run", "python", "collect_executables.py"]
if not platform.system().lower().startswith("win"):
command = ["./collect_executables.sh"]
target_filename = "setup.exe"
if platform.system().lower().startswith("darwin"):
target_filename = "Firefox.dmg"
elif platform.system().lower().startswith("linux"):
target_filename = "firefox.tar.xz"
url = check_output(command).decode().strip()
if "collect_executables.py" in command:
resp = requests.get(url)
resp.raise_for_status()
with open(target_filename, "wb") as fh:
fh.write(resp.content)
installdir = Path(get_fx_exec()).parent
if not installdir.is_dir():
os.makedirs(installdir, exist_ok=True)
mozinstall.install(target_filename, installdir)


def run_suite(parsed_args):
"""Convert script / argparse args (parsed_args) to pytest_args"""
pytest_args = parsed_args.added_args or []
if parsed_args.install:
install()
if parsed_args.ci and "--fx-executable" not in pytest_args:
pytest_args.extend(["--fx-executable", get_fx_exec()])
if parsed_args.pyproject:
os.replace(parsed_args.pyproject, "pyproject.toml")
if parsed_args.subset:
tests = open("selected_tests").read()
else:
tests = "tests"
workers = None
if not parsed_args.headed:
workers = "auto"
pytest_args.append("--run-headless")
if parsed_args.workers:
workers = pytest_args.workers
if workers:
pytest_args.extend(["-n", workers])
pytest_args.extend(tests.split())
print("pytest " + " ".join(pytest_args))
return pytest.main(pytest_args)


parser = argparse.ArgumentParser(
prog="Run STARfox tests", description="Run the STARfox suites"
)

parser.add_argument("added_args", nargs="*")
parser.add_argument("--pyproject", default=None)
parser.add_argument("-w", "--workers", default=None)
parser.add_argument("-s", "--subset", action="store_true")
parser.add_argument("--install", action="store_true")
parser.add_argument("--ci", action="store_true")
parser.add_argument("--headed", action="store_true")

sys.exit(run_suite(parser.parse_args()))
5 changes: 5 additions & 0 deletions taskcluster/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,8 @@ workers:
implementation: generic-worker
os: linux
worker-type: 't-linux-2204-wayland'
b-win2022:
provisioner: '{trust-domain}-1'
implementation: generic-worker
os: windows
worker-type: 'b-win2022'
150 changes: 84 additions & 66 deletions taskcluster/kinds/run-smoke-tests/kind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ transforms:
- taskgraph.transforms.notify:transforms

task-defaults:
label: "Smoke Tests"
description: "Runs Smoke Tests and Notifies Slack"
worker-type: t-linux-wayland
worker:
taskcluster-proxy: true
max-run-time: 1800
Expand All @@ -18,9 +16,71 @@ task-defaults:
scopes:
- queue:route:notify.slack-channel.C07AHPJ525V # notify mobile-alerts-sandbox on failure
- notify:slack-channel:C07AHPJ525V
notify:
recipients:
- type: slack-channel
channel-id: C07AHPJ525V
status-type: on-defined
content:
slack:
blocks: [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "firefox-desktop :firefox: ${task.metadata.name} Linux\n "
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Task*: <https://firefox-ci-tc.services.mozilla.com/tasks/${status.taskId}|Taskcluster>"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Owner*: ${task.metadata.owner}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Commit*: <${task.metadata.source}>"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Test Summary*: <https://firefoxci.taskcluster-artifacts.net/${status.taskId}/0/public/results/report.html?sort=result> :debug:"
}
},
{
"type": "divider"
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": ":testops-notify: created by Desktop QA Test Engineering"
}
]
}
]
text: "{task[name]} with id $taskId has finished!"

tasks:
linux:
label: "Smoke Tests Linux"
worker-type: t-linux-wayland
run:
using: run-task
cwd: "{checkout}"
Expand All @@ -29,75 +89,33 @@ tasks:
mkdir -p artifacts;
pip3 install 'pipenv==2023.11.15';
pip3 install 'ruff>=0.4.8,<0.5';
mv ./ci_pyproject.toml ./pyproject.toml;
pipenv install;
./collect_executables.sh;
./firefox/firefox --version;
. ./keyring-unlock.sh
pipenv run python3 choose_ci_set.py
pipenv run pytest --fx-executable ./firefox/firefox -n 4 $(cat selected_tests)
pipenv run python3 run_tests.py -s --ci --pyproject ci_pyproject.toml
export FAILURE=${?}
mv ./ci_pyproject_headed.toml ./pyproject.toml;
pipenv run python3 choose_ci_set.py
pipenv run pytest --fx-executable ./firefox/firefox $(cat selected_tests)
pipenv run python3 run_tests.py -s --ci --headed --pyproject ci_pyproject_headed.toml
exit $((${?} | ${FAILURE}))
notify:
recipients:
- type: slack-channel
channel-id: C07AHPJ525V
status-type: on-defined
content:
slack:
blocks: [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "firefox-desktop :firefox: ${task.metadata.name} Linux\n "
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Task*: <https://firefox-ci-tc.services.mozilla.com/tasks/${status.taskId}|Taskcluster>"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Owner*: ${task.metadata.owner}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Commit*: <${task.metadata.source}>"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Test Summary*: <https://firefoxci.taskcluster-artifacts.net/${status.taskId}/0/public/results/report.html?sort=result> :debug:"
}
},
{
"type": "divider"
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": ":testops-notify: created by Desktop QA Test Engineering"
}
]
}
]
text: "{task[name]} with id $taskId has finished!"

windows:
label: "Smoke Tests Windows"
worker-type: b-win2022
run:
using: run-task
cwd: "{checkout}"
command: |-
mkdir -p artifacts;
python --version
python -m pip install pipenv==2023.11.15
cd build\src
dir .
set PATH=%PATH%;C:\mozilla-build\python3\scripts
pipenv install
pipenv run python choose_ci_set.py
pipenv run pip list
pipenv run python -c "import requests"
pipenv run python run_tests.py -s --ci --install --pyproject ci_pyproject.toml
pipenv run python run_tests.py -s --ci --headed --pyproject ci_pyproject_headed.toml