Skip to content

Commit 040d54b

Browse files
committed
modify tc files, add python script to run tests independent of os
1 parent 6b6bfb4 commit 040d54b

File tree

4 files changed

+129
-66
lines changed

4 files changed

+129
-66
lines changed

l10n_CM/run_l10n.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@
1313
valid_flags = {"--run-headless", "-n", "--reruns", "--fx-executable", "--ci"}
1414
flag_with_parameter = {"-n", "--reruns"}
1515
valid_region = {"US", "CA", "DE", "FR"}
16-
valid_sites = {"demo", "amazon", "walmart", "mediamarkt", "lowes", "etsy", "calvinklein", "bestbuy"}
16+
valid_sites = {
17+
"demo",
18+
"amazon",
19+
"walmart",
20+
"mediamarkt",
21+
"lowes",
22+
"etsy",
23+
"calvinklein",
24+
"bestbuy",
25+
}
1726
live_sites = []
1827

1928
LOCALHOST = "127.0.0.1"

run_tests.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import argparse
2+
import os
3+
import platform
4+
import sys
5+
6+
import pytest
7+
8+
LINUX_FX_EXEC = "./firefox/firefox"
9+
WIN_FX_EXEC = "C:\\Program Files\\Custom Firefox\\firefox.exe"
10+
MAC_FX_EXEC = ""
11+
12+
13+
def run_suite(parsed_args):
14+
"""Convert script / argparse args (parsed_args) to pytest_args"""
15+
pytest_args = parsed_args.added_args or []
16+
if "--ci" in pytest_args and "--fx-executable" not in pytest_args:
17+
fx_exec = LINUX_FX_EXEC
18+
if platform.system().lower().startswith("win"):
19+
fx_exec = WIN_FX_EXEC
20+
elif platform.system().lower().startswith("darwin"):
21+
fx_exec = MAC_FX_EXEC
22+
pytest_args.extend(["--fx-executable", fx_exec])
23+
if parsed_args.pyproject:
24+
os.rename(parsed_args.pyproject, "pyproject.toml")
25+
if parsed_args.subset:
26+
tests = open("selected_tests").read()
27+
else:
28+
tests = "tests"
29+
workers = None
30+
if not parsed_args.headed:
31+
workers = "auto"
32+
pytest_args.append("--run-headless")
33+
if parsed_args.workers:
34+
workers = pytest_args.workers
35+
if workers:
36+
pytest_args.extend(["-n", workers])
37+
pytest_args.extend(tests.split())
38+
return pytest.main(pytest_args)
39+
40+
41+
parser = argparse.ArgumentParser(
42+
prog="Run STARfox tests", description="Run the STARfox suites"
43+
)
44+
45+
parser.add_argument("added_args", nargs="*")
46+
parser.add_argument("--pyproject", default=None)
47+
parser.add_argument("-w", "--workers", default=None)
48+
parser.add_argument("-s", "--subset", action="store_true")
49+
parser.add_argument("--headed", action="store_true")
50+
51+
sys.exit(run_suite(parser.parse_args()))

taskcluster/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,8 @@ workers:
3131
implementation: generic-worker
3232
os: linux
3333
worker-type: 't-linux-2204-wayland'
34+
t-win11-64-source:
35+
provisioner: '{trust-domain}-t'
36+
implementation: generic-worker
37+
os: windows
38+
worker-type: '{alias}'

taskcluster/kinds/run-smoke-tests/kind.yml

Lines changed: 63 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ transforms:
55
task-defaults:
66
label: "Smoke Tests"
77
description: "Runs Smoke Tests and Notifies Slack"
8-
worker-type: t-linux-wayland
98
worker:
109
taskcluster-proxy: true
1110
max-run-time: 1800
@@ -18,9 +17,70 @@ task-defaults:
1817
scopes:
1918
- queue:route:notify.slack-channel.C07AHPJ525V # notify mobile-alerts-sandbox on failure
2019
- notify:slack-channel:C07AHPJ525V
20+
notify:
21+
recipients:
22+
- type: slack-channel
23+
channel-id: C07AHPJ525V
24+
status-type: on-defined
25+
content:
26+
slack:
27+
blocks: [
28+
{
29+
"type": "header",
30+
"text": {
31+
"type": "plain_text",
32+
"text": "firefox-desktop :firefox: ${task.metadata.name} Linux\n "
33+
}
34+
},
35+
{
36+
"type": "divider"
37+
},
38+
{
39+
"type": "section",
40+
"text": {
41+
"type": "mrkdwn",
42+
"text": "*Task*: <https://firefox-ci-tc.services.mozilla.com/tasks/${status.taskId}|Taskcluster>"
43+
}
44+
},
45+
{
46+
"type": "section",
47+
"text": {
48+
"type": "mrkdwn",
49+
"text": "*Owner*: ${task.metadata.owner}"
50+
}
51+
},
52+
{
53+
"type": "section",
54+
"text": {
55+
"type": "mrkdwn",
56+
"text": "*Commit*: <${task.metadata.source}>"
57+
}
58+
},
59+
{
60+
"type": "section",
61+
"text": {
62+
"type": "mrkdwn",
63+
"text": "*Test Summary*: <https://firefoxci.taskcluster-artifacts.net/${status.taskId}/0/public/results/report.html?sort=result> :debug:"
64+
}
65+
},
66+
{
67+
"type": "divider"
68+
},
69+
{
70+
"type": "context",
71+
"elements": [
72+
{
73+
"type": "mrkdwn",
74+
"text": ":testops-notify: created by Desktop QA Test Engineering"
75+
}
76+
]
77+
}
78+
]
79+
text: "{task[name]} with id $taskId has finished!"
2180

2281
tasks:
2382
linux:
83+
worker-type: t-linux-wayland
2484
run:
2585
using: run-task
2686
cwd: "{checkout}"
@@ -29,75 +89,13 @@ tasks:
2989
mkdir -p artifacts;
3090
pip3 install 'pipenv==2023.11.15';
3191
pip3 install 'ruff>=0.4.8,<0.5';
32-
mv ./ci_pyproject.toml ./pyproject.toml;
3392
pipenv install;
3493
./collect_executables.sh;
3594
./firefox/firefox --version;
3695
. ./keyring-unlock.sh
3796
pipenv run python3 choose_ci_set.py
38-
pipenv run pytest --fx-executable ./firefox/firefox -n 4 $(cat selected_tests)
97+
pipenv run python3 run_tests.py -s --pyproject ci_pyproject.toml
3998
export FAILURE=${?}
40-
mv ./ci_pyproject_headed.toml ./pyproject.toml;
4199
pipenv run python3 choose_ci_set.py
42-
pipenv run pytest --fx-executable ./firefox/firefox $(cat selected_tests)
100+
pipenv run python3 run_tests.py -s --headed --pyproject ci_pyproject_headed.toml
43101
exit $((${?} | ${FAILURE}))
44-
notify:
45-
recipients:
46-
- type: slack-channel
47-
channel-id: C07AHPJ525V
48-
status-type: on-defined
49-
content:
50-
slack:
51-
blocks: [
52-
{
53-
"type": "header",
54-
"text": {
55-
"type": "plain_text",
56-
"text": "firefox-desktop :firefox: ${task.metadata.name} Linux\n "
57-
}
58-
},
59-
{
60-
"type": "divider"
61-
},
62-
{
63-
"type": "section",
64-
"text": {
65-
"type": "mrkdwn",
66-
"text": "*Task*: <https://firefox-ci-tc.services.mozilla.com/tasks/${status.taskId}|Taskcluster>"
67-
}
68-
},
69-
{
70-
"type": "section",
71-
"text": {
72-
"type": "mrkdwn",
73-
"text": "*Owner*: ${task.metadata.owner}"
74-
}
75-
},
76-
{
77-
"type": "section",
78-
"text": {
79-
"type": "mrkdwn",
80-
"text": "*Commit*: <${task.metadata.source}>"
81-
}
82-
},
83-
{
84-
"type": "section",
85-
"text": {
86-
"type": "mrkdwn",
87-
"text": "*Test Summary*: <https://firefoxci.taskcluster-artifacts.net/${status.taskId}/0/public/results/report.html?sort=result> :debug:"
88-
}
89-
},
90-
{
91-
"type": "divider"
92-
},
93-
{
94-
"type": "context",
95-
"elements": [
96-
{
97-
"type": "mrkdwn",
98-
"text": ":testops-notify: created by Desktop QA Test Engineering"
99-
}
100-
]
101-
}
102-
]
103-
text: "{task[name]} with id $taskId has finished!"

0 commit comments

Comments
 (0)